From 67ceccf2d45dc88de5dc83488de6bcbffae8e1e6 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 6 Mar 2026 11:20:45 -0600 Subject: [PATCH 01/24] refactor: unglob `std::shared_ptr` --- Minecraft.Client/Commands/TeleportCommand.cpp | 10 +- Minecraft.Client/Commands/TeleportCommand.h | 4 +- Minecraft.Client/GameState/CreativeMode.cpp | 10 +- Minecraft.Client/GameState/CreativeMode.h | 8 +- Minecraft.Client/GameState/DemoMode.cpp | 6 +- Minecraft.Client/GameState/DemoMode.h | 6 +- Minecraft.Client/GameState/GameMode.cpp | 30 +- Minecraft.Client/GameState/GameMode.h | 28 +- Minecraft.Client/GameState/SurvivalMode.cpp | 10 +- Minecraft.Client/GameState/SurvivalMode.h | 6 +- Minecraft.Client/Level/DemoLevel.cpp | 2 +- Minecraft.Client/Level/DemoLevel.h | 2 +- Minecraft.Client/Level/DerivedServerLevel.cpp | 2 +- Minecraft.Client/Level/DerivedServerLevel.h | 2 +- Minecraft.Client/Level/MultiPlayerLevel.cpp | 40 +- Minecraft.Client/Level/MultiPlayerLevel.h | 24 +- Minecraft.Client/Level/ServerLevel.cpp | 66 +-- Minecraft.Client/Level/ServerLevel.h | 38 +- .../Level/ServerLevelListener.cpp | 24 +- Minecraft.Client/Level/ServerLevelListener.h | 10 +- Minecraft.Client/Minecraft.cpp | 98 ++--- Minecraft.Client/Minecraft.h | 10 +- Minecraft.Client/MinecraftServer.cpp | 38 +- Minecraft.Client/Network/ClientConnection.cpp | 382 +++++++++--------- Minecraft.Client/Network/ClientConnection.h | 136 +++---- .../Network/PendingConnection.cpp | 26 +- Minecraft.Client/Network/PendingConnection.h | 16 +- Minecraft.Client/Network/PlayerChunkMap.cpp | 56 +-- Minecraft.Client/Network/PlayerChunkMap.h | 32 +- Minecraft.Client/Network/PlayerConnection.cpp | 194 ++++----- Minecraft.Client/Network/PlayerConnection.h | 80 ++-- Minecraft.Client/Network/PlayerList.cpp | 188 ++++----- Minecraft.Client/Network/PlayerList.h | 56 +-- .../Network/ServerCommandDispatcher.cpp | 4 +- .../Network/ServerCommandDispatcher.h | 2 +- Minecraft.Client/Network/ServerConnection.cpp | 26 +- Minecraft.Client/Network/ServerConnection.h | 10 +- .../Durango/Sentient/DurangoTelemetry.cpp | 4 +- .../Platform/PS3/PS3Extras/Ps3Types.h | 4 +- .../ChunkUpdate/ChunkRebuildData.cpp | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/LeverTile_SPU.h | 2 +- .../ChunkUpdate/PistonBaseTile_SPU.h | 2 +- .../ChunkUpdate/PistonExtensionTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/TheEndPortal_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp | 36 +- .../LevelRenderer_FindNearestChunk.cpp | 2 +- .../LevelRenderer_FindNearestChunk.h | 2 +- .../Platform/Xbox/Audio/SoundEngine.cpp | 2 +- .../Platform/Xbox/Audio/SoundEngine.h | 2 +- Minecraft.Client/Player/EntityTracker.cpp | 46 +-- Minecraft.Client/Player/EntityTracker.h | 22 +- Minecraft.Client/Player/LocalPlayer.cpp | 40 +- Minecraft.Client/Player/LocalPlayer.h | 22 +- .../Player/MultiPlayerGameMode.cpp | 68 ++-- Minecraft.Client/Player/MultiPlayerGameMode.h | 26 +- .../Player/MultiPlayerLocalPlayer.cpp | 50 +-- .../Player/MultiPlayerLocalPlayer.h | 6 +- Minecraft.Client/Player/RemotePlayer.cpp | 4 +- Minecraft.Client/Player/RemotePlayer.h | 2 +- Minecraft.Client/Player/ServerPlayer.cpp | 228 +++++------ Minecraft.Client/Player/ServerPlayer.h | 36 +- .../Player/ServerPlayerGameMode.cpp | 10 +- .../Player/ServerPlayerGameMode.h | 6 +- Minecraft.Client/Player/TrackedEntity.cpp | 262 ++++++------ Minecraft.Client/Player/TrackedEntity.h | 30 +- Minecraft.Client/Rendering/Camera.cpp | 8 +- Minecraft.Client/Rendering/Camera.h | 8 +- Minecraft.Client/Rendering/Chunk.cpp | 36 +- Minecraft.Client/Rendering/Chunk.h | 6 +- .../Rendering/Culling/DirtyChunkSorter.cpp | 2 +- .../Rendering/Culling/DirtyChunkSorter.h | 4 +- .../Rendering/Culling/DistanceChunkSorter.cpp | 2 +- .../Rendering/Culling/DistanceChunkSorter.h | 2 +- .../Rendering/Culling/ViewportCuller.cpp | 2 +- .../Rendering/Culling/ViewportCuller.h | 2 +- .../EntityRenderers/ArrowRenderer.cpp | 6 +- .../Rendering/EntityRenderers/ArrowRenderer.h | 2 +- .../EntityRenderers/BlazeRenderer.cpp | 6 +- .../Rendering/EntityRenderers/BlazeRenderer.h | 2 +- .../EntityRenderers/BoatRenderer.cpp | 6 +- .../Rendering/EntityRenderers/BoatRenderer.h | 2 +- .../EntityRenderers/ChestRenderer.cpp | 4 +- .../Rendering/EntityRenderers/ChestRenderer.h | 2 +- .../EntityRenderers/ChickenRenderer.cpp | 6 +- .../EntityRenderers/ChickenRenderer.h | 4 +- .../Rendering/EntityRenderers/CowRenderer.cpp | 2 +- .../Rendering/EntityRenderers/CowRenderer.h | 2 +- .../EntityRenderers/CreeperRenderer.cpp | 14 +- .../EntityRenderers/CreeperRenderer.h | 8 +- .../EntityRenderers/DefaultRenderer.cpp | 2 +- .../EntityRenderers/DefaultRenderer.h | 2 +- .../EntityRenderers/EnchantTableRenderer.cpp | 4 +- .../EntityRenderers/EnchantTableRenderer.h | 2 +- .../EntityRenderers/EnderChestRenderer.cpp | 4 +- .../EntityRenderers/EnderChestRenderer.h | 2 +- .../EntityRenderers/EnderCrystalRenderer.cpp | 6 +- .../EntityRenderers/EnderCrystalRenderer.h | 2 +- .../EntityRenderers/EnderDragonRenderer.cpp | 22 +- .../EntityRenderers/EnderDragonRenderer.h | 12 +- .../EntityRenderers/EnderManRenderer.cpp | 18 +- .../EntityRenderers/EnderManRenderer.h | 6 +- .../EntityRenderDispatcher.cpp | 10 +- .../EntityRenderers/EntityRenderDispatcher.h | 10 +- .../EntityRenderers/EntityRenderer.cpp | 12 +- .../EntityRenderers/EntityRenderer.h | 8 +- .../EntityRenderers/EntityTileRenderer.cpp | 4 +- .../EntityRenderers/EntityTileRenderer.h | 4 +- .../EntityRenderers/ExperienceOrbRenderer.cpp | 4 +- .../EntityRenderers/ExperienceOrbRenderer.h | 2 +- .../EntityRenderers/FallingTileRenderer.cpp | 4 +- .../EntityRenderers/FallingTileRenderer.h | 2 +- .../EntityRenderers/FireballRenderer.cpp | 6 +- .../EntityRenderers/FireballRenderer.h | 4 +- .../EntityRenderers/FishingHookRenderer.cpp | 4 +- .../EntityRenderers/FishingHookRenderer.h | 2 +- .../EntityRenderers/GhastRenderer.cpp | 4 +- .../Rendering/EntityRenderers/GhastRenderer.h | 2 +- .../EntityRenderers/GiantMobRenderer.cpp | 2 +- .../EntityRenderers/GiantMobRenderer.h | 2 +- .../EntityRenderers/HumanoidMobRenderer.cpp | 8 +- .../EntityRenderers/HumanoidMobRenderer.h | 4 +- .../EntityRenderers/ItemFrameRenderer.cpp | 16 +- .../EntityRenderers/ItemFrameRenderer.h | 6 +- .../EntityRenderers/ItemInHandRenderer.cpp | 18 +- .../EntityRenderers/ItemInHandRenderer.h | 4 +- .../EntityRenderers/ItemRenderer.cpp | 26 +- .../Rendering/EntityRenderers/ItemRenderer.h | 20 +- .../EntityRenderers/ItemSpriteRenderer.cpp | 2 +- .../EntityRenderers/ItemSpriteRenderer.h | 2 +- .../EntityRenderers/LavaSlimeRenderer.cpp | 12 +- .../EntityRenderers/LavaSlimeRenderer.h | 4 +- .../EntityRenderers/LightningBoltRenderer.cpp | 4 +- .../EntityRenderers/LightningBoltRenderer.h | 2 +- .../EntityRenderers/MinecartRenderer.cpp | 4 +- .../EntityRenderers/MinecartRenderer.h | 2 +- .../Rendering/EntityRenderers/MobRenderer.cpp | 38 +- .../Rendering/EntityRenderers/MobRenderer.h | 30 +- .../EntityRenderers/MobSpawnerRenderer.cpp | 6 +- .../EntityRenderers/MobSpawnerRenderer.h | 4 +- .../EntityRenderers/MushroomCowRenderer.cpp | 12 +- .../EntityRenderers/MushroomCowRenderer.h | 4 +- .../EntityRenderers/OcelotRenderer.cpp | 8 +- .../EntityRenderers/OcelotRenderer.h | 4 +- .../EntityRenderers/PaintingRenderer.cpp | 8 +- .../EntityRenderers/PaintingRenderer.h | 6 +- .../Rendering/EntityRenderers/PigRenderer.cpp | 6 +- .../Rendering/EntityRenderers/PigRenderer.h | 4 +- .../EntityRenderers/PistonPieceRenderer.cpp | 4 +- .../EntityRenderers/PistonPieceRenderer.h | 2 +- .../EntityRenderers/PlayerRenderer.cpp | 46 +-- .../EntityRenderers/PlayerRenderer.h | 18 +- .../EntityRenderers/SheepRenderer.cpp | 6 +- .../Rendering/EntityRenderers/SheepRenderer.h | 4 +- .../EntityRenderers/SignRenderer.cpp | 4 +- .../Rendering/EntityRenderers/SignRenderer.h | 2 +- .../EntityRenderers/SilverfishRenderer.cpp | 6 +- .../EntityRenderers/SilverfishRenderer.h | 6 +- .../EntityRenderers/SkullTileRenderer.cpp | 4 +- .../EntityRenderers/SkullTileRenderer.h | 2 +- .../EntityRenderers/SlimeRenderer.cpp | 8 +- .../Rendering/EntityRenderers/SlimeRenderer.h | 4 +- .../EntityRenderers/SnowManRenderer.cpp | 8 +- .../EntityRenderers/SnowManRenderer.h | 2 +- .../EntityRenderers/SpiderRenderer.cpp | 10 +- .../EntityRenderers/SpiderRenderer.h | 6 +- .../EntityRenderers/SquidRenderer.cpp | 10 +- .../Rendering/EntityRenderers/SquidRenderer.h | 6 +- .../EntityRenderers/TheEndPortalRenderer.cpp | 4 +- .../EntityRenderers/TheEndPortalRenderer.h | 2 +- .../TileEntityRenderDispatcher.cpp | 10 +- .../TileEntityRenderDispatcher.h | 12 +- .../EntityRenderers/TileEntityRenderer.h | 2 +- .../EntityRenderers/TileRenderer.cpp | 4 +- .../Rendering/EntityRenderers/TileRenderer.h | 6 +- .../Rendering/EntityRenderers/TntRenderer.cpp | 4 +- .../Rendering/EntityRenderers/TntRenderer.h | 2 +- .../EntityRenderers/VillagerGolemRenderer.cpp | 14 +- .../EntityRenderers/VillagerGolemRenderer.h | 6 +- .../EntityRenderers/VillagerRenderer.cpp | 14 +- .../EntityRenderers/VillagerRenderer.h | 10 +- .../EntityRenderers/WolfRenderer.cpp | 8 +- .../Rendering/EntityRenderers/WolfRenderer.h | 4 +- .../EntityRenderers/ZombieRenderer.cpp | 18 +- .../EntityRenderers/ZombieRenderer.h | 10 +- Minecraft.Client/Rendering/GameRenderer.cpp | 46 +-- Minecraft.Client/Rendering/GameRenderer.h | 4 +- Minecraft.Client/Rendering/LevelRenderer.cpp | 150 +++---- Minecraft.Client/Rendering/LevelRenderer.h | 24 +- Minecraft.Client/Rendering/Minimap.cpp | 2 +- Minecraft.Client/Rendering/Minimap.h | 2 +- .../Rendering/Models/BlazeModel.cpp | 2 +- .../Rendering/Models/BlazeModel.h | 2 +- .../Rendering/Models/BoatModel.cpp | 2 +- Minecraft.Client/Rendering/Models/BoatModel.h | 2 +- .../Rendering/Models/BookModel.cpp | 2 +- Minecraft.Client/Rendering/Models/BookModel.h | 2 +- .../Rendering/Models/ChickenModel.cpp | 2 +- .../Rendering/Models/ChickenModel.h | 2 +- Minecraft.Client/Rendering/Models/CowModel.h | 2 +- .../Rendering/Models/CreeperModel.cpp | 2 +- .../Rendering/Models/CreeperModel.h | 2 +- .../Rendering/Models/DragonModel.cpp | 6 +- .../Rendering/Models/DragonModel.h | 4 +- .../Rendering/Models/EnderCrystalModel.cpp | 2 +- .../Rendering/Models/EnderCrystalModel.h | 2 +- .../Rendering/Models/GhastModel.cpp | 2 +- .../Rendering/Models/GhastModel.h | 2 +- .../Rendering/Models/HumanoidModel.cpp | 2 +- .../Rendering/Models/HumanoidModel.h | 2 +- .../Rendering/Models/LavaSlimeModel.cpp | 6 +- .../Rendering/Models/LavaSlimeModel.h | 4 +- .../Rendering/Models/MinecartModel.cpp | 2 +- .../Rendering/Models/MinecartModel.h | 2 +- Minecraft.Client/Rendering/Models/Model.h | 4 +- .../Rendering/Models/OcelotModel.cpp | 6 +- .../Rendering/Models/OcelotModel.h | 4 +- .../Rendering/Models/QuadrupedModel.cpp | 2 +- .../Rendering/Models/QuadrupedModel.h | 2 +- .../Rendering/Models/SheepFurModel.cpp | 4 +- .../Rendering/Models/SheepFurModel.h | 2 +- .../Rendering/Models/SheepModel.cpp | 4 +- .../Rendering/Models/SheepModel.h | 2 +- .../Rendering/Models/SilverfishModel.cpp | 2 +- .../Rendering/Models/SilverfishModel.h | 2 +- .../Rendering/Models/SkeletonHeadModel.cpp | 2 +- .../Rendering/Models/SkeletonHeadModel.h | 2 +- .../Rendering/Models/SlimeModel.cpp | 2 +- .../Rendering/Models/SlimeModel.h | 2 +- .../Rendering/Models/SnowManModel.cpp | 2 +- .../Rendering/Models/SnowManModel.h | 2 +- .../Rendering/Models/SpiderModel.cpp | 2 +- .../Rendering/Models/SpiderModel.h | 2 +- .../Rendering/Models/SquidModel.cpp | 2 +- .../Rendering/Models/SquidModel.h | 2 +- .../Rendering/Models/VillagerGolemModel.cpp | 6 +- .../Rendering/Models/VillagerGolemModel.h | 4 +- .../Rendering/Models/VillagerModel.cpp | 2 +- .../Rendering/Models/VillagerModel.h | 2 +- .../Rendering/Models/WolfModel.cpp | 6 +- Minecraft.Client/Rendering/Models/WolfModel.h | 4 +- .../Rendering/Particles/CritParticle.cpp | 8 +- .../Rendering/Particles/CritParticle.h | 8 +- .../Rendering/Particles/Particle.cpp | 4 +- .../Rendering/Particles/Particle.h | 4 +- .../Rendering/Particles/ParticleEngine.cpp | 16 +- .../Rendering/Particles/ParticleEngine.h | 8 +- .../Particles/PlayerCloudParticle.cpp | 2 +- .../Particles/TakeAnimationParticle.cpp | 2 +- .../Particles/TakeAnimationParticle.h | 6 +- .../Rendering/Particles/TerrainParticle.cpp | 4 +- .../Rendering/Particles/TerrainParticle.h | 4 +- Minecraft.Client/UI/Gui.cpp | 8 +- .../UI/Screens/AbstractContainerScreen.cpp | 6 +- .../UI/Screens/AbstractContainerScreen.h | 2 +- Minecraft.Client/UI/Screens/ConnectScreen.cpp | 2 +- .../UI/Screens/ContainerScreen.cpp | 2 +- Minecraft.Client/UI/Screens/ContainerScreen.h | 6 +- .../UI/Screens/CraftingScreen.cpp | 2 +- Minecraft.Client/UI/Screens/CraftingScreen.h | 2 +- Minecraft.Client/UI/Screens/FurnaceScreen.cpp | 2 +- Minecraft.Client/UI/Screens/FurnaceScreen.h | 4 +- .../UI/Screens/InventoryScreen.cpp | 2 +- Minecraft.Client/UI/Screens/InventoryScreen.h | 2 +- .../UI/Screens/ReceivingLevelScreen.cpp | 2 +- .../UI/Screens/TextEditScreen.cpp | 4 +- Minecraft.Client/UI/Screens/TextEditScreen.h | 4 +- Minecraft.Client/UI/Screens/TrapScreen.cpp | 2 +- Minecraft.Client/UI/Screens/TrapScreen.h | 2 +- Minecraft.World/AI/Control/LookControl.cpp | 4 +- Minecraft.World/AI/Control/LookControl.h | 2 +- Minecraft.World/AI/Control/Sensing.cpp | 2 +- Minecraft.World/AI/Control/Sensing.h | 2 +- Minecraft.World/AI/Goals/ArrowAttackGoal.cpp | 10 +- Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp | 4 +- Minecraft.World/AI/Goals/BegGoal.cpp | 4 +- Minecraft.World/AI/Goals/BegGoal.h | 2 +- Minecraft.World/AI/Goals/BreedGoal.cpp | 12 +- Minecraft.World/AI/Goals/BreedGoal.h | 2 +- .../AI/Goals/ControlledByPlayerGoal.cpp | 8 +- .../AI/Goals/DefendVillageTargetGoal.cpp | 2 +- Minecraft.World/AI/Goals/FollowOwnerGoal.cpp | 2 +- Minecraft.World/AI/Goals/FollowParentGoal.cpp | 6 +- Minecraft.World/AI/Goals/HurtByTargetGoal.cpp | 4 +- Minecraft.World/AI/Goals/HurtByTargetGoal.h | 2 +- Minecraft.World/AI/Goals/MakeLoveGoal.cpp | 6 +- Minecraft.World/AI/Goals/MeleeAttackGoal.cpp | 4 +- Minecraft.World/AI/Goals/MoveIndoorsGoal.cpp | 8 +- .../AI/Goals/MoveThroughVillageGoal.cpp | 20 +- .../AI/Goals/MoveThroughVillageGoal.h | 4 +- .../AI/Goals/NearestAttackableTargetGoal.cpp | 8 +- .../AI/Goals/NearestAttackableTargetGoal.h | 2 +- Minecraft.World/AI/Goals/OcelotAttackGoal.cpp | 2 +- .../AI/Goals/OcelotSitOnTileGoal.cpp | 2 +- .../AI/Goals/OwnerHurtByTargetGoal.cpp | 2 +- .../AI/Goals/OwnerHurtTargetGoal.cpp | 2 +- Minecraft.World/AI/Goals/PlayGoal.cpp | 6 +- .../AI/Goals/RestrictOpenDoorGoal.cpp | 8 +- Minecraft.World/AI/Goals/SitGoal.cpp | 2 +- Minecraft.World/AI/Goals/SwellGoal.cpp | 2 +- Minecraft.World/AI/Goals/TakeFlowerGoal.cpp | 4 +- Minecraft.World/AI/Goals/TargetGoal.cpp | 10 +- Minecraft.World/AI/Goals/TargetGoal.h | 4 +- Minecraft.World/AI/Goals/TemptGoal.cpp | 2 +- .../AI/Goals/TradeWithPlayerGoal.cpp | 2 +- Minecraft.World/AI/Navigation/Path.cpp | 4 +- Minecraft.World/AI/Navigation/Path.h | 4 +- .../AI/Navigation/PathNavigation.cpp | 4 +- .../AI/Navigation/PathNavigation.h | 4 +- Minecraft.World/AI/Navigation/RandomPos.cpp | 8 +- Minecraft.World/AI/Navigation/RandomPos.h | 8 +- Minecraft.World/Blocks/AnvilTile.cpp | 8 +- Minecraft.World/Blocks/AnvilTile.h | 8 +- Minecraft.World/Blocks/BedTile.cpp | 10 +- Minecraft.World/Blocks/BedTile.h | 6 +- Minecraft.World/Blocks/BrewingStandTile.cpp | 18 +- Minecraft.World/Blocks/BrewingStandTile.h | 6 +- Minecraft.World/Blocks/ButtonTile.cpp | 10 +- Minecraft.World/Blocks/ButtonTile.h | 8 +- Minecraft.World/Blocks/CactusTile.cpp | 2 +- Minecraft.World/Blocks/CactusTile.h | 2 +- Minecraft.World/Blocks/CakeTile.cpp | 8 +- Minecraft.World/Blocks/CakeTile.h | 8 +- Minecraft.World/Blocks/CauldronTile.cpp | 12 +- Minecraft.World/Blocks/CauldronTile.h | 4 +- Minecraft.World/Blocks/ChestTile.cpp | 34 +- Minecraft.World/Blocks/ChestTile.h | 8 +- Minecraft.World/Blocks/CocoaTile.cpp | 6 +- Minecraft.World/Blocks/CocoaTile.h | 4 +- Minecraft.World/Blocks/CropTile.cpp | 2 +- Minecraft.World/Blocks/DeadBushTile.cpp | 4 +- Minecraft.World/Blocks/DeadBushTile.h | 2 +- Minecraft.World/Blocks/DetectorRailTile.cpp | 4 +- Minecraft.World/Blocks/DetectorRailTile.h | 2 +- Minecraft.World/Blocks/DiodeTile.cpp | 4 +- Minecraft.World/Blocks/DiodeTile.h | 4 +- Minecraft.World/Blocks/DispenserTile.cpp | 58 +-- Minecraft.World/Blocks/DispenserTile.h | 10 +- Minecraft.World/Blocks/DoorTile.cpp | 6 +- Minecraft.World/Blocks/DoorTile.h | 6 +- Minecraft.World/Blocks/EggTile.cpp | 6 +- Minecraft.World/Blocks/EggTile.h | 4 +- .../Blocks/EnchantmentTableTile.cpp | 6 +- Minecraft.World/Blocks/EnchantmentTableTile.h | 4 +- Minecraft.World/Blocks/EnderChestTile.cpp | 12 +- Minecraft.World/Blocks/EnderChestTile.h | 6 +- Minecraft.World/Blocks/FallingTile.cpp | 4 +- Minecraft.World/Blocks/FarmTile.cpp | 4 +- Minecraft.World/Blocks/FarmTile.h | 2 +- Minecraft.World/Blocks/FenceGateTile.cpp | 6 +- Minecraft.World/Blocks/FenceGateTile.h | 6 +- Minecraft.World/Blocks/FenceTile.cpp | 2 +- Minecraft.World/Blocks/FenceTile.h | 2 +- Minecraft.World/Blocks/FlowerPotTile.cpp | 36 +- Minecraft.World/Blocks/FlowerPotTile.h | 6 +- Minecraft.World/Blocks/FurnaceTile.cpp | 20 +- Minecraft.World/Blocks/FurnaceTile.h | 6 +- Minecraft.World/Blocks/HalfSlabTile.cpp | 4 +- Minecraft.World/Blocks/HalfSlabTile.h | 4 +- Minecraft.World/Blocks/HeavyTile.cpp | 4 +- Minecraft.World/Blocks/HeavyTile.h | 2 +- Minecraft.World/Blocks/HellSandTile.cpp | 2 +- Minecraft.World/Blocks/HellSandTile.h | 2 +- Minecraft.World/Blocks/IceTile.cpp | 4 +- Minecraft.World/Blocks/IceTile.h | 2 +- Minecraft.World/Blocks/LadderTile.cpp | 2 +- Minecraft.World/Blocks/LadderTile.h | 2 +- Minecraft.World/Blocks/LeafTile.cpp | 14 +- Minecraft.World/Blocks/LeafTile.h | 6 +- Minecraft.World/Blocks/LeverTile.cpp | 6 +- Minecraft.World/Blocks/LeverTile.h | 6 +- Minecraft.World/Blocks/LiquidTile.cpp | 2 +- Minecraft.World/Blocks/LiquidTile.h | 2 +- Minecraft.World/Blocks/MobSpawner.cpp | 20 +- Minecraft.World/Blocks/MobSpawner.h | 4 +- Minecraft.World/Blocks/MobSpawnerTile.cpp | 4 +- Minecraft.World/Blocks/MobSpawnerTile.h | 2 +- Minecraft.World/Blocks/MusicTile.cpp | 14 +- Minecraft.World/Blocks/MusicTile.h | 6 +- Minecraft.World/Blocks/NetherStalkTile.cpp | 2 +- Minecraft.World/Blocks/PistonBaseTile.cpp | 16 +- Minecraft.World/Blocks/PistonBaseTile.h | 10 +- .../Blocks/PistonExtensionTile.cpp | 4 +- Minecraft.World/Blocks/PistonExtensionTile.h | 4 +- .../Blocks/PistonMovingTileEntity.cpp | 22 +- .../Blocks/PistonMovingTileEntity.h | 10 +- Minecraft.World/Blocks/PortalTile.cpp | 4 +- Minecraft.World/Blocks/PortalTile.h | 4 +- Minecraft.World/Blocks/PotatoTile.cpp | 2 +- Minecraft.World/Blocks/PressurePlateTile.cpp | 6 +- Minecraft.World/Blocks/PressurePlateTile.h | 4 +- Minecraft.World/Blocks/PumpkinTile.cpp | 6 +- Minecraft.World/Blocks/PumpkinTile.h | 2 +- Minecraft.World/Blocks/QuartzBlockTile.cpp | 4 +- Minecraft.World/Blocks/QuartzBlockTile.h | 2 +- Minecraft.World/Blocks/RailTile.cpp | 2 +- Minecraft.World/Blocks/RailTile.h | 2 +- Minecraft.World/Blocks/RecordPlayerTile.cpp | 14 +- Minecraft.World/Blocks/RecordPlayerTile.h | 10 +- Minecraft.World/Blocks/RedStoneOreTile.cpp | 10 +- Minecraft.World/Blocks/RedStoneOreTile.h | 8 +- Minecraft.World/Blocks/SignTile.cpp | 6 +- Minecraft.World/Blocks/SignTile.h | 4 +- Minecraft.World/Blocks/SkullTile.cpp | 24 +- Minecraft.World/Blocks/SkullTile.h | 10 +- Minecraft.World/Blocks/StairTile.cpp | 16 +- Minecraft.World/Blocks/StairTile.h | 16 +- Minecraft.World/Blocks/StemTile.cpp | 4 +- Minecraft.World/Blocks/StemTile.h | 2 +- Minecraft.World/Blocks/StoneMonsterTile.cpp | 6 +- Minecraft.World/Blocks/StoneMonsterTile.h | 2 +- Minecraft.World/Blocks/StoneSlabTile.cpp | 4 +- Minecraft.World/Blocks/StoneSlabTile.h | 2 +- Minecraft.World/Blocks/TallGrassPlantTile.cpp | 4 +- Minecraft.World/Blocks/TallGrassPlantTile.h | 2 +- .../Blocks/TheEndPortalFrameTile.cpp | 4 +- .../Blocks/TheEndPortalFrameTile.h | 4 +- Minecraft.World/Blocks/TheEndPortalTile.cpp | 10 +- Minecraft.World/Blocks/TheEndPortalTile.h | 8 +- Minecraft.World/Blocks/ThinFenceTile.cpp | 8 +- Minecraft.World/Blocks/ThinFenceTile.h | 6 +- Minecraft.World/Blocks/Tile.cpp | 42 +- Minecraft.World/Blocks/Tile.h | 32 +- .../TileEntities/BrewingStandTileEntity.cpp | 30 +- .../TileEntities/BrewingStandTileEntity.h | 14 +- .../Blocks/TileEntities/ChestTileEntity.cpp | 20 +- .../Blocks/TileEntities/ChestTileEntity.h | 12 +- .../TileEntities/DispenserTileEntity.cpp | 26 +- .../Blocks/TileEntities/DispenserTileEntity.h | 16 +- .../EnchantmentTableTileEntity.cpp | 6 +- .../TileEntities/EnchantmentTableTileEntity.h | 2 +- .../TileEntities/EnderChestTileEntity.cpp | 6 +- .../TileEntities/EnderChestTileEntity.h | 4 +- .../Blocks/TileEntities/EntityTile.cpp | 2 +- .../Blocks/TileEntities/EntityTile.h | 2 +- .../Blocks/TileEntities/FurnaceTileEntity.cpp | 26 +- .../Blocks/TileEntities/FurnaceTileEntity.h | 16 +- .../TileEntities/MobSpawnerTileEntity.cpp | 20 +- .../TileEntities/MobSpawnerTileEntity.h | 10 +- .../Blocks/TileEntities/MusicTileEntity.cpp | 4 +- .../Blocks/TileEntities/MusicTileEntity.h | 2 +- .../TileEntities/PistonPieceTileEntity.cpp | 8 +- .../TileEntities/PistonPieceTileEntity.h | 2 +- .../Blocks/TileEntities/SignTileEntity.cpp | 8 +- .../Blocks/TileEntities/SignTileEntity.h | 4 +- .../Blocks/TileEntities/SkullTileEntity.cpp | 8 +- .../Blocks/TileEntities/SkullTileEntity.h | 4 +- .../TileEntities/TheEndPortalTileEntity.cpp | 4 +- .../TileEntities/TheEndPortalTileEntity.h | 2 +- .../Blocks/TileEntities/TileEntity.cpp | 10 +- .../Blocks/TileEntities/TileEntity.h | 8 +- Minecraft.World/Blocks/TntTile.cpp | 12 +- Minecraft.World/Blocks/TntTile.h | 6 +- Minecraft.World/Blocks/TopSnowTile.cpp | 6 +- Minecraft.World/Blocks/TopSnowTile.h | 4 +- Minecraft.World/Blocks/TorchTile.cpp | 2 +- Minecraft.World/Blocks/TorchTile.h | 2 +- Minecraft.World/Blocks/TrapDoorTile.cpp | 6 +- Minecraft.World/Blocks/TrapDoorTile.h | 6 +- Minecraft.World/Blocks/TreeTile.cpp | 6 +- Minecraft.World/Blocks/TreeTile.h | 4 +- Minecraft.World/Blocks/TripWireSourceTile.cpp | 2 +- Minecraft.World/Blocks/TripWireSourceTile.h | 2 +- Minecraft.World/Blocks/TripWireTile.cpp | 8 +- Minecraft.World/Blocks/TripWireTile.h | 6 +- Minecraft.World/Blocks/VineTile.cpp | 6 +- Minecraft.World/Blocks/VineTile.h | 4 +- Minecraft.World/Blocks/WallTile.cpp | 2 +- Minecraft.World/Blocks/WallTile.h | 2 +- Minecraft.World/Blocks/WaterLilyTile.cpp | 2 +- Minecraft.World/Blocks/WaterLilyTile.h | 2 +- Minecraft.World/Blocks/WebTile.cpp | 2 +- Minecraft.World/Blocks/WebTile.h | 2 +- Minecraft.World/Blocks/WoodSlabTile.cpp | 4 +- Minecraft.World/Blocks/WoodSlabTile.h | 2 +- Minecraft.World/Blocks/WoolCarpetTile.cpp | 2 +- Minecraft.World/Blocks/WoolCarpetTile.h | 2 +- Minecraft.World/Blocks/WorkbenchTile.cpp | 2 +- Minecraft.World/Blocks/WorkbenchTile.h | 2 +- Minecraft.World/Commands/AdminLogCommand.h | 2 +- Minecraft.World/Commands/Command.cpp | 10 +- Minecraft.World/Commands/Command.h | 10 +- .../Commands/CommandDispatcher.cpp | 2 +- Minecraft.World/Commands/CommandDispatcher.h | 2 +- .../Commands/DefaultGameModeCommand.cpp | 2 +- .../Commands/DefaultGameModeCommand.h | 2 +- .../Commands/EnchantItemCommand.cpp | 10 +- Minecraft.World/Commands/EnchantItemCommand.h | 4 +- .../Commands/ExperienceCommand.cpp | 6 +- Minecraft.World/Commands/ExperienceCommand.h | 4 +- Minecraft.World/Commands/GameModeCommand.cpp | 6 +- Minecraft.World/Commands/GameModeCommand.h | 6 +- Minecraft.World/Commands/GiveItemCommand.cpp | 10 +- Minecraft.World/Commands/GiveItemCommand.h | 4 +- Minecraft.World/Commands/KillCommand.cpp | 4 +- Minecraft.World/Commands/KillCommand.h | 2 +- Minecraft.World/Commands/TimeCommand.cpp | 10 +- Minecraft.World/Commands/TimeCommand.h | 8 +- .../Commands/ToggleDownfallCommand.cpp | 6 +- .../Commands/ToggleDownfallCommand.h | 4 +- .../Containers/AbstractContainerMenu.cpp | 68 ++-- .../Containers/AbstractContainerMenu.h | 34 +- Minecraft.World/Containers/ArmorSlot.cpp | 14 +- Minecraft.World/Containers/ArmorSlot.h | 8 +- .../Containers/BrewingStandMenu.cpp | 26 +- Minecraft.World/Containers/BrewingStandMenu.h | 26 +- .../Containers/ClientSideMerchant.cpp | 12 +- .../Containers/ClientSideMerchant.h | 12 +- .../Containers/CompoundContainer.cpp | 12 +- .../Containers/CompoundContainer.h | 14 +- Minecraft.World/Containers/Container.h | 10 +- Minecraft.World/Containers/ContainerMenu.cpp | 20 +- Minecraft.World/Containers/ContainerMenu.h | 12 +- .../Containers/CraftingContainer.cpp | 18 +- .../Containers/CraftingContainer.h | 12 +- Minecraft.World/Containers/CraftingMenu.cpp | 20 +- Minecraft.World/Containers/CraftingMenu.h | 14 +- .../Containers/EnchantmentMenu.cpp | 24 +- Minecraft.World/Containers/EnchantmentMenu.h | 14 +- Minecraft.World/Containers/EnchantmentSlot.h | 6 +- Minecraft.World/Containers/FurnaceMenu.cpp | 14 +- Minecraft.World/Containers/FurnaceMenu.h | 10 +- .../Containers/FurnaceResultSlot.cpp | 16 +- .../Containers/FurnaceResultSlot.h | 16 +- Minecraft.World/Containers/Inventory.cpp | 68 ++-- Minecraft.World/Containers/Inventory.h | 50 +-- Minecraft.World/Containers/InventoryMenu.cpp | 28 +- Minecraft.World/Containers/InventoryMenu.h | 20 +- Minecraft.World/Containers/MenuBackup.cpp | 2 +- Minecraft.World/Containers/MenuBackup.h | 4 +- Minecraft.World/Containers/Merchant.h | 8 +- .../Containers/MerchantContainer.cpp | 24 +- .../Containers/MerchantContainer.h | 16 +- Minecraft.World/Containers/MerchantMenu.cpp | 22 +- Minecraft.World/Containers/MerchantMenu.h | 18 +- Minecraft.World/Containers/MerchantRecipe.cpp | 20 +- Minecraft.World/Containers/MerchantRecipe.h | 22 +- .../Containers/MerchantRecipeList.cpp | 12 +- .../Containers/MerchantRecipeList.h | 4 +- .../Containers/MerchantResultSlot.cpp | 24 +- .../Containers/MerchantResultSlot.h | 20 +- Minecraft.World/Containers/RepairMenu.cpp | 26 +- Minecraft.World/Containers/RepairMenu.h | 16 +- .../Containers/RepairResultSlot.cpp | 12 +- Minecraft.World/Containers/RepairResultSlot.h | 10 +- .../Containers/ResultContainer.cpp | 14 +- Minecraft.World/Containers/ResultContainer.h | 10 +- Minecraft.World/Containers/ResultSlot.cpp | 18 +- Minecraft.World/Containers/ResultSlot.h | 18 +- .../Containers/SimpleContainer.cpp | 16 +- Minecraft.World/Containers/SimpleContainer.h | 10 +- Minecraft.World/Containers/Slot.cpp | 38 +- Minecraft.World/Containers/Slot.h | 28 +- Minecraft.World/Containers/TrapMenu.cpp | 10 +- Minecraft.World/Containers/TrapMenu.h | 8 +- .../Enchantments/DamageEnchantment.cpp | 4 +- .../Enchantments/DamageEnchantment.h | 4 +- .../Enchantments/DigDurabilityEnchantment.cpp | 4 +- .../Enchantments/DigDurabilityEnchantment.h | 4 +- .../Enchantments/DiggingEnchantment.cpp | 2 +- .../Enchantments/DiggingEnchantment.h | 2 +- Minecraft.World/Enchantments/Enchantment.cpp | 4 +- Minecraft.World/Enchantments/Enchantment.h | 4 +- .../Enchantments/EnchantmentHelper.cpp | 44 +- .../Enchantments/EnchantmentHelper.h | 44 +- .../Enchantments/ProtectionEnchantment.cpp | 4 +- .../Enchantments/ProtectionEnchantment.h | 4 +- .../Enchantments/ThornsEnchantment.cpp | 6 +- .../Enchantments/ThornsEnchantment.h | 4 +- .../Enchantments/UntouchingEnchantment.cpp | 2 +- .../Enchantments/UntouchingEnchantment.h | 2 +- Minecraft.World/Entities/BossMobPart.cpp | 2 +- Minecraft.World/Entities/BossMobPart.h | 2 +- Minecraft.World/Entities/Entity.cpp | 50 +-- Minecraft.World/Entities/Entity.h | 44 +- .../Entities/EntityDamageSource.cpp | 14 +- Minecraft.World/Entities/EntityDamageSource.h | 12 +- Minecraft.World/Entities/EntityPos.cpp | 2 +- Minecraft.World/Entities/EntityPos.h | 2 +- Minecraft.World/Entities/HangingEntity.cpp | 12 +- Minecraft.World/Entities/HangingEntity.h | 2 +- .../Entities/IndirectEntityDamageSource.cpp | 16 +- .../Entities/IndirectEntityDamageSource.h | 14 +- Minecraft.World/Entities/ItemEntity.cpp | 26 +- Minecraft.World/Entities/ItemEntity.h | 10 +- Minecraft.World/Entities/Mob.cpp | 60 +-- Minecraft.World/Entities/Mob.h | 42 +- Minecraft.World/Entities/MobEffect.cpp | 4 +- Minecraft.World/Entities/MobEffect.h | 4 +- .../Entities/MobEffectInstance.cpp | 4 +- Minecraft.World/Entities/MobEffectInstance.h | 4 +- Minecraft.World/Entities/Mobs/AgeableMob.cpp | 6 +- Minecraft.World/Entities/Mobs/AgeableMob.h | 4 +- Minecraft.World/Entities/Mobs/Animal.cpp | 46 +-- Minecraft.World/Entities/Mobs/Animal.h | 18 +- Minecraft.World/Entities/Mobs/Arrow.cpp | 16 +- Minecraft.World/Entities/Mobs/Arrow.h | 8 +- Minecraft.World/Entities/Mobs/Blaze.cpp | 4 +- Minecraft.World/Entities/Mobs/Blaze.h | 2 +- Minecraft.World/Entities/Mobs/Boat.cpp | 12 +- Minecraft.World/Entities/Mobs/Boat.h | 4 +- Minecraft.World/Entities/Mobs/BossMob.cpp | 2 +- Minecraft.World/Entities/Mobs/BossMob.h | 2 +- Minecraft.World/Entities/Mobs/CaveSpider.cpp | 2 +- Minecraft.World/Entities/Mobs/CaveSpider.h | 2 +- Minecraft.World/Entities/Mobs/Chicken.cpp | 6 +- Minecraft.World/Entities/Mobs/Chicken.h | 4 +- Minecraft.World/Entities/Mobs/Cow.cpp | 14 +- Minecraft.World/Entities/Mobs/Cow.h | 4 +- Minecraft.World/Entities/Mobs/Creeper.cpp | 4 +- Minecraft.World/Entities/Mobs/Creeper.h | 2 +- .../Entities/Mobs/DragonFireball.cpp | 8 +- .../Entities/Mobs/DragonFireball.h | 2 +- .../Entities/Mobs/EnderCrystal.cpp | 8 +- Minecraft.World/Entities/Mobs/EnderDragon.cpp | 50 +-- Minecraft.World/Entities/Mobs/EnderDragon.h | 30 +- Minecraft.World/Entities/Mobs/EnderMan.cpp | 12 +- Minecraft.World/Entities/Mobs/EnderMan.h | 6 +- .../Entities/Mobs/ExperienceOrb.cpp | 2 +- Minecraft.World/Entities/Mobs/ExperienceOrb.h | 4 +- .../Entities/Mobs/EyeOfEnderSignal.cpp | 2 +- Minecraft.World/Entities/Mobs/Fireball.cpp | 10 +- Minecraft.World/Entities/Mobs/Fireball.h | 4 +- Minecraft.World/Entities/Mobs/FishingHook.cpp | 16 +- Minecraft.World/Entities/Mobs/FishingHook.h | 8 +- Minecraft.World/Entities/Mobs/Ghast.cpp | 4 +- Minecraft.World/Entities/Mobs/Ghast.h | 2 +- Minecraft.World/Entities/Mobs/ItemFrame.cpp | 16 +- Minecraft.World/Entities/Mobs/ItemFrame.h | 6 +- Minecraft.World/Entities/Mobs/LavaSlime.cpp | 4 +- Minecraft.World/Entities/Mobs/LavaSlime.h | 2 +- .../Entities/Mobs/LightningBolt.cpp | 4 +- Minecraft.World/Entities/Mobs/Minecart.cpp | 50 +-- Minecraft.World/Entities/Mobs/Minecart.h | 16 +- Minecraft.World/Entities/Mobs/MushroomCow.cpp | 16 +- Minecraft.World/Entities/Mobs/MushroomCow.h | 4 +- Minecraft.World/Entities/Mobs/Ocelot.cpp | 16 +- Minecraft.World/Entities/Mobs/Ocelot.h | 10 +- Minecraft.World/Entities/Mobs/Painting.cpp | 4 +- Minecraft.World/Entities/Mobs/Painting.h | 2 +- Minecraft.World/Entities/Mobs/Pig.cpp | 12 +- Minecraft.World/Entities/Mobs/Pig.h | 6 +- Minecraft.World/Entities/Mobs/PigZombie.cpp | 26 +- Minecraft.World/Entities/Mobs/PigZombie.h | 8 +- Minecraft.World/Entities/Mobs/Sheep.cpp | 26 +- Minecraft.World/Entities/Mobs/Sheep.h | 12 +- Minecraft.World/Entities/Mobs/Silverfish.cpp | 8 +- Minecraft.World/Entities/Mobs/Silverfish.h | 4 +- Minecraft.World/Entities/Mobs/Skeleton.cpp | 10 +- Minecraft.World/Entities/Mobs/Skeleton.h | 4 +- Minecraft.World/Entities/Mobs/Slime.cpp | 10 +- Minecraft.World/Entities/Mobs/Slime.h | 4 +- .../Entities/Mobs/SmallFireball.cpp | 2 +- Minecraft.World/Entities/Mobs/SmallFireball.h | 2 +- Minecraft.World/Entities/Mobs/Snowball.cpp | 2 +- Minecraft.World/Entities/Mobs/Snowball.h | 2 +- Minecraft.World/Entities/Mobs/Spider.cpp | 8 +- Minecraft.World/Entities/Mobs/Spider.h | 4 +- Minecraft.World/Entities/Mobs/Squid.cpp | 2 +- Minecraft.World/Entities/Mobs/ThrownEgg.cpp | 4 +- Minecraft.World/Entities/Mobs/ThrownEgg.h | 2 +- .../Entities/Mobs/ThrownEnderPearl.cpp | 4 +- .../Entities/Mobs/ThrownEnderPearl.h | 2 +- .../Entities/Mobs/ThrownExpBottle.cpp | 4 +- .../Entities/Mobs/ThrownExpBottle.h | 2 +- .../Entities/Mobs/ThrownPotion.cpp | 8 +- Minecraft.World/Entities/Mobs/ThrownPotion.h | 2 +- Minecraft.World/Entities/Mobs/Villager.cpp | 60 +-- Minecraft.World/Entities/Mobs/Villager.h | 16 +- .../Entities/Mobs/VillagerGolem.cpp | 6 +- Minecraft.World/Entities/Mobs/VillagerGolem.h | 4 +- Minecraft.World/Entities/Mobs/Wolf.cpp | 20 +- Minecraft.World/Entities/Mobs/Wolf.h | 12 +- Minecraft.World/Entities/Mobs/Zombie.cpp | 10 +- Minecraft.World/Entities/Mobs/Zombie.h | 4 +- Minecraft.World/Entities/Monster.cpp | 16 +- Minecraft.World/Entities/Monster.h | 6 +- Minecraft.World/Entities/PathfinderMob.cpp | 10 +- Minecraft.World/Entities/PathfinderMob.h | 10 +- Minecraft.World/Entities/SyncedEntityData.cpp | 80 ++-- Minecraft.World/Entities/SyncedEntityData.h | 26 +- Minecraft.World/Entities/TamableAnimal.cpp | 2 +- Minecraft.World/Entities/TamableAnimal.h | 2 +- Minecraft.World/Entities/Throwable.cpp | 8 +- Minecraft.World/Entities/Throwable.h | 4 +- Minecraft.World/Entities/WaterAnimal.cpp | 2 +- Minecraft.World/Entities/WaterAnimal.h | 2 +- .../net.minecraft.world.ContainerListener.h | 2 +- ...ecraft.world.inventory.ContainerListener.h | 4 +- Minecraft.World/Items/ArmorItem.cpp | 12 +- Minecraft.World/Items/ArmorItem.h | 12 +- Minecraft.World/Items/BedItem.cpp | 2 +- Minecraft.World/Items/BedItem.h | 2 +- Minecraft.World/Items/BoatItem.cpp | 10 +- Minecraft.World/Items/BoatItem.h | 4 +- Minecraft.World/Items/BookItem.cpp | 2 +- Minecraft.World/Items/BookItem.h | 2 +- Minecraft.World/Items/BottleItem.cpp | 10 +- Minecraft.World/Items/BottleItem.h | 4 +- Minecraft.World/Items/BowItem.cpp | 12 +- Minecraft.World/Items/BowItem.h | 10 +- Minecraft.World/Items/BowlFoodItem.cpp | 4 +- Minecraft.World/Items/BowlFoodItem.h | 2 +- Minecraft.World/Items/BucketItem.cpp | 30 +- Minecraft.World/Items/BucketItem.h | 4 +- Minecraft.World/Items/CarrotOnAStickItem.cpp | 6 +- Minecraft.World/Items/CarrotOnAStickItem.h | 2 +- Minecraft.World/Items/CoalItem.cpp | 2 +- Minecraft.World/Items/CoalItem.h | 2 +- Minecraft.World/Items/ComplexItem.cpp | 2 +- Minecraft.World/Items/ComplexItem.h | 2 +- Minecraft.World/Items/DiggerItem.cpp | 10 +- Minecraft.World/Items/DiggerItem.h | 10 +- Minecraft.World/Items/DoorItem.cpp | 2 +- Minecraft.World/Items/DoorItem.h | 2 +- Minecraft.World/Items/DyePowderItem.cpp | 10 +- Minecraft.World/Items/DyePowderItem.h | 8 +- Minecraft.World/Items/EggItem.cpp | 4 +- Minecraft.World/Items/EggItem.h | 2 +- Minecraft.World/Items/EnchantedBookItem.cpp | 24 +- Minecraft.World/Items/EnchantedBookItem.h | 18 +- Minecraft.World/Items/EnderEyeItem.cpp | 10 +- Minecraft.World/Items/EnderEyeItem.h | 6 +- Minecraft.World/Items/EnderPearlItem.cpp | 6 +- Minecraft.World/Items/EnderPearlItem.h | 4 +- Minecraft.World/Items/ExperienceItem.cpp | 8 +- Minecraft.World/Items/ExperienceItem.h | 6 +- Minecraft.World/Items/FireChargeItem.cpp | 2 +- Minecraft.World/Items/FireChargeItem.h | 2 +- Minecraft.World/Items/FishingRodItem.cpp | 6 +- Minecraft.World/Items/FishingRodItem.h | 2 +- Minecraft.World/Items/FlintAndSteelItem.cpp | 2 +- Minecraft.World/Items/FlintAndSteelItem.h | 2 +- Minecraft.World/Items/FoodItem.cpp | 12 +- Minecraft.World/Items/FoodItem.h | 12 +- Minecraft.World/Items/GoldenAppleItem.cpp | 8 +- Minecraft.World/Items/GoldenAppleItem.h | 8 +- Minecraft.World/Items/HangingEntityItem.cpp | 10 +- Minecraft.World/Items/HangingEntityItem.h | 4 +- Minecraft.World/Items/HatchetItem.cpp | 2 +- Minecraft.World/Items/HatchetItem.h | 2 +- Minecraft.World/Items/HoeItem.cpp | 2 +- Minecraft.World/Items/HoeItem.h | 2 +- Minecraft.World/Items/Item.cpp | 56 +-- Minecraft.World/Items/Item.h | 56 +-- Minecraft.World/Items/ItemInstance.cpp | 60 +-- Minecraft.World/Items/ItemInstance.h | 54 +-- Minecraft.World/Items/MapItem.cpp | 38 +- Minecraft.World/Items/MapItem.h | 12 +- Minecraft.World/Items/MilkBucketItem.cpp | 10 +- Minecraft.World/Items/MilkBucketItem.h | 8 +- Minecraft.World/Items/MinecartItem.cpp | 4 +- Minecraft.World/Items/MinecartItem.h | 2 +- Minecraft.World/Items/MonsterPlacerItem.cpp | 18 +- Minecraft.World/Items/MonsterPlacerItem.h | 10 +- Minecraft.World/Items/PickaxeItem.cpp | 2 +- Minecraft.World/Items/PickaxeItem.h | 2 +- Minecraft.World/Items/PotionItem.cpp | 30 +- Minecraft.World/Items/PotionItem.h | 24 +- Minecraft.World/Items/RecordingItem.cpp | 8 +- Minecraft.World/Items/RecordingItem.h | 6 +- Minecraft.World/Items/RedstoneItem.cpp | 2 +- Minecraft.World/Items/RedstoneItem.h | 2 +- Minecraft.World/Items/SaddleItem.cpp | 6 +- Minecraft.World/Items/SaddleItem.h | 4 +- Minecraft.World/Items/SeedFoodItem.cpp | 2 +- Minecraft.World/Items/SeedFoodItem.h | 2 +- Minecraft.World/Items/SeedItem.cpp | 2 +- Minecraft.World/Items/SeedItem.h | 2 +- Minecraft.World/Items/ShearsItem.cpp | 4 +- Minecraft.World/Items/ShearsItem.h | 4 +- Minecraft.World/Items/SignItem.cpp | 4 +- Minecraft.World/Items/SignItem.h | 2 +- Minecraft.World/Items/SnowballItem.cpp | 6 +- Minecraft.World/Items/SnowballItem.h | 2 +- .../Items/TileItems/ClothTileItem.cpp | 2 +- .../Items/TileItems/ClothTileItem.h | 2 +- .../Items/TileItems/ColoredTileItem.cpp | 4 +- .../Items/TileItems/ColoredTileItem.h | 4 +- .../Items/TileItems/LeafTileItem.cpp | 4 +- .../Items/TileItems/LeafTileItem.h | 4 +- .../Items/TileItems/MultiTextureTileItem.cpp | 2 +- .../Items/TileItems/MultiTextureTileItem.h | 2 +- .../Items/TileItems/PlanterTileItem.cpp | 2 +- .../Items/TileItems/PlanterTileItem.h | 2 +- .../Items/TileItems/SaplingTileItem.cpp | 2 +- .../Items/TileItems/SaplingTileItem.h | 2 +- Minecraft.World/Items/TileItems/SkullItem.cpp | 12 +- Minecraft.World/Items/TileItems/SkullItem.h | 8 +- .../TileItems/SmoothStoneBrickTileItem.cpp | 2 +- .../TileItems/SmoothStoneBrickTileItem.h | 2 +- .../Items/TileItems/StoneMonsterTileItem.cpp | 2 +- .../Items/TileItems/StoneMonsterTileItem.h | 2 +- .../Items/TileItems/StoneSlabTileItem.cpp | 8 +- .../Items/TileItems/StoneSlabTileItem.h | 8 +- Minecraft.World/Items/TileItems/TileItem.cpp | 8 +- Minecraft.World/Items/TileItems/TileItem.h | 8 +- .../Items/TileItems/TreeTileItem.cpp | 2 +- .../Items/TileItems/TreeTileItem.h | 2 +- .../Items/TileItems/WaterLilyTileItem.cpp | 4 +- .../Items/TileItems/WaterLilyTileItem.h | 4 +- Minecraft.World/Items/WeaponItem.cpp | 16 +- Minecraft.World/Items/WeaponItem.h | 16 +- Minecraft.World/Level/ChunkPos.cpp | 2 +- Minecraft.World/Level/ChunkPos.h | 2 +- Minecraft.World/Level/DerivedLevelData.cpp | 2 +- Minecraft.World/Level/DerivedLevelData.h | 2 +- Minecraft.World/Level/EmptyLevelChunk.cpp | 18 +- Minecraft.World/Level/EmptyLevelChunk.h | 16 +- Minecraft.World/Level/Events/LevelListener.h | 10 +- Minecraft.World/Level/Events/VillageSiege.cpp | 18 +- Minecraft.World/Level/Explosion.cpp | 12 +- Minecraft.World/Level/Explosion.h | 8 +- Minecraft.World/Level/Level.cpp | 198 ++++----- Minecraft.World/Level/Level.h | 118 +++--- Minecraft.World/Level/LevelChunk.cpp | 56 +-- Minecraft.World/Level/LevelChunk.h | 20 +- Minecraft.World/Level/LevelData.cpp | 2 +- Minecraft.World/Level/LevelData.h | 2 +- .../Level/Storage/DirectoryLevelStorage.cpp | 8 +- .../Level/Storage/DirectoryLevelStorage.h | 8 +- .../Storage/DirectoryLevelStorageSource.cpp | 4 +- .../Storage/DirectoryLevelStorageSource.h | 2 +- Minecraft.World/Level/Storage/EntityIO.cpp | 28 +- Minecraft.World/Level/Storage/EntityIO.h | 12 +- Minecraft.World/Level/Storage/LevelSource.h | 2 +- Minecraft.World/Level/Storage/LevelStorage.h | 2 +- .../Storage/LevelStorageProfilerDecorator.cpp | 2 +- .../Storage/LevelStorageProfilerDecorator.h | 2 +- .../Level/Storage/LevelStorageSource.h | 2 +- .../Level/Storage/MapItemSavedData.cpp | 30 +- .../Level/Storage/MapItemSavedData.h | 18 +- .../Level/Storage/McRegionLevelStorage.cpp | 2 +- .../Level/Storage/McRegionLevelStorage.h | 2 +- .../Storage/McRegionLevelStorageSource.cpp | 4 +- .../Storage/McRegionLevelStorageSource.h | 2 +- .../Level/Storage/MemoryLevelStorage.cpp | 6 +- .../Level/Storage/MemoryLevelStorage.h | 6 +- .../Storage/MemoryLevelStorageSource.cpp | 4 +- .../Level/Storage/MemoryLevelStorageSource.h | 2 +- .../Level/Storage/MockedLevelStorage.cpp | 2 +- .../Level/Storage/MockedLevelStorage.h | 2 +- .../Level/Storage/OldChunkStorage.cpp | 16 +- Minecraft.World/Level/Storage/PlayerIO.h | 6 +- .../Level/Storage/PortalForcer.cpp | 6 +- Minecraft.World/Level/Storage/PortalForcer.h | 6 +- Minecraft.World/Level/Storage/Region.cpp | 2 +- Minecraft.World/Level/Storage/Region.h | 2 +- .../Level/Storage/SavedDataStorage.cpp | 20 +- .../Level/Storage/SavedDataStorage.h | 10 +- .../Level/Storage/ZonedChunkStorage.cpp | 12 +- Minecraft.World/Level/WaterLevelChunk.cpp | 18 +- Minecraft.World/Level/WaterLevelChunk.h | 16 +- Minecraft.World/Network/Connection.cpp | 16 +- Minecraft.World/Network/Connection.h | 10 +- .../Network/Packets/AddEntityPacket.cpp | 6 +- .../Network/Packets/AddEntityPacket.h | 8 +- .../Packets/AddExperienceOrbPacket.cpp | 2 +- .../Network/Packets/AddExperienceOrbPacket.h | 4 +- .../Network/Packets/AddGlobalEntityPacket.cpp | 2 +- .../Network/Packets/AddGlobalEntityPacket.h | 4 +- .../Network/Packets/AddMobPacket.cpp | 4 +- .../Network/Packets/AddMobPacket.h | 10 +- .../Network/Packets/AddPaintingPacket.cpp | 2 +- .../Network/Packets/AddPaintingPacket.h | 4 +- .../Network/Packets/AddPlayerPacket.cpp | 6 +- .../Network/Packets/AddPlayerPacket.h | 10 +- .../Network/Packets/AnimatePacket.cpp | 2 +- .../Network/Packets/AnimatePacket.h | 4 +- .../Network/Packets/AwardStatPacket.h | 2 +- .../Network/Packets/BlockRegionUpdatePacket.h | 2 +- Minecraft.World/Network/Packets/ChatPacket.h | 2 +- .../Network/Packets/ChunkTilesUpdatePacket.h | 2 +- .../Packets/ChunkVisibilityAreaPacket.h | 2 +- .../Network/Packets/ChunkVisibilityPacket.h | 2 +- .../Network/Packets/ClientCommandPacket.h | 2 +- .../Network/Packets/ComplexItemDataPacket.h | 2 +- .../Network/Packets/ContainerAckPacket.h | 2 +- .../Packets/ContainerButtonClickPacket.h | 2 +- .../Network/Packets/ContainerClickPacket.cpp | 2 +- .../Network/Packets/ContainerClickPacket.h | 6 +- .../Network/Packets/ContainerClosePacket.h | 2 +- .../Network/Packets/ContainerOpenPacket.h | 2 +- .../Packets/ContainerSetContentPacket.cpp | 4 +- .../Packets/ContainerSetContentPacket.h | 4 +- .../Network/Packets/ContainerSetDataPacket.h | 2 +- .../Packets/ContainerSetSlotPacket.cpp | 2 +- .../Network/Packets/ContainerSetSlotPacket.h | 6 +- .../Network/Packets/CraftItemPacket.h | 2 +- .../Network/Packets/CustomPayloadPacket.h | 2 +- .../Network/Packets/DebugOptionsPacket.h | 2 +- .../Network/Packets/DisconnectPacket.cpp | 2 +- .../Network/Packets/DisconnectPacket.h | 4 +- .../Packets/EntityActionAtPositionPacket.cpp | 2 +- .../Packets/EntityActionAtPositionPacket.h | 4 +- .../Network/Packets/EntityEventPacket.h | 2 +- .../Network/Packets/ExplodePacket.h | 2 +- .../Network/Packets/GameCommandPacket.h | 2 +- .../Network/Packets/GameEventPacket.h | 2 +- .../Network/Packets/GetInfoPacket.h | 2 +- .../Network/Packets/InteractPacket.h | 2 +- .../Network/Packets/KeepAlivePacket.cpp | 2 +- .../Network/Packets/KeepAlivePacket.h | 4 +- .../Network/Packets/KickPlayerPacket.h | 2 +- .../Network/Packets/LevelEventPacket.h | 2 +- .../Network/Packets/LevelSoundPacket.h | 2 +- Minecraft.World/Network/Packets/LoginPacket.h | 2 +- .../Network/Packets/MoveEntityPacket.cpp | 4 +- .../Network/Packets/MoveEntityPacket.h | 10 +- .../Network/Packets/MoveEntityPacketSmall.cpp | 4 +- .../Network/Packets/MoveEntityPacketSmall.h | 10 +- .../Network/Packets/MovePlayerPacket.cpp | 2 +- .../Network/Packets/MovePlayerPacket.h | 10 +- Minecraft.World/Network/Packets/Packet.cpp | 22 +- Minecraft.World/Network/Packets/Packet.h | 18 +- .../Network/Packets/PacketListener.cpp | 300 +++++++------- .../Network/Packets/PacketListener.h | 174 ++++---- .../Network/Packets/PlayerAbilitiesPacket.cpp | 2 +- .../Network/Packets/PlayerAbilitiesPacket.h | 4 +- .../Network/Packets/PlayerActionPacket.h | 2 +- .../Network/Packets/PlayerCommandPacket.cpp | 2 +- .../Network/Packets/PlayerCommandPacket.h | 4 +- .../Network/Packets/PlayerInfoPacket.cpp | 2 +- .../Network/Packets/PlayerInfoPacket.h | 4 +- .../Network/Packets/PlayerInputPacket.h | 2 +- .../Network/Packets/PreLoginPacket.h | 2 +- .../Network/Packets/RemoveEntitiesPacket.h | 2 +- .../Network/Packets/RemoveMobEffectPacket.h | 2 +- .../Network/Packets/RespawnPacket.h | 2 +- .../Network/Packets/RotateHeadPacket.cpp | 4 +- .../Network/Packets/RotateHeadPacket.h | 4 +- .../Packets/ServerSettingsChangedPacket.h | 2 +- .../Network/Packets/SetCarriedItemPacket.cpp | 2 +- .../Network/Packets/SetCarriedItemPacket.h | 4 +- .../Packets/SetCreativeModeSlotPacket.cpp | 4 +- .../Packets/SetCreativeModeSlotPacket.h | 6 +- .../Network/Packets/SetEntityDataPacket.cpp | 4 +- .../Network/Packets/SetEntityDataPacket.h | 8 +- .../Network/Packets/SetEntityMotionPacket.cpp | 6 +- .../Network/Packets/SetEntityMotionPacket.h | 6 +- .../Network/Packets/SetEquippedItemPacket.cpp | 8 +- .../Network/Packets/SetEquippedItemPacket.h | 10 +- .../Network/Packets/SetExperiencePacket.cpp | 2 +- .../Network/Packets/SetExperiencePacket.h | 4 +- .../Network/Packets/SetHealthPacket.cpp | 2 +- .../Network/Packets/SetHealthPacket.h | 4 +- .../Network/Packets/SetRidingPacket.cpp | 6 +- .../Network/Packets/SetRidingPacket.h | 6 +- .../Packets/SetSpawnPositionPacket.cpp | 2 +- .../Network/Packets/SetSpawnPositionPacket.h | 4 +- .../Network/Packets/SetTimePacket.cpp | 2 +- .../Network/Packets/SetTimePacket.h | 4 +- .../Network/Packets/SignUpdatePacket.h | 2 +- .../Network/Packets/TakeItemEntityPacket.h | 2 +- .../Network/Packets/TeleportEntityPacket.cpp | 6 +- .../Network/Packets/TeleportEntityPacket.h | 6 +- .../TextureAndGeometryChangePacket.cpp | 2 +- .../Packets/TextureAndGeometryChangePacket.h | 4 +- .../Packets/TextureAndGeometryPacket.h | 2 +- .../Network/Packets/TextureChangePacket.cpp | 2 +- .../Network/Packets/TextureChangePacket.h | 4 +- .../Network/Packets/TexturePacket.h | 2 +- .../Network/Packets/TileDestructionPacket.cpp | 4 +- .../Network/Packets/TileDestructionPacket.h | 4 +- .../Network/Packets/TileEntityDataPacket.h | 2 +- .../Network/Packets/TileEventPacket.h | 2 +- .../Network/Packets/TileUpdatePacket.h | 2 +- .../Network/Packets/TradeItemPacket.h | 2 +- .../Packets/UpdateGameRuleProgressPacket.h | 2 +- .../Network/Packets/UpdateMobEffectPacket.cpp | 4 +- .../Network/Packets/UpdateMobEffectPacket.h | 4 +- .../Network/Packets/UpdateProgressPacket.h | 2 +- .../Network/Packets/UseItemPacket.cpp | 6 +- .../Network/Packets/UseItemPacket.h | 8 +- Minecraft.World/Network/Packets/XZPacket.h | 2 +- Minecraft.World/Player/FoodData.cpp | 2 +- Minecraft.World/Player/FoodData.h | 2 +- Minecraft.World/Player/Player.cpp | 178 ++++---- Minecraft.World/Player/Player.h | 92 ++--- .../Player/PlayerEnderChestContainer.cpp | 6 +- .../Player/PlayerEnderChestContainer.h | 6 +- Minecraft.World/Recipes/ArmorDyeRecipe.cpp | 16 +- Minecraft.World/Recipes/ArmorDyeRecipe.h | 6 +- Minecraft.World/Recipes/Recipes.cpp | 12 +- Minecraft.World/Recipes/Recipes.h | 4 +- Minecraft.World/Recipes/Recipy.h | 4 +- Minecraft.World/Recipes/ShapedRecipy.cpp | 12 +- Minecraft.World/Recipes/ShapedRecipy.h | 6 +- Minecraft.World/Recipes/ShapelessRecipy.cpp | 6 +- Minecraft.World/Recipes/ShapelessRecipy.h | 4 +- Minecraft.World/Stats/Achievement.cpp | 2 +- Minecraft.World/Stats/Achievement.h | 4 +- Minecraft.World/Stats/DurangoStats.cpp | 40 +- Minecraft.World/Stats/DurangoStats.h | 30 +- Minecraft.World/Stats/GenericStats.cpp | 8 +- Minecraft.World/Stats/GenericStats.h | 8 +- Minecraft.World/Stats/Stat.h | 2 +- Minecraft.World/Util/ArrayWithLength.h | 4 +- Minecraft.World/Util/DamageSource.cpp | 26 +- Minecraft.World/Util/DamageSource.h | 22 +- Minecraft.World/Util/DelayedRelease.cpp | 2 +- Minecraft.World/Util/DelayedRelease.h | 4 +- Minecraft.World/Util/HashExtension.h | 4 +- Minecraft.World/Util/HitResult.cpp | 4 +- Minecraft.World/Util/HitResult.h | 6 +- Minecraft.World/Util/WeighedTreasure.cpp | 16 +- Minecraft.World/Util/WeighedTreasure.h | 8 +- Minecraft.World/WorldGen/Biomes/BiomeSource.h | 4 +- .../WorldGen/Features/BonusChestFeature.cpp | 2 +- .../WorldGen/Features/HouseFeature.cpp | 2 +- .../WorldGen/Features/MonsterRoomFeature.cpp | 32 +- .../WorldGen/Features/MonsterRoomFeature.h | 2 +- .../WorldGen/Features/SpikeFeature.cpp | 4 +- .../WorldGen/Layers/AddIslandLayer.cpp | 2 +- .../WorldGen/Layers/AddIslandLayer.h | 2 +- .../Layers/AddMushroomIslandLayer.cpp | 2 +- .../WorldGen/Layers/AddMushroomIslandLayer.h | 2 +- .../WorldGen/Layers/AddSnowLayer.cpp | 2 +- .../WorldGen/Layers/AddSnowLayer.h | 2 +- .../WorldGen/Layers/BiomeInitLayer.cpp | 2 +- .../WorldGen/Layers/BiomeInitLayer.h | 2 +- .../WorldGen/Layers/DownfallLayer.cpp | 2 +- .../WorldGen/Layers/DownfallLayer.h | 2 +- .../WorldGen/Layers/DownfallMixerLayer.cpp | 2 +- .../WorldGen/Layers/DownfallMixerLayer.h | 4 +- .../WorldGen/Layers/FuzzyZoomLayer.cpp | 8 +- .../WorldGen/Layers/FuzzyZoomLayer.h | 4 +- .../Layers/GrowMushroomIslandLayer.cpp | 2 +- .../WorldGen/Layers/GrowMushroomIslandLayer.h | 2 +- Minecraft.World/WorldGen/Layers/Layer.cpp | 58 +-- Minecraft.World/WorldGen/Layers/Layer.h | 2 +- .../WorldGen/Layers/RegionHillsLayer.cpp | 2 +- .../WorldGen/Layers/RegionHillsLayer.h | 2 +- .../WorldGen/Layers/RiverInitLayer.cpp | 2 +- .../WorldGen/Layers/RiverInitLayer.h | 2 +- .../WorldGen/Layers/RiverLayer.cpp | 2 +- Minecraft.World/WorldGen/Layers/RiverLayer.h | 2 +- .../WorldGen/Layers/RiverMixerLayer.cpp | 2 +- .../WorldGen/Layers/RiverMixerLayer.h | 6 +- .../WorldGen/Layers/ShoreLayer.cpp | 2 +- Minecraft.World/WorldGen/Layers/ShoreLayer.h | 2 +- .../WorldGen/Layers/SmoothLayer.cpp | 2 +- Minecraft.World/WorldGen/Layers/SmoothLayer.h | 2 +- .../WorldGen/Layers/SmoothZoomLayer.cpp | 8 +- .../WorldGen/Layers/SmoothZoomLayer.h | 4 +- .../WorldGen/Layers/SwampRiversLayer.cpp | 2 +- .../WorldGen/Layers/SwampRiversLayer.h | 2 +- .../WorldGen/Layers/TemperatureLayer.cpp | 2 +- .../WorldGen/Layers/TemperatureLayer.h | 2 +- .../WorldGen/Layers/TemperatureMixerLayer.cpp | 2 +- .../WorldGen/Layers/TemperatureMixerLayer.h | 4 +- .../WorldGen/Layers/VoronoiZoom.cpp | 2 +- Minecraft.World/WorldGen/Layers/VoronoiZoom.h | 2 +- Minecraft.World/WorldGen/Layers/ZoomLayer.cpp | 8 +- Minecraft.World/WorldGen/Layers/ZoomLayer.h | 4 +- .../WorldGen/Structures/MineShaftPieces.cpp | 2 +- .../Structures/NetherBridgePieces.cpp | 2 +- .../WorldGen/Structures/StrongholdPieces.cpp | 2 +- .../WorldGen/Structures/StructurePiece.cpp | 4 +- .../Structures/TheEndBiomeDecorator.cpp | 2 +- .../WorldGen/Structures/Village.cpp | 46 +-- Minecraft.World/WorldGen/Structures/Village.h | 22 +- .../WorldGen/Structures/VillagePieces.cpp | 2 +- .../WorldGen/Structures/Villages.cpp | 38 +- .../WorldGen/Structures/Villages.h | 10 +- scripts/llvm_native.txt | 5 + 1065 files changed, 5754 insertions(+), 5749 deletions(-) create mode 100644 scripts/llvm_native.txt diff --git a/Minecraft.Client/Commands/TeleportCommand.cpp b/Minecraft.Client/Commands/TeleportCommand.cpp index ca1b2a6a6..a81db8e4e 100644 --- a/Minecraft.Client/Commands/TeleportCommand.cpp +++ b/Minecraft.Client/Commands/TeleportCommand.cpp @@ -14,7 +14,7 @@ EGameCommand TeleportCommand::getId() return eGameCommand_Teleport; } -void TeleportCommand::execute(shared_ptr source, byteArray commandData) +void TeleportCommand::execute(std::shared_ptr source, byteArray commandData) { ByteArrayInputStream bais(commandData); DataInputStream dis(&bais); @@ -26,8 +26,8 @@ void TeleportCommand::execute(shared_ptr source, byteArray comman PlayerList *players = MinecraftServer::getInstance()->getPlayerList(); - shared_ptr subject = players->getPlayer(subjectID); - shared_ptr destination = players->getPlayer(destinationID); + std::shared_ptr subject = players->getPlayer(subjectID); + std::shared_ptr destination = players->getPlayer(destinationID); if(subject != NULL && destination != NULL && subject->level->dimension->id == destination->level->dimension->id && subject->isAlive() ) { @@ -78,7 +78,7 @@ void TeleportCommand::execute(shared_ptr source, byteArray comman //} } -shared_ptr TeleportCommand::preparePacket(PlayerUID subject, PlayerUID destination) +std::shared_ptr TeleportCommand::preparePacket(PlayerUID subject, PlayerUID destination) { ByteArrayOutputStream baos; DataOutputStream dos(&baos); @@ -86,5 +86,5 @@ shared_ptr TeleportCommand::preparePacket(PlayerUID subject, dos.writePlayerUID(subject); dos.writePlayerUID(destination); - return shared_ptr( new GameCommandPacket(eGameCommand_Teleport, baos.toByteArray() )); + return std::shared_ptr( new GameCommandPacket(eGameCommand_Teleport, baos.toByteArray() )); } \ No newline at end of file diff --git a/Minecraft.Client/Commands/TeleportCommand.h b/Minecraft.Client/Commands/TeleportCommand.h index 5e487cfae..f17e728df 100644 --- a/Minecraft.Client/Commands/TeleportCommand.h +++ b/Minecraft.Client/Commands/TeleportCommand.h @@ -6,7 +6,7 @@ class TeleportCommand : public Command { public: virtual EGameCommand getId(); - virtual void execute(shared_ptr source, byteArray commandData); + virtual void execute(std::shared_ptr source, byteArray commandData); - static shared_ptr preparePacket(PlayerUID subject, PlayerUID destination); + static std::shared_ptr preparePacket(PlayerUID subject, PlayerUID destination); }; \ No newline at end of file diff --git a/Minecraft.Client/GameState/CreativeMode.cpp b/Minecraft.Client/GameState/CreativeMode.cpp index 10adfce8f..20f7aa8ce 100644 --- a/Minecraft.Client/GameState/CreativeMode.cpp +++ b/Minecraft.Client/GameState/CreativeMode.cpp @@ -21,7 +21,7 @@ void CreativeMode::init() // initPlayer(); } -void CreativeMode::enableCreativeForPlayer(shared_ptr player) +void CreativeMode::enableCreativeForPlayer(std::shared_ptr player) { // please check ServerPlayerGameMode.java if you change these player->abilities.mayfly = true; @@ -29,7 +29,7 @@ void CreativeMode::enableCreativeForPlayer(shared_ptr player) player->abilities.invulnerable = true; } -void CreativeMode::disableCreativeForPlayer(shared_ptr player) +void CreativeMode::disableCreativeForPlayer(std::shared_ptr player) { player->abilities.mayfly = false; player->abilities.flying = false; @@ -37,7 +37,7 @@ void CreativeMode::disableCreativeForPlayer(shared_ptr player) player->abilities.invulnerable = false; } -void CreativeMode::adjustPlayer(shared_ptr player) +void CreativeMode::adjustPlayer(std::shared_ptr player) { enableCreativeForPlayer(player); @@ -45,7 +45,7 @@ void CreativeMode::adjustPlayer(shared_ptr player) { if (player->inventory->items[i] == NULL) { - player->inventory->items[i] = shared_ptr( new ItemInstance(User::allowedTiles[i]) ); + player->inventory->items[i] = std::shared_ptr( new ItemInstance(User::allowedTiles[i]) ); } else { @@ -63,7 +63,7 @@ void CreativeMode::creativeDestroyBlock(Minecraft *minecraft, GameMode *gameMode } } -bool CreativeMode::useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly, bool *pbUsedItem) +bool CreativeMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly, bool *pbUsedItem) { int t = level->getTile(x, y, z); if (t > 0) diff --git a/Minecraft.Client/GameState/CreativeMode.h b/Minecraft.Client/GameState/CreativeMode.h index 10b27a53c..9732cfd0f 100644 --- a/Minecraft.Client/GameState/CreativeMode.h +++ b/Minecraft.Client/GameState/CreativeMode.h @@ -9,11 +9,11 @@ private: public: CreativeMode(Minecraft *minecraft); virtual void init(); - static void enableCreativeForPlayer(shared_ptr player); - static void disableCreativeForPlayer(shared_ptr player); - virtual void adjustPlayer(shared_ptr player); + static void enableCreativeForPlayer(std::shared_ptr player); + static void disableCreativeForPlayer(std::shared_ptr player); + virtual void adjustPlayer(std::shared_ptr player); static void creativeDestroyBlock(Minecraft *minecraft, GameMode *gameMode, int x, int y, int z, int face); - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem = NULL); + virtual bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem = NULL); virtual void startDestroyBlock(int x, int y, int z, int face); virtual void continueDestroyBlock(int x, int y, int z, int face); virtual void stopDestroyBlock(); diff --git a/Minecraft.Client/GameState/DemoMode.cpp b/Minecraft.Client/GameState/DemoMode.cpp index 3a48f2d78..390885f6f 100644 --- a/Minecraft.Client/GameState/DemoMode.cpp +++ b/Minecraft.Client/GameState/DemoMode.cpp @@ -95,7 +95,7 @@ bool DemoMode::destroyBlock(int x, int y, int z, int face) return SurvivalMode::destroyBlock(x, y, z, face); } -bool DemoMode::useItem(shared_ptr player, Level *level, shared_ptr item) +bool DemoMode::useItem(std::shared_ptr player, Level *level, std::shared_ptr item) { if (demoHasEnded) { @@ -105,7 +105,7 @@ bool DemoMode::useItem(shared_ptr player, Level *level, shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face) +bool DemoMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face) { if (demoHasEnded) { outputDemoReminder(); @@ -114,7 +114,7 @@ bool DemoMode::useItemOn(shared_ptr player, Level *level, shared_ptr player, shared_ptr entity) +void DemoMode::attack(std::shared_ptr player, std::shared_ptr entity) { if (demoHasEnded) { diff --git a/Minecraft.Client/GameState/DemoMode.h b/Minecraft.Client/GameState/DemoMode.h index 429c9ec3c..9b5f19401 100644 --- a/Minecraft.Client/GameState/DemoMode.h +++ b/Minecraft.Client/GameState/DemoMode.h @@ -21,7 +21,7 @@ public: virtual void startDestroyBlock(int x, int y, int z, int face); virtual void continueDestroyBlock(int x, int y, int z, int face); virtual bool destroyBlock(int x, int y, int z, int face); - virtual bool useItem(shared_ptr player, Level *level, shared_ptr item); - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face); - virtual void attack(shared_ptr player, shared_ptr entity); + virtual bool useItem(std::shared_ptr player, Level *level, std::shared_ptr item); + virtual bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face); + virtual void attack(std::shared_ptr player, std::shared_ptr entity); }; diff --git a/Minecraft.Client/GameState/GameMode.cpp b/Minecraft.Client/GameState/GameMode.cpp index 632618570..96ff861ab 100644 --- a/Minecraft.Client/GameState/GameMode.cpp +++ b/Minecraft.Client/GameState/GameMode.cpp @@ -47,11 +47,11 @@ void GameMode::render(float a) { } -bool GameMode::useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly) +bool GameMode::useItem(std::shared_ptr player, Level *level, std::shared_ptr item, bool bTestUseOnly) { } -void GameMode::initPlayer(shared_ptr player) +void GameMode::initPlayer(std::shared_ptr player) { } @@ -59,11 +59,11 @@ void GameMode::tick() { } -void GameMode::adjustPlayer(shared_ptr player) +void GameMode::adjustPlayer(std::shared_ptr player) { } -//bool GameMode::useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly) +//bool GameMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly) //{ // // 4J-PB - Adding a test only version to allow tooltips to be displayed // int t = level->getTile(x, y, z); @@ -101,27 +101,27 @@ void GameMode::adjustPlayer(shared_ptr player) //} -shared_ptr GameMode::createPlayer(Level *level) +std::shared_ptr GameMode::createPlayer(Level *level) { - return shared_ptr( new LocalPlayer(minecraft, level, minecraft->user, level->dimension->id) ); + return std::shared_ptr( new LocalPlayer(minecraft, level, minecraft->user, level->dimension->id) ); } -bool GameMode::interact(shared_ptr player, shared_ptr entity) +bool GameMode::interact(std::shared_ptr player, std::shared_ptr entity) { return player->interact(entity); } -void GameMode::attack(shared_ptr player, shared_ptr entity) +void GameMode::attack(std::shared_ptr player, std::shared_ptr entity) { player->attack(entity); } -shared_ptr GameMode::handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, shared_ptr player) +std::shared_ptr GameMode::handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, std::shared_ptr player) { return nullptr; } -void GameMode::handleCloseInventory(int containerId, shared_ptr player) +void GameMode::handleCloseInventory(int containerId, std::shared_ptr player) { player->containerMenu->removed(player); delete player->containerMenu; @@ -138,7 +138,7 @@ bool GameMode::isCutScene() return false; } -void GameMode::releaseUsingItem(shared_ptr player) +void GameMode::releaseUsingItem(std::shared_ptr player) { player->releaseUsingItem(); } @@ -163,21 +163,21 @@ bool GameMode::hasFarPickRange() return false; } -void GameMode::handleCreativeModeItemAdd(shared_ptr clicked, int i) +void GameMode::handleCreativeModeItemAdd(std::shared_ptr clicked, int i) { } -void GameMode::handleCreativeModeItemDrop(shared_ptr clicked) +void GameMode::handleCreativeModeItemDrop(std::shared_ptr clicked) { } -bool GameMode::handleCraftItem(int recipe, shared_ptr player) +bool GameMode::handleCraftItem(int recipe, std::shared_ptr player) { return true; } // 4J-PB -void GameMode::handleDebugOptions(unsigned int uiVal, shared_ptr player) +void GameMode::handleDebugOptions(unsigned int uiVal, std::shared_ptr player) { player->SetDebugOptions(uiVal); } diff --git a/Minecraft.Client/GameState/GameMode.h b/Minecraft.Client/GameState/GameMode.h index ab9ec9d12..71559708a 100644 --- a/Minecraft.Client/GameState/GameMode.h +++ b/Minecraft.Client/GameState/GameMode.h @@ -25,32 +25,32 @@ public: virtual void stopDestroyBlock() = 0; virtual void render(float a); virtual float getPickRange() = 0; - virtual void initPlayer(shared_ptr player); + virtual void initPlayer(std::shared_ptr player); virtual void tick(); virtual bool canHurtPlayer() = 0; - virtual void adjustPlayer(shared_ptr player); - virtual bool useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly=false); - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem = NULL) = 0; + virtual void adjustPlayer(std::shared_ptr player); + virtual bool useItem(std::shared_ptr player, Level *level, std::shared_ptr item, bool bTestUseOnly=false); + virtual bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem = NULL) = 0; - virtual shared_ptr createPlayer(Level *level); - virtual bool interact(shared_ptr player, shared_ptr entity); - virtual void attack(shared_ptr player, shared_ptr entity); - virtual shared_ptr handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, shared_ptr player); - virtual void handleCloseInventory(int containerId, shared_ptr player); + virtual std::shared_ptr createPlayer(Level *level); + virtual bool interact(std::shared_ptr player, std::shared_ptr entity); + virtual void attack(std::shared_ptr player, std::shared_ptr entity); + virtual std::shared_ptr handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, std::shared_ptr player); + virtual void handleCloseInventory(int containerId, std::shared_ptr player); virtual void handleInventoryButtonClick(int containerId, int buttonId); virtual bool isCutScene(); - virtual void releaseUsingItem(shared_ptr player); + virtual void releaseUsingItem(std::shared_ptr player); virtual bool hasExperience(); virtual bool hasMissTime(); virtual bool hasInfiniteItems(); virtual bool hasFarPickRange(); - virtual void handleCreativeModeItemAdd(shared_ptr clicked, int i); - virtual void handleCreativeModeItemDrop(shared_ptr clicked); + virtual void handleCreativeModeItemAdd(std::shared_ptr clicked, int i); + virtual void handleCreativeModeItemDrop(std::shared_ptr clicked); // 4J Stu - Added so we can send packets for this in the network game - virtual bool handleCraftItem(int recipe, shared_ptr player); - virtual void handleDebugOptions(unsigned int uiVal, shared_ptr player); + virtual bool handleCraftItem(int recipe, std::shared_ptr player); + virtual void handleDebugOptions(unsigned int uiVal, std::shared_ptr player); // 4J Stu - Added for tutorial checks virtual bool isInputAllowed(int mapping) { return true; } diff --git a/Minecraft.Client/GameState/SurvivalMode.cpp b/Minecraft.Client/GameState/SurvivalMode.cpp index 0b71f4ee8..e797d9905 100644 --- a/Minecraft.Client/GameState/SurvivalMode.cpp +++ b/Minecraft.Client/GameState/SurvivalMode.cpp @@ -45,7 +45,7 @@ SurvivalMode::SurvivalMode(SurvivalMode *copy) : GameMode( copy->minecraft ) destroyDelay = copy->destroyDelay; } -void SurvivalMode::initPlayer(shared_ptr player) +void SurvivalMode::initPlayer(std::shared_ptr player) { player->yRot = -180; } @@ -65,7 +65,7 @@ bool SurvivalMode::destroyBlock(int x, int y, int z, int face) int data = minecraft->level->getData(x, y, z); bool changed = GameMode::destroyBlock(x, y, z, face); - shared_ptr item = minecraft->player->getSelectedItem(); + std::shared_ptr item = minecraft->player->getSelectedItem(); bool couldDestroy = minecraft->player->canDestroy(Tile::tiles[t]); if (item != NULL) { @@ -173,9 +173,9 @@ void SurvivalMode::initLevel(Level *level) GameMode::initLevel(level); } -shared_ptr SurvivalMode::createPlayer(Level *level) +std::shared_ptr SurvivalMode::createPlayer(Level *level) { - shared_ptr player = GameMode::createPlayer(level); + std::shared_ptr player = GameMode::createPlayer(level); // player.inventory.add(new ItemInstance(Item.pickAxe_diamond)); // player.inventory.add(new ItemInstance(Item.hatchet_diamond)); // player.inventory.add(new ItemInstance(Tile.torch, 64)); @@ -191,7 +191,7 @@ void SurvivalMode::tick() //minecraft->soundEngine->playMusicTick(); } -bool SurvivalMode::useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly, bool *pbUsedItem) +bool SurvivalMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly, bool *pbUsedItem) { int t = level->getTile(x, y, z); if (t > 0) diff --git a/Minecraft.Client/GameState/SurvivalMode.h b/Minecraft.Client/GameState/SurvivalMode.h index b4ce5e6dd..643e50d15 100644 --- a/Minecraft.Client/GameState/SurvivalMode.h +++ b/Minecraft.Client/GameState/SurvivalMode.h @@ -15,7 +15,7 @@ private: public: SurvivalMode(Minecraft *minecraft); SurvivalMode(SurvivalMode *copy); - virtual void initPlayer(shared_ptr player); + virtual void initPlayer(std::shared_ptr player); virtual void init(); virtual bool canHurtPlayer(); virtual bool destroyBlock(int x, int y, int z, int face); @@ -25,8 +25,8 @@ public: virtual void render(float a); virtual float getPickRange(); virtual void initLevel(Level *level); - virtual shared_ptr createPlayer(Level *level); + virtual std::shared_ptr createPlayer(Level *level); virtual void tick(); - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem=NULL); + virtual bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem=NULL); virtual bool hasExperience(); }; \ No newline at end of file diff --git a/Minecraft.Client/Level/DemoLevel.cpp b/Minecraft.Client/Level/DemoLevel.cpp index 08cea65f1..adab55825 100644 --- a/Minecraft.Client/Level/DemoLevel.cpp +++ b/Minecraft.Client/Level/DemoLevel.cpp @@ -11,7 +11,7 @@ LevelSettings DemoLevel::DEMO_LEVEL_SETTINGS = LevelSettings( 1.0 ); -DemoLevel::DemoLevel(shared_ptr levelStorage, const wstring& levelName) : Level(levelStorage, levelName, &DEMO_LEVEL_SETTINGS) +DemoLevel::DemoLevel(std::shared_ptr levelStorage, const wstring& levelName) : Level(levelStorage, levelName, &DEMO_LEVEL_SETTINGS) { } diff --git a/Minecraft.Client/Level/DemoLevel.h b/Minecraft.Client/Level/DemoLevel.h index 7f6c89168..7e69ed160 100644 --- a/Minecraft.Client/Level/DemoLevel.h +++ b/Minecraft.Client/Level/DemoLevel.h @@ -10,7 +10,7 @@ private: static const int DEMO_SPAWN_Z = -731; static LevelSettings DEMO_LEVEL_SETTINGS; public: - DemoLevel(shared_ptr levelStorage, const wstring& levelName); + DemoLevel(std::shared_ptr levelStorage, const wstring& levelName); DemoLevel(Level *level, Dimension *dimension); protected: virtual void setInitialSpawn(); diff --git a/Minecraft.Client/Level/DerivedServerLevel.cpp b/Minecraft.Client/Level/DerivedServerLevel.cpp index 407ea6e62..b6f6aabca 100644 --- a/Minecraft.Client/Level/DerivedServerLevel.cpp +++ b/Minecraft.Client/Level/DerivedServerLevel.cpp @@ -3,7 +3,7 @@ #include "../../Minecraft.World/Level/Storage/SavedDataStorage.h" #include "../../Minecraft.World/Level/DerivedLevelData.h" -DerivedServerLevel::DerivedServerLevel(MinecraftServer *server, shared_ptr levelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings, ServerLevel *wrapped) +DerivedServerLevel::DerivedServerLevel(MinecraftServer *server, std::shared_ptr levelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings, ServerLevel *wrapped) : ServerLevel(server, levelStorage, levelName, dimension, levelSettings) { // 4J-PB - we're going to override the savedDataStorage, so we need to delete the current one diff --git a/Minecraft.Client/Level/DerivedServerLevel.h b/Minecraft.Client/Level/DerivedServerLevel.h index 2d49e4fa0..ada362f4b 100644 --- a/Minecraft.Client/Level/DerivedServerLevel.h +++ b/Minecraft.Client/Level/DerivedServerLevel.h @@ -4,7 +4,7 @@ class DerivedServerLevel : public ServerLevel { public: - DerivedServerLevel(MinecraftServer *server, shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings, ServerLevel *wrapped); + DerivedServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings, ServerLevel *wrapped); ~DerivedServerLevel(); protected: diff --git a/Minecraft.Client/Level/MultiPlayerLevel.cpp b/Minecraft.Client/Level/MultiPlayerLevel.cpp index a76558ecf..86e7a5317 100644 --- a/Minecraft.Client/Level/MultiPlayerLevel.cpp +++ b/Minecraft.Client/Level/MultiPlayerLevel.cpp @@ -24,7 +24,7 @@ MultiPlayerLevel::ResetInfo::ResetInfo(int x, int y, int z, int tile, int data) } MultiPlayerLevel::MultiPlayerLevel(ClientConnection *connection, LevelSettings *levelSettings, int dimension, int difficulty) - : Level(shared_ptr(new MockedLevelStorage()), L"MpServer", Dimension::getNew(dimension), levelSettings, false) + : Level(std::shared_ptr(new MockedLevelStorage()), L"MpServer", Dimension::getNew(dimension), levelSettings, false) { minecraft = Minecraft::GetInstance(); @@ -108,7 +108,7 @@ void MultiPlayerLevel::tick() EnterCriticalSection(&m_entitiesCS); for (int i = 0; i < 10 && !reEntries.empty(); i++) { - shared_ptr e = *(reEntries.begin()); + std::shared_ptr e = *(reEntries.begin()); if (find(entities.begin(), entities.end(), e) == entities.end() ) addEntity(e); } @@ -403,7 +403,7 @@ void MultiPlayerLevel::setChunkVisible(int x, int z, bool visible) } -bool MultiPlayerLevel::addEntity(shared_ptr e) +bool MultiPlayerLevel::addEntity(std::shared_ptr e) { bool ok = Level::addEntity(e); forced.insert(e); @@ -416,7 +416,7 @@ bool MultiPlayerLevel::addEntity(shared_ptr e) return ok; } -void MultiPlayerLevel::removeEntity(shared_ptr e) +void MultiPlayerLevel::removeEntity(std::shared_ptr e) { // 4J Stu - Add this remove from the reEntries collection to stop us continually removing and re-adding things, // in particular the MultiPlayerLocalPlayer when they die @@ -430,7 +430,7 @@ void MultiPlayerLevel::removeEntity(shared_ptr e) forced.erase(e); } -void MultiPlayerLevel::entityAdded(shared_ptr e) +void MultiPlayerLevel::entityAdded(std::shared_ptr e) { Level::entityAdded(e); AUTO_VAR(it, reEntries.find(e)); @@ -440,7 +440,7 @@ void MultiPlayerLevel::entityAdded(shared_ptr e) } } -void MultiPlayerLevel::entityRemoved(shared_ptr e) +void MultiPlayerLevel::entityRemoved(std::shared_ptr e) { Level::entityRemoved(e); AUTO_VAR(it, forced.find(e)); @@ -450,9 +450,9 @@ void MultiPlayerLevel::entityRemoved(shared_ptr e) } } -void MultiPlayerLevel::putEntity(int id, shared_ptr e) +void MultiPlayerLevel::putEntity(int id, std::shared_ptr e) { - shared_ptr old = getEntity(id); + std::shared_ptr old = getEntity(id); if (old != NULL) { removeEntity(old); @@ -467,16 +467,16 @@ void MultiPlayerLevel::putEntity(int id, shared_ptr e) entitiesById[id] = e; } -shared_ptr MultiPlayerLevel::getEntity(int id) +std::shared_ptr MultiPlayerLevel::getEntity(int id) { AUTO_VAR(it, entitiesById.find(id)); if( it == entitiesById.end() ) return nullptr; return it->second; } -shared_ptr MultiPlayerLevel::removeEntity(int id) +std::shared_ptr MultiPlayerLevel::removeEntity(int id) { - shared_ptr e; + std::shared_ptr e; AUTO_VAR(it, entitiesById.find(id)); if( it != entitiesById.end() ) { @@ -493,11 +493,11 @@ shared_ptr MultiPlayerLevel::removeEntity(int id) // 4J Added to remove the entities from the forced list // This gets called when a chunk is unloaded, but we only do half an unload to remove entities slightly differently -void MultiPlayerLevel::removeEntities(vector > *list) +void MultiPlayerLevel::removeEntities(vector > *list) { for(AUTO_VAR(it, list->begin()); it < list->end(); ++it) { - shared_ptr e = *it; + std::shared_ptr e = *it; AUTO_VAR(reIt, reEntries.find(e)); if (reIt!=reEntries.end()) @@ -609,7 +609,7 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/) { for(AUTO_VAR(it, connections.begin()); it < connections.end(); ++it ) { - (*it)->sendAndDisconnect( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) ); + (*it)->sendAndDisconnect( std::shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) ); } } else @@ -730,7 +730,7 @@ void MultiPlayerLevel::animateTickDoWork() } -void MultiPlayerLevel::playSound(shared_ptr entity, int iSound, float volume, float pitch) +void MultiPlayerLevel::playSound(std::shared_ptr entity, int iSound, float volume, float pitch) { playLocalSound(entity->x, entity->y - entity->heightOffset, entity->z, iSound, volume, pitch); } @@ -790,7 +790,7 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() AUTO_VAR(endIt, entitiesToRemove.end()); for (AUTO_VAR(it, entitiesToRemove.begin()); it != endIt; it++) { - shared_ptr e = *it; + std::shared_ptr e = *it; int xc = e->xChunk; int zc = e->zChunk; if (e->inChunk && hasChunk(xc, zc)) @@ -809,10 +809,10 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() //for (int i = 0; i < entities.size(); i++) EnterCriticalSection(&m_entitiesCS); - vector >::iterator it = entities.begin(); + vector >::iterator it = entities.begin(); while( it != entities.end() ) { - shared_ptr e = *it;//entities.at(i); + std::shared_ptr e = *it;//entities.at(i); if (e->riding != NULL) { @@ -853,7 +853,7 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection *c, bool sendDisc { if( sendDisconnect ) { - c->sendAndDisconnect( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) ); + c->sendAndDisconnect( std::shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) ); } AUTO_VAR(it, find( connections.begin(), connections.end(), c )); @@ -886,7 +886,7 @@ void MultiPlayerLevel::removeUnusedTileEntitiesInRegion(int x0, int y0, int z0, for (unsigned int i = 0; i < tileEntityList.size();) { bool removed = false; - shared_ptr te = tileEntityList[i]; + std::shared_ptr te = tileEntityList[i]; 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); diff --git a/Minecraft.Client/Level/MultiPlayerLevel.h b/Minecraft.Client/Level/MultiPlayerLevel.h index d2a7beb2e..5d0c8b4a1 100644 --- a/Minecraft.Client/Level/MultiPlayerLevel.h +++ b/Minecraft.Client/Level/MultiPlayerLevel.h @@ -54,21 +54,21 @@ public: void setChunkVisible(int x, int z, bool visible); private: - unordered_map, IntKeyHash2, IntKeyEq> entitiesById; // 4J - was IntHashMap - unordered_set > forced; - unordered_set > reEntries; + unordered_map, IntKeyHash2, IntKeyEq> entitiesById; // 4J - was IntHashMap + unordered_set > forced; + unordered_set > reEntries; public: - virtual bool addEntity(shared_ptr e); - virtual void removeEntity(shared_ptr e); + virtual bool addEntity(std::shared_ptr e); + virtual void removeEntity(std::shared_ptr e); protected: - virtual void entityAdded(shared_ptr e); - virtual void entityRemoved(shared_ptr e); + virtual void entityAdded(std::shared_ptr e); + virtual void entityRemoved(std::shared_ptr e); public: - void putEntity(int id, shared_ptr e); - shared_ptr getEntity(int id); - shared_ptr removeEntity(int id); - virtual void removeEntities(vector > *list); // 4J Added override + void putEntity(int id, std::shared_ptr e); + std::shared_ptr getEntity(int id); + std::shared_ptr removeEntity(int id); + virtual void removeEntities(vector > *list); // 4J Added override virtual bool setDataNoUpdate(int x, int y, int z, int data); virtual bool setTileAndDataNoUpdate(int x, int y, int z, int tile, int data); virtual bool setTileNoUpdate(int x, int y, int z, int tile); @@ -87,7 +87,7 @@ public: public: void removeAllPendingEntityRemovals(); - virtual void playSound(shared_ptr entity, int iSound, float volume, float pitch); + virtual void playSound(std::shared_ptr entity, int iSound, float volume, float pitch); virtual void playLocalSound(double x, double y, double z, int iSound, float volume, float pitch, float fClipSoundDist=16.0f); diff --git a/Minecraft.Client/Level/ServerLevel.cpp b/Minecraft.Client/Level/ServerLevel.cpp index 5a3fa9789..43448d7f0 100644 --- a/Minecraft.Client/Level/ServerLevel.cpp +++ b/Minecraft.Client/Level/ServerLevel.cpp @@ -91,7 +91,7 @@ void ServerLevel::staticCtor() }; -ServerLevel::ServerLevel(MinecraftServer *server, shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings) : Level(levelStorage, levelName, levelSettings, Dimension::getNew(dimension), false) +ServerLevel::ServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings) : Level(levelStorage, levelName, levelSettings, Dimension::getNew(dimension), false) { InitializeCriticalSection(&m_limiterCS); InitializeCriticalSection(&m_tickNextTickCS); @@ -289,7 +289,7 @@ void ServerLevel::updateSleepingPlayerList() m_bAtLeastOnePlayerSleeping = false; AUTO_VAR(itEnd, players.end()); - for (vector >::iterator it = players.begin(); it != itEnd; it++) + for (vector >::iterator it = players.begin(); it != itEnd; it++) { if (!(*it)->isSleeping()) { @@ -310,7 +310,7 @@ void ServerLevel::awakenAllPlayers() m_bAtLeastOnePlayerSleeping = false; AUTO_VAR(itEnd, players.end()); - for (vector >::iterator it = players.begin(); it != itEnd; it++) + for (vector >::iterator it = players.begin(); it != itEnd; it++) { if ((*it)->isSleeping()) { @@ -335,7 +335,7 @@ bool ServerLevel::allPlayersAreSleeping() { // all players are sleeping, but have they slept long enough? AUTO_VAR(itEnd, players.end()); - for (vector >::iterator it = players.begin(); it != itEnd; it++ ) + for (vector >::iterator it = players.begin(); it != itEnd; it++ ) { // System.out.println(player->entityId + ": " + player->getSleepTimer()); if (! (*it)->isSleepingLongEnough()) @@ -467,7 +467,7 @@ void ServerLevel::tickTiles() if (isRainingAt(x, y, z)) { - addGlobalEntity( shared_ptr( new LightningBolt(this, x, y, z) ) ); + addGlobalEntity( std::shared_ptr( new LightningBolt(this, x, y, z) ) ); lightningTime = 2; } } @@ -665,7 +665,7 @@ vector *ServerLevel::fetchTicksInChunk(LevelChunk *chunk, bool return results; } -void ServerLevel::tick(shared_ptr e, bool actual) +void ServerLevel::tick(std::shared_ptr e, bool actual) { if (!server->isAnimals() && ((e->GetType() & eTYPE_ANIMAL) || (e->GetType() & eTYPE_WATERANIMAL))) { @@ -681,7 +681,7 @@ void ServerLevel::tick(shared_ptr e, bool actual) } } -void ServerLevel::forceTick(shared_ptr e, bool actual) +void ServerLevel::forceTick(std::shared_ptr e, bool actual) { Level::tick(e, actual); } @@ -693,12 +693,12 @@ ChunkSource *ServerLevel::createChunkSource() return cache; } -vector > *ServerLevel::getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1) +vector > *ServerLevel::getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1) { - vector > *result = new vector >; + vector > *result = new vector >; for (unsigned int i = 0; i < tileEntityList.size(); i++) { - shared_ptr te = tileEntityList[i]; + std::shared_ptr te = tileEntityList[i]; if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1) { result->push_back(te); @@ -707,7 +707,7 @@ vector > *ServerLevel::getTileEntitiesInRegion(int x0, in return result; } -bool ServerLevel::mayInteract(shared_ptr player, int xt, int yt, int zt, int content) +bool ServerLevel::mayInteract(std::shared_ptr player, int xt, int yt, int zt, int content) { // 4J-PB - This will look like a bug to players, and we really should have a message to explain why we're not allowing lava to be placed at or near a spawn point // We'll need to do this in a future update @@ -814,7 +814,7 @@ void ServerLevel::generateBonusItemsNearSpawn() if( getTile( x, y, z ) == Tile::chest_Id ) { - shared_ptr chest = dynamic_pointer_cast(getTileEntity(x, y, z)); + std::shared_ptr chest = dynamic_pointer_cast(getTileEntity(x, y, z)); if (chest != NULL) { if( chest->isBonusChest ) @@ -948,11 +948,11 @@ void ServerLevel::saveLevelData() savedDataStorage->save(); } -void ServerLevel::entityAdded(shared_ptr e) +void ServerLevel::entityAdded(std::shared_ptr e) { Level::entityAdded(e); entitiesById[e->entityId] = e; - vector > *es = e->getSubEntities(); + vector > *es = e->getSubEntities(); if (es != NULL) { //for (int i = 0; i < es.length; i++) @@ -964,11 +964,11 @@ void ServerLevel::entityAdded(shared_ptr e) entityAddedExtra(e); // 4J added } -void ServerLevel::entityRemoved(shared_ptr e) +void ServerLevel::entityRemoved(std::shared_ptr e) { Level::entityRemoved(e); entitiesById.erase(e->entityId); - vector > *es = e->getSubEntities(); + vector > *es = e->getSubEntities(); if (es != NULL) { //for (int i = 0; i < es.length; i++) @@ -980,32 +980,32 @@ void ServerLevel::entityRemoved(shared_ptr e) entityRemovedExtra(e); // 4J added } -shared_ptr ServerLevel::getEntity(int id) +std::shared_ptr ServerLevel::getEntity(int id) { return entitiesById[id]; } -bool ServerLevel::addGlobalEntity(shared_ptr e) +bool ServerLevel::addGlobalEntity(std::shared_ptr e) { if (Level::addGlobalEntity(e)) { - server->getPlayers()->broadcast(e->x, e->y, e->z, 512, dimension->id, shared_ptr( new AddGlobalEntityPacket(e) ) ); + server->getPlayers()->broadcast(e->x, e->y, e->z, 512, dimension->id, std::shared_ptr( new AddGlobalEntityPacket(e) ) ); return true; } return false; } -void ServerLevel::broadcastEntityEvent(shared_ptr e, uint8_t event) +void ServerLevel::broadcastEntityEvent(std::shared_ptr e, uint8_t event) { - shared_ptr p = shared_ptr( new EntityEventPacket(e->entityId, event) ); + std::shared_ptr p = std::shared_ptr( new EntityEventPacket(e->entityId, event) ); server->getLevel(dimension->id)->getTracker()->broadcastAndSend(e, p); } -shared_ptr ServerLevel::explode(shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks) +std::shared_ptr ServerLevel::explode(std::shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks) { // instead of calling super, we run the same explosion code here except // we don't generate any particles - shared_ptr explosion = shared_ptr( new Explosion(this, source, x, y, z, r) ); + std::shared_ptr explosion = std::shared_ptr( new Explosion(this, source, x, y, z, r) ); explosion->fire = fire; explosion->destroyBlocks = destroyBlocks; explosion->explode(); @@ -1016,10 +1016,10 @@ shared_ptr ServerLevel::explode(shared_ptr source, double x, explosion->toBlow.clear(); } - vector > sentTo; + vector > sentTo; for(AUTO_VAR(it, players.begin()); it != players.end(); ++it) { - shared_ptr player = dynamic_pointer_cast(*it); + std::shared_ptr player = dynamic_pointer_cast(*it); if (player->dimension != dimension->id) continue; bool knockbackOnly = false; @@ -1034,7 +1034,7 @@ shared_ptr ServerLevel::explode(shared_ptr source, double x, { for(unsigned int j = 0; j < sentTo.size(); j++ ) { - shared_ptr player2 = sentTo[j]; + std::shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { @@ -1049,7 +1049,7 @@ shared_ptr ServerLevel::explode(shared_ptr source, double x, Vec3 *knockbackVec = explosion->getHitPlayerKnockback(player); //app.DebugPrintf("Sending %s with knockback (%f,%f,%f)\n", knockbackOnly?"knockbackOnly":"allExplosion",knockbackVec->x,knockbackVec->y,knockbackVec->z); // If the player is not the primary on the system, then we only want to send info for the knockback - player->connection->send( shared_ptr( new ExplodePacket(x, y, z, r, &explosion->toBlow, knockbackVec, knockbackOnly))); + player->connection->send( std::shared_ptr( new ExplodePacket(x, y, z, r, &explosion->toBlow, knockbackVec, knockbackOnly))); sentTo.push_back( player ); } } @@ -1088,7 +1088,7 @@ void ServerLevel::runTileEvents() if (doTileEvent(&(*it))) { TileEventData te = *it; - server->getPlayers()->broadcast(te.getX(), te.getY(), te.getZ(), 64, dimension->id, shared_ptr( new TileEventPacket(te.getX(), te.getY(), te.getZ(), te.getTile(), te.getParamA(), te.getParamB()))); + server->getPlayers()->broadcast(te.getX(), te.getY(), te.getZ(), 64, dimension->id, std::shared_ptr( new TileEventPacket(te.getX(), te.getY(), te.getZ(), te.getTile(), te.getParamA(), te.getParamB()))); } } tileEvents[runList].clear(); @@ -1119,11 +1119,11 @@ void ServerLevel::tickWeather() { if (wasRaining) { - server->getPlayers()->broadcastAll( shared_ptr( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) ); } else { - server->getPlayers()->broadcastAll( shared_ptr( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) ); } } @@ -1185,7 +1185,7 @@ void ServerLevel::runQueuedSendTileUpdates() } // 4J - added special versions of addEntity and extra processing on entity removed and added so we can limit the number of itementities created -bool ServerLevel::addEntity(shared_ptr e) +bool ServerLevel::addEntity(std::shared_ptr e) { // If its an item entity, and we've got to our capacity, delete the oldest if( dynamic_pointer_cast(e) != NULL ) @@ -1244,7 +1244,7 @@ bool ServerLevel::addEntity(shared_ptr e) } // Maintain a cound of primed tnt & falling tiles in this level -void ServerLevel::entityAddedExtra(shared_ptr e) +void ServerLevel::entityAddedExtra(std::shared_ptr e) { if( dynamic_pointer_cast(e) != NULL ) { @@ -1289,7 +1289,7 @@ void ServerLevel::entityAddedExtra(shared_ptr e) } // Maintain a cound of primed tnt & falling tiles in this level, and remove any item entities from our list -void ServerLevel::entityRemovedExtra(shared_ptr e) +void ServerLevel::entityRemovedExtra(std::shared_ptr e) { if( dynamic_pointer_cast(e) != NULL ) { diff --git a/Minecraft.Client/Level/ServerLevel.h b/Minecraft.Client/Level/ServerLevel.h index 6e2a90b3c..81ca5f475 100644 --- a/Minecraft.Client/Level/ServerLevel.h +++ b/Minecraft.Client/Level/ServerLevel.h @@ -41,7 +41,7 @@ private: int activeTileEventsList; public: static void staticCtor(); - ServerLevel(MinecraftServer *server, shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings); + ServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings); ~ServerLevel(); void tick(); Biome::MobSpawnerData *getRandomMobSpawnAt(MobCategory *mobCategory, int x, int y, int z); @@ -65,15 +65,15 @@ public: void tickEntities(); bool tickPendingTicks(bool force); vector *fetchTicksInChunk(LevelChunk *chunk, bool remove); - virtual void tick(shared_ptr e, bool actual); - void forceTick(shared_ptr e, bool actual); + virtual void tick(std::shared_ptr e, bool actual); + void forceTick(std::shared_ptr e, bool actual); bool AllPlayersAreSleeping() { return allPlayersSleeping;} // 4J added for a message to other players bool isAtLeastOnePlayerSleeping() { return m_bAtLeastOnePlayerSleeping;} protected: ChunkSource *createChunkSource(); // 4J - was virtual, but was called from parent ctor public: - vector > *getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1); - virtual bool mayInteract(shared_ptr player, int xt, int yt, int zt, int id); + vector > *getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1); + virtual bool mayInteract(std::shared_ptr player, int xt, int yt, int zt, int id); protected: virtual void initializeLevel(LevelSettings *settings); virtual void setInitialSpawn(LevelSettings *settings); @@ -90,16 +90,16 @@ public: private: void saveLevelData(); - typedef unordered_map , IntKeyHash2, IntKeyEq> intEntityMap; + typedef unordered_map , IntKeyHash2, IntKeyEq> intEntityMap; intEntityMap entitiesById; // 4J - was IntHashMap, using same hashing function as this uses protected: - virtual void entityAdded(shared_ptr e); - virtual void entityRemoved(shared_ptr e); + virtual void entityAdded(std::shared_ptr e); + virtual void entityRemoved(std::shared_ptr e); public: - shared_ptr getEntity(int id); - virtual bool addGlobalEntity(shared_ptr e); - void broadcastEntityEvent(shared_ptr e, uint8_t event); - virtual shared_ptr explode(shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks); + std::shared_ptr getEntity(int id); + virtual bool addGlobalEntity(std::shared_ptr e); + void broadcastEntityEvent(std::shared_ptr e, uint8_t event); + virtual std::shared_ptr explode(std::shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks); virtual void tileEvent(int x, int y, int z, int tile, int b0, int b1); private: @@ -134,14 +134,14 @@ public: int m_primedTntCount; int m_fallingTileCount; CRITICAL_SECTION m_limiterCS; - list< shared_ptr > m_itemEntities; - list< shared_ptr > m_hangingEntities; - list< shared_ptr > m_arrowEntities; - list< shared_ptr > m_experienceOrbEntities; + list< std::shared_ptr > m_itemEntities; + list< std::shared_ptr > m_hangingEntities; + list< std::shared_ptr > m_arrowEntities; + list< std::shared_ptr > m_experienceOrbEntities; - virtual bool addEntity(shared_ptr e); - void entityAddedExtra(shared_ptr e); - void entityRemovedExtra(shared_ptr e); + virtual bool addEntity(std::shared_ptr e); + void entityAddedExtra(std::shared_ptr e); + void entityRemovedExtra(std::shared_ptr e); virtual bool newPrimedTntAllowed(); virtual bool newFallingTileAllowed(); diff --git a/Minecraft.Client/Level/ServerLevelListener.cpp b/Minecraft.Client/Level/ServerLevelListener.cpp index f77563271..8201f05ff 100644 --- a/Minecraft.Client/Level/ServerLevelListener.cpp +++ b/Minecraft.Client/Level/ServerLevelListener.cpp @@ -33,22 +33,22 @@ void ServerLevelListener::allChanged() { } -void ServerLevelListener::entityAdded(shared_ptr entity) +void ServerLevelListener::entityAdded(std::shared_ptr entity) { MemSect(10); level->getTracker()->addEntity(entity); MemSect(0); } -void ServerLevelListener::entityRemoved(shared_ptr entity) +void ServerLevelListener::entityRemoved(std::shared_ptr entity) { level->getTracker()->removeEntity(entity); } // 4J added -void ServerLevelListener::playerRemoved(shared_ptr entity) +void ServerLevelListener::playerRemoved(std::shared_ptr entity) { - shared_ptr player = dynamic_pointer_cast(entity); + std::shared_ptr player = dynamic_pointer_cast(entity); player->getLevel()->getTracker()->removePlayer(entity); } @@ -62,11 +62,11 @@ void ServerLevelListener::playSound(int iSound, double x, double y, double z, fl { // 4J-PB - I don't want to broadcast player sounds to my local machine, since we're already playing these in the LevelRenderer::playSound. // The PC version does seem to do this and the result is I can stop walking , and then I'll hear my footstep sound with a delay - server->getPlayers()->broadcast(x, y, z, volume > 1 ? 16 * volume : 16, level->dimension->id, shared_ptr(new LevelSoundPacket(iSound, x, y, z, volume, pitch))); + server->getPlayers()->broadcast(x, y, z, volume > 1 ? 16 * volume : 16, level->dimension->id, std::shared_ptr(new LevelSoundPacket(iSound, x, y, z, volume, pitch))); } } -void ServerLevelListener::playSound(shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fClipSoundDist) +void ServerLevelListener::playSound(std::shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fClipSoundDist) { if(iSound < 0) { @@ -76,8 +76,8 @@ void ServerLevelListener::playSound(shared_ptr entity,int iSound, double { // 4J-PB - I don't want to broadcast player sounds to my local machine, since we're already playing these in the LevelRenderer::playSound. // The PC version does seem to do this and the result is I can stop walking , and then I'll hear my footstep sound with a delay - shared_ptr player= dynamic_pointer_cast(entity); - server->getPlayers()->broadcast(player,x, y, z, volume > 1 ? 16 * volume : 16, level->dimension->id, shared_ptr(new LevelSoundPacket(iSound, x, y, z, volume, pitch))); + std::shared_ptr player= dynamic_pointer_cast(entity); + server->getPlayers()->broadcast(player,x, y, z, volume > 1 ? 16 * volume : 16, level->dimension->id, std::shared_ptr(new LevelSoundPacket(iSound, x, y, z, volume, pitch))); } } @@ -102,9 +102,9 @@ void ServerLevelListener::playStreamingMusic(const wstring& name, int x, int y, { } -void ServerLevelListener::levelEvent(shared_ptr source, int type, int x, int y, int z, int data) +void ServerLevelListener::levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data) { - server->getPlayers()->broadcast(source, x, y, z, 64, level->dimension->id, shared_ptr( new LevelEventPacket(type, x, y, z, data) ) ); + server->getPlayers()->broadcast(source, x, y, z, 64, level->dimension->id, std::shared_ptr( new LevelEventPacket(type, x, y, z, data) ) ); } void ServerLevelListener::destroyTileProgress(int id, int x, int y, int z, int progress) @@ -112,7 +112,7 @@ void ServerLevelListener::destroyTileProgress(int id, int x, int y, int z, int p //for (ServerPlayer p : server->getPlayers()->players) for(AUTO_VAR(it, server->getPlayers()->players.begin()); it != server->getPlayers()->players.end(); ++it) { - shared_ptr p = *it; + std::shared_ptr p = *it; if (p == NULL || p->level != level || p->entityId == id) continue; double xd = (double) x - p->x; double yd = (double) y - p->y; @@ -120,7 +120,7 @@ void ServerLevelListener::destroyTileProgress(int id, int x, int y, int z, int p if (xd * xd + yd * yd + zd * zd < 32 * 32) { - p->connection->send(shared_ptr(new TileDestructionPacket(id, x, y, z, progress))); + p->connection->send(std::shared_ptr(new TileDestructionPacket(id, x, y, z, progress))); } } } \ No newline at end of file diff --git a/Minecraft.Client/Level/ServerLevelListener.h b/Minecraft.Client/Level/ServerLevelListener.h index 3af0a977e..339b30e71 100644 --- a/Minecraft.Client/Level/ServerLevelListener.h +++ b/Minecraft.Client/Level/ServerLevelListener.h @@ -18,16 +18,16 @@ public: // 4J removed - virtual void addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za); virtual void addParticle(ePARTICLE_TYPE name, double x, double y, double z, double xa, double ya, double za); // 4J added virtual void allChanged(); - virtual void entityAdded(shared_ptr entity); - virtual void entityRemoved(shared_ptr entity); - virtual void playerRemoved(shared_ptr entity); // 4J added - for when a player is removed from the level's player array, not just the entity storage + virtual void entityAdded(std::shared_ptr entity); + virtual void entityRemoved(std::shared_ptr entity); + virtual void playerRemoved(std::shared_ptr entity); // 4J added - for when a player is removed from the level's player array, not just the entity storage virtual void playSound(int iSound, double x, double y, double z, float volume, float pitch, float fClipSoundDist); - virtual void playSound(shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fClipSoundDist); + virtual void playSound(std::shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fClipSoundDist); virtual void setTilesDirty(int x0, int y0, int z0, int x1, int y1, int z1, Level *level); // 4J - added level param virtual void skyColorChanged(); virtual void tileChanged(int x, int y, int z); virtual void tileLightChanged(int x, int y, int z); virtual void playStreamingMusic(const wstring& name, int x, int y, int z); - virtual void levelEvent(shared_ptr source, int type, int x, int y, int z, int data); + virtual void levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data); virtual void destroyTileProgress(int id, int x, int y, int z, int progress); }; diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 4956e35e5..5b1f6f59a 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -977,7 +977,7 @@ bool Minecraft::addLocalPlayer(int idx) if(success) { app.DebugPrintf("Adding temp local player on pad %d\n", idx); - localplayers[idx] = shared_ptr( new MultiplayerLocalPlayer(this, level, user, NULL ) ); + localplayers[idx] = std::shared_ptr( new MultiplayerLocalPlayer(this, level, user, NULL ) ); localgameModes[idx] = NULL; updatePlayerViewportAssignments(); @@ -1025,7 +1025,7 @@ void Minecraft::addPendingLocalConnection(int idx, ClientConnection *connection) m_pendingLocalConnections[idx] = connection; } -shared_ptr Minecraft::createExtraLocalPlayer(int idx, const wstring& name, int iPad, int iDimension, ClientConnection *clientConnection /*= NULL*/,MultiPlayerLevel *levelpassedin) +std::shared_ptr Minecraft::createExtraLocalPlayer(int idx, const wstring& name, int iPad, int iDimension, ClientConnection *clientConnection /*= NULL*/,MultiPlayerLevel *levelpassedin) { if( clientConnection == NULL) return nullptr; @@ -1141,7 +1141,7 @@ void Minecraft::removeLocalPlayerIdx(int idx) { if( getLevel( localplayers[idx]->dimension )->isClientSide ) { - shared_ptr mplp = localplayers[idx]; + std::shared_ptr mplp = localplayers[idx]; ( (MultiPlayerLevel *)getLevel( localplayers[idx]->dimension ) )->removeClientConnection(mplp->connection, true); delete mplp->connection; mplp->connection = NULL; @@ -1163,7 +1163,7 @@ void Minecraft::removeLocalPlayerIdx(int idx) } else if( m_pendingLocalConnections[idx] != NULL ) { - m_pendingLocalConnections[idx]->sendAndDisconnect( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );; + m_pendingLocalConnections[idx]->sendAndDisconnect( std::shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );; delete m_pendingLocalConnections[idx]; m_pendingLocalConnections[idx] = NULL; g_NetworkManager.RemoveLocalPlayerByUserIndex(idx); @@ -1584,7 +1584,7 @@ void Minecraft::run_middle() else { // create the localplayer - shared_ptr player = localplayers[i]; + std::shared_ptr player = localplayers[i]; if( player == NULL) { player = createExtraLocalPlayer(i, (convStringToWstring( ProfileManager.GetGamertag(i) )).c_str(), i, level->dimension->id); @@ -1800,7 +1800,7 @@ void Minecraft::run_middle() // if (pause) timer.a = 1; PIXBeginNamedEvent(0,"Sound engine update"); - soundEngine->tick((shared_ptr *)localplayers, timer->a); + soundEngine->tick((std::shared_ptr *)localplayers, timer->a); PIXEndNamedEvent(); PIXBeginNamedEvent(0,"Light update"); @@ -2345,7 +2345,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) else { // no hit result, but we may have something in our hand that we can do something with - shared_ptr itemInstance = player->inventory->getSelected(); + std::shared_ptr itemInstance = player->inventory->getSelected(); // 4J-JEV: Moved all this here to avoid having it in 3 different places. if (itemInstance) @@ -2716,14 +2716,14 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // is there an object in hand? if(player->inventory->IsHeldItem()) { - shared_ptr heldItem=player->inventory->getSelected(); + std::shared_ptr heldItem=player->inventory->getSelected(); int iID=heldItem->getItem()->id; switch(iID) { default: { - shared_ptr animal = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr animal = dynamic_pointer_cast(hitResult->entity); if(!animal->isBaby() && !animal->isInLove() && (animal->getAge() == 0) && animal->isFood(heldItem)) { @@ -2740,7 +2740,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // is there an object in hand? if(player->inventory->IsHeldItem()) { - shared_ptr heldItem=player->inventory->getSelected(); + std::shared_ptr heldItem=player->inventory->getSelected(); int iID=heldItem->getItem()->id; // It's an item @@ -2752,7 +2752,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; default: { - shared_ptr animal = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr animal = dynamic_pointer_cast(hitResult->entity); if(!animal->isBaby() && !animal->isInLove() && (animal->getAge() == 0) && animal->isFood(heldItem)) { @@ -2769,7 +2769,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; - shared_ptr heldItem=player->inventory->getSelected(); + std::shared_ptr heldItem=player->inventory->getSelected(); int iID=heldItem->getItem()->id; // It's an item @@ -2783,13 +2783,13 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case Item::shears_Id: { if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; - shared_ptr animal = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr animal = dynamic_pointer_cast(hitResult->entity); if(!animal->isBaby()) *piUse=IDS_TOOLTIPS_SHEAR; } break; default: { - shared_ptr animal = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr animal = dynamic_pointer_cast(hitResult->entity); if(!animal->isBaby() && !animal->isInLove() && (animal->getAge() == 0) && animal->isFood(heldItem)) { @@ -2842,7 +2842,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // is there an object in hand? if(player->inventory->IsHeldItem()) { - shared_ptr heldItem=player->inventory->getSelected(); + std::shared_ptr heldItem=player->inventory->getSelected(); int iID=heldItem->getItem()->id; if(iID==Item::coal->id) @@ -2864,14 +2864,14 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; if(player->inventory->IsHeldItem()) { - shared_ptr heldItem=player->inventory->getSelected(); + std::shared_ptr heldItem=player->inventory->getSelected(); int iID=heldItem->getItem()->id; switch(iID) { case Item::dye_powder_Id: { - shared_ptr sheep = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr sheep = dynamic_pointer_cast(hitResult->entity); // convert to tile-based color value (0 is white instead of black) int newColor = ClothTile::getTileDataForItemAuxValue(heldItem->getAuxValue()); @@ -2884,7 +2884,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; case Item::shears_Id: { - shared_ptr sheep = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr sheep = dynamic_pointer_cast(hitResult->entity); // can only shear a sheep that hasn't been sheared if(!sheep->isSheared() ) @@ -2896,7 +2896,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; default: { - shared_ptr animal = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr animal = dynamic_pointer_cast(hitResult->entity); if(!animal->isBaby() && !animal->isInLove() && (animal->getAge() == 0) && animal->isFood(heldItem)) { @@ -2926,7 +2926,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if(player->inventory->IsHeldItem()) { - shared_ptr heldItem=player->inventory->getSelected(); + std::shared_ptr heldItem=player->inventory->getSelected(); int iID=heldItem->getItem()->id; switch(iID) @@ -2936,7 +2936,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; default: { - shared_ptr animal = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr animal = dynamic_pointer_cast(hitResult->entity); if(!animal->isBaby() && !animal->isInLove() && (animal->getAge() == 0) && animal->isFood(heldItem)) { @@ -2954,8 +2954,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // can be tamed, fed, and made to sit/stand, or enter love mode { int iID=-1; - shared_ptr heldItem=nullptr; - shared_ptr wolf = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr heldItem=nullptr; + std::shared_ptr wolf = dynamic_pointer_cast(hitResult->entity); if(player->inventory->IsHeldItem()) { @@ -3044,8 +3044,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case eTYPE_OZELOT: { int iID=-1; - shared_ptr heldItem=nullptr; - shared_ptr ocelot = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr heldItem=nullptr; + std::shared_ptr ocelot = dynamic_pointer_cast(hitResult->entity); if(player->inventory->IsHeldItem()) { @@ -3106,7 +3106,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case eTYPE_PLAYER: { // Fix for #58576 - TU6: Content: Gameplay: Hit button prompt is available when attacking a host who has "Invisible" option turned on - shared_ptr TargetPlayer = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr TargetPlayer = dynamic_pointer_cast(hitResult->entity); if(!TargetPlayer->hasInvisiblePrivilege()) // This means they are invisible, not just that they have the privilege { @@ -3119,7 +3119,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; case eTYPE_ITEM_FRAME: { - shared_ptr itemFrame = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr itemFrame = dynamic_pointer_cast(hitResult->entity); // is the frame occupied? if(itemFrame->getItem()!=NULL) @@ -3141,7 +3141,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; case eTYPE_VILLAGER: { - shared_ptr villager = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr villager = dynamic_pointer_cast(hitResult->entity); if (!villager->isBaby()) { *piUse=IDS_TOOLTIPS_TRADE; @@ -3151,8 +3151,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; case eTYPE_ZOMBIE: { - shared_ptr zomb = dynamic_pointer_cast(hitResult->entity); - shared_ptr heldItem=nullptr; + std::shared_ptr zomb = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr heldItem=nullptr; if(player->inventory->IsHeldItem()) { @@ -3337,9 +3337,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) if((player->ullButtonsPressed&(1LL< mob = dynamic_pointer_cast(Creeper::_class->newInstance( level )); - //shared_ptr mob = dynamic_pointer_cast(Wolf::_class->newInstance( level )); - shared_ptr mob = dynamic_pointer_cast(shared_ptr(new Spider( level ))); + //std::shared_ptr mob = dynamic_pointer_cast(Creeper::_class->newInstance( level )); + //std::shared_ptr mob = dynamic_pointer_cast(Wolf::_class->newInstance( level )); + std::shared_ptr mob = dynamic_pointer_cast(std::shared_ptr(new Spider( level ))); mob->moveTo(player->x+1, player->y, player->z+1, level->random->nextFloat() * 360, 0); level->addEntity(mob); } @@ -3369,14 +3369,14 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) if((player->ullButtonsPressed&(1LL<isInputAllowed(MINECRAFT_ACTION_INVENTORY)) { - shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->player ); + std::shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->player ); ui.PlayUISFX(eSFX_Press); app.LoadInventoryMenu(iPad,player); } if((player->ullButtonsPressed&(1LL<isInputAllowed(MINECRAFT_ACTION_CRAFTING)) { - shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->player ); + std::shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->player ); // 4J-PB - reordered the if statement so creative mode doesn't bring up the crafting table // Fix for #39014 - TU5: Creative Mode: Pressing X to access the creative menu while looking at a crafting table causes the crafting menu to display @@ -3440,7 +3440,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) if( selected || wheel != 0 || (player->ullButtonsPressed&(1LL< selectedItem = player->getSelectedItem(); + std::shared_ptr selectedItem = player->getSelectedItem(); // 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; @@ -3708,7 +3708,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) setLocalPlayerIdx(idx); gameRenderer->setupCamera(timer->a, i); Camera::prepare(localplayers[idx], localplayers[idx]->ThirdPersonView() == 2); - shared_ptr cameraEntity = cameraTargetPlayer; + std::shared_ptr cameraEntity = cameraTargetPlayer; double xOff = cameraEntity->xOld + (cameraEntity->x - cameraEntity->xOld) * timer->a; double yOff = cameraEntity->yOld + (cameraEntity->y - cameraEntity->yOld) * timer->a; double zOff = cameraEntity->zOld + (cameraEntity->z - cameraEntity->zOld) * timer->a; @@ -3834,7 +3834,7 @@ MultiPlayerLevel *Minecraft::getLevel(int dimension) //} // Also causing ambiguous call for some reason -// as it is matching shared_ptr from the func below with bool from this one +// as it is matching std::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); @@ -3848,7 +3848,7 @@ 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*/, std::shared_ptr forceInsertPlayer /*=NULL*/, bool doForceStatsSave /*=true*/, bool bPrimaryPlayerSignedOut /*=false*/) { EnterCriticalSection(&m_setLevelCS); bool playerAdded = false; @@ -3913,7 +3913,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt // Delete all the player objects for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - shared_ptr mplp = localplayers[idx]; + std::shared_ptr mplp = localplayers[idx]; if(mplp != NULL && mplp->connection != NULL ) { delete mplp->connection; @@ -4160,7 +4160,7 @@ wstring Minecraft::gatherStats4() void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) { gameRenderer->DisableUpdateThread(); // 4J - don't do updating whilst we are adjusting the player & localplayer array - shared_ptr localPlayer = localplayers[iPad]; + std::shared_ptr localPlayer = localplayers[iPad]; level->validateSpawn(); level->removeAllPendingEntityRemovals(); @@ -4171,7 +4171,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) level->removeEntity(localPlayer); } - shared_ptr oldPlayer = localPlayer; + std::shared_ptr oldPlayer = localPlayer; cameraTargetPlayer = nullptr; // 4J-PB - copy and set the players xbox pad @@ -4559,7 +4559,7 @@ bool mayUse = true; if(button==1 && (player->isSleeping() && level != NULL && level->isClientSide)) { -shared_ptr mplp = dynamic_pointer_cast( player ); +std::shared_ptr mplp = dynamic_pointer_cast( player ); if(mplp) mplp->StopSleeping(); @@ -4608,7 +4608,7 @@ gameMode->startDestroyBlock(x, y, z, hitResult->f); } else { -shared_ptr item = player->inventory->getSelected(); +std::shared_ptr item = player->inventory->getSelected(); int oldCount = item != NULL ? item->count : 0; if (gameMode->useItemOn(player, level, item, x, y, z, face)) { @@ -4634,7 +4634,7 @@ gameRenderer->itemInHandRenderer->itemPlaced(); if (mayUse && button == 1) { -shared_ptr item = player->inventory->getSelected(); +std::shared_ptr item = player->inventory->getSelected(); if (item != NULL) { if (gameMode->useItem(player, level, item)) @@ -4721,7 +4721,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP else if( ProfileManager.IsSignedInLive(iPad) && ProfileManager.AllowedToPlayMultiplayer(iPad) ) { // create the local player for the iPad - shared_ptr player = pClass->localplayers[iPad]; + std::shared_ptr player = pClass->localplayers[iPad]; if( player == NULL) { if( pClass->level->isClientSide ) @@ -4731,7 +4731,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP else { // create the local player for the iPad - shared_ptr player = pClass->localplayers[iPad]; + std::shared_ptr player = pClass->localplayers[iPad]; if( player == NULL) { player = pClass->createExtraLocalPlayer(iPad, (convStringToWstring( ProfileManager.GetGamertag(iPad) )).c_str(), iPad, pClass->level->dimension->id); @@ -4802,7 +4802,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad) else { // create the local player for the iPad - shared_ptr player = pMinecraftClass->localplayers[iPad]; + std::shared_ptr player = pMinecraftClass->localplayers[iPad]; if( player == NULL) { player = pMinecraftClass->createExtraLocalPlayer(iPad, (convStringToWstring( ProfileManager.GetGamertag(iPad) )).c_str(), iPad, pMinecraftClass->level->dimension->id); @@ -4831,7 +4831,7 @@ void Minecraft::tickAllConnections() int oldIdx = getLocalPlayerIdx(); for(unsigned int i = 0; i < XUSER_MAX_COUNT; i++ ) { - shared_ptr mplp = localplayers[i]; + std::shared_ptr mplp = localplayers[i]; if( mplp && mplp->connection) { setLocalPlayerIdx(i); diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index b4b7835e2..ea0a6e456 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -94,11 +94,11 @@ public: MultiPlayerLevel *level; LevelRenderer *levelRenderer; - shared_ptr player; + std::shared_ptr player; MultiPlayerLevelArray levels; - shared_ptr localplayers[XUSER_MAX_COUNT]; + std::shared_ptr localplayers[XUSER_MAX_COUNT]; MultiPlayerGameMode *localgameModes[XUSER_MAX_COUNT]; int localPlayerIdx; ItemInHandRenderer *localitemInHandRenderers[XUSER_MAX_COUNT]; @@ -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); + std::shared_ptr createExtraLocalPlayer(int idx, const wstring& name, int pad, int iDimension, ClientConnection *clientConnection = NULL,MultiPlayerLevel *levelpassedin=NULL); void createPrimaryLocalPlayer(int iPad); bool setLocalPlayerIdx(int idx); int getLocalPlayerIdx(); @@ -123,7 +123,7 @@ public: void updatePlayerViewportAssignments(); int unoccupiedQuadrant; // 4J - added - shared_ptr cameraTargetPlayer; + std::shared_ptr cameraTargetPlayer; ParticleEngine *particleEngine; User *user; wstring serverDomain; @@ -277,7 +277,7 @@ public: // 4J Stu - Added the doForceStatsSave param //void setLevel(Level *level, bool doForceStatsSave = true); //void setLevel(Level *level, const wstring& message, bool doForceStatsSave = true); - void setLevel(MultiPlayerLevel *level, int message = -1, shared_ptr forceInsertPlayer = nullptr, bool doForceStatsSave = true,bool bPrimaryPlayerSignedOut=false); + void setLevel(MultiPlayerLevel *level, int message = -1, std::shared_ptr forceInsertPlayer = nullptr, bool doForceStatsSave = true,bool bPrimaryPlayerSignedOut=false); // 4J-PB - added to force in the 'other' level when the main player creates the level at game load time void forceaddLevel(MultiPlayerLevel *level); void prepareLevel(int title); // 4J - changed to public diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index d63fb7933..06a3151a7 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -398,7 +398,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring if( app.GetGameHostOption(eGameHostOption_BonusChest ) ) levelSettings->enableStartingBonusItems(); // 4J - temp - load existing level - shared_ptr storage = nullptr; + std::shared_ptr storage = nullptr; bool levelChunksNeedConverted = false; if( initData->saveData != NULL ) { @@ -416,7 +416,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring levelChunksNeedConverted = true; pSave->ConvertToLocalPlatform(); // check if we need to convert this file from PS3->PS4 - storage = shared_ptr(new McRegionLevelStorage(pSave, File(L"."), name, true)); + storage = std::shared_ptr(new McRegionLevelStorage(pSave, File(L"."), name, true)); } else { @@ -441,9 +441,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring newFormatSave = new ConsoleSaveFileSplit( L"" ); } - storage = shared_ptr(new McRegionLevelStorage(newFormatSave, File(L"."), name, true)); + storage = std::shared_ptr(new McRegionLevelStorage(newFormatSave, File(L"."), name, true)); #else - storage = shared_ptr(new McRegionLevelStorage(new ConsoleSaveFileOriginal( L"" ), File(L"."), name, true)); + storage = std::shared_ptr(new McRegionLevelStorage(new ConsoleSaveFileOriginal( L"" ), File(L"."), name, true)); #endif } @@ -1258,7 +1258,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) players->saveAll(Minecraft::GetInstance()->progressRenderer); } - players->broadcastAll( shared_ptr( new UpdateProgressPacket(20) ) ); + players->broadcastAll( std::shared_ptr( new UpdateProgressPacket(20) ) ); for (unsigned int j = 0; j < levels.length; j++) { @@ -1269,7 +1269,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) ServerLevel *level = levels[levels.length - 1 - j]; level->save(true, Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame)); - players->broadcastAll( shared_ptr( new UpdateProgressPacket(33 + (j*33) ) ) ); + players->broadcastAll( std::shared_ptr( new UpdateProgressPacket(33 + (j*33) ) ) ); } if( !s_bServerHalted ) { @@ -1282,16 +1282,16 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) case eXuiServerAction_DropItem: // Find the player, and drop the id at their feet { - shared_ptr player = players->players.at(0); + std::shared_ptr player = players->players.at(0); size_t id = (size_t) param; - player->drop( shared_ptr( new ItemInstance(id, 1, 0 ) ) ); + player->drop( std::shared_ptr( new ItemInstance(id, 1, 0 ) ) ); } break; case eXuiServerAction_SpawnMob: { - shared_ptr player = players->players.at(0); + std::shared_ptr player = players->players.at(0); eINSTANCEOF factory = (eINSTANCEOF)((size_t)param); - shared_ptr mob = dynamic_pointer_cast(EntityIO::newByEnumType(factory,player->level )); + std::shared_ptr mob = dynamic_pointer_cast(EntityIO::newByEnumType(factory,player->level )); mob->moveTo(player->x+1, player->y, player->z+1, player->level->random->nextFloat() * 360, 0); mob->setDespawnProtected(); // 4J added, default to being protected against despawning (has to be done after initial position is set) player->level->addEntity(mob); @@ -1319,20 +1319,20 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) } break; case eXuiServerAction_ServerSettingChanged_Gamertags: - players->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_OPTIONS, app.GetGameHostOption(eGameHostOption_Gamertags)) ) ); + players->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_OPTIONS, app.GetGameHostOption(eGameHostOption_Gamertags)) ) ); break; case eXuiServerAction_ServerSettingChanged_BedrockFog: - players->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, app.GetGameHostOption(eGameHostOption_All)) ) ); + players->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, app.GetGameHostOption(eGameHostOption_All)) ) ); break; case eXuiServerAction_ServerSettingChanged_Difficulty: - players->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_DIFFICULTY, Minecraft::GetInstance()->options->difficulty) ) ); + players->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_DIFFICULTY, Minecraft::GetInstance()->options->difficulty) ) ); break; case eXuiServerAction_ExportSchematic: #ifndef _CONTENT_PACKAGE app.EnterSaveNotificationSection(); - //players->broadcastAll( shared_ptr( new UpdateProgressPacket(20) ) ); + //players->broadcastAll( std::shared_ptr( new UpdateProgressPacket(20) ) ); if( !s_bServerHalted ) { @@ -1370,7 +1370,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) pos->m_yRot, pos->m_elev ); - shared_ptr player = players->players.at(pos->player); + std::shared_ptr player = players->players.at(pos->player); player->debug_setPosition( pos->m_camX, pos->m_camY, pos->m_camZ, pos->m_yRot, pos->m_elev ); @@ -1427,14 +1427,14 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) void MinecraftServer::broadcastStartSavingPacket() { - players->broadcastAll( shared_ptr( new GameEventPacket(GameEventPacket::START_SAVING, 0) ) );; + players->broadcastAll( std::shared_ptr( new GameEventPacket(GameEventPacket::START_SAVING, 0) ) );; } void MinecraftServer::broadcastStopSavingPacket() { if( !s_bServerHalted ) { - players->broadcastAll( shared_ptr( new GameEventPacket(GameEventPacket::STOP_SAVING, 0) ) );; + players->broadcastAll( std::shared_ptr( new GameEventPacket(GameEventPacket::STOP_SAVING, 0) ) );; } } @@ -1469,7 +1469,7 @@ void MinecraftServer::tick() /* if(m_lastSentDifficulty != pMinecraft->options->difficulty) { m_lastSentDifficulty = pMinecraft->options->difficulty; - players->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_DIFFICULTY, pMinecraft->options->difficulty) ) ); + players->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_DIFFICULTY, pMinecraft->options->difficulty) ) ); }*/ for (unsigned int i = 0; i < levels.length; i++) @@ -1489,7 +1489,7 @@ void MinecraftServer::tick() if (tickCount % 20 == 0) { - players->broadcastAll( shared_ptr( new SetTimePacket(level->getTime() ) ), level->dimension->id); + players->broadcastAll( std::shared_ptr( new SetTimePacket(level->getTime() ) ), level->dimension->id); } // #ifndef __PS3__ static __int64 stc = 0; diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index 425f3f5d6..b570e0b39 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -150,7 +150,7 @@ INetworkPlayer *ClientConnection::getNetworkPlayer() else return NULL; } -void ClientConnection::handleLogin(shared_ptr packet) +void ClientConnection::handleLogin(std::shared_ptr packet) { if (done) return; @@ -328,7 +328,7 @@ void ClientConnection::handleLogin(shared_ptr packet) // 4J-PB - this isn't the level we want //level = (MultiPlayerLevel *)minecraft->level; level = (MultiPlayerLevel *)minecraft->getLevel( packet->dimension ); - shared_ptr player; + std::shared_ptr player; if(level==NULL) { @@ -355,7 +355,7 @@ void ClientConnection::handleLogin(shared_ptr packet) player = minecraft->createExtraLocalPlayer(m_userIndex, networkPlayer->GetOnlineName(), m_userIndex, packet->dimension, this,levelpassedin); // need to have a player before the setlevel - shared_ptr lastPlayer = minecraft->player; + std::shared_ptr lastPlayer = minecraft->player; minecraft->player = minecraft->localplayers[m_userIndex]; minecraft->setLevel(level); minecraft->player = lastPlayer; @@ -389,7 +389,7 @@ void ClientConnection::handleLogin(shared_ptr packet) maxPlayers = packet->maxPlayers; // need to have a player before the setLocalCreativeMode - shared_ptr lastPlayer = minecraft->player; + std::shared_ptr lastPlayer = minecraft->player; minecraft->player = minecraft->localplayers[m_userIndex]; ((MultiPlayerGameMode *)minecraft->localgameModes[m_userIndex])->setLocalMode(GameType::byId(packet->gameType)); minecraft->player = lastPlayer; @@ -403,32 +403,32 @@ void ClientConnection::handleLogin(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()); } -void ClientConnection::handleAddEntity(shared_ptr packet) +void ClientConnection::handleAddEntity(std::shared_ptr packet) { double x = packet->x / 32.0; double y = packet->y / 32.0; double z = packet->z / 32.0; - shared_ptr e; + std::shared_ptr e; boolean setRot = true; // 4J-PB - replacing this massive if nest with switch switch(packet->type) { case AddEntityPacket::MINECART_RIDEABLE: - e = shared_ptr( new Minecart(level, x, y, z, Minecart::RIDEABLE) ); + e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::RIDEABLE) ); break; case AddEntityPacket::MINECART_CHEST: - e = shared_ptr( new Minecart(level, x, y, z, Minecart::CHEST) ); + e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::CHEST) ); break; case AddEntityPacket::MINECART_FURNACE: - e = shared_ptr( new Minecart(level, x, y, z, Minecart::FURNACE) ); + e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::FURNACE) ); break; case AddEntityPacket::FISH_HOOK: { // 4J Stu - Brought forward from 1.4 to be able to drop XP from fishing - shared_ptr owner = getEntity(packet->data); + std::shared_ptr owner = getEntity(packet->data); // 4J - check all local players to find match if( owner == NULL ) @@ -446,10 +446,10 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } } } - shared_ptr player = dynamic_pointer_cast(owner); + std::shared_ptr player = dynamic_pointer_cast(owner); if (player != NULL) { - shared_ptr hook = shared_ptr( new FishingHook(level, x, y, z, player) ); + std::shared_ptr hook = std::shared_ptr( new FishingHook(level, x, y, z, player) ); e = hook; // 4J Stu - Move the player->fishing out of the ctor as we cannot reference 'this' player->fishing = hook; @@ -458,10 +458,10 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } break; case AddEntityPacket::ARROW: - e = shared_ptr( new Arrow(level, x, y, z) ); + e = std::shared_ptr( new Arrow(level, x, y, z) ); break; case AddEntityPacket::SNOWBALL: - e = shared_ptr( new Snowball(level, x, y, z) ); + e = std::shared_ptr( new Snowball(level, x, y, z) ); break; case AddEntityPacket::ITEM_FRAME: { @@ -470,66 +470,66 @@ void ClientConnection::handleAddEntity(shared_ptr packet) int iz = (int) z; app.DebugPrintf("ClientConnection ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz); } - e = shared_ptr(new ItemFrame(level, (int) x, (int) y, (int) z, packet->data)); + e = std::shared_ptr(new ItemFrame(level, (int) x, (int) y, (int) z, packet->data)); packet->data = 0; setRot = false; break; case AddEntityPacket::THROWN_ENDERPEARL: - e = shared_ptr( new ThrownEnderpearl(level, x, y, z) ); + e = std::shared_ptr( new ThrownEnderpearl(level, x, y, z) ); break; case AddEntityPacket::EYEOFENDERSIGNAL: - e = shared_ptr( new EyeOfEnderSignal(level, x, y, z) ); + e = std::shared_ptr( new EyeOfEnderSignal(level, x, y, z) ); break; case AddEntityPacket::FIREBALL: - e = shared_ptr( new Fireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); + e = std::shared_ptr( new Fireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; break; case AddEntityPacket::SMALL_FIREBALL: - e = shared_ptr( new SmallFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); + e = std::shared_ptr( new SmallFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; break; case AddEntityPacket::DRAGON_FIRE_BALL: - e = shared_ptr( new DragonFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); + e = std::shared_ptr( new DragonFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; break; case AddEntityPacket::EGG: - e = shared_ptr( new ThrownEgg(level, x, y, z) ); + e = std::shared_ptr( new ThrownEgg(level, x, y, z) ); break; case AddEntityPacket::THROWN_POTION: - e = shared_ptr( new ThrownPotion(level, x, y, z, packet->data) ); + e = std::shared_ptr( new ThrownPotion(level, x, y, z, packet->data) ); packet->data = 0; break; case AddEntityPacket::THROWN_EXPBOTTLE: - e = shared_ptr( new ThrownExpBottle(level, x, y, z) ); + e = std::shared_ptr( new ThrownExpBottle(level, x, y, z) ); packet->data = 0; break; case AddEntityPacket::BOAT: - e = shared_ptr( new Boat(level, x, y, z) ); + e = std::shared_ptr( new Boat(level, x, y, z) ); break; case AddEntityPacket::PRIMED_TNT: - e = shared_ptr( new PrimedTnt(level, x, y, z) ); + e = std::shared_ptr( new PrimedTnt(level, x, y, z) ); break; case AddEntityPacket::ENDER_CRYSTAL: - e = shared_ptr( new EnderCrystal(level, x, y, z) ); + e = std::shared_ptr( new EnderCrystal(level, x, y, z) ); break; case AddEntityPacket::ITEM: - e = shared_ptr( new ItemEntity(level, x, y, z) ); + e = std::shared_ptr( new ItemEntity(level, x, y, z) ); break; case AddEntityPacket::FALLING: - e = shared_ptr( new FallingTile(level, x, y, z, packet->data & 0xFFFF, packet->data >> 16) ); + e = std::shared_ptr( new FallingTile(level, x, y, z, packet->data & 0xFFFF, packet->data >> 16) ); packet->data = 0; break; } - /* if (packet->type == AddEntityPacket::MINECART_RIDEABLE) e = shared_ptr( new Minecart(level, x, y, z, Minecart::RIDEABLE) ); - if (packet->type == AddEntityPacket::MINECART_CHEST) e = shared_ptr( new Minecart(level, x, y, z, Minecart::CHEST) ); - if (packet->type == AddEntityPacket::MINECART_FURNACE) e = shared_ptr( new Minecart(level, x, y, z, Minecart::FURNACE) ); + /* if (packet->type == AddEntityPacket::MINECART_RIDEABLE) e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::RIDEABLE) ); + if (packet->type == AddEntityPacket::MINECART_CHEST) e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::CHEST) ); + if (packet->type == AddEntityPacket::MINECART_FURNACE) e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::FURNACE) ); if (packet->type == AddEntityPacket::FISH_HOOK) { // 4J Stu - Brought forward from 1.4 to be able to drop XP from fishing - shared_ptr owner = getEntity(packet->data); + std::shared_ptr owner = getEntity(packet->data); // 4J - check all local players to find match if( owner == NULL ) @@ -547,10 +547,10 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } } } - shared_ptr player = dynamic_pointer_cast(owner); + std::shared_ptr player = dynamic_pointer_cast(owner); if (player != NULL) { - shared_ptr hook = shared_ptr( new FishingHook(level, x, y, z, player) ); + std::shared_ptr hook = std::shared_ptr( new FishingHook(level, x, y, z, player) ); e = hook; // 4J Stu - Move the player->fishing out of the ctor as we cannot reference 'this' player->fishing = hook; @@ -558,37 +558,37 @@ void ClientConnection::handleAddEntity(shared_ptr packet) packet->data = 0; } - if (packet->type == AddEntityPacket::ARROW) e = shared_ptr( new Arrow(level, x, y, z) ); - if (packet->type == AddEntityPacket::SNOWBALL) e = shared_ptr( new Snowball(level, x, y, z) ); - if (packet->type == AddEntityPacket::THROWN_ENDERPEARL) e = shared_ptr( new ThrownEnderpearl(level, x, y, z) ); - if (packet->type == AddEntityPacket::EYEOFENDERSIGNAL) e = shared_ptr( new EyeOfEnderSignal(level, x, y, z) ); + if (packet->type == AddEntityPacket::ARROW) e = std::shared_ptr( new Arrow(level, x, y, z) ); + if (packet->type == AddEntityPacket::SNOWBALL) e = std::shared_ptr( new Snowball(level, x, y, z) ); + if (packet->type == AddEntityPacket::THROWN_ENDERPEARL) e = std::shared_ptr( new ThrownEnderpearl(level, x, y, z) ); + if (packet->type == AddEntityPacket::EYEOFENDERSIGNAL) e = std::shared_ptr( new EyeOfEnderSignal(level, x, y, z) ); if (packet->type == AddEntityPacket::FIREBALL) { - e = shared_ptr( new Fireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); + e = std::shared_ptr( new Fireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; } if (packet->type == AddEntityPacket::SMALL_FIREBALL) { - e = shared_ptr( new SmallFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); + e = std::shared_ptr( new SmallFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; } - if (packet->type == AddEntityPacket::EGG) e = shared_ptr( new ThrownEgg(level, x, y, z) ); + if (packet->type == AddEntityPacket::EGG) e = std::shared_ptr( new ThrownEgg(level, x, y, z) ); if (packet->type == AddEntityPacket::THROWN_POTION) { - e = shared_ptr( new ThrownPotion(level, x, y, z, packet->data) ); + e = std::shared_ptr( new ThrownPotion(level, x, y, z, packet->data) ); packet->data = 0; } if (packet->type == AddEntityPacket::THROWN_EXPBOTTLE) { - e = shared_ptr( new ThrownExpBottle(level, x, y, z) ); + e = std::shared_ptr( new ThrownExpBottle(level, x, y, z) ); packet->data = 0; } - if (packet->type == AddEntityPacket::BOAT) e = shared_ptr( new Boat(level, x, y, z) ); - if (packet->type == AddEntityPacket::PRIMED_TNT) e = shared_ptr( new PrimedTnt(level, x, y, z) ); - if (packet->type == AddEntityPacket::ENDER_CRYSTAL) e = shared_ptr( new EnderCrystal(level, x, y, z) ); - if (packet->type == AddEntityPacket::FALLING_SAND) e = shared_ptr( new FallingTile(level, x, y, z, Tile::sand->id) ); - if (packet->type == AddEntityPacket::FALLING_GRAVEL) e = shared_ptr( new FallingTile(level, x, y, z, Tile::gravel->id) ); - if (packet->type == AddEntityPacket::FALLING_EGG) e = shared_ptr( new FallingTile(level, x, y, z, Tile::dragonEgg_Id) ); + if (packet->type == AddEntityPacket::BOAT) e = std::shared_ptr( new Boat(level, x, y, z) ); + if (packet->type == AddEntityPacket::PRIMED_TNT) e = std::shared_ptr( new PrimedTnt(level, x, y, z) ); + if (packet->type == AddEntityPacket::ENDER_CRYSTAL) e = std::shared_ptr( new EnderCrystal(level, x, y, z) ); + if (packet->type == AddEntityPacket::FALLING_SAND) e = std::shared_ptr( new FallingTile(level, x, y, z, Tile::sand->id) ); + if (packet->type == AddEntityPacket::FALLING_GRAVEL) e = std::shared_ptr( new FallingTile(level, x, y, z, Tile::gravel->id) ); + if (packet->type == AddEntityPacket::FALLING_EGG) e = std::shared_ptr( new FallingTile(level, x, y, z, Tile::dragonEgg_Id) ); */ @@ -609,7 +609,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) e->xRot = 0.0f; } - vector > *subEntities = e->getSubEntities(); + vector > *subEntities = e->getSubEntities(); if (subEntities != NULL) { int offs = packet->id - e->entityId; @@ -635,7 +635,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) if (packet->type == AddEntityPacket::ARROW) { - shared_ptr owner = getEntity(packet->data); + std::shared_ptr owner = getEntity(packet->data); // 4J - check all local players to find match if( owner == NULL ) @@ -665,9 +665,9 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } -void ClientConnection::handleAddExperienceOrb(shared_ptr packet) +void ClientConnection::handleAddExperienceOrb(std::shared_ptr packet) { - shared_ptr e = shared_ptr( new ExperienceOrb(level, packet->x / 32.0, packet->y / 32.0, packet->z / 32.0, packet->value) ); + std::shared_ptr e = std::shared_ptr( new ExperienceOrb(level, packet->x / 32.0, packet->y / 32.0, packet->z / 32.0, packet->value) ); e->xp = packet->x; e->yp = packet->y; e->zp = packet->z; @@ -677,13 +677,13 @@ void ClientConnection::handleAddExperienceOrb(shared_ptr level->putEntity(packet->id, e); } -void ClientConnection::handleAddGlobalEntity(shared_ptr packet) +void ClientConnection::handleAddGlobalEntity(std::shared_ptr packet) { double x = packet->x / 32.0; double y = packet->y / 32.0; double z = packet->z / 32.0; - shared_ptr e;// = nullptr; - if (packet->type == AddGlobalEntityPacket::LIGHTNING) e = shared_ptr( new LightningBolt(level, x, y, z) ); + std::shared_ptr e;// = nullptr; + if (packet->type == AddGlobalEntityPacket::LIGHTNING) e = std::shared_ptr( new LightningBolt(level, x, y, z) ); if (e != NULL) { e->xp = packet->x; @@ -696,29 +696,29 @@ void ClientConnection::handleAddGlobalEntity(shared_ptr p } } -void ClientConnection::handleAddPainting(shared_ptr packet) +void ClientConnection::handleAddPainting(std::shared_ptr packet) { - shared_ptr painting = shared_ptr( new Painting(level, packet->x, packet->y, packet->z, packet->dir, packet->motive) ); + std::shared_ptr painting = std::shared_ptr( new Painting(level, packet->x, packet->y, packet->z, packet->dir, packet->motive) ); level->putEntity(packet->id, painting); } -void ClientConnection::handleSetEntityMotion(shared_ptr packet) +void ClientConnection::handleSetEntityMotion(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0); } -void ClientConnection::handleSetEntityData(shared_ptr packet) +void ClientConnection::handleSetEntityData(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e != NULL && packet->getUnpackedData() != NULL) { e->getEntityData()->assignValues(packet->getUnpackedData()); } } -void ClientConnection::handleAddPlayer(shared_ptr packet) +void ClientConnection::handleAddPlayer(std::shared_ptr packet) { // Some remote players could actually be local players that are already added for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) @@ -740,7 +740,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) double z = packet->z / 32.0; float yRot = packet->yRot * 360 / 256.0f; float xRot = packet->xRot * 360 / 256.0f; - shared_ptr player = shared_ptr( new RemotePlayer(minecraft->level, packet->name) ); + std::shared_ptr player = std::shared_ptr( new RemotePlayer(minecraft->level, packet->name) ); player->xo = player->xOld = player->xp = packet->x; player->yo = player->yOld = player->yp = packet->y; player->zo = player->zOld = player->zp = packet->z; @@ -763,11 +763,11 @@ 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] = std::shared_ptr(); // NULL; } else { - player->inventory->items[player->inventory->selected] = shared_ptr( new ItemInstance(item, 1, 0) ); + player->inventory->items[player->inventory->selected] = std::shared_ptr( new ItemInstance(item, 1, 0) ); } player->absMoveTo(x, y, z, yRot, xRot); @@ -782,7 +782,7 @@ 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(std::shared_ptr( new TextureAndGeometryPacket(player->customTextureUrl,NULL,0) ) ); } } else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl)) @@ -798,7 +798,7 @@ 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(std::shared_ptr( new TexturePacket(player->customTextureUrl2,NULL,0) ) ); } } else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2)) @@ -811,7 +811,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) level->putEntity(packet->id, player); - vector > *unpackedData = packet->getUnpackedData(); + vector > *unpackedData = packet->getUnpackedData(); if (unpackedData != NULL) { player->getEntityData()->assignValues(unpackedData); @@ -819,9 +819,9 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) } -void ClientConnection::handleTeleportEntity(shared_ptr packet) +void ClientConnection::handleTeleportEntity(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; e->xp = packet->x; e->yp = packet->y; @@ -841,9 +841,9 @@ void ClientConnection::handleTeleportEntity(shared_ptr pac e->lerpTo(x, y, z, yRot, xRot, 3); } -void ClientConnection::handleMoveEntity(shared_ptr packet) +void ClientConnection::handleMoveEntity(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; e->xp += packet->xa; e->yp += packet->ya; @@ -862,17 +862,17 @@ void ClientConnection::handleMoveEntity(shared_ptr packet) e->lerpTo(x, y, z, yRot, xRot, 3); } -void ClientConnection::handleRotateMob(shared_ptr packet) +void ClientConnection::handleRotateMob(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; float yHeadRot = packet->yHeadRot * 360 / 256.f; e->setYHeadRot(yHeadRot); } -void ClientConnection::handleMoveEntitySmall(shared_ptr packet) +void ClientConnection::handleMoveEntitySmall(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; e->xp += packet->xa; e->yp += packet->ya; @@ -891,7 +891,7 @@ void ClientConnection::handleMoveEntitySmall(shared_ptr p e->lerpTo(x, y, z, yRot, xRot, 3); } -void ClientConnection::handleRemoveEntity(shared_ptr packet) +void ClientConnection::handleRemoveEntity(std::shared_ptr packet) { for (int i = 0; i < packet->ids.length; i++) { @@ -899,9 +899,9 @@ void ClientConnection::handleRemoveEntity(shared_ptr packe } } -void ClientConnection::handleMovePlayer(shared_ptr packet) +void ClientConnection::handleMovePlayer(std::shared_ptr packet) { - shared_ptr player = minecraft->localplayers[m_userIndex]; //minecraft->player; + std::shared_ptr player = minecraft->localplayers[m_userIndex]; //minecraft->player; double x = player->x; double y = player->y; @@ -959,19 +959,19 @@ void ClientConnection::handleMovePlayer(shared_ptr packet) } // 4J Added -void ClientConnection::handleChunkVisibilityArea(shared_ptr packet) +void ClientConnection::handleChunkVisibilityArea(std::shared_ptr packet) { for(int z = packet->m_minZ; z <= packet->m_maxZ; ++z) for(int x = packet->m_minX; x <= packet->m_maxX; ++x) level->setChunkVisible(x, z, true); } -void ClientConnection::handleChunkVisibility(shared_ptr packet) +void ClientConnection::handleChunkVisibility(std::shared_ptr packet) { level->setChunkVisible(packet->x, packet->z, packet->visible); } -void ClientConnection::handleChunkTilesUpdate(shared_ptr packet) +void ClientConnection::handleChunkTilesUpdate(std::shared_ptr packet) { // 4J - changed to encode level in packet MultiPlayerLevel *dimensionLevel = (MultiPlayerLevel *)minecraft->levels[packet->levelIdx]; @@ -1040,7 +1040,7 @@ void ClientConnection::handleChunkTilesUpdate(shared_ptr } } -void ClientConnection::handleBlockRegionUpdate(shared_ptr packet) +void ClientConnection::handleBlockRegionUpdate(std::shared_ptr packet) { // 4J - changed to encode level in packet MultiPlayerLevel *dimensionLevel = (MultiPlayerLevel *)minecraft->levels[packet->levelIdx]; @@ -1075,7 +1075,7 @@ void ClientConnection::handleBlockRegionUpdate(shared_ptr packet) +void ClientConnection::handleTileUpdate(std::shared_ptr packet) { // 4J added - using a block of 255 to signify that this is a packet for destroying a tile, where we need to inform the level renderer that we are about to do so. // This is used in creative mode as the point where a tile is first destroyed at the client end of things. Packets formed like this are potentially sent from @@ -1132,7 +1132,7 @@ void ClientConnection::handleTileUpdate(shared_ptr packet) } } -void ClientConnection::handleDisconnect(shared_ptr packet) +void ClientConnection::handleDisconnect(std::shared_ptr packet) { #ifdef __linux__ // Linux fix: On local host connections, ignore DisconnectPacket. The singleplayer internal @@ -1185,23 +1185,23 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, //minecraft->setScreen(new DisconnectedScreen(L"disconnect.lost", reason, reasonObjects)); } -void ClientConnection::sendAndDisconnect(shared_ptr packet) +void ClientConnection::sendAndDisconnect(std::shared_ptr packet) { if (done) return; connection->send(packet); connection->sendAndQuit(); } -void ClientConnection::send(shared_ptr packet) +void ClientConnection::send(std::shared_ptr packet) { if (done) return; connection->send(packet); } -void ClientConnection::handleTakeItemEntity(shared_ptr packet) +void ClientConnection::handleTakeItemEntity(std::shared_ptr packet) { - shared_ptr from = getEntity(packet->itemId); - shared_ptr to = dynamic_pointer_cast(getEntity(packet->playerId)); + std::shared_ptr from = getEntity(packet->itemId); + std::shared_ptr to = dynamic_pointer_cast(getEntity(packet->playerId)); // 4J - the original game could assume that if getEntity didn't find the player, it must be the local player. We // need to search all local players @@ -1234,7 +1234,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac // "from" reference if we've already removed the item for an earlier processed connection if( isLocalPlayer ) { - shared_ptr player = dynamic_pointer_cast(to); + std::shared_ptr player = dynamic_pointer_cast(to); // 4J Stu - Fix for #10213 - UI: Local clients cannot progress through the tutorial normally. // We only send this packet once if many local players can see the event, so make sure we update @@ -1255,7 +1255,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac level->playSound(from, eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f); } - minecraft->particleEngine->add( shared_ptr( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) ); + minecraft->particleEngine->add( std::shared_ptr( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) ); level->removeEntity(packet->itemId); } else @@ -1268,14 +1268,14 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac else { level->playSound(from, eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f); - minecraft->particleEngine->add( shared_ptr( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) ); + minecraft->particleEngine->add( std::shared_ptr( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) ); level->removeEntity(packet->itemId); } } } -void ClientConnection::handleChat(shared_ptr packet) +void ClientConnection::handleChat(std::shared_ptr packet) { wstring message; int iPos; @@ -1559,13 +1559,13 @@ void ClientConnection::handleChat(shared_ptr packet) if( displayOnGui ) minecraft->gui->addMessage(message,m_userIndex, bIsDeathMessage); } -void ClientConnection::handleAnimate(shared_ptr packet) +void ClientConnection::handleAnimate(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; if (packet->action == AnimatePacket::SWING) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = dynamic_pointer_cast(e); if(player != NULL) player->swing(); } else if (packet->action == AnimatePacket::HURT) @@ -1574,7 +1574,7 @@ void ClientConnection::handleAnimate(shared_ptr packet) } else if (packet->action == AnimatePacket::WAKE_UP) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = dynamic_pointer_cast(e); if(player != NULL) player->stopSleepInBed(false, false, false); } else if (packet->action == AnimatePacket::RESPAWN) @@ -1582,13 +1582,13 @@ void ClientConnection::handleAnimate(shared_ptr packet) } else if (packet->action == AnimatePacket::CRITICAL_HIT) { - shared_ptr critParticle = shared_ptr( new CritParticle(minecraft->level, e) ); + std::shared_ptr critParticle = std::shared_ptr( new CritParticle(minecraft->level, e) ); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add( critParticle ); } else if (packet->action == AnimatePacket::MAGIC_CRITICAL_HIT) { - shared_ptr critParticle = shared_ptr( new CritParticle(minecraft->level, e, eParticleType_magicCrit) ); + std::shared_ptr critParticle = std::shared_ptr( new CritParticle(minecraft->level, e, eParticleType_magicCrit) ); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); } @@ -1598,13 +1598,13 @@ void ClientConnection::handleAnimate(shared_ptr packet) } -void ClientConnection::handleEntityActionAtPosition(shared_ptr packet) +void ClientConnection::handleEntityActionAtPosition(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; if (packet->action == EntityActionAtPositionPacket::START_SLEEP) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = dynamic_pointer_cast(e); player->startSleepInBed(packet->x, packet->y, packet->z); if( player == minecraft->localplayers[m_userIndex] ) @@ -1614,7 +1614,7 @@ void ClientConnection::handleEntityActionAtPosition(shared_ptr packet) +void ClientConnection::handlePreLogin(std::shared_ptr packet) { fprintf(stderr, "[LOGIN-CLI] handlePreLogin entered, isHost=%d, userIdx=%d\n", (int)g_NetworkManager.IsHost(), m_userIndex); #if 1 @@ -2060,7 +2060,7 @@ void ClientConnection::handlePreLogin(shared_ptr packet) ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed); fprintf(stderr, "[LOGIN] Sending LoginPacket: user=%ls netVer=%d userIdx=%d isHost=%d\n", minecraft->user->name.c_str(), SharedConstants::NETWORK_PROTOCOL_VERSION, m_userIndex, (int)g_NetworkManager.IsHost()); - send( shared_ptr( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE), + send( std::shared_ptr( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE), packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest( m_userIndex )))); fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n"); @@ -2102,7 +2102,7 @@ void ClientConnection::close() connection->close(DisconnectPacket::eDisconnect_Closed); } -void ClientConnection::handleAddMob(shared_ptr packet) +void ClientConnection::handleAddMob(std::shared_ptr packet) { double x = packet->x / 32.0; double y = packet->y / 32.0; @@ -2110,7 +2110,7 @@ void ClientConnection::handleAddMob(shared_ptr packet) float yRot = packet->yRot * 360 / 256.0f; float xRot = packet->xRot * 360 / 256.0f; - shared_ptr mob = dynamic_pointer_cast(EntityIO::newById(packet->type, level)); + std::shared_ptr mob = dynamic_pointer_cast(EntityIO::newById(packet->type, level)); mob->xp = packet->x; mob->yp = packet->y; mob->zp = packet->z; @@ -2118,7 +2118,7 @@ void ClientConnection::handleAddMob(shared_ptr packet) mob->yRotp = packet->yRot; mob->xRotp = packet->xRot; - vector > *subEntities = mob->getSubEntities(); + vector > *subEntities = mob->getSubEntities(); if (subEntities != NULL) { int offs = packet->id - mob->entityId; @@ -2140,7 +2140,7 @@ void ClientConnection::handleAddMob(shared_ptr packet) mob->zd = packet->zd / 8000.0f; level->putEntity(packet->id, mob); - vector > *unpackedData = packet->getUnpackedData(); + vector > *unpackedData = packet->getUnpackedData(); if (unpackedData != NULL) { mob->getEntityData()->assignValues(unpackedData); @@ -2150,17 +2150,17 @@ void ClientConnection::handleAddMob(shared_ptr packet) // 4J Stu - Slimes have a different BB depending on their size which is set in the entity data, so update the BB if(mob->GetType() == eTYPE_SLIME || mob->GetType() == eTYPE_LAVASLIME) { - shared_ptr slime = dynamic_pointer_cast(mob); + std::shared_ptr slime = dynamic_pointer_cast(mob); slime->setSize( slime->getSize() ); } } -void ClientConnection::handleSetTime(shared_ptr packet) +void ClientConnection::handleSetTime(std::shared_ptr packet) { minecraft->level->setTime(packet->time); } -void ClientConnection::handleSetSpawn(shared_ptr packet) +void ClientConnection::handleSetSpawn(std::shared_ptr packet) { //minecraft->player->setRespawnPosition(new Pos(packet->x, packet->y, packet->z)); minecraft->localplayers[m_userIndex]->setRespawnPosition(new Pos(packet->x, packet->y, packet->z)); @@ -2168,12 +2168,12 @@ void ClientConnection::handleSetSpawn(shared_ptr packet) } -void ClientConnection::handleRidePacket(shared_ptr packet) +void ClientConnection::handleRidePacket(std::shared_ptr packet) { - shared_ptr rider = getEntity(packet->riderId); - shared_ptr ridden = getEntity(packet->riddenId); + std::shared_ptr rider = getEntity(packet->riderId); + std::shared_ptr ridden = getEntity(packet->riddenId); - shared_ptr boat = dynamic_pointer_cast(ridden); + std::shared_ptr boat = dynamic_pointer_cast(ridden); //if (packet->riderId == minecraft->player->entityId) rider = minecraft->player; if (packet->riderId == minecraft->localplayers[m_userIndex]->entityId) { @@ -2190,13 +2190,13 @@ void ClientConnection::handleRidePacket(shared_ptr packet) rider->ride(ridden); } -void ClientConnection::handleEntityEvent(shared_ptr packet) +void ClientConnection::handleEntityEvent(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->entityId); + std::shared_ptr e = getEntity(packet->entityId); if (e != NULL) e->handleEntityEvent(packet->eventId); } -shared_ptr ClientConnection::getEntity(int entityId) +std::shared_ptr ClientConnection::getEntity(int entityId) { //if (entityId == minecraft->player->entityId) if(entityId == minecraft->localplayers[m_userIndex]->entityId) @@ -2207,7 +2207,7 @@ shared_ptr ClientConnection::getEntity(int entityId) return level->getEntity(entityId); } -void ClientConnection::handleSetHealth(shared_ptr packet) +void ClientConnection::handleSetHealth(std::shared_ptr packet) { //minecraft->player->hurtTo(packet->health); minecraft->localplayers[m_userIndex]->hurtTo(packet->health,packet->damageSource); @@ -2224,12 +2224,12 @@ void ClientConnection::handleSetHealth(shared_ptr packet) } } -void ClientConnection::handleSetExperience(shared_ptr packet) +void ClientConnection::handleSetExperience(std::shared_ptr packet) { minecraft->localplayers[m_userIndex]->setExperienceValues(packet->experienceProgress, packet->totalExperience, packet->experienceLevel); } -void ClientConnection::handleTexture(shared_ptr packet) +void ClientConnection::handleTexture(std::shared_ptr packet) { // Both PlayerConnection and ClientConnection should handle this mostly the same way // Server side also needs to store a list of those clients waiting to get a texture the server doesn't have yet @@ -2247,7 +2247,7 @@ void ClientConnection::handleTexture(shared_ptr packet) if(dwBytes!=0) { - send( shared_ptr( new TexturePacket(packet->textureName,pbData,dwBytes) ) ); + send( std::shared_ptr( new TexturePacket(packet->textureName,pbData,dwBytes) ) ); } } else @@ -2261,7 +2261,7 @@ void ClientConnection::handleTexture(shared_ptr packet) } } -void ClientConnection::handleTextureAndGeometry(shared_ptr packet) +void ClientConnection::handleTextureAndGeometry(std::shared_ptr packet) { // Both PlayerConnection and ClientConnection should handle this mostly the same way // Server side also needs to store a list of those clients waiting to get a texture the server doesn't have yet @@ -2284,18 +2284,18 @@ void ClientConnection::handleTextureAndGeometry(shared_ptrgetAdditionalBoxesCount()!=0) { - send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes,pDLCSkinFile) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes,pDLCSkinFile) ) ); } else { - send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes) ) ); } } else { unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID); - send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes,app.GetAdditionalSkinBoxes(packet->dwSkinID),uiAnimOverrideBitmask) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes,app.GetAdditionalSkinBoxes(packet->dwSkinID),uiAnimOverrideBitmask) ) ); } } } @@ -2320,11 +2320,11 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr packet) +void ClientConnection::handleTextureChange(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = dynamic_pointer_cast(e); if( e == NULL) return; bool isLocalPlayer = false; @@ -2365,7 +2365,7 @@ 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(std::shared_ptr( new TexturePacket(packet->path,NULL,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) @@ -2375,11 +2375,11 @@ void ClientConnection::handleTextureChange(shared_ptr packe } } -void ClientConnection::handleTextureAndGeometryChange(shared_ptr packet) +void ClientConnection::handleTextureAndGeometryChange(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = dynamic_pointer_cast(e); if( e == NULL) return; bool isLocalPlayer = false; @@ -2410,7 +2410,7 @@ void ClientConnection::handleTextureAndGeometryChange(shared_ptrpath.c_str(), player->name.c_str()); #endif - send(shared_ptr( new TextureAndGeometryPacket(packet->path,NULL,0) ) ); + send(std::shared_ptr( new TextureAndGeometryPacket(packet->path,NULL,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) @@ -2421,7 +2421,7 @@ void ClientConnection::handleTextureAndGeometryChange(shared_ptr packet) +void ClientConnection::handleRespawn(std::shared_ptr packet) { //if (packet->dimension != minecraft->player->dimension) if( packet->dimension != minecraft->localplayers[m_userIndex]->dimension || packet->mapSeed != minecraft->localplayers[m_userIndex]->level->getSeed() ) @@ -2456,13 +2456,13 @@ void ClientConnection::handleRespawn(shared_ptr packet) } // Remove the player entity from the current level - level->removeEntity( shared_ptr(minecraft->localplayers[m_userIndex]) ); + level->removeEntity( std::shared_ptr(minecraft->localplayers[m_userIndex]) ); level = dimensionLevel; // Whilst calling setLevel, make sure that minecraft::player is set up to be correct for this // connection - shared_ptr lastPlayer = minecraft->player; + std::shared_ptr lastPlayer = minecraft->player; minecraft->player = minecraft->localplayers[m_userIndex]; minecraft->setLevel(dimensionLevel); minecraft->player = lastPlayer; @@ -2534,7 +2534,7 @@ void ClientConnection::handleRespawn(shared_ptr packet) minecraft->setLocalPlayerIdx(oldIndex); } -void ClientConnection::handleExplosion(shared_ptr packet) +void ClientConnection::handleExplosion(std::shared_ptr packet) { if(!packet->m_bKnockbackOnly) { @@ -2566,15 +2566,15 @@ void ClientConnection::handleExplosion(shared_ptr packet) minecraft->localplayers[m_userIndex]->zd += packet->getKnockbackZ(); } -void ClientConnection::handleContainerOpen(shared_ptr packet) +void ClientConnection::handleContainerOpen(std::shared_ptr packet) { bool failed = false; - shared_ptr player = minecraft->localplayers[m_userIndex]; + std::shared_ptr player = minecraft->localplayers[m_userIndex]; switch(packet->type) { case ContainerOpenPacket::CONTAINER: { - if( player->openContainer(shared_ptr( new SimpleContainer(packet->title, packet->size) ))) + if( player->openContainer(std::shared_ptr( new SimpleContainer(packet->title, packet->size) ))) { player->containerMenu->containerId = packet->containerId; } @@ -2586,7 +2586,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::FURNACE: { - if( player->openFurnace(shared_ptr( new FurnaceTileEntity() )) ) + if( player->openFurnace(std::shared_ptr( new FurnaceTileEntity() )) ) { player->containerMenu->containerId = packet->containerId; } @@ -2598,7 +2598,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::BREWING_STAND: { - if( player->openBrewingStand(shared_ptr( new BrewingStandTileEntity() )) ) + if( player->openBrewingStand(std::shared_ptr( new BrewingStandTileEntity() )) ) { player->containerMenu->containerId = packet->containerId; } @@ -2610,7 +2610,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::TRAP: { - if( player->openTrap(shared_ptr( new DispenserTileEntity() )) ) + if( player->openTrap(std::shared_ptr( new DispenserTileEntity() )) ) { player->containerMenu->containerId = packet->containerId; } @@ -2646,7 +2646,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::TRADER_NPC: { - shared_ptr csm = shared_ptr(new ClientSideMerchant(player,packet->title)); + std::shared_ptr csm = std::shared_ptr(new ClientSideMerchant(player,packet->title)); csm->createContainer(); if(player->openTrading(csm)) { @@ -2683,14 +2683,14 @@ void ClientConnection::handleContainerOpen(shared_ptr packe } else { - send(shared_ptr(new ContainerClosePacket(packet->containerId))); + send(std::shared_ptr(new ContainerClosePacket(packet->containerId))); } } } -void ClientConnection::handleContainerSetSlot(shared_ptr packet) +void ClientConnection::handleContainerSetSlot(std::shared_ptr packet) { - shared_ptr player = minecraft->localplayers[m_userIndex]; + std::shared_ptr player = minecraft->localplayers[m_userIndex]; if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_CARRIED ) { player->inventory->setCarried(packet->item); @@ -2702,7 +2702,7 @@ void ClientConnection::handleContainerSetSlot(shared_ptr // 4J Stu - Reworked a bit to fix a bug where things being collected while the creative menu was up replaced items in the creative menu if(packet->slot >= 36 && packet->slot < 36 + 9) { - shared_ptr lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem(); + std::shared_ptr lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem(); if (packet->item != NULL) { if (lastItem == NULL || lastItem->count < packet->item->count) @@ -2720,9 +2720,9 @@ void ClientConnection::handleContainerSetSlot(shared_ptr } } -void ClientConnection::handleContainerAck(shared_ptr packet) +void ClientConnection::handleContainerAck(std::shared_ptr packet) { - shared_ptr player = minecraft->localplayers[m_userIndex]; + std::shared_ptr player = minecraft->localplayers[m_userIndex]; AbstractContainerMenu *menu = NULL; if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY) { @@ -2736,14 +2736,14 @@ void ClientConnection::handleContainerAck(shared_ptr packet) { if (!packet->accepted) { - send( shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, true) )); + send( std::shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, true) )); } } } -void ClientConnection::handleContainerContent(shared_ptr packet) +void ClientConnection::handleContainerContent(std::shared_ptr packet) { - shared_ptr player = minecraft->localplayers[m_userIndex]; + std::shared_ptr player = minecraft->localplayers[m_userIndex]; if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY) { player->inventoryMenu->setAll(&packet->items); @@ -2754,17 +2754,17 @@ void ClientConnection::handleContainerContent(shared_ptr packet) +void ClientConnection::handleSignUpdate(std::shared_ptr packet) { app.DebugPrintf("ClientConnection::handleSignUpdate - "); if (minecraft->level->hasChunkAt(packet->x, packet->y, packet->z)) { - shared_ptr te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z); + std::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) { - shared_ptr ste = dynamic_pointer_cast(te); + std::shared_ptr ste = dynamic_pointer_cast(te); for (int i = 0; i < MAX_SIGN_LINES; i++) { ste->SetMessage(i,packet->lines[i]); @@ -2787,11 +2787,11 @@ void ClientConnection::handleSignUpdate(shared_ptr packet) } } -void ClientConnection::handleTileEntityData(shared_ptr packet) +void ClientConnection::handleTileEntityData(std::shared_ptr packet) { if (minecraft->level->hasChunkAt(packet->x, packet->y, packet->z)) { - shared_ptr te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z); + std::shared_ptr te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z); if (te != NULL) { @@ -2815,7 +2815,7 @@ void ClientConnection::handleTileEntityData(shared_ptr pac } } -void ClientConnection::handleContainerSetData(shared_ptr packet) +void ClientConnection::handleContainerSetData(std::shared_ptr packet) { onUnhandledPacket(packet); if (minecraft->localplayers[m_userIndex]->containerMenu != NULL && minecraft->localplayers[m_userIndex]->containerMenu->containerId == packet->containerId) @@ -2824,9 +2824,9 @@ void ClientConnection::handleContainerSetData(shared_ptr } } -void ClientConnection::handleSetEquippedItem(shared_ptr packet) +void ClientConnection::handleSetEquippedItem(std::shared_ptr packet) { - shared_ptr entity = getEntity(packet->entity); + std::shared_ptr entity = getEntity(packet->entity); if (entity != NULL) { // 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 @@ -2834,19 +2834,19 @@ void ClientConnection::handleSetEquippedItem(shared_ptr p } } -void ClientConnection::handleContainerClose(shared_ptr packet) +void ClientConnection::handleContainerClose(std::shared_ptr packet) { minecraft->localplayers[m_userIndex]->closeContainer(); } -void ClientConnection::handleTileEvent(shared_ptr packet) +void ClientConnection::handleTileEvent(std::shared_ptr packet) { PIXBeginNamedEvent(0,"Handle tile event\n"); minecraft->level->tileEvent(packet->x, packet->y, packet->z, packet->tile, packet->b0, packet->b1); PIXEndNamedEvent(); } -void ClientConnection::handleTileDestruction(shared_ptr packet) +void ClientConnection::handleTileDestruction(std::shared_ptr packet) { minecraft->level->destroyTileProgress(packet->getEntityId(), packet->getX(), packet->getY(), packet->getZ(), packet->getState()); } @@ -2856,7 +2856,7 @@ bool ClientConnection::canHandleAsyncPackets() return minecraft != NULL && minecraft->level != NULL && minecraft->localplayers[m_userIndex] != NULL && level != NULL; } -void ClientConnection::handleGameEvent(shared_ptr gameEventPacket) +void ClientConnection::handleGameEvent(std::shared_ptr gameEventPacket) { int event = gameEventPacket->_event; int param = gameEventPacket->param; @@ -2922,7 +2922,7 @@ void ClientConnection::handleGameEvent(shared_ptr gameEventPack } } -void ClientConnection::handleComplexItemData(shared_ptr packet) +void ClientConnection::handleComplexItemData(std::shared_ptr packet) { if (packet->itemType == Item::map->id) { @@ -2936,7 +2936,7 @@ void ClientConnection::handleComplexItemData(shared_ptr p -void ClientConnection::handleLevelEvent(shared_ptr packet) +void ClientConnection::handleLevelEvent(std::shared_ptr packet) { switch(packet->type) { @@ -2960,22 +2960,22 @@ void ClientConnection::handleLevelEvent(shared_ptr packet) } } -void ClientConnection::handleAwardStat(shared_ptr packet) +void ClientConnection::handleAwardStat(std::shared_ptr packet) { minecraft->localplayers[m_userIndex]->awardStatFromServer(GenericStats::stat(packet->statId), packet->getParamData()); } -void ClientConnection::handleUpdateMobEffect(shared_ptr packet) +void ClientConnection::handleUpdateMobEffect(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->entityId); + std::shared_ptr e = getEntity(packet->entityId); if (e == NULL || dynamic_pointer_cast(e) == NULL) return; ( dynamic_pointer_cast(e) )->addEffect(new MobEffectInstance(packet->effectId, packet->effectDurationTicks, packet->effectAmplifier)); } -void ClientConnection::handleRemoveMobEffect(shared_ptr packet) +void ClientConnection::handleRemoveMobEffect(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->entityId); + std::shared_ptr e = getEntity(packet->entityId); if (e == NULL || dynamic_pointer_cast(e) == NULL) return; ( dynamic_pointer_cast(e) )->removeEffectNoUpdate(packet->effectId); @@ -2986,7 +2986,7 @@ bool ClientConnection::isServerPacketListener() return false; } -void ClientConnection::handlePlayerInfo(shared_ptr packet) +void ClientConnection::handlePlayerInfo(std::shared_ptr packet) { unsigned int startingPrivileges = app.GetPlayerPrivileges(packet->m_networkSmallId); @@ -3002,17 +3002,17 @@ void ClientConnection::handlePlayerInfo(shared_ptr packet) // 4J Stu - Repurposed this packet for player info that we want app.UpdatePlayerInfo(packet->m_networkSmallId, packet->m_playerColourIndex, packet->m_playerPrivileges); - shared_ptr entity = getEntity(packet->m_entityId); + std::shared_ptr entity = getEntity(packet->m_entityId); if(entity != NULL && entity->GetType() == eTYPE_PLAYER) { - shared_ptr player = dynamic_pointer_cast(entity); + std::shared_ptr player = dynamic_pointer_cast(entity); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_playerPrivileges); } if(networkPlayer != NULL && networkPlayer->IsLocal()) { for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - shared_ptr localPlayer = minecraft->localplayers[i]; + std::shared_ptr localPlayer = minecraft->localplayers[i]; if(localPlayer != NULL && localPlayer->connection != NULL && localPlayer->connection->getNetworkPlayer() == networkPlayer ) { localPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All,packet->m_playerPrivileges); @@ -3041,7 +3041,7 @@ void ClientConnection::handlePlayerInfo(shared_ptr packet) } -void ClientConnection::displayPrivilegeChanges(shared_ptr player, unsigned int oldPrivileges) +void ClientConnection::displayPrivilegeChanges(std::shared_ptr player, unsigned int oldPrivileges) { int userIndex = player->GetXboxPad(); unsigned int newPrivileges = player->getAllPlayerGamePrivileges(); @@ -3138,14 +3138,14 @@ void ClientConnection::displayPrivilegeChanges(shared_ptr packet) +void ClientConnection::handleKeepAlive(std::shared_ptr packet) { - send(shared_ptr(new KeepAlivePacket(packet->id))); + send(std::shared_ptr(new KeepAlivePacket(packet->id))); } -void ClientConnection::handlePlayerAbilities(shared_ptr playerAbilitiesPacket) +void ClientConnection::handlePlayerAbilities(std::shared_ptr playerAbilitiesPacket) { - shared_ptr player = minecraft->localplayers[m_userIndex]; + std::shared_ptr player = minecraft->localplayers[m_userIndex]; player->abilities.flying = playerAbilitiesPacket->isFlying(); player->abilities.instabuild = playerAbilitiesPacket->canInstabuild(); player->abilities.invulnerable = playerAbilitiesPacket->isInvulnerable(); @@ -3153,12 +3153,12 @@ void ClientConnection::handlePlayerAbilities(shared_ptr p player->abilities.setFlyingSpeed(playerAbilitiesPacket->getFlyingSpeed()); } -void ClientConnection::handleSoundEvent(shared_ptr packet) +void ClientConnection::handleSoundEvent(std::shared_ptr packet) { minecraft->level->playLocalSound(packet->getX(), packet->getY(), packet->getZ(), packet->getSound(), packet->getVolume(), packet->getPitch()); } -void ClientConnection::handleCustomPayload(shared_ptr customPayloadPacket) +void ClientConnection::handleCustomPayload(std::shared_ptr customPayloadPacket) { if (CustomPayloadPacket::TRADER_LIST_PACKET.compare(customPayloadPacket->identifier) == 0) { @@ -3167,7 +3167,7 @@ void ClientConnection::handleCustomPayload(shared_ptr custo int containerId = input.readInt(); if (ui.IsSceneInStack(m_userIndex, eUIScene_TradingMenu) && containerId == minecraft->localplayers[m_userIndex]->containerMenu->containerId) { - shared_ptr trader = nullptr; + std::shared_ptr trader = nullptr; #ifdef _XBOX HXUIOBJ scene = app.GetCurrentScene(m_userIndex); @@ -3200,7 +3200,7 @@ Connection *ClientConnection::getConnection() } // 4J Added -void ClientConnection::handleServerSettingsChanged(shared_ptr packet) +void ClientConnection::handleServerSettingsChanged(std::shared_ptr packet) { if(packet->action==ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS) { @@ -3226,7 +3226,7 @@ void ClientConnection::handleServerSettingsChanged(shared_ptr packet) +void ClientConnection::handleXZ(std::shared_ptr packet) { if(packet->action==XZPacket::STRONGHOLD) { @@ -3236,12 +3236,12 @@ void ClientConnection::handleXZ(shared_ptr packet) } } -void ClientConnection::handleUpdateProgress(shared_ptr packet) +void ClientConnection::handleUpdateProgress(std::shared_ptr packet) { if(!g_NetworkManager.IsHost() ) Minecraft::GetInstance()->progressRenderer->progressStagePercentage( packet->m_percentage ); } -void ClientConnection::handleUpdateGameRuleProgressPacket(shared_ptr packet) +void ClientConnection::handleUpdateGameRuleProgressPacket(std::shared_ptr packet) { LPCWSTR string = app.GetGameRulesString(packet->m_messageId); if(string != NULL) diff --git a/Minecraft.Client/Network/ClientConnection.h b/Minecraft.Client/Network/ClientConnection.h index eced984fa..305b3a21b 100644 --- a/Minecraft.Client/Network/ClientConnection.h +++ b/Minecraft.Client/Network/ClientConnection.h @@ -49,92 +49,92 @@ public: ~ClientConnection(); void tick(); INetworkPlayer *getNetworkPlayer(); - virtual void handleLogin(shared_ptr packet); - virtual void handleAddEntity(shared_ptr packet); - virtual void handleAddExperienceOrb(shared_ptr packet); - virtual void handleAddGlobalEntity(shared_ptr packet); - virtual void handleAddPainting(shared_ptr packet); - virtual void handleSetEntityMotion(shared_ptr packet); - virtual void handleSetEntityData(shared_ptr packet); - virtual void handleAddPlayer(shared_ptr packet); - virtual void handleTeleportEntity(shared_ptr packet); - virtual void handleMoveEntity(shared_ptr packet); - virtual void handleRotateMob(shared_ptr packet); - virtual void handleMoveEntitySmall(shared_ptr packet); - virtual void handleRemoveEntity(shared_ptr packet); - virtual void handleMovePlayer(shared_ptr packet); + virtual void handleLogin(std::shared_ptr packet); + virtual void handleAddEntity(std::shared_ptr packet); + virtual void handleAddExperienceOrb(std::shared_ptr packet); + virtual void handleAddGlobalEntity(std::shared_ptr packet); + virtual void handleAddPainting(std::shared_ptr packet); + virtual void handleSetEntityMotion(std::shared_ptr packet); + virtual void handleSetEntityData(std::shared_ptr packet); + virtual void handleAddPlayer(std::shared_ptr packet); + virtual void handleTeleportEntity(std::shared_ptr packet); + virtual void handleMoveEntity(std::shared_ptr packet); + virtual void handleRotateMob(std::shared_ptr packet); + virtual void handleMoveEntitySmall(std::shared_ptr packet); + virtual void handleRemoveEntity(std::shared_ptr packet); + virtual void handleMovePlayer(std::shared_ptr packet); Random *random; // 4J Added - virtual void handleChunkVisibilityArea(shared_ptr packet); + virtual void handleChunkVisibilityArea(std::shared_ptr packet); - virtual void handleChunkVisibility(shared_ptr packet); - virtual void handleChunkTilesUpdate(shared_ptr packet); - virtual void handleBlockRegionUpdate(shared_ptr packet); - virtual void handleTileUpdate(shared_ptr packet); - virtual void handleDisconnect(shared_ptr packet); + virtual void handleChunkVisibility(std::shared_ptr packet); + virtual void handleChunkTilesUpdate(std::shared_ptr packet); + virtual void handleBlockRegionUpdate(std::shared_ptr packet); + virtual void handleTileUpdate(std::shared_ptr packet); + virtual void handleDisconnect(std::shared_ptr packet); virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects); - void sendAndDisconnect(shared_ptr packet); - void send(shared_ptr packet); - virtual void handleTakeItemEntity(shared_ptr packet); - virtual void handleChat(shared_ptr packet); - virtual void handleAnimate(shared_ptr packet); - virtual void handleEntityActionAtPosition(shared_ptr packet); - virtual void handlePreLogin(shared_ptr packet); + void sendAndDisconnect(std::shared_ptr packet); + void send(std::shared_ptr packet); + virtual void handleTakeItemEntity(std::shared_ptr packet); + virtual void handleChat(std::shared_ptr packet); + virtual void handleAnimate(std::shared_ptr packet); + virtual void handleEntityActionAtPosition(std::shared_ptr packet); + virtual void handlePreLogin(std::shared_ptr packet); void close(); - virtual void handleAddMob(shared_ptr packet); - virtual void handleSetTime(shared_ptr packet); - virtual void handleSetSpawn(shared_ptr packet); - virtual void handleRidePacket(shared_ptr packet); - virtual void handleEntityEvent(shared_ptr packet); + virtual void handleAddMob(std::shared_ptr packet); + virtual void handleSetTime(std::shared_ptr packet); + virtual void handleSetSpawn(std::shared_ptr packet); + virtual void handleRidePacket(std::shared_ptr packet); + virtual void handleEntityEvent(std::shared_ptr packet); private: - shared_ptr getEntity(int entityId); + std::shared_ptr getEntity(int entityId); wstring GetDisplayNameByGamertag(wstring gamertag); public: - virtual void handleSetHealth(shared_ptr packet); - virtual void handleSetExperience(shared_ptr packet); - virtual void handleRespawn(shared_ptr packet); - virtual void handleExplosion(shared_ptr packet); - virtual void handleContainerOpen(shared_ptr packet); - virtual void handleContainerSetSlot(shared_ptr packet); - virtual void handleContainerAck(shared_ptr packet); - virtual void handleContainerContent(shared_ptr packet); - virtual void handleSignUpdate(shared_ptr packet); - virtual void handleTileEntityData(shared_ptr packet); - virtual void handleContainerSetData(shared_ptr packet); - virtual void handleSetEquippedItem(shared_ptr packet); - virtual void handleContainerClose(shared_ptr packet); - virtual void handleTileEvent(shared_ptr packet); - virtual void handleTileDestruction(shared_ptr packet); + virtual void handleSetHealth(std::shared_ptr packet); + virtual void handleSetExperience(std::shared_ptr packet); + virtual void handleRespawn(std::shared_ptr packet); + virtual void handleExplosion(std::shared_ptr packet); + virtual void handleContainerOpen(std::shared_ptr packet); + virtual void handleContainerSetSlot(std::shared_ptr packet); + virtual void handleContainerAck(std::shared_ptr packet); + virtual void handleContainerContent(std::shared_ptr packet); + virtual void handleSignUpdate(std::shared_ptr packet); + virtual void handleTileEntityData(std::shared_ptr packet); + virtual void handleContainerSetData(std::shared_ptr packet); + virtual void handleSetEquippedItem(std::shared_ptr packet); + virtual void handleContainerClose(std::shared_ptr packet); + virtual void handleTileEvent(std::shared_ptr packet); + virtual void handleTileDestruction(std::shared_ptr packet); virtual bool canHandleAsyncPackets(); - virtual void handleGameEvent(shared_ptr gameEventPacket); - virtual void handleComplexItemData(shared_ptr packet); - virtual void handleLevelEvent(shared_ptr packet); - virtual void handleAwardStat(shared_ptr packet); - virtual void handleUpdateMobEffect(shared_ptr packet); - virtual void handleRemoveMobEffect(shared_ptr packet); + virtual void handleGameEvent(std::shared_ptr gameEventPacket); + virtual void handleComplexItemData(std::shared_ptr packet); + virtual void handleLevelEvent(std::shared_ptr packet); + virtual void handleAwardStat(std::shared_ptr packet); + virtual void handleUpdateMobEffect(std::shared_ptr packet); + virtual void handleRemoveMobEffect(std::shared_ptr packet); virtual bool isServerPacketListener(); - virtual void handlePlayerInfo(shared_ptr packet); - virtual void handleKeepAlive(shared_ptr packet); - virtual void handlePlayerAbilities(shared_ptr playerAbilitiesPacket); - virtual void handleSoundEvent(shared_ptr packet); - virtual void handleCustomPayload(shared_ptr customPayloadPacket); + virtual void handlePlayerInfo(std::shared_ptr packet); + virtual void handleKeepAlive(std::shared_ptr packet); + virtual void handlePlayerAbilities(std::shared_ptr playerAbilitiesPacket); + virtual void handleSoundEvent(std::shared_ptr packet); + virtual void handleCustomPayload(std::shared_ptr customPayloadPacket); virtual Connection *getConnection(); // 4J Added - virtual void handleServerSettingsChanged(shared_ptr packet); - virtual void handleTexture(shared_ptr packet); - virtual void handleTextureAndGeometry(shared_ptr packet); - virtual void handleUpdateProgress(shared_ptr packet); + virtual void handleServerSettingsChanged(std::shared_ptr packet); + virtual void handleTexture(std::shared_ptr packet); + virtual void handleTextureAndGeometry(std::shared_ptr packet); + virtual void handleUpdateProgress(std::shared_ptr packet); // 4J Added static int HostDisconnectReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - virtual void handleTextureChange(shared_ptr packet); - virtual void handleTextureAndGeometryChange(shared_ptr packet); - virtual void handleUpdateGameRuleProgressPacket(shared_ptr packet); - virtual void handleXZ(shared_ptr packet); + virtual void handleTextureChange(std::shared_ptr packet); + virtual void handleTextureAndGeometryChange(std::shared_ptr packet); + virtual void handleUpdateGameRuleProgressPacket(std::shared_ptr packet); + virtual void handleXZ(std::shared_ptr packet); - void displayPrivilegeChanges(shared_ptr player, unsigned int oldPrivileges); + void displayPrivilegeChanges(std::shared_ptr player, unsigned int oldPrivileges); }; \ No newline at end of file diff --git a/Minecraft.Client/Network/PendingConnection.cpp b/Minecraft.Client/Network/PendingConnection.cpp index 8cd7b63a0..f30124234 100644 --- a/Minecraft.Client/Network/PendingConnection.cpp +++ b/Minecraft.Client/Network/PendingConnection.cpp @@ -62,7 +62,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason) // logger.info("Disconnecting " + getName() + ": " + reason); fprintf(stderr, "[PENDING] disconnect called with reason=%d at tick=%d\n", reason, _tick); app.DebugPrintf("Pending connection disconnect: %d\n", reason ); - connection->send( shared_ptr( new DisconnectPacket(reason) ) ); + connection->send( std::shared_ptr( new DisconnectPacket(reason) ) ); connection->sendAndQuit(); done = true; // } catch (Exception e) { @@ -70,7 +70,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason) // } } -void PendingConnection::handlePreLogin(shared_ptr packet) +void PendingConnection::handlePreLogin(std::shared_ptr packet) { if (packet->m_netcodeVersion != MINECRAFT_NET_VERSION) { @@ -104,7 +104,7 @@ void PendingConnection::sendPreLoginResponse() PlayerList *playerList = MinecraftServer::getInstance()->getPlayers(); for(AUTO_VAR(it, playerList->players.begin()); it != playerList->players.end(); ++it) { - shared_ptr player = *it; + std::shared_ptr player = *it; // If the offline Xuid is invalid but the online one is not then that's guest which we should ignore // If the online Xuid is invalid but the offline one is not then we are definitely an offline game so dont care about UGC @@ -129,16 +129,16 @@ void PendingConnection::sendPreLoginResponse() if (false)// server->onlineMode) // 4J - removed { loginKey = L"TOIMPLEMENT"; // 4J - todo Long.toHexString(random.nextLong()); - connection->send( shared_ptr( new PreLoginPacket(loginKey, ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion, szUniqueMapName,app.GetGameHostOption(eGameHostOption_All),hostIndex) ) ); + connection->send( std::shared_ptr( new PreLoginPacket(loginKey, ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion, szUniqueMapName,app.GetGameHostOption(eGameHostOption_All),hostIndex) ) ); } else #endif { - connection->send( shared_ptr( new PreLoginPacket(L"-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion,szUniqueMapName,app.GetGameHostOption(eGameHostOption_All),hostIndex, server->m_texturePackId) ) ); + connection->send( std::shared_ptr( new PreLoginPacket(L"-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion,szUniqueMapName,app.GetGameHostOption(eGameHostOption_All),hostIndex, server->m_texturePackId) ) ); } } -void PendingConnection::handleLogin(shared_ptr packet) +void PendingConnection::handleLogin(std::shared_ptr packet) { fprintf(stderr, "[LOGIN-SRV] handleLogin called! clientVersion=%d\n", packet->clientVersion); //name = packet->userName; @@ -199,7 +199,7 @@ void PendingConnection::handleLogin(shared_ptr packet) } -void PendingConnection::handleAcceptedLogin(shared_ptr packet) +void PendingConnection::handleAcceptedLogin(std::shared_ptr packet) { if(packet->m_ugcPlayersVersion != server->m_ugcPlayersVersion) { @@ -212,7 +212,7 @@ void PendingConnection::handleAcceptedLogin(shared_ptr packet) PlayerUID playerXuid = packet->m_offlineXuid; if(playerXuid == INVALID_XUID) playerXuid = packet->m_onlineXuid; - shared_ptr playerEntity = server->getPlayers()->getPlayerForLogin(this, name, playerXuid,packet->m_onlineXuid); + std::shared_ptr playerEntity = server->getPlayers()->getPlayerForLogin(this, name, playerXuid,packet->m_onlineXuid); if (playerEntity != NULL) { server->getPlayers()->placeNewPlayer(connection, playerEntity, packet); @@ -228,12 +228,12 @@ void PendingConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, done = true; } -void PendingConnection::handleGetInfo(shared_ptr packet) +void PendingConnection::handleGetInfo(std::shared_ptr packet) { //try { //String message = server->motd + "§" + server->players->getPlayerCount() + "§" + server->players->getMaxPlayers(); //connection->send(new DisconnectPacket(message)); - connection->send(shared_ptr(new DisconnectPacket(DisconnectPacket::eDisconnect_ServerFull) ) ); + connection->send(std::shared_ptr(new DisconnectPacket(DisconnectPacket::eDisconnect_ServerFull) ) ); connection->sendAndQuit(); server->connection->removeSpamProtection(connection->getSocket()); done = true; @@ -242,17 +242,17 @@ void PendingConnection::handleGetInfo(shared_ptr packet) //} } -void PendingConnection::handleKeepAlive(shared_ptr packet) +void PendingConnection::handleKeepAlive(std::shared_ptr packet) { // Ignore } -void PendingConnection::onUnhandledPacket(shared_ptr packet) +void PendingConnection::onUnhandledPacket(std::shared_ptr packet) { disconnect(DisconnectPacket::eDisconnect_UnexpectedPacket); } -void PendingConnection::send(shared_ptr packet) +void PendingConnection::send(std::shared_ptr packet) { connection->send(packet); } diff --git a/Minecraft.Client/Network/PendingConnection.h b/Minecraft.Client/Network/PendingConnection.h index 380c7cf39..e8c286721 100644 --- a/Minecraft.Client/Network/PendingConnection.h +++ b/Minecraft.Client/Network/PendingConnection.h @@ -24,7 +24,7 @@ private: MinecraftServer *server; int _tick; wstring name; - shared_ptr acceptedLogin; + std::shared_ptr acceptedLogin; wstring loginKey; public: @@ -32,14 +32,14 @@ public: ~PendingConnection(); void tick(); void disconnect(DisconnectPacket::eDisconnectReason reason); - virtual void handlePreLogin(shared_ptr packet); - virtual void handleLogin(shared_ptr packet); - virtual void handleAcceptedLogin(shared_ptr packet); + virtual void handlePreLogin(std::shared_ptr packet); + virtual void handleLogin(std::shared_ptr packet); + virtual void handleAcceptedLogin(std::shared_ptr packet); virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects); - virtual void handleGetInfo(shared_ptr packet); - virtual void handleKeepAlive(shared_ptr packet); - virtual void onUnhandledPacket(shared_ptr packet); - void send(shared_ptr packet); + virtual void handleGetInfo(std::shared_ptr packet); + virtual void handleKeepAlive(std::shared_ptr packet); + virtual void onUnhandledPacket(std::shared_ptr packet); + void send(std::shared_ptr packet); wstring getName(); virtual bool isServerPacketListener(); diff --git a/Minecraft.Client/Network/PlayerChunkMap.cpp b/Minecraft.Client/Network/PlayerChunkMap.cpp index 9849c96bd..edbe18c88 100644 --- a/Minecraft.Client/Network/PlayerChunkMap.cpp +++ b/Minecraft.Client/Network/PlayerChunkMap.cpp @@ -44,12 +44,12 @@ void PlayerChunkMap::flagEntitiesToBeRemoved(unsigned int *flags, bool *flagToBe { for(AUTO_VAR(it,players.begin()); it != players.end(); it++) { - shared_ptr serverPlayer = *it; + std::shared_ptr serverPlayer = *it; serverPlayer->flagEntitiesToBeRemoved(flags, flagToBeRemoved); } } -void PlayerChunkMap::PlayerChunk::add(shared_ptr player, bool sendPacket /*= true*/) +void PlayerChunkMap::PlayerChunk::add(std::shared_ptr player, bool sendPacket /*= true*/) { //app.DebugPrintf("--- Adding player to chunk x=%d\tz=%d\n",x, z); if (find(players.begin(),players.end(),player) != players.end()) @@ -66,7 +66,7 @@ void PlayerChunkMap::PlayerChunk::add(shared_ptr player, bool send player->seenChunks.insert(pos); // 4J Added the sendPacket check. See PlayerChunkMap::add for the usage - if( sendPacket ) player->connection->send( shared_ptr( new ChunkVisibilityPacket(pos.x, pos.z, true) ) ); + if( sendPacket ) player->connection->send( std::shared_ptr( new ChunkVisibilityPacket(pos.x, pos.z, true) ) ); players.push_back(player); @@ -77,7 +77,7 @@ void PlayerChunkMap::PlayerChunk::add(shared_ptr player, bool send #endif } -void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) +void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr player) { PlayerChunkMap::PlayerChunk *toDelete = NULL; @@ -121,7 +121,7 @@ void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) { for( AUTO_VAR(it, players.begin()); it < players.end(); ++it ) { - shared_ptr currPlayer = *it; + std::shared_ptr currPlayer = *it; INetworkPlayer *currNetPlayer = currPlayer->connection->getNetworkPlayer(); if( currNetPlayer != NULL && currNetPlayer->IsSameSystem( thisNetPlayer ) && currPlayer->seenChunks.find(pos) != currPlayer->seenChunks.end() ) { @@ -132,7 +132,7 @@ void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) if(noOtherPlayersFound) { //wprintf(L"Sending ChunkVisiblity packet false for chunk (%d,%d) to player %ls\n", x, z, player->name.c_str() ); - player->connection->send( shared_ptr( new ChunkVisibilityPacket(pos.x, pos.z, false) ) ); + player->connection->send( std::shared_ptr( new ChunkVisibilityPacket(pos.x, pos.z, false) ) ); } } else @@ -181,12 +181,12 @@ void PlayerChunkMap::PlayerChunk::prioritiseTileChanges() prioritised = true; } -void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) +void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr packet) { - vector< shared_ptr > sentTo; + vector< std::shared_ptr > sentTo; for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; // 4J - don't send to a player we've already sent this data to that shares the same machine. TileUpdatePacket, // ChunkTilesUpdatePacket and SignUpdatePacket all used to limit themselves to sending once to each machine @@ -205,7 +205,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) { for(unsigned int j = 0; j < sentTo.size(); j++ ) { - shared_ptr player2 = sentTo[j]; + std::shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { @@ -244,7 +244,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) for( int i = 0; i < parent->level->getServer()->getPlayers()->players.size(); i++ ) { - shared_ptr player = parent->level->getServer()->getPlayers()->players[i]; + std::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->isLocal() ) continue; @@ -267,7 +267,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) { for(unsigned int j = 0; j < sentTo.size(); j++ ) { - shared_ptr player2 = sentTo[j]; + std::shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { @@ -299,7 +299,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) int x = pos.x * 16 + xChangeMin; int y = yChangeMin; int z = pos.z * 16 + zChangeMin; - broadcast( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); + broadcast( std::shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); if (level->isEntityTile(x, y, z)) { broadcast(level->getTileEntity(x, y, z)); @@ -329,8 +329,8 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) // Block region update packets can only encode ys in a range of 1 - 256 if( ys > 256 ) ys = 256; - broadcast( shared_ptr( new BlockRegionUpdatePacket(xp, yp, zp, xs, ys, zs, level) ) ); - vector > *tes = level->getTileEntitiesInRegion(xp, yp, zp, xp + xs, yp + ys, zp + zs); + broadcast( std::shared_ptr( new BlockRegionUpdatePacket(xp, yp, zp, xs, ys, zs, level) ) ); + vector > *tes = level->getTileEntitiesInRegion(xp, yp, zp, xp + xs, yp + ys, zp + zs); for (unsigned int i = 0; i < tes->size(); i++) { broadcast(tes->at(i)); @@ -342,7 +342,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) else { // 4J As we only get here if changes is less than MAX_CHANGES_BEFORE_RESEND (10) we only need to send a byte value in the packet - broadcast( shared_ptr( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, (uint8_t)changes, level) ) ); + broadcast( std::shared_ptr( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, (uint8_t)changes, level) ) ); for (int i = 0; i < changes; i++) { int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15); @@ -361,11 +361,11 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) return didRegionUpdate; } -void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr te) +void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr te) { if (te != NULL) { - shared_ptr p = te->getUpdatePacket(); + std::shared_ptr p = te->getUpdatePacket(); if (p != NULL) { broadcast(p); @@ -458,7 +458,7 @@ PlayerChunkMap::PlayerChunk *PlayerChunkMap::getChunk(int x, int z, bool create) // 4J - added. If a chunk exists, add a player to it straight away. If it doesn't exist, // queue a request for it to be created. -void PlayerChunkMap::getChunkAndAddPlayer(int x, int z, shared_ptr player) +void PlayerChunkMap::getChunkAndAddPlayer(int x, int z, std::shared_ptr player) { __int64 id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); AUTO_VAR(it, chunks.find(id)); @@ -475,7 +475,7 @@ void PlayerChunkMap::getChunkAndAddPlayer(int x, int z, shared_ptr // 4J - added. If the chunk and player are in the queue to be added, remove from there. Otherwise // attempt to remove from main chunk map. -void PlayerChunkMap::getChunkAndRemovePlayer(int x, int z, shared_ptr player) +void PlayerChunkMap::getChunkAndRemovePlayer(int x, int z, std::shared_ptr player) { for( AUTO_VAR(it, addRequests.begin()); it != addRequests.end(); it++ ) { @@ -497,7 +497,7 @@ void PlayerChunkMap::getChunkAndRemovePlayer(int x, int z, shared_ptr player) +void PlayerChunkMap::tickAddRequests(std::shared_ptr player) { if( addRequests.size() ) { @@ -533,7 +533,7 @@ void PlayerChunkMap::tickAddRequests(shared_ptr player) } } -void PlayerChunkMap::broadcastTileUpdate(shared_ptr packet, int x, int y, int z) +void PlayerChunkMap::broadcastTileUpdate(std::shared_ptr packet, int x, int y, int z) { int xc = x >> 4; int zc = z >> 4; @@ -576,7 +576,7 @@ void PlayerChunkMap::prioritiseTileChanges(int x, int y, int z) } } -void PlayerChunkMap::add(shared_ptr player) +void PlayerChunkMap::add(std::shared_ptr player) { static int direction[4][2] = { { 1, 0 }, { 0, 1 }, { -1, 0 }, {0, -1} }; @@ -649,7 +649,7 @@ void PlayerChunkMap::add(shared_ptr player) } // CraftBukkit end - player->connection->send( shared_ptr( new ChunkVisibilityAreaPacket(minX, maxX, minZ, maxZ) ) ); + player->connection->send( std::shared_ptr( new ChunkVisibilityAreaPacket(minX, maxX, minZ, maxZ) ) ); #ifdef _LARGE_WORLDS getLevel()->cache->dontDrop(xc,zc); @@ -659,7 +659,7 @@ void PlayerChunkMap::add(shared_ptr player) } -void PlayerChunkMap::remove(shared_ptr player) +void PlayerChunkMap::remove(std::shared_ptr player) { int xc = ((int) player->lastMoveX) >> 4; int zc = ((int) player->lastMoveZ) >> 4; @@ -702,7 +702,7 @@ bool PlayerChunkMap::chunkInRange(int x, int z, int xc, int zc) // 4J - have changed this so that we queue requests to add the player to chunks if they // need to be created, so that we aren't creating potentially 20 chunks per player per tick -void PlayerChunkMap::move(shared_ptr player) +void PlayerChunkMap::move(std::shared_ptr player) { int xc = ((int) player->x) >> 4; int zc = ((int) player->z) >> 4; @@ -744,7 +744,7 @@ int PlayerChunkMap::getMaxRange() return radius * 16 - 16; } -bool PlayerChunkMap::isPlayerIn(shared_ptr player, int xChunk, int zChunk) +bool PlayerChunkMap::isPlayerIn(std::shared_ptr player, int xChunk, int zChunk) { PlayerChunk *chunk = getChunk(xChunk, zChunk, false); @@ -775,7 +775,7 @@ void PlayerChunkMap::setRadius(int newRadius) PlayerList* players = level->getServer()->getPlayerList(); for( int i = 0;i < players->players.size();i += 1 ) { - shared_ptr player = players->players[i]; + std::shared_ptr player = players->players[i]; if( player->level == level ) { int xc = ((int) player->x) >> 4; diff --git a/Minecraft.Client/Network/PlayerChunkMap.h b/Minecraft.Client/Network/PlayerChunkMap.h index e8673b6b5..17dd95a10 100644 --- a/Minecraft.Client/Network/PlayerChunkMap.h +++ b/Minecraft.Client/Network/PlayerChunkMap.h @@ -25,8 +25,8 @@ public: { public: int x,z; - shared_ptr player; - PlayerChunkAddRequest(int x, int z, shared_ptr player ) : x(x), z(z), player(player) {} + std::shared_ptr player; + PlayerChunkAddRequest(int x, int z, std::shared_ptr player ) : x(x), z(z), player(player) {} }; class PlayerChunk @@ -34,7 +34,7 @@ public: friend class PlayerChunkMap; private: PlayerChunkMap *parent; // 4J added - vector > players; + vector > players; //int x, z; ChunkPos pos; @@ -51,25 +51,25 @@ public: ~PlayerChunk(); // 4J Added sendPacket param so we can aggregate the initial send into one much smaller packet - void add(shared_ptr player, bool sendPacket = true); - void remove(shared_ptr player); + void add(std::shared_ptr player, bool sendPacket = true); + void remove(std::shared_ptr player); void tileChanged(int x, int y, int z); void prioritiseTileChanges(); // 4J added - void broadcast(shared_ptr packet); + void broadcast(std::shared_ptr packet); bool broadcastChanges(bool allowRegionUpdate); // 4J - added parm private: - void broadcast(shared_ptr te); + void broadcast(std::shared_ptr te); }; public: - vector > players; + vector > players; void flagEntitiesToBeRemoved(unsigned int *flags, bool *removedFound); // 4J added private: unordered_map<__int64,PlayerChunk *,LongKeyHash,LongKeyEq> chunks; // 4J - was LongHashMap vector changedChunks; vector addRequests; // 4J added - void tickAddRequests(shared_ptr player); // 4J added + void tickAddRequests(std::shared_ptr player); // 4J added ServerLevel *level; int radius; @@ -83,21 +83,21 @@ public: bool hasChunk(int x, int z); private: PlayerChunk *getChunk(int x, int z, bool create); - void getChunkAndAddPlayer(int x, int z, shared_ptr player); // 4J added - void getChunkAndRemovePlayer(int x, int z, shared_ptr player); // 4J added + void getChunkAndAddPlayer(int x, int z, std::shared_ptr player); // 4J added + void getChunkAndRemovePlayer(int x, int z, std::shared_ptr player); // 4J added public: - void broadcastTileUpdate(shared_ptr packet, int x, int y, int z); + void broadcastTileUpdate(std::shared_ptr packet, int x, int y, int z); void tileChanged(int x, int y, int z); bool isTrackingTile(int x, int y, int z); // 4J added void prioritiseTileChanges(int x, int y, int z); // 4J added - void add(shared_ptr player); - void remove(shared_ptr player); + void add(std::shared_ptr player); + void remove(std::shared_ptr player); private: bool chunkInRange(int x, int z, int xc, int zc); public: - void move(shared_ptr player); + void move(std::shared_ptr player); int getMaxRange(); - bool isPlayerIn(shared_ptr player, int xChunk, int zChunk); + bool isPlayerIn(std::shared_ptr player, int xChunk, int zChunk); static int convertChunkRangeToBlock(int radius); // AP added for Vita diff --git a/Minecraft.Client/Network/PlayerConnection.cpp b/Minecraft.Client/Network/PlayerConnection.cpp index 6f696d91c..f931c8bbc 100644 --- a/Minecraft.Client/Network/PlayerConnection.cpp +++ b/Minecraft.Client/Network/PlayerConnection.cpp @@ -34,7 +34,7 @@ Random PlayerConnection::random; -PlayerConnection::PlayerConnection(MinecraftServer *server, Connection *connection, shared_ptr player) +PlayerConnection::PlayerConnection(MinecraftServer *server, Connection *connection, std::shared_ptr player) { // 4J - added initialisers done = false; @@ -93,7 +93,7 @@ void PlayerConnection::tick() lastKeepAliveTick = tickCount; lastKeepAliveTime = System::nanoTime() / 1000000; lastKeepAliveId = random.nextInt(); - send( shared_ptr( new KeepAlivePacket(lastKeepAliveId) ) ); + send( std::shared_ptr( new KeepAlivePacket(lastKeepAliveId) ) ); } // if (!didTick) { // player->doTick(false); @@ -123,17 +123,17 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason) // 4J Stu - Need to remove the player from the receiving list before their socket is NULLed so that we can find another player on their system server->getPlayers()->removePlayerFromReceiving( player ); - send( shared_ptr( new DisconnectPacket(reason) )); + send( std::shared_ptr( new DisconnectPacket(reason) )); connection->sendAndQuit(); // 4J-PB - removed, since it needs to be localised in the language the client is in - //server->players->broadcastAll( shared_ptr( new ChatPacket(L"§e" + player->name + L" left the game.") ) ); + //server->players->broadcastAll( std::shared_ptr( new ChatPacket(L"§e" + player->name + L" left the game.") ) ); if(getWasKicked()) { - server->getPlayers()->broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) ); } else { - server->getPlayers()->broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) ); } server->getPlayers()->remove(player); @@ -141,12 +141,12 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason) LeaveCriticalSection(&done_cs); } -void PlayerConnection::handlePlayerInput(shared_ptr packet) +void PlayerConnection::handlePlayerInput(std::shared_ptr packet) { player->setPlayerInput(packet->getXa(), packet->getYa(), packet->isJumping(), packet->isSneaking(), packet->getXRot(), packet->getYRot()); } -void PlayerConnection::handleMovePlayer(shared_ptr packet) +void PlayerConnection::handleMovePlayer(std::shared_ptr packet) { ServerLevel *level = server->getLevel(player->dimension); @@ -391,10 +391,10 @@ void PlayerConnection::teleport(double x, double y, double z, float yRot, float player->absMoveTo(x, y, z, yRot, xRot); // 4J - note that 1.62 is added to the height here as the client connection that receives this will presume it represents y + heightOffset at that end // This is different to the way that height is sent back to the server, where it represents the bottom of the player bounding volume - if(sendPacket) player->connection->send( shared_ptr( new MovePlayerPacket::PosRot(x, y + 1.62f, y, z, yRot, xRot, false, false) ) ); + if(sendPacket) player->connection->send( std::shared_ptr( new MovePlayerPacket::PosRot(x, y + 1.62f, y, z, yRot, xRot, false, false) ) ); } -void PlayerConnection::handlePlayerAction(shared_ptr packet) +void PlayerConnection::handlePlayerAction(std::shared_ptr packet) { ServerLevel *level = server->getLevel(player->dimension); @@ -442,19 +442,19 @@ void PlayerConnection::handlePlayerAction(shared_ptr packet) if (packet->action == PlayerActionPacket::START_DESTROY_BLOCK) { if (zd > 16 || canEditSpawn) player->gameMode->startDestroyBlock(x, y, z, packet->face); - else player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); + else player->connection->send( std::shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); } else if (packet->action == PlayerActionPacket::STOP_DESTROY_BLOCK) { player->gameMode->stopDestroyBlock(x, y, z); server->getPlayers()->prioritiseTileChanges(x, y, z, level->dimension->id); // 4J added - make sure that the update packets for this get prioritised over other general world updates - if (level->getTile(x, y, z) != 0) player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); + if (level->getTile(x, y, z) != 0) player->connection->send( std::shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); } else if (packet->action == PlayerActionPacket::ABORT_DESTROY_BLOCK) { player->gameMode->abortDestroyBlock(x, y, z); - if (level->getTile(x, y, z) != 0) player->connection->send(shared_ptr( new TileUpdatePacket(x, y, z, level))); + if (level->getTile(x, y, z) != 0) player->connection->send(std::shared_ptr( new TileUpdatePacket(x, y, z, level))); } else if (packet->action == PlayerActionPacket::GET_UPDATED_BLOCK) { @@ -464,7 +464,7 @@ void PlayerConnection::handlePlayerAction(shared_ptr packet) double dist = xDist * xDist + yDist * yDist + zDist * zDist; if (dist < 16 * 16) { - player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); + player->connection->send( std::shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); } } @@ -473,10 +473,10 @@ void PlayerConnection::handlePlayerAction(shared_ptr packet) } -void PlayerConnection::handleUseItem(shared_ptr packet) +void PlayerConnection::handleUseItem(std::shared_ptr packet) { ServerLevel *level = server->getLevel(player->dimension); - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); bool informClient = false; int x = packet->getX(); int y = packet->getY(); @@ -509,14 +509,14 @@ void PlayerConnection::handleUseItem(shared_ptr packet) } else { - //player->connection->send(shared_ptr(new ChatPacket("\u00A77Height limit for building is " + server->maxBuildHeight))); + //player->connection->send(std::shared_ptr(new ChatPacket("\u00A77Height limit for building is " + server->maxBuildHeight))); informClient = true; } if (informClient) { - player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); + player->connection->send( std::shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); if (face == 0) y--; if (face == 1) y++; @@ -532,7 +532,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) // isn't what it is expecting. if( level->getTile(x,y,z) != Tile::pistonMovingPiece_Id ) { - player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); + player->connection->send( std::shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); } } @@ -554,7 +554,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) if (!ItemInstance::matches(player->inventory->getSelected(), packet->getItem())) { - send( shared_ptr( new ContainerSetSlotPacket(player->containerMenu->containerId, s->index, player->inventory->getSelected()) ) ); + send( std::shared_ptr( new ContainerSetSlotPacket(player->containerMenu->containerId, s->index, player->inventory->getSelected()) ) ); } } @@ -569,27 +569,27 @@ void PlayerConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, if( done ) return; // logger.info(player.name + " lost connection: " + reason); // 4J-PB - removed, since it needs to be localised in the language the client is in - //server->players->broadcastAll( shared_ptr( new ChatPacket(L"§e" + player->name + L" left the game.") ) ); + //server->players->broadcastAll( std::shared_ptr( new ChatPacket(L"§e" + player->name + L" left the game.") ) ); if(getWasKicked()) { - server->getPlayers()->broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) ); } else { - server->getPlayers()->broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) ); } server->getPlayers()->remove(player); done = true; LeaveCriticalSection(&done_cs); } -void PlayerConnection::onUnhandledPacket(shared_ptr packet) +void PlayerConnection::onUnhandledPacket(std::shared_ptr packet) { // logger.warning(getClass() + " wasn't prepared to deal with a " + packet.getClass()); disconnect(DisconnectPacket::eDisconnect_UnexpectedPacket); } -void PlayerConnection::send(shared_ptr packet) +void PlayerConnection::send(std::shared_ptr packet) { if( connection->getSocket() != NULL ) { @@ -607,7 +607,7 @@ void PlayerConnection::send(shared_ptr packet) } // 4J Added -void PlayerConnection::queueSend(shared_ptr packet) +void PlayerConnection::queueSend(std::shared_ptr packet) { if( connection->getSocket() != NULL ) { @@ -624,7 +624,7 @@ void PlayerConnection::queueSend(shared_ptr packet) } } -void PlayerConnection::handleSetCarriedItem(shared_ptr packet) +void PlayerConnection::handleSetCarriedItem(std::shared_ptr packet) { if (packet->slot < 0 || packet->slot >= Inventory::getSelectionSize()) { @@ -634,7 +634,7 @@ void PlayerConnection::handleSetCarriedItem(shared_ptr pac player->inventory->selected = packet->slot; } -void PlayerConnection::handleChat(shared_ptr packet) +void PlayerConnection::handleChat(std::shared_ptr packet) { // 4J - TODO #if 0 @@ -678,7 +678,7 @@ void PlayerConnection::handleCommand(const wstring& message) #endif } -void PlayerConnection::handleAnimate(shared_ptr packet) +void PlayerConnection::handleAnimate(std::shared_ptr packet) { if (packet->action == AnimatePacket::SWING) { @@ -686,7 +686,7 @@ void PlayerConnection::handleAnimate(shared_ptr packet) } } -void PlayerConnection::handlePlayerCommand(shared_ptr packet) +void PlayerConnection::handlePlayerCommand(std::shared_ptr packet) { if (packet->action == PlayerCommandPacket::START_SNEAKING) { @@ -725,7 +725,7 @@ void PlayerConnection::setShowOnMaps(bool bVal) player->setShowOnMaps(bVal); } -void PlayerConnection::handleDisconnect(shared_ptr packet) +void PlayerConnection::handleDisconnect(std::shared_ptr packet) { // 4J Stu - Need to remove the player from the receiving list before their socket is NULLed so that we can find another player on their system server->getPlayers()->removePlayerFromReceiving( player ); @@ -740,13 +740,13 @@ int PlayerConnection::countDelayedPackets() void PlayerConnection::info(const wstring& string) { // 4J-PB - removed, since it needs to be localised in the language the client is in - //send( shared_ptr( new ChatPacket(L"§7" + string) ) ); + //send( std::shared_ptr( new ChatPacket(L"§7" + string) ) ); } void PlayerConnection::warn(const wstring& string) { // 4J-PB - removed, since it needs to be localised in the language the client is in - //send( shared_ptr( new ChatPacket(L"§9" + string) ) ); + //send( std::shared_ptr( new ChatPacket(L"§9" + string) ) ); } wstring PlayerConnection::getConsoleName() @@ -754,10 +754,10 @@ wstring PlayerConnection::getConsoleName() return player->name; } -void PlayerConnection::handleInteract(shared_ptr packet) +void PlayerConnection::handleInteract(std::shared_ptr packet) { ServerLevel *level = server->getLevel(player->dimension); - shared_ptr target = level->getEntity(packet->target); + std::shared_ptr target = level->getEntity(packet->target); // Fix for #8218 - Gameplay: Attacking zombies from a different level often results in no hits being registered // 4J Stu - If the client says that we hit something, then agree with it. The canSee can fail here as it checks @@ -792,7 +792,7 @@ bool PlayerConnection::canHandleAsyncPackets() return true; } -void PlayerConnection::handleTexture(shared_ptr packet) +void PlayerConnection::handleTexture(std::shared_ptr packet) { // Both PlayerConnection and ClientConnection should handle this mostly the same way @@ -808,7 +808,7 @@ void PlayerConnection::handleTexture(shared_ptr packet) if(dwBytes!=0) { - send( shared_ptr( new TexturePacket(packet->textureName,pbData,dwBytes) ) ); + send( std::shared_ptr( new TexturePacket(packet->textureName,pbData,dwBytes) ) ); } else { @@ -826,7 +826,7 @@ void PlayerConnection::handleTexture(shared_ptr packet) } } -void PlayerConnection::handleTextureAndGeometry(shared_ptr packet) +void PlayerConnection::handleTextureAndGeometry(std::shared_ptr packet) { // Both PlayerConnection and ClientConnection should handle this mostly the same way @@ -848,11 +848,11 @@ void PlayerConnection::handleTextureAndGeometry(shared_ptrgetAdditionalBoxesCount()!=0) { - send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pDLCSkinFile) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pDLCSkinFile) ) ); } else { - send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes) ) ); } } else @@ -861,7 +861,7 @@ void PlayerConnection::handleTextureAndGeometry(shared_ptr *pvSkinBoxes = app.GetAdditionalSkinBoxes(packet->dwSkinID); unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID); - send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pvSkinBoxes,uiAnimOverrideBitmask) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pvSkinBoxes,uiAnimOverrideBitmask) ) ); } } else @@ -906,7 +906,7 @@ void PlayerConnection::handleTextureReceived(const wstring &textureName) if(dwBytes!=0) { - send( shared_ptr( new TexturePacket(textureName,pbData,dwBytes) ) ); + send( std::shared_ptr( new TexturePacket(textureName,pbData,dwBytes) ) ); m_texturesRequested.erase(it); } } @@ -927,7 +927,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(const wstring &textureNa { if(pDLCSkinFile && (pDLCSkinFile->getAdditionalBoxesCount()!=0)) { - send( shared_ptr( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes,pDLCSkinFile) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes,pDLCSkinFile) ) ); } else { @@ -936,14 +936,14 @@ void PlayerConnection::handleTextureAndGeometryReceived(const wstring &textureNa vector *pvSkinBoxes = app.GetAdditionalSkinBoxes(dwSkinID); unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(dwSkinID); - send( shared_ptr( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask) ) ); } m_texturesRequested.erase(it); } } } -void PlayerConnection::handleTextureChange(shared_ptr packet) +void PlayerConnection::handleTextureChange(std::shared_ptr packet) { switch(packet->action) { @@ -968,7 +968,7 @@ 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(std::shared_ptr( new TexturePacket(packet->path,NULL,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) @@ -976,10 +976,10 @@ void PlayerConnection::handleTextureChange(shared_ptr packe // Update the ref count on the memory texture data app.AddMemoryTextureFile(packet->path,NULL,0); } - server->getPlayers()->broadcastAll( shared_ptr( new TextureChangePacket(player,packet->action,packet->path) ), player->dimension ); + server->getPlayers()->broadcastAll( std::shared_ptr( new TextureChangePacket(player,packet->action,packet->path) ), player->dimension ); } -void PlayerConnection::handleTextureAndGeometryChange(shared_ptr packet) +void PlayerConnection::handleTextureAndGeometryChange(std::shared_ptr packet) { player->setCustomSkin( app.getSkinIdFromPath( packet->path ) ); @@ -995,7 +995,7 @@ void PlayerConnection::handleTextureAndGeometryChange(shared_ptrpath.c_str(), player->name.c_str()); #endif - send(shared_ptr( new TextureAndGeometryPacket(packet->path,NULL,0) ) ); + send(std::shared_ptr( new TextureAndGeometryPacket(packet->path,NULL,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) @@ -1009,10 +1009,10 @@ void PlayerConnection::handleTextureAndGeometryChange(shared_ptrdwSkinID,) //DebugBreak(); } - server->getPlayers()->broadcastAll( shared_ptr( new TextureAndGeometryChangePacket(player,packet->path) ), player->dimension ); + server->getPlayers()->broadcastAll( std::shared_ptr( new TextureAndGeometryChangePacket(player,packet->path) ), player->dimension ); } -void PlayerConnection::handleServerSettingsChanged(shared_ptr packet) +void PlayerConnection::handleServerSettingsChanged(std::shared_ptr packet) { if(packet->action==ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS) { @@ -1024,7 +1024,7 @@ void PlayerConnection::handleServerSettingsChanged(shared_ptrdata,eGameHostOption_FireSpreads)); app.SetGameHostOption(eGameHostOption_TNT, app.GetGameHostOption(packet->data,eGameHostOption_TNT)); - server->getPlayers()->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS,app.GetGameHostOption(eGameHostOption_All) ) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS,app.GetGameHostOption(eGameHostOption_All) ) ) ); // Update the QoS data g_NetworkManager.UpdateAndSetGameSessionData(); @@ -1032,7 +1032,7 @@ void PlayerConnection::handleServerSettingsChanged(shared_ptr packet) +void PlayerConnection::handleKickPlayer(std::shared_ptr packet) { INetworkPlayer *networkPlayer = getNetworkPlayer(); if( (networkPlayer != NULL && networkPlayer->IsHost()) || player->isModerator()) @@ -1041,12 +1041,12 @@ void PlayerConnection::handleKickPlayer(shared_ptr packet) } } -void PlayerConnection::handleGameCommand(shared_ptr packet) +void PlayerConnection::handleGameCommand(std::shared_ptr packet) { MinecraftServer::getInstance()->getCommandDispatcher()->performCommand(player, packet->command, packet->data); } -void PlayerConnection::handleClientCommand(shared_ptr packet) +void PlayerConnection::handleClientCommand(std::shared_ptr packet) { if (packet->action == ClientCommandPacket::PERFORM_RESPAWN) { @@ -1078,17 +1078,17 @@ void PlayerConnection::handleClientCommand(shared_ptr packe } } -void PlayerConnection::handleRespawn(shared_ptr packet) +void PlayerConnection::handleRespawn(std::shared_ptr packet) { } -void PlayerConnection::handleContainerClose(shared_ptr packet) +void PlayerConnection::handleContainerClose(std::shared_ptr packet) { player->doCloseContainer(); } #ifndef _CONTENT_PACKAGE -void PlayerConnection::handleContainerSetSlot(shared_ptr packet) +void PlayerConnection::handleContainerSetSlot(std::shared_ptr packet) { if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_CARRIED ) { @@ -1098,7 +1098,7 @@ 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(); + std::shared_ptr lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem(); if (packet->item != NULL) { if (lastItem == NULL || lastItem->count < packet->item->count) @@ -1124,16 +1124,16 @@ void PlayerConnection::handleContainerSetSlot(shared_ptr } #endif -void PlayerConnection::handleContainerClick(shared_ptr packet) +void PlayerConnection::handleContainerClick(std::shared_ptr packet) { if (player->containerMenu->containerId == packet->containerId && player->containerMenu->isSynched(player)) { - shared_ptr clicked = player->containerMenu->clicked(packet->slotNum, packet->buttonNum, packet->quickKey?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, player); + std::shared_ptr clicked = player->containerMenu->clicked(packet->slotNum, packet->buttonNum, packet->quickKey?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, player); if (ItemInstance::matches(packet->item, clicked)) { // Yep, you sure did click what you claimed to click! - player->connection->send( shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, true) ) ); + player->connection->send( std::shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, true) ) ); player->ignoreSlotUpdateHack = true; player->containerMenu->broadcastChanges(); player->broadcastCarriedItem(); @@ -1143,10 +1143,10 @@ void PlayerConnection::handleContainerClick(shared_ptr pac { // No, you clicked the wrong thing! expectedAcks[player->containerMenu->containerId] = packet->uid; - player->connection->send( shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, false) ) ); + player->connection->send( std::shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, false) ) ); player->containerMenu->setSynched(player, false); - vector > items; + vector > items; for (unsigned int i = 0; i < player->containerMenu->slots->size(); i++) { items.push_back(player->containerMenu->slots->at(i)->getItem()); @@ -1159,7 +1159,7 @@ void PlayerConnection::handleContainerClick(shared_ptr pac } -void PlayerConnection::handleContainerButtonClick(shared_ptr packet) +void PlayerConnection::handleContainerButtonClick(std::shared_ptr packet) { if (player->containerMenu->containerId == packet->containerId && player->containerMenu->isSynched(player)) { @@ -1168,12 +1168,12 @@ void PlayerConnection::handleContainerButtonClick(shared_ptr packet) +void PlayerConnection::handleSetCreativeModeSlot(std::shared_ptr packet) { if (player->gameMode->isCreative()) { bool drop = packet->slotNum < 0; - shared_ptr item = packet->item; + std::shared_ptr item = packet->item; if(item != NULL && item->id == Item::map_Id) { @@ -1189,7 +1189,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptrsetAuxValue( player->level->getAuxValueForMap(player->getXuid(), player->dimension, centreXC, centreZC, mapScale) ); - shared_ptr data = MapItem::getSavedData(item->getAuxValue(), player->level); + std::shared_ptr data = MapItem::getSavedData(item->getAuxValue(), player->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 wchar_t buf[64]; @@ -1197,9 +1197,9 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptr( new MapItemSavedData(id) ); + data = std::shared_ptr( new MapItemSavedData(id) ); } - player->level->setSavedData(id, (shared_ptr ) data); + player->level->setSavedData(id, (std::shared_ptr ) data); data->scale = mapScale; // 4J-PB - for Xbox maps, we'll centre them on the origin of the world, since we can fit the whole world in our map @@ -1232,7 +1232,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptr dropped = player->drop(item); + std::shared_ptr dropped = player->drop(item); if (dropped != NULL) { dropped->setShortLifeTime(); @@ -1244,7 +1244,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptr > items; + vector > items; for (unsigned int i = 0; i < player->inventoryMenu->slots->size(); i++) { items.push_back(player->inventoryMenu->slots->at(i)->getItem()); @@ -1254,7 +1254,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptr packet) +void PlayerConnection::handleContainerAck(std::shared_ptr packet) { AUTO_VAR(it, expectedAcks.find(player->containerMenu->containerId)); @@ -1264,18 +1264,18 @@ void PlayerConnection::handleContainerAck(shared_ptr packet) } } -void PlayerConnection::handleSignUpdate(shared_ptr packet) +void PlayerConnection::handleSignUpdate(std::shared_ptr packet) { app.DebugPrintf("PlayerConnection::handleSignUpdate\n"); ServerLevel *level = server->getLevel(player->dimension); if (level->hasChunkAt(packet->x, packet->y, packet->z)) { - shared_ptr te = level->getTileEntity(packet->x, packet->y, packet->z); + std::shared_ptr te = level->getTileEntity(packet->x, packet->y, packet->z); if (dynamic_pointer_cast(te) != NULL) { - shared_ptr ste = dynamic_pointer_cast(te); + std::shared_ptr ste = dynamic_pointer_cast(te); if (!ste->isEditable()) { server->warn(L"Player " + player->name + L" just tried to change non-editable sign"); @@ -1289,7 +1289,7 @@ void PlayerConnection::handleSignUpdate(shared_ptr packet) int x = packet->x; int y = packet->y; int z = packet->z; - shared_ptr ste = dynamic_pointer_cast(te); + std::shared_ptr ste = dynamic_pointer_cast(te); for (int i = 0; i < 4; i++) { wstring lineText = packet->lines[i].substr(0,15); @@ -1303,7 +1303,7 @@ void PlayerConnection::handleSignUpdate(shared_ptr packet) } -void PlayerConnection::handleKeepAlive(shared_ptr packet) +void PlayerConnection::handleKeepAlive(std::shared_ptr packet) { if (packet->id == lastKeepAliveId) { @@ -1312,18 +1312,18 @@ void PlayerConnection::handleKeepAlive(shared_ptr packet) } } -void PlayerConnection::handlePlayerInfo(shared_ptr packet) +void PlayerConnection::handlePlayerInfo(std::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() ) { - shared_ptr serverPlayer; + std::shared_ptr serverPlayer; // Find the player being edited for(AUTO_VAR(it, server->getPlayers()->players.begin()); it != server->getPlayers()->players.end(); ++it) { - shared_ptr checkingPlayer = *it; + std::shared_ptr checkingPlayer = *it; if(checkingPlayer->connection->getNetworkPlayer() != NULL && checkingPlayer->connection->getNetworkPlayer()->GetSmallId() == packet->m_networkSmallId) { serverPlayer = checkingPlayer; @@ -1348,7 +1348,7 @@ void PlayerConnection::handlePlayerInfo(shared_ptr packet) #endif serverPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_CreativeMode,Player::getPlayerGamePrivilege(packet->m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode) ); serverPlayer->gameMode->setGameModeForPlayer(gameType); - serverPlayer->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, gameType->getId()) )); + serverPlayer->connection->send( std::shared_ptr( new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, gameType->getId()) )); } else { @@ -1400,7 +1400,7 @@ void PlayerConnection::handlePlayerInfo(shared_ptr packet) } } - server->getPlayers()->broadcastAll( shared_ptr( new PlayerInfoPacket( serverPlayer ) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new PlayerInfoPacket( serverPlayer ) ) ); } } } @@ -1410,7 +1410,7 @@ bool PlayerConnection::isServerPacketListener() return true; } -void PlayerConnection::handlePlayerAbilities(shared_ptr playerAbilitiesPacket) +void PlayerConnection::handlePlayerAbilities(std::shared_ptr playerAbilitiesPacket) { player->abilities.flying = playerAbilitiesPacket->isFlying() && player->abilities.mayfly; } @@ -1427,19 +1427,19 @@ void PlayerConnection::handlePlayerAbilities(shared_ptr p // player.connection.send(new ChatAutoCompletePacket(result.toString())); //} -//void handleClientInformation(shared_ptr packet) +//void handleClientInformation(std::shared_ptr packet) //{ // player->updateOptions(packet); //} -void PlayerConnection::handleCustomPayload(shared_ptr customPayloadPacket) +void PlayerConnection::handleCustomPayload(std::shared_ptr customPayloadPacket) { #if 0 if (CustomPayloadPacket.CUSTOM_BOOK_PACKET.equals(customPayloadPacket.identifier)) { ByteArrayInputStream bais(customPayloadPacket->data); DataInputStream input(&bais); - shared_ptr sentItem = Packet::readItem(input); + std::shared_ptr sentItem = Packet::readItem(input); if (!WritingBookItem.makeSureTagIsValid(sentItem.getTag())) { @@ -1510,13 +1510,13 @@ void PlayerConnection::handleCustomPayload(shared_ptr custo // 4J Added -void PlayerConnection::handleDebugOptions(shared_ptr packet) +void PlayerConnection::handleDebugOptions(std::shared_ptr packet) { //Player player = dynamic_pointer_cast( player->shared_from_this() ); player->SetDebugOptions(packet->m_uiVal); } -void PlayerConnection::handleCraftItem(shared_ptr packet) +void PlayerConnection::handleCraftItem(std::shared_ptr packet) { int iRecipe = packet->recipe; @@ -1524,7 +1524,7 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) return; Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray(); - shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); + std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); if(app.DebugSettingsOn() && (player->GetDebugOptions()&(1L< packet) { for(int j=0;j ingItemInst = nullptr; + std::shared_ptr ingItemInst = nullptr; // do we need to remove a specific aux value? if(pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]!=Recipes::ANY_AUX_VALUE) { @@ -1568,7 +1568,7 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) if (ingItemInst->getItem()->hasCraftingRemainingItem()) { // replace item with remaining result - player->inventory->add( shared_ptr( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) ); + player->inventory->add( std::shared_ptr( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) ); } } @@ -1586,7 +1586,7 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) { // 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 - vector > items; + vector > items; for (unsigned int i = 0; i < player->containerMenu->slots->size(); i++) { items.push_back(player->containerMenu->slots->at(i)->getItem()); @@ -1625,7 +1625,7 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) } -void PlayerConnection::handleTradeItem(shared_ptr packet) +void PlayerConnection::handleTradeItem(std::shared_ptr packet) { if (player->containerMenu->containerId == packet->containerId) { @@ -1642,8 +1642,8 @@ void PlayerConnection::handleTradeItem(shared_ptr packet) if(!activeRecipe->isDeprecated()) { // Do we have the ingredients? - shared_ptr buyAItem = activeRecipe->getBuyAItem(); - shared_ptr buyBItem = activeRecipe->getBuyBItem(); + std::shared_ptr buyAItem = activeRecipe->getBuyAItem(); + std::shared_ptr buyBItem = activeRecipe->getBuyBItem(); int buyAMatches = player->inventory->countMatches(buyAItem); int buyBMatches = player->inventory->countMatches(buyBItem); @@ -1656,7 +1656,7 @@ void PlayerConnection::handleTradeItem(shared_ptr packet) player->inventory->removeResources(buyBItem); // Add the item we have purchased - shared_ptr result = activeRecipe->getSellItem()->copy(); + std::shared_ptr result = activeRecipe->getSellItem()->copy(); // 4J JEV - Award itemsBought stat. player->awardStat( diff --git a/Minecraft.Client/Network/PlayerConnection.h b/Minecraft.Client/Network/PlayerConnection.h index 83c2729ca..daa8926d6 100644 --- a/Minecraft.Client/Network/PlayerConnection.h +++ b/Minecraft.Client/Network/PlayerConnection.h @@ -25,7 +25,7 @@ public: private: MinecraftServer *server; - shared_ptr player; + std::shared_ptr player; int tickCount; int aboveGroundTickCount; @@ -40,7 +40,7 @@ private: bool m_bHasClientTickedOnce; public: - PlayerConnection(MinecraftServer *server, Connection *connection, shared_ptr player); + PlayerConnection(MinecraftServer *server, Connection *connection, std::shared_ptr player); ~PlayerConnection(); void tick(); void disconnect(DisconnectPacket::eDisconnectReason reason); @@ -50,32 +50,32 @@ private: bool synched; public: - virtual void handlePlayerInput(shared_ptr packet); - virtual void handleMovePlayer(shared_ptr packet); + virtual void handlePlayerInput(std::shared_ptr packet); + virtual void handleMovePlayer(std::shared_ptr packet); void teleport(double x, double y, double z, float yRot, float xRot, bool sendPacket = true); // 4J Added sendPacket param - virtual void handlePlayerAction(shared_ptr packet); - virtual void handleUseItem(shared_ptr packet); + virtual void handlePlayerAction(std::shared_ptr packet); + virtual void handleUseItem(std::shared_ptr packet); virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects); - virtual void onUnhandledPacket(shared_ptr packet); - void send(shared_ptr packet); - void queueSend(shared_ptr packet); // 4J Added - virtual void handleSetCarriedItem(shared_ptr packet); - virtual void handleChat(shared_ptr packet); + virtual void onUnhandledPacket(std::shared_ptr packet); + void send(std::shared_ptr packet); + void queueSend(std::shared_ptr packet); // 4J Added + virtual void handleSetCarriedItem(std::shared_ptr packet); + virtual void handleChat(std::shared_ptr packet); private: void handleCommand(const wstring& message); public: - virtual void handleAnimate(shared_ptr packet); - virtual void handlePlayerCommand(shared_ptr packet); - virtual void handleDisconnect(shared_ptr packet); + virtual void handleAnimate(std::shared_ptr packet); + virtual void handlePlayerCommand(std::shared_ptr packet); + virtual void handleDisconnect(std::shared_ptr packet); int countDelayedPackets(); virtual void info(const wstring& string); virtual void warn(const wstring& string); virtual wstring getConsoleName(); - virtual void handleInteract(shared_ptr packet); + virtual void handleInteract(std::shared_ptr packet); bool canHandleAsyncPackets(); - virtual void handleClientCommand(shared_ptr packet); - virtual void handleRespawn(shared_ptr packet); - virtual void handleContainerClose(shared_ptr packet); + virtual void handleClientCommand(std::shared_ptr packet); + virtual void handleRespawn(std::shared_ptr packet); + virtual void handleContainerClose(std::shared_ptr packet); private: unordered_map expectedAcks; @@ -83,38 +83,38 @@ private: public: // 4J Stu - Handlers only valid in debug mode #ifndef _CONTENT_PACKAGE - virtual void handleContainerSetSlot(shared_ptr packet); + virtual void handleContainerSetSlot(std::shared_ptr packet); #endif - virtual void handleContainerClick(shared_ptr packet); - virtual void handleContainerButtonClick(shared_ptr packet); - virtual void handleSetCreativeModeSlot(shared_ptr packet); - virtual void handleContainerAck(shared_ptr packet); - virtual void handleSignUpdate(shared_ptr packet); - virtual void handleKeepAlive(shared_ptr packet); - virtual void handlePlayerInfo(shared_ptr packet); // 4J Added + virtual void handleContainerClick(std::shared_ptr packet); + virtual void handleContainerButtonClick(std::shared_ptr packet); + virtual void handleSetCreativeModeSlot(std::shared_ptr packet); + virtual void handleContainerAck(std::shared_ptr packet); + virtual void handleSignUpdate(std::shared_ptr packet); + virtual void handleKeepAlive(std::shared_ptr packet); + virtual void handlePlayerInfo(std::shared_ptr packet); // 4J Added virtual bool isServerPacketListener(); - virtual void handlePlayerAbilities(shared_ptr playerAbilitiesPacket); - virtual void handleCustomPayload(shared_ptr customPayloadPacket); + virtual void handlePlayerAbilities(std::shared_ptr playerAbilitiesPacket); + virtual void handleCustomPayload(std::shared_ptr customPayloadPacket); // 4J Added - virtual void handleCraftItem(shared_ptr packet); - virtual void handleTradeItem(shared_ptr packet); - virtual void handleDebugOptions(shared_ptr packet); - virtual void handleTexture(shared_ptr packet); - virtual void handleTextureAndGeometry(shared_ptr packet); - virtual void handleTextureChange(shared_ptr packet); - virtual void handleTextureAndGeometryChange(shared_ptr packet); - virtual void handleServerSettingsChanged(shared_ptr packet); - virtual void handleKickPlayer(shared_ptr packet); - virtual void handleGameCommand(shared_ptr packet); + virtual void handleCraftItem(std::shared_ptr packet); + virtual void handleTradeItem(std::shared_ptr packet); + virtual void handleDebugOptions(std::shared_ptr packet); + virtual void handleTexture(std::shared_ptr packet); + virtual void handleTextureAndGeometry(std::shared_ptr packet); + virtual void handleTextureChange(std::shared_ptr packet); + virtual void handleTextureAndGeometryChange(std::shared_ptr packet); + virtual void handleServerSettingsChanged(std::shared_ptr packet); + virtual void handleKickPlayer(std::shared_ptr packet); + virtual void handleGameCommand(std::shared_ptr packet); INetworkPlayer *getNetworkPlayer(); bool isLocal(); bool isGuest(); // 4J Added as we need to set this from outside sometimes - void setPlayer(shared_ptr player) { this->player = player; } - shared_ptr getPlayer() { return player; } + void setPlayer(std::shared_ptr player) { this->player = player; } + std::shared_ptr getPlayer() { return player; } // 4J Added to signal a disconnect from another thread void closeOnTick() { m_bCloseOnTick = true; } diff --git a/Minecraft.Client/Network/PlayerList.cpp b/Minecraft.Client/Network/PlayerList.cpp index 8f0a52f45..bfda41a48 100644 --- a/Minecraft.Client/Network/PlayerList.cpp +++ b/Minecraft.Client/Network/PlayerList.cpp @@ -72,7 +72,7 @@ PlayerList::~PlayerList() DeleteCriticalSection(&m_closePlayersCS); } -void PlayerList::placeNewPlayer(Connection *connection, shared_ptr player, shared_ptr packet) +void PlayerList::placeNewPlayer(Connection *connection, std::shared_ptr player, std::shared_ptr packet) { bool newPlayer = load(player); player->setLevel(server->getLevel(player->dimension)); @@ -127,8 +127,8 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr player->setCustomCape( packet->m_playerCapeId ); // 4J-JEV: Moved this here so we can send player-model texture and geometry data. - shared_ptr playerConnection = shared_ptr(new PlayerConnection(server, connection, player)); - //player->connection = playerConnection; // Used to be assigned in PlayerConnection ctor but moved out so we can use shared_ptr + std::shared_ptr playerConnection = std::shared_ptr(new PlayerConnection(server, connection, player)); + //player->connection = playerConnection; // Used to be assigned in PlayerConnection ctor but moved out so we can use std::shared_ptr if(newPlayer) { @@ -143,7 +143,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr int centreZC = 0; #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 ) ) ) ); + player->inventory->setItem( 9, std::shared_ptr( new ItemInstance(Item::map_Id, 1, level->getAuxValueForMap(player->getXuid(),0,centreXC, centreZC, mapScale ) ) ) ); if(app.getGameRuleDefinitions() != NULL) { app.getGameRuleDefinitions()->postProcessPlayer(player); @@ -157,7 +157,7 @@ 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(std::shared_ptr( new TextureAndGeometryPacket(player->customTextureUrl,NULL,0) ) ); } } else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl)) @@ -173,7 +173,7 @@ 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(std::shared_ptr( new TexturePacket(player->customTextureUrl2,NULL,0) ) ); } } else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2)) @@ -196,8 +196,8 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_CreativeMode,player->gameMode->getGameModeForPlayer()->getId() ); } - //shared_ptr playerConnection = shared_ptr(new PlayerConnection(server, connection, player)); - player->connection = playerConnection; // Used to be assigned in PlayerConnection ctor but moved out so we can use shared_ptr + //std::shared_ptr playerConnection = std::shared_ptr(new PlayerConnection(server, connection, player)); + player->connection = playerConnection; // Used to be assigned in PlayerConnection ctor but moved out so we can use std::shared_ptr // 4J Added to store UGC settings playerConnection->m_friendsOnlyUGC = packet->m_friendsOnlyUGC; @@ -209,19 +209,19 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr addPlayerToReceiving( player ); - playerConnection->send( shared_ptr( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), + playerConnection->send( std::shared_ptr( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), (uint8_t) level->dimension->id, (uint8_t) level->getMaxBuildHeight(), (uint8_t) getMaxPlayers(), level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), (BYTE)playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(), level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale() ) ) ); - playerConnection->send( shared_ptr( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) ); - playerConnection->send( shared_ptr( new PlayerAbilitiesPacket(&player->abilities)) ); + playerConnection->send( std::shared_ptr( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) ); + playerConnection->send( std::shared_ptr( new PlayerAbilitiesPacket(&player->abilities)) ); delete spawnPos; sendLevelInfo(player, level); // 4J-PB - removed, since it needs to be localised in the language the client is in - //server->players->broadcastAll( shared_ptr( new ChatPacket(L"§e" + playerEntity->name + L" joined the game.") ) ); - broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerJoinedGame) ) ); + //server->players->broadcastAll( std::shared_ptr( new ChatPacket(L"§e" + playerEntity->name + L" joined the game.") ) ); + broadcastAll( std::shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerJoinedGame) ) ); MemSect(14); add(player); @@ -231,13 +231,13 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr playerConnection->teleport(player->x, player->y, player->z, player->yRot, player->xRot); server->getConnection()->addPlayerConnection(playerConnection); - playerConnection->send( shared_ptr( new SetTimePacket(level->getTime()) ) ); + playerConnection->send( std::shared_ptr( new SetTimePacket(level->getTime()) ) ); AUTO_VAR(activeEffects, player->getActiveEffects()); for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it) { MobEffectInstance *effect = *it; - playerConnection->send(shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); + playerConnection->send(std::shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); } player->initMenu(); @@ -249,7 +249,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr { for(AUTO_VAR(it, players.begin()); it != players.end(); ++it) { - shared_ptr servPlayer = *it; + std::shared_ptr servPlayer = *it; INetworkPlayer *checkPlayer = servPlayer->connection->getNetworkPlayer(); if(thisPlayer != checkPlayer && checkPlayer != NULL && thisPlayer->IsSameSystem( checkPlayer ) && servPlayer->wonGame ) { @@ -265,7 +265,7 @@ void PlayerList::setLevel(ServerLevelArray levels) playerIo = levels[0]->getLevelStorage()->getPlayerIO(); } -void PlayerList::changeDimension(shared_ptr player, ServerLevel *from) +void PlayerList::changeDimension(std::shared_ptr player, ServerLevel *from) { ServerLevel *to = player->getLevel(); @@ -281,12 +281,12 @@ int PlayerList::getMaxRange() } // 4J Changed return val to bool to check if new player or loaded player -bool PlayerList::load(shared_ptr player) +bool PlayerList::load(std::shared_ptr player) { return playerIo->load(player); } -void PlayerList::save(shared_ptr player) +void PlayerList::save(std::shared_ptr player) { playerIo->save(player); } @@ -295,7 +295,7 @@ void PlayerList::save(shared_ptr player) // Add this function to take some of the code from the PlayerList::add function with the fixes // for checking spawn area, especially in the nether. These needed to be done in a different order from before // Fix for #13150 - When a player loads/joins a game after saving/leaving in the nether, sometimes they are spawned on top of the nether and cannot mine down -void PlayerList::validatePlayerSpawnPosition(shared_ptr player) +void PlayerList::validatePlayerSpawnPosition(std::shared_ptr player) { // 4J Stu - Some adjustments to make sure the current players position is correct // Make sure that the player is on the ground, and in the centre x/z of the current column @@ -359,12 +359,12 @@ void PlayerList::validatePlayerSpawnPosition(shared_ptr player) } } -void PlayerList::add(shared_ptr player) +void PlayerList::add(std::shared_ptr player) { - //broadcastAll(shared_ptr( new PlayerInfoPacket(player->name, true, 1000) ) ); + //broadcastAll(std::shared_ptr( new PlayerInfoPacket(player->name, true, 1000) ) ); if( player->connection->getNetworkPlayer() ) { - broadcastAll(shared_ptr( new PlayerInfoPacket( player ) ) ); + broadcastAll(std::shared_ptr( new PlayerInfoPacket( player ) ) ); } players.push_back(player); @@ -386,36 +386,36 @@ void PlayerList::add(shared_ptr player) for (int i = 0; i < players.size(); i++) { - shared_ptr op = players.at(i); - //player->connection->send(shared_ptr( new PlayerInfoPacket(op->name, true, op->latency) ) ); + std::shared_ptr op = players.at(i); + //player->connection->send(std::shared_ptr( new PlayerInfoPacket(op->name, true, op->latency) ) ); if( op->connection->getNetworkPlayer() ) { - player->connection->send(shared_ptr( new PlayerInfoPacket( op ) ) ); + player->connection->send(std::shared_ptr( new PlayerInfoPacket( op ) ) ); } } if(level->isAtLeastOnePlayerSleeping()) { - shared_ptr firstSleepingPlayer = nullptr; + std::shared_ptr firstSleepingPlayer = nullptr; for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr thisPlayer = players[i]; + std::shared_ptr thisPlayer = players[i]; if(thisPlayer->isSleeping()) { if(firstSleepingPlayer == NULL) firstSleepingPlayer = thisPlayer; - thisPlayer->connection->send(shared_ptr( new ChatPacket(thisPlayer->name, ChatPacket::e_ChatBedMeSleep))); + thisPlayer->connection->send(std::shared_ptr( new ChatPacket(thisPlayer->name, ChatPacket::e_ChatBedMeSleep))); } } - player->connection->send(shared_ptr( new ChatPacket(firstSleepingPlayer->name, ChatPacket::e_ChatBedPlayerSleep))); + player->connection->send(std::shared_ptr( new ChatPacket(firstSleepingPlayer->name, ChatPacket::e_ChatBedPlayerSleep))); } } -void PlayerList::move(shared_ptr player) +void PlayerList::move(std::shared_ptr player) { player->getLevel()->getChunkMap()->move(player); } -void PlayerList::remove(shared_ptr player) +void PlayerList::remove(std::shared_ptr player) { save(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 @@ -428,7 +428,7 @@ void PlayerList::remove(shared_ptr player) { players.erase(it); } - //broadcastAll(shared_ptr( new PlayerInfoPacket(player->name, false, 9999) ) ); + //broadcastAll(std::shared_ptr( new PlayerInfoPacket(player->name, false, 9999) ) ); removePlayerFromReceiving(player); player->connection = nullptr; // Must remove reference to connection, or else there is a circular dependency @@ -439,15 +439,15 @@ void PlayerList::remove(shared_ptr player) saveAll(NULL,false); } -shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendingConnection, const wstring& userName, PlayerUID xuid, PlayerUID onlineXuid) +std::shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendingConnection, const wstring& userName, PlayerUID xuid, PlayerUID onlineXuid) { if (players.size() >= maxPlayers) { pendingConnection->disconnect(DisconnectPacket::eDisconnect_ServerFull); - return shared_ptr(); + return std::shared_ptr(); } - shared_ptr player = shared_ptr(new ServerPlayer(server, server->getLevel(0), userName, new ServerPlayerGameMode(server->getLevel(0)) )); + std::shared_ptr player = std::shared_ptr(new ServerPlayer(server, server->getLevel(0), userName, new ServerPlayerGameMode(server->getLevel(0)) )); player->gameMode->player = player; // 4J added as had to remove this assignment from ServerPlayer ctor player->setXuid( xuid ); // 4J Added player->setOnlineXuid( onlineXuid ); // 4J Added @@ -469,7 +469,7 @@ shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendin return player; } -shared_ptr PlayerList::respawn(shared_ptr serverPlayer, int targetDimension, bool keepAllPlayerData) +std::shared_ptr PlayerList::respawn(std::shared_ptr serverPlayer, int targetDimension, bool keepAllPlayerData) { // How we handle the entity tracker depends on whether we are the primary player currently, and whether there will be any player in the same system in the same dimension once we finish respawning. bool isPrimary = canReceiveAllPackets(serverPlayer); // Is this the primary player in its current dimension? @@ -483,7 +483,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay for( unsigned int i = 0; i < players.size(); i++ ) { - shared_ptr ep = players[i]; + std::shared_ptr ep = players[i]; if( ep == serverPlayer ) continue; if( ep->dimension != oldDimension ) continue; @@ -540,7 +540,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay PlayerUID playerXuid = serverPlayer->getXuid(); PlayerUID playerOnlineXuid = serverPlayer->getOnlineXuid(); - shared_ptr player = shared_ptr(new ServerPlayer(server, server->getLevel(serverPlayer->dimension), serverPlayer->name, new ServerPlayerGameMode(server->getLevel(serverPlayer->dimension)))); + std::shared_ptr player = std::shared_ptr(new ServerPlayer(server, server->getLevel(serverPlayer->dimension), serverPlayer->name, new ServerPlayerGameMode(server->getLevel(serverPlayer->dimension)))); player->restoreFrom(serverPlayer, keepAllPlayerData); if (keepAllPlayerData) { @@ -598,7 +598,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay } else { - player->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::NO_RESPAWN_BED_AVAILABLE, 0) ) ); + player->connection->send( std::shared_ptr( new GameEventPacket(GameEventPacket::NO_RESPAWN_BED_AVAILABLE, 0) ) ); } delete bedPosition; } @@ -611,7 +611,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay player->setPos(player->x, player->y + 1, player->z); } - player->connection->send( shared_ptr( new RespawnPacket((char) player->dimension, player->level->getSeed(), player->level->getMaxBuildHeight(), + player->connection->send( std::shared_ptr( new RespawnPacket((char) player->dimension, player->level->getSeed(), player->level->getMaxBuildHeight(), player->gameMode->getGameModeForPlayer(), level->difficulty, level->getLevelData()->getGenerator(), player->level->useNewSeaLevel(), player->entityId, level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale()) ) ); player->connection->teleport(player->x, player->y, player->z, player->yRot, player->xRot); @@ -623,7 +623,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay { MobEffectInstance *effect = *it; - player->connection->send(shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); + player->connection->send(std::shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); } delete activeEffects; player->getEntityData()->markDirty(Mob::DATA_EFFECT_COLOR_ID); @@ -654,7 +654,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay } -void PlayerList::toggleDimension(shared_ptr player, int targetDimension) +void PlayerList::toggleDimension(std::shared_ptr player, int targetDimension) { int lastDimension = player->dimension; // How we handle the entity tracker depends on whether we are the primary player currently, and whether there will be any player in the same system in the same dimension once we finish respawning. @@ -666,7 +666,7 @@ void PlayerList::toggleDimension(shared_ptr player, int targetDime for( unsigned int i = 0; i < players.size(); i++ ) { - shared_ptr ep = players[i]; + std::shared_ptr ep = players[i]; if( ep == player ) continue; if( ep->dimension != lastDimension ) continue; @@ -728,7 +728,7 @@ void PlayerList::toggleDimension(shared_ptr player, int targetDime // 4J Stu Added so that we remove entities from the correct level, after the respawn packet we will be in the wrong level player->flushEntitiesToRemove(); - player->connection->send( shared_ptr( new RespawnPacket((char) player->dimension, newLevel->getSeed(), newLevel->getMaxBuildHeight(), + player->connection->send( std::shared_ptr( new RespawnPacket((char) player->dimension, newLevel->getSeed(), newLevel->getMaxBuildHeight(), player->gameMode->getGameModeForPlayer(), newLevel->difficulty, newLevel->getLevelData()->getGenerator(), newLevel->useNewSeaLevel(), player->entityId, newLevel->getLevelData()->getXZSize(), newLevel->getLevelData()->getHellScale()) ) ); @@ -816,7 +816,7 @@ void PlayerList::toggleDimension(shared_ptr player, int targetDime { MobEffectInstance *effect = *it; - player->connection->send(shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); + player->connection->send(std::shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); } delete activeEffects; player->getEntityData()->markDirty(Mob::DATA_EFFECT_COLOR_ID); @@ -835,11 +835,11 @@ void PlayerList::tick() if (sendAllPlayerInfoIn < players.size()) { - shared_ptr op = players[sendAllPlayerInfoIn]; - //broadcastAll(shared_ptr( new PlayerInfoPacket(op->name, true, op->latency) ) ); + std::shared_ptr op = players[sendAllPlayerInfoIn]; + //broadcastAll(std::shared_ptr( new PlayerInfoPacket(op->name, true, op->latency) ) ); if( op->connection->getNetworkPlayer() ) { - broadcastAll(shared_ptr( new PlayerInfoPacket( op ) ) ); + broadcastAll(std::shared_ptr( new PlayerInfoPacket( op ) ) ); } } @@ -849,11 +849,11 @@ void PlayerList::tick() BYTE smallId = m_smallIdsToClose.front(); m_smallIdsToClose.pop_front(); - shared_ptr player = nullptr; + std::shared_ptr player = nullptr; for(unsigned int i = 0; i < players.size(); i++) { - shared_ptr p = players.at(i); + std::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 ) { @@ -882,11 +882,11 @@ void PlayerList::tick() //#ifdef _XBOX PlayerUID xuid = selectedPlayer->GetUID(); // Kick this player from the game - shared_ptr player = nullptr; + std::shared_ptr player = nullptr; for(unsigned int i = 0; i < players.size(); i++) { - shared_ptr p = players.at(i); + std::shared_ptr p = players.at(i); PlayerUID playersXuid = p->getOnlineXuid(); if (p != NULL && ProfileManager.AreXUIDSEqual(playersXuid, xuid ) ) { @@ -901,7 +901,7 @@ void PlayerList::tick() // 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 player->enableAllPlayerPrivileges( false ); player->connection->setWasKicked(); - player->connection->send( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Kicked) )); + player->connection->send( std::shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Kicked) )); } //#endif } @@ -914,10 +914,10 @@ void PlayerList::tick() { for(unsigned int i = 0; i < receiveAllPlayers[dim].size(); ++i) { - shared_ptr currentPlayer = receiveAllPlayers[dim][i]; + std::shared_ptr currentPlayer = receiveAllPlayers[dim][i]; if(currentPlayer->removed) { - shared_ptr newPlayer = findAlivePlayerOnSystem(currentPlayer); + std::shared_ptr newPlayer = findAlivePlayerOnSystem(currentPlayer); if(newPlayer != NULL) { receiveAllPlayers[dim][i] = newPlayer; @@ -939,20 +939,20 @@ void PlayerList::prioritiseTileChanges(int x, int y, int z, int dimension) server->getLevel(dimension)->getChunkMap()->prioritiseTileChanges(x, y, z); } -void PlayerList::broadcastAll(shared_ptr packet) +void PlayerList::broadcastAll(std::shared_ptr packet) { for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; player->connection->send(packet); } } -void PlayerList::broadcastAll(shared_ptr packet, int dimension) +void PlayerList::broadcastAll(std::shared_ptr packet, int dimension) { for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; if (player->dimension == dimension) player->connection->send(packet); } } @@ -978,7 +978,7 @@ bool PlayerList::isOp(const wstring& name) return false; } -bool PlayerList::isOp(shared_ptr player) +bool PlayerList::isOp(std::shared_ptr player) { bool cheatsEnabled = app.GetGameHostOption(eGameHostOption_CheatsEnabled); #ifdef _DEBUG_MENUS_ENABLED @@ -989,11 +989,11 @@ bool PlayerList::isOp(shared_ptr player) return isOp; } -shared_ptr PlayerList::getPlayer(const wstring& name) +std::shared_ptr PlayerList::getPlayer(const wstring& name) { for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr p = players[i]; + std::shared_ptr p = players[i]; if (p->name == name) // 4J - used to be case insensitive (using equalsIgnoreCase) - imagine we'll be shifting to XUIDs anyway { return p; @@ -1003,11 +1003,11 @@ shared_ptr PlayerList::getPlayer(const wstring& name) } // 4J Added -shared_ptr PlayerList::getPlayer(PlayerUID uid) +std::shared_ptr PlayerList::getPlayer(PlayerUID uid) { for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr p = players[i]; + std::shared_ptr p = players[i]; if (p->getXuid() == uid || p->getOnlineXuid() == uid) // 4J - used to be case insensitive (using equalsIgnoreCase) - imagine we'll be shifting to XUIDs anyway { return p; @@ -1018,23 +1018,23 @@ shared_ptr PlayerList::getPlayer(PlayerUID uid) void PlayerList::sendMessage(const wstring& name, const wstring& message) { - shared_ptr player = getPlayer(name); + std::shared_ptr player = getPlayer(name); if (player != NULL) { - player->connection->send( shared_ptr( new ChatPacket(message) ) ); + player->connection->send( std::shared_ptr( new ChatPacket(message) ) ); } } -void PlayerList::broadcast(double x, double y, double z, double range, int dimension, shared_ptr packet) +void PlayerList::broadcast(double x, double y, double z, double range, int dimension, std::shared_ptr packet) { broadcast(nullptr, x, y, z, range, dimension, packet); } -void PlayerList::broadcast(shared_ptr except, double x, double y, double z, double range, int dimension, shared_ptr packet) +void PlayerList::broadcast(std::shared_ptr except, double x, double y, double z, double range, int dimension, std::shared_ptr packet) { // 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; + vector< std::shared_ptr > sentTo; if( except != NULL ) { sentTo.push_back(dynamic_pointer_cast(except)); @@ -1042,7 +1042,7 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr p = players[i]; + std::shared_ptr p = players[i]; if (p == except) continue; if (p->dimension != dimension) continue; @@ -1059,7 +1059,7 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double { for(unsigned int j = 0; j < sentTo.size(); j++ ) { - shared_ptr player2 = sentTo[j]; + std::shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { @@ -1080,7 +1080,7 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double if (xd * xd + yd * yd + zd * zd < range * range) { #if 0 // _DEBUG - shared_ptr SoundPacket= dynamic_pointer_cast(packet); + std::shared_ptr SoundPacket= dynamic_pointer_cast(packet); if(SoundPacket) { @@ -1099,10 +1099,10 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double void PlayerList::broadcastToAllOps(const wstring& message) { - shared_ptr chatPacket = shared_ptr( new ChatPacket(message) ); + std::shared_ptr chatPacket = std::shared_ptr( new ChatPacket(message) ); for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr p = players[i]; + std::shared_ptr p = players[i]; if (isOp(p->name)) { p->connection->send(chatPacket); @@ -1110,9 +1110,9 @@ void PlayerList::broadcastToAllOps(const wstring& message) } } -bool PlayerList::sendTo(const wstring& name, shared_ptr packet) +bool PlayerList::sendTo(const wstring& name, std::shared_ptr packet) { - shared_ptr player = getPlayer(name); + std::shared_ptr player = getPlayer(name); if (player != NULL) { player->connection->send(packet); @@ -1154,28 +1154,28 @@ void PlayerList::reloadWhitelist() { } -void PlayerList::sendLevelInfo(shared_ptr player, ServerLevel *level) +void PlayerList::sendLevelInfo(std::shared_ptr player, ServerLevel *level) { - player->connection->send( shared_ptr( new SetTimePacket(level->getTime()) ) ); + player->connection->send( std::shared_ptr( new SetTimePacket(level->getTime()) ) ); if (level->isRaining()) { - player->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) ); + player->connection->send( std::shared_ptr( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) ); } else { // 4J Stu - Fix for #44836 - Customer Encountered: Out of Sync Weather [A-10] // If it was raining when the player left the level, and is now not raining we need to make sure that state is updated - player->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) ); + player->connection->send( std::shared_ptr( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) ); } // send the stronghold position if there is one if((level->dimension->id==0) && level->getLevelData()->getHasStronghold()) { - player->connection->send( shared_ptr( new XZPacket(XZPacket::STRONGHOLD,level->getLevelData()->getXStronghold(),level->getLevelData()->getZStronghold()) ) ); + player->connection->send( std::shared_ptr( new XZPacket(XZPacket::STRONGHOLD,level->getLevelData()->getXStronghold(),level->getLevelData()->getZStronghold()) ) ); } } -void PlayerList::sendAllPlayerInfo(shared_ptr player) +void PlayerList::sendAllPlayerInfo(std::shared_ptr player) { player->refreshContainer(player->inventoryMenu); player->resetSentInfo(); @@ -1218,7 +1218,7 @@ void PlayerList::setOverrideGameMode(GameType *gameMode) this->overrideGameMode = gameMode; } -void PlayerList::updatePlayerGameMode(shared_ptr newPlayer, shared_ptr oldPlayer, Level *level) +void PlayerList::updatePlayerGameMode(std::shared_ptr newPlayer, std::shared_ptr oldPlayer, Level *level) { // reset the player's game mode (first pick from old, then copy level if @@ -1239,7 +1239,7 @@ void PlayerList::setAllowCheatsForAllPlayers(bool allowCommands) this->allowCheatsForAllPlayers = allowCommands; } -shared_ptr PlayerList::findAlivePlayerOnSystem(shared_ptr player) +std::shared_ptr PlayerList::findAlivePlayerOnSystem(std::shared_ptr player) { int dimIndex, playerDim; dimIndex = playerDim = player->dimension; @@ -1251,7 +1251,7 @@ shared_ptr PlayerList::findAlivePlayerOnSystem(shared_ptr newPlayer = *itP; + std::shared_ptr newPlayer = *itP; INetworkPlayer *otherPlayer = newPlayer->connection->getNetworkPlayer(); @@ -1270,7 +1270,7 @@ shared_ptr PlayerList::findAlivePlayerOnSystem(shared_ptr player, bool usePlayerDimension /*= true*/, int dimension /*= 0*/) +void PlayerList::removePlayerFromReceiving(std::shared_ptr player, bool usePlayerDimension /*= true*/, int dimension /*= 0*/) { int dimIndex, playerDim; dimIndex = playerDim = usePlayerDimension ? player->dimension : dimension; @@ -1297,7 +1297,7 @@ void PlayerList::removePlayerFromReceiving(shared_ptr player, bool { for(AUTO_VAR(itP, players.begin()); itP != players.end(); ++itP) { - shared_ptr newPlayer = *itP; + std::shared_ptr newPlayer = *itP; INetworkPlayer *otherPlayer = newPlayer->connection->getNetworkPlayer(); @@ -1324,7 +1324,7 @@ void PlayerList::removePlayerFromReceiving(shared_ptr player, bool // Re-check all active players and make sure they have someone on their system to receive all packets for(AUTO_VAR(itP, players.begin()); itP != players.end(); ++itP) { - shared_ptr newPlayer = *itP; + std::shared_ptr newPlayer = *itP; INetworkPlayer *checkingPlayer = newPlayer->connection->getNetworkPlayer(); if( checkingPlayer != NULL ) @@ -1335,7 +1335,7 @@ void PlayerList::removePlayerFromReceiving(shared_ptr player, bool bool foundPrimary = false; for(AUTO_VAR(it, receiveAllPlayers[newPlayerDim].begin()); it != receiveAllPlayers[newPlayerDim].end(); ++it) { - shared_ptr primaryPlayer = *it; + std::shared_ptr primaryPlayer = *it; INetworkPlayer *primPlayer = primaryPlayer->connection->getNetworkPlayer(); if(primPlayer != NULL && checkingPlayer->IsSameSystem( primPlayer ) ) { @@ -1355,7 +1355,7 @@ void PlayerList::removePlayerFromReceiving(shared_ptr player, bool } } -void PlayerList::addPlayerToReceiving(shared_ptr player) +void PlayerList::addPlayerToReceiving(std::shared_ptr player) { int playerDim = 0; if( player->dimension == -1 ) playerDim = 1; @@ -1380,7 +1380,7 @@ void PlayerList::addPlayerToReceiving(shared_ptr player) { for(AUTO_VAR(it, receiveAllPlayers[playerDim].begin()); it != receiveAllPlayers[playerDim].end(); ++it) { - shared_ptr oldPlayer = *it; + std::shared_ptr oldPlayer = *it; INetworkPlayer *checkingPlayer = oldPlayer->connection->getNetworkPlayer(); if(checkingPlayer != NULL && checkingPlayer->IsSameSystem( thisPlayer ) ) { @@ -1399,14 +1399,14 @@ void PlayerList::addPlayerToReceiving(shared_ptr player) } } -bool PlayerList::canReceiveAllPackets(shared_ptr player) +bool PlayerList::canReceiveAllPackets(std::shared_ptr player) { int playerDim = 0; if( player->dimension == -1 ) playerDim = 1; else if( player->dimension == 1) playerDim = 2; for(AUTO_VAR(it, receiveAllPlayers[playerDim].begin()); it != receiveAllPlayers[playerDim].end(); ++it) { - shared_ptr newPlayer = *it; + std::shared_ptr newPlayer = *it; if(newPlayer == player) { return true; diff --git a/Minecraft.Client/Network/PlayerList.h b/Minecraft.Client/Network/PlayerList.h index 7bab169f0..ce50270d7 100644 --- a/Minecraft.Client/Network/PlayerList.h +++ b/Minecraft.Client/Network/PlayerList.h @@ -22,7 +22,7 @@ private: static const int SEND_PLAYER_INFO_INTERVAL = 20 * 10; // 4J - brought forward from 1.2.3 // public static Logger logger = Logger.getLogger("Minecraft"); public: - vector > players; + vector > players; private: MinecraftServer *server; @@ -51,60 +51,60 @@ private: int sendAllPlayerInfoIn; // 4J Added to maintain which players in which dimensions can receive all packet types - vector > receiveAllPlayers[3]; + vector > receiveAllPlayers[3]; private: - shared_ptr findAlivePlayerOnSystem(shared_ptr currentPlayer); + std::shared_ptr findAlivePlayerOnSystem(std::shared_ptr currentPlayer); public: - void removePlayerFromReceiving(shared_ptr player, bool usePlayerDimension = true, int dimension = 0); - void addPlayerToReceiving(shared_ptr player); - bool canReceiveAllPackets(shared_ptr player); + void removePlayerFromReceiving(std::shared_ptr player, bool usePlayerDimension = true, int dimension = 0); + void addPlayerToReceiving(std::shared_ptr player); + bool canReceiveAllPackets(std::shared_ptr player); public: PlayerList(MinecraftServer *server); ~PlayerList(); - void placeNewPlayer(Connection *connection, shared_ptr player, shared_ptr packet); + void placeNewPlayer(Connection *connection, std::shared_ptr player, std::shared_ptr packet); void setLevel(ServerLevelArray levels); - void changeDimension(shared_ptr player, ServerLevel *from); + void changeDimension(std::shared_ptr player, ServerLevel *from); int getMaxRange(); - bool load(shared_ptr player); // 4J Changed return val to bool to check if new player or loaded player + bool load(std::shared_ptr player); // 4J Changed return val to bool to check if new player or loaded player protected: - void save(shared_ptr player); + void save(std::shared_ptr player); public: - void validatePlayerSpawnPosition(shared_ptr player); // 4J Added - void add(shared_ptr player); - void move(shared_ptr player); - void remove(shared_ptr player); - shared_ptr getPlayerForLogin(PendingConnection *pendingConnection, const wstring& userName, PlayerUID xuid, PlayerUID OnlineXuid); - shared_ptr respawn(shared_ptr serverPlayer, int targetDimension, bool keepAllPlayerData); - void toggleDimension(shared_ptr player, int targetDimension); + void validatePlayerSpawnPosition(std::shared_ptr player); // 4J Added + void add(std::shared_ptr player); + void move(std::shared_ptr player); + void remove(std::shared_ptr player); + std::shared_ptr getPlayerForLogin(PendingConnection *pendingConnection, const wstring& userName, PlayerUID xuid, PlayerUID OnlineXuid); + std::shared_ptr respawn(std::shared_ptr serverPlayer, int targetDimension, bool keepAllPlayerData); + void toggleDimension(std::shared_ptr player, int targetDimension); void tick(); bool isTrackingTile(int x, int y, int z, int dimension); // 4J added void prioritiseTileChanges(int x, int y, int z, int dimension); // 4J added - void broadcastAll(shared_ptr packet); - void broadcastAll(shared_ptr packet, int dimension); + void broadcastAll(std::shared_ptr packet); + void broadcastAll(std::shared_ptr packet, int dimension); wstring getPlayerNames(); public: bool isWhiteListed(const wstring& name); bool isOp(const wstring& name); - bool isOp(shared_ptr player); // 4J Added - shared_ptr getPlayer(const wstring& name); - shared_ptr getPlayer(PlayerUID uid); + bool isOp(std::shared_ptr player); // 4J Added + std::shared_ptr getPlayer(const wstring& name); + std::shared_ptr getPlayer(PlayerUID uid); void sendMessage(const wstring& name, const wstring& message); - void broadcast(double x, double y, double z, double range, int dimension, shared_ptr packet); - void broadcast(shared_ptr except, double x, double y, double z, double range, int dimension, shared_ptr packet); + void broadcast(double x, double y, double z, double range, int dimension, std::shared_ptr packet); + void broadcast(std::shared_ptr except, double x, double y, double z, double range, int dimension, std::shared_ptr packet); void broadcastToAllOps(const wstring& message); - bool sendTo(const wstring& name, shared_ptr packet); + bool sendTo(const wstring& name, std::shared_ptr packet); // 4J Added ProgressListener *progressListener param and bDeleteGuestMaps param void saveAll(ProgressListener *progressListener, bool bDeleteGuestMaps = false); void whiteList(const wstring& playerName); void blackList(const wstring& playerName); // Set getWhiteList(); / 4J removed void reloadWhitelist(); - void sendLevelInfo(shared_ptr player, ServerLevel *level); - void sendAllPlayerInfo(shared_ptr player); + void sendLevelInfo(std::shared_ptr player, ServerLevel *level); + void sendAllPlayerInfo(std::shared_ptr player); int getPlayerCount(); int getPlayerCount(ServerLevel *level); // 4J Added int getMaxPlayers(); @@ -113,7 +113,7 @@ public: void setOverrideGameMode(GameType *gameMode); private: - void updatePlayerGameMode(shared_ptr newPlayer, shared_ptr oldPlayer, Level *level); + void updatePlayerGameMode(std::shared_ptr newPlayer, std::shared_ptr oldPlayer, Level *level); public: void setAllowCheatsForAllPlayers(bool allowCommands); diff --git a/Minecraft.Client/Network/ServerCommandDispatcher.cpp b/Minecraft.Client/Network/ServerCommandDispatcher.cpp index 389633925..736e4209f 100644 --- a/Minecraft.Client/Network/ServerCommandDispatcher.cpp +++ b/Minecraft.Client/Network/ServerCommandDispatcher.cpp @@ -52,13 +52,13 @@ ServerCommandDispatcher::ServerCommandDispatcher() Command::setLogger(this); } -void ServerCommandDispatcher::logAdminCommand(shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message, int customData, const wstring& additionalMessage) +void ServerCommandDispatcher::logAdminCommand(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message, int customData, const wstring& additionalMessage) { PlayerList *playerList = MinecraftServer::getInstance()->getPlayers(); //for (Player player : MinecraftServer.getInstance().getPlayers().players) for(AUTO_VAR(it, playerList->players.begin()); it != playerList->players.end(); ++it) { - shared_ptr player = *it; + std::shared_ptr player = *it; if (player != source && playerList->isOp(player)) { // TODO: Change chat packet to be able to send more bits of data diff --git a/Minecraft.Client/Network/ServerCommandDispatcher.h b/Minecraft.Client/Network/ServerCommandDispatcher.h index d0b1c2e4e..eaa98679b 100644 --- a/Minecraft.Client/Network/ServerCommandDispatcher.h +++ b/Minecraft.Client/Network/ServerCommandDispatcher.h @@ -7,5 +7,5 @@ class ServerCommandDispatcher : public CommandDispatcher, public AdminLogCommand { public: ServerCommandDispatcher(); - void logAdminCommand(shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L""); + void logAdminCommand(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L""); }; \ No newline at end of file diff --git a/Minecraft.Client/Network/ServerConnection.cpp b/Minecraft.Client/Network/ServerConnection.cpp index 31a4b498e..a22549f6f 100644 --- a/Minecraft.Client/Network/ServerConnection.cpp +++ b/Minecraft.Client/Network/ServerConnection.cpp @@ -26,16 +26,16 @@ ServerConnection::~ServerConnection() // 4J - added to handle incoming connections, to replace thread that original used to have void ServerConnection::NewIncomingSocket(Socket *socket) { - shared_ptr unconnectedClient = shared_ptr(new PendingConnection(server, socket, L"Connection #" + _toString(connectionCounter++))); + std::shared_ptr unconnectedClient = std::shared_ptr(new PendingConnection(server, socket, L"Connection #" + _toString(connectionCounter++))); handleConnection(unconnectedClient); } -void ServerConnection::addPlayerConnection(shared_ptr uc) +void ServerConnection::addPlayerConnection(std::shared_ptr uc) { players.push_back(uc); } -void ServerConnection::handleConnection(shared_ptr uc) +void ServerConnection::handleConnection(std::shared_ptr uc) { EnterCriticalSection(&pending_cs); pending.push_back(uc); @@ -47,14 +47,14 @@ void ServerConnection::stop() EnterCriticalSection(&pending_cs); for (unsigned int i = 0; i < pending.size(); i++) { - shared_ptr uc = pending[i]; + std::shared_ptr uc = pending[i]; uc->connection->close(DisconnectPacket::eDisconnect_Closed); } LeaveCriticalSection(&pending_cs); for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; player->connection->close(DisconnectPacket::eDisconnect_Closed); } } @@ -64,12 +64,12 @@ void ServerConnection::tick() { // MGH - changed this so that the the CS lock doesn't cover the tick (was causing a lockup when 2 players tried to join) EnterCriticalSection(&pending_cs); - vector< shared_ptr > tempPending = pending; + vector< std::shared_ptr > tempPending = pending; LeaveCriticalSection(&pending_cs); for (unsigned int i = 0; i < tempPending.size(); i++) { - shared_ptr uc = tempPending[i]; + std::shared_ptr uc = tempPending[i]; // try { // 4J - removed try/catch uc->tick(); // } catch (Exception e) { @@ -92,8 +92,8 @@ void ServerConnection::tick() for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; - shared_ptr serverPlayer = player->getPlayer(); + std::shared_ptr player = players[i]; + std::shared_ptr serverPlayer = player->getPlayer(); if( serverPlayer ) { serverPlayer->doChunkSendingTick(false); @@ -138,7 +138,7 @@ void ServerConnection::handleTextureReceived(const wstring &textureName) } for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; if (!player->done) { player->handleTextureReceived(textureName); @@ -155,7 +155,7 @@ void ServerConnection::handleTextureAndGeometryReceived(const wstring &textureNa } for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; if (!player->done) { player->handleTextureAndGeometryReceived(textureName); @@ -163,7 +163,7 @@ void ServerConnection::handleTextureAndGeometryReceived(const wstring &textureNa } } -void ServerConnection::handleServerSettingsChanged(shared_ptr packet) +void ServerConnection::handleServerSettingsChanged(std::shared_ptr packet) { Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -197,7 +197,7 @@ void ServerConnection::handleServerSettingsChanged(shared_ptr playerconnection = players[i]; +// std::shared_ptr playerconnection = players[i]; // playerconnection->setShowOnMaps(pMinecraft->options->GetGamertagSetting()); // } // } diff --git a/Minecraft.Client/Network/ServerConnection.h b/Minecraft.Client/Network/ServerConnection.h index 56c5d39e5..e4105675f 100644 --- a/Minecraft.Client/Network/ServerConnection.h +++ b/Minecraft.Client/Network/ServerConnection.h @@ -20,8 +20,8 @@ private: int connectionCounter; private: CRITICAL_SECTION pending_cs; // 4J added - vector< shared_ptr > pending; - vector< shared_ptr > players; + vector< std::shared_ptr > pending; + vector< std::shared_ptr > players; // 4J - When the server requests a texture, it should add it to here while we are waiting for it vector m_pendingTextureRequests; @@ -34,9 +34,9 @@ public: void NewIncomingSocket(Socket *socket); // 4J - added void removeSpamProtection(Socket *socket) { }// 4J Stu - Not implemented as not required - void addPlayerConnection(shared_ptr uc); + void addPlayerConnection(std::shared_ptr uc); private: - void handleConnection(shared_ptr uc); + void handleConnection(std::shared_ptr uc); public: void stop(); void tick(); @@ -45,5 +45,5 @@ public: bool addPendingTextureRequest(const wstring &textureName); void handleTextureReceived(const wstring &textureName); void handleTextureAndGeometryReceived(const wstring &textureName); - void handleServerSettingsChanged(shared_ptr packet); + void handleServerSettingsChanged(std::shared_ptr packet); }; diff --git a/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.cpp b/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.cpp index bfe8ea271..f53e3f824 100644 --- a/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.cpp +++ b/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.cpp @@ -57,7 +57,7 @@ bool CDurangoTelemetryManager::RecordPlayerSessionStart(int iPad) bool CDurangoTelemetryManager::RecordPlayerSessionExit(int iPad, int exitStatus) { - PlayerUID puid; shared_ptr plr; + PlayerUID puid; std::shared_ptr plr; ProfileManager.GetXUID(iPad, &puid, true); plr = Minecraft::GetInstance()->localplayers[iPad]; @@ -127,7 +127,7 @@ bool CDurangoTelemetryManager::RecordLevelStart(int iPad, ESen_FriendOrMatch fri ULONG hr = 0; // Grab player info. - PlayerUID puid; shared_ptr plr; + PlayerUID puid; std::shared_ptr plr; ProfileManager.GetXUID(iPad, &puid, true); plr = Minecraft::GetInstance()->localplayers[iPad]; diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Types.h b/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Types.h index 92d288138..ccdacff9b 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Types.h +++ b/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Types.h @@ -25,7 +25,7 @@ using std::tr1::const_pointer_cast; using std::tr1::dynamic_pointer_cast; using std::tr1::enable_shared_from_this; using std::tr1::get_deleter; -using std::tr1::shared_ptr; +using std::tr1::std::shared_ptr; using std::tr1::static_pointer_cast; using std::tr1::swap; using std::tr1::weak_ptr; @@ -62,7 +62,7 @@ using boost::hash; class Cnullptr{ public: template - operator shared_ptr() { return shared_ptr(); } + operator std::shared_ptr() { return std::shared_ptr(); } }; extern Cnullptr nullptr; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp index c1000a9b8..739cc5f61 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp @@ -647,7 +647,7 @@ void ChunkRebuildData::tesselateAllTiles(TileRenderer_SPU* pTileRenderer) { // if (m_currentLayer == 0 && m_tileData.isEntityTile[tileId]) // { -// shared_ptr et = region->getTileEntity(x, y, z); +// std::shared_ptr et = region->getTileEntity(x, y, z); // if (TileEntityRenderDispatcher::instance->hasRenderer(et)) // { // renderableTileEntities.push_back(et); diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeverTile_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeverTile_SPU.h index 06dda5bbb..53c9f3ec8 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeverTile_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeverTile_SPU.h @@ -8,5 +8,5 @@ public: virtual bool blocksLight() { return false; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } virtual int getRenderShape() { return Tile_SPU::SHAPE_LEVER; } -// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param +// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param }; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h index e8411c885..a8c6851c2 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h @@ -12,7 +12,7 @@ public: virtual int getRenderShape() { return SHAPE_PISTON_BASE; } 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 + // virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param // virtual void updateDefaultShape(); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h index d5460492e..3323cfd00 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h @@ -9,5 +9,5 @@ public: virtual Icon_SPU *getTexture(int face, int data) { return NULL; } 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 +// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TheEndPortal_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TheEndPortal_SPU.h index f6e3b3e76..b8bed9a88 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TheEndPortal_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TheEndPortal_SPU.h @@ -6,7 +6,7 @@ class TheEndPortal_SPU : public EntityTile_SPU public: TheEndPortal_SPU(int id) : EntityTile_SPU(id) {} -// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param +// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face) { if (face != 0) return false; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp index 77886f911..a11e242f2 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp @@ -288,7 +288,7 @@ Icon_SPU *Tile_SPU::getTexture(int face) // return id; // } // -// float Tile_SPU::getDestroyProgress(shared_ptr player) +// float Tile_SPU::getDestroyProgress(std::shared_ptr player) // { // if (destroySpeed < 0) return 0; // if (!player->canDestroy(this)) return 1 / destroySpeed / 100.0f; @@ -310,11 +310,11 @@ Icon_SPU *Tile_SPU::getTexture(int face) // int type = getResource(data, level->random, playerBonusLevel); // if (type <= 0) continue; // -// popResource(level, x, y, z, shared_ptr( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data) ) ) ); +// popResource(level, x, y, z, std::shared_ptr( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data) ) ) ); // } // } // -// void Tile_SPU::popResource(Level *level, int x, int y, int z, shared_ptr itemInstance) +// void Tile_SPU::popResource(Level *level, int x, int y, int z, std::shared_ptr itemInstance) // { // if( level->isClientSide ) return; // @@ -322,7 +322,7 @@ Icon_SPU *Tile_SPU::getTexture(int face) // double xo = level->random->nextFloat() * s + (1 - s) * 0.5; // double yo = level->random->nextFloat() * s + (1 - s) * 0.5; // double zo = level->random->nextFloat() * s + (1 - s) * 0.5; -// shared_ptr item = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, itemInstance ) ); +// std::shared_ptr item = std::shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, itemInstance ) ); // item->throwTime = 10; // level->addEntity(item); // } @@ -336,7 +336,7 @@ Icon_SPU *Tile_SPU::getTexture(int face) // { // int newCount = ExperienceOrb::getExperienceValue(amount); // amount -= newCount; -// level->addEntity(shared_ptr( new ExperienceOrb(level, x + .5, y + .5, z + .5, newCount))); +// level->addEntity(std::shared_ptr( new ExperienceOrb(level, x + .5, y + .5, z + .5, newCount))); // } // } // } @@ -346,7 +346,7 @@ Icon_SPU *Tile_SPU::getTexture(int face) // return 0; // } // -// float Tile_SPU::getExplosionResistance(shared_ptr source) +// float Tile_SPU::getExplosionResistance(std::shared_ptr source) // { // return explosionResistance / 5.0f; // } @@ -437,17 +437,17 @@ int Tile_SPU::getRenderLayer() // return false; // } // -// bool Tile_SPU::TestUse(Level *level, int x, int y, int z, shared_ptr player) +// bool Tile_SPU::TestUse(Level *level, int x, int y, int z, std::shared_ptr player) // { // return false; // } // -// bool Tile_SPU::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +// bool Tile_SPU::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param // { // return false; // } // -// void Tile_SPU::stepOn(Level *level, int x, int y, int z, shared_ptr entity) +// void Tile_SPU::stepOn(Level *level, int x, int y, int z, std::shared_ptr entity) // { // } // @@ -459,11 +459,11 @@ int Tile_SPU::getRenderLayer() // { // } // -// void Tile_SPU::attack(Level *level, int x, int y, int z, shared_ptr player) +// void Tile_SPU::attack(Level *level, int x, int y, int z, std::shared_ptr player) // { // } // -// void Tile_SPU::handleEntityInside(Level *level, int x, int y, int z, shared_ptr e, Vec3 *current) +// void Tile_SPU::handleEntityInside(Level *level, int x, int y, int z, std::shared_ptr e, Vec3 *current) // { // } // @@ -498,7 +498,7 @@ int Tile_SPU::getColor(ChunkRebuildData *level, int x, int y, int z) // return false; // } // -// void Tile_SPU::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +// void Tile_SPU::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) // { // } // @@ -511,7 +511,7 @@ void Tile_SPU::updateDefaultShape() { } // -// void Tile_SPU::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) +// void Tile_SPU::playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data) // { // // 4J Stu - Special case - only record a crop destroy if is fully grown // if(id==Tile_SPU::crops_Id) @@ -532,7 +532,7 @@ void Tile_SPU::updateDefaultShape() // // if (isCubeShaped() && !isEntityTile[id] && EnchantmentHelper::hasSilkTouch(player->inventory)) // { -// shared_ptr item = getSilkTouchItemInstance(data); +// std::shared_ptr item = getSilkTouchItemInstance(data); // if (item != NULL) // { // popResource(level, x, y, z, item); @@ -545,14 +545,14 @@ void Tile_SPU::updateDefaultShape() // } // } // -// shared_ptr Tile_SPU::getSilkTouchItemInstance(int data) +// std::shared_ptr Tile_SPU::getSilkTouchItemInstance(int data) // { // int popData = 0; // if (id >= 0 && id < Item::items.length && Item::items[id]->isStackedByData()) // { // popData = data; // } -// return shared_ptr(new ItemInstance(id, 1, popData)); +// return std::shared_ptr(new ItemInstance(id, 1, popData)); // } // // int Tile_SPU::getResourceCountForLootBonus(int bonusLevel, Random *random) @@ -565,7 +565,7 @@ void Tile_SPU::updateDefaultShape() // return true; // } // -// void Tile_SPU::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +// void Tile_SPU::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) // { // } // @@ -646,7 +646,7 @@ Material_SPU* Tile_SPU::getMaterial() } // -// void Tile_SPU::fallOn(Level *level, int x, int y, int z, shared_ptr entity, float fallDistance) +// void Tile_SPU::fallOn(Level *level, int x, int y, int z, std::shared_ptr entity, float fallDistance) // { // } // diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.cpp index 093b1a0d6..17e5cfdd2 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.cpp @@ -172,7 +172,7 @@ void LevelRenderer_FindNearestChunk_DataIn::findNearestChunk() for( int p = 0; p < 4; 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 - // So take a reference to the player object now. As it is a shared_ptr it should live as long as we need it + // So take a reference to the player object now. As it is a std::shared_ptr it should live as long as we need it PlayerData* player = &playerData[p]; if( player->bValid == NULL ) continue; if( chunks[p] == NULL ) continue; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.h index 55ffcabd3..22c3db1bb 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.h @@ -64,7 +64,7 @@ public: int id; int padding[1]; //public: - // vector > renderableTileEntities; // 4J - removed + // vector > renderableTileEntities; // 4J - removed private: void *globalRenderableTileEntities; diff --git a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp index 38f84e5d9..7431a23e5 100644 --- a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp @@ -984,7 +984,7 @@ void SoundEngine::update3DPosition(SoundEngine::soundInfo *pInfo, bool bPlaceEmi XACT3DApply( &m_DSPSettings, pInfo->pCue); } -void SoundEngine::tick(shared_ptr *players, float a) +void SoundEngine::tick(std::shared_ptr *players, float a) { if( m_pXACT3Engine == NULL ) return; diff --git a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h index c698b17e6..e34ad4c9d 100644 --- a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h +++ b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h @@ -86,7 +86,7 @@ public: virtual void updateSystemMusicPlaying(bool isPlaying); virtual void updateSoundEffectVolume(float fVal); virtual void init(Options *); - virtual void tick(shared_ptr *players, float a); // 4J - updated to take array of local players rather than single one + virtual void tick(std::shared_ptr *players, float a); // 4J - updated to take array of local players rather than single one virtual void add(const wstring& name, File *file); virtual void addMusic(const wstring& name, File *file); virtual void addStreaming(const wstring& name, File *file); diff --git a/Minecraft.Client/Player/EntityTracker.cpp b/Minecraft.Client/Player/EntityTracker.cpp index 88e85feb8..d73ec6f1f 100644 --- a/Minecraft.Client/Player/EntityTracker.cpp +++ b/Minecraft.Client/Player/EntityTracker.cpp @@ -26,12 +26,12 @@ EntityTracker::EntityTracker(ServerLevel *level) maxRange = level->getServer()->getPlayers()->getMaxRange(); } -void EntityTracker::addEntity(shared_ptr e) +void EntityTracker::addEntity(std::shared_ptr e) { if (e->GetType() == eTYPE_SERVERPLAYER) { addEntity(e, 32 * 16, 2); - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = dynamic_pointer_cast(e); for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) { if( (*it)->e != player ) @@ -65,12 +65,12 @@ void EntityTracker::addEntity(shared_ptr e) else if (e->GetType() == eTYPE_ITEM_FRAME) addEntity(e, 16 * 10, INT_MAX, false); } -void EntityTracker::addEntity(shared_ptr e, int range, int updateInterval) +void EntityTracker::addEntity(std::shared_ptr e, int range, int updateInterval) { addEntity(e, range, updateInterval, false); } -void EntityTracker::addEntity(shared_ptr e, int range, int updateInterval, bool trackDeltas) +void EntityTracker::addEntity(std::shared_ptr e, int range, int updateInterval, bool trackDeltas) { if (range > maxRange) range = maxRange; if (entityMap.find(e->entityId) != entityMap.end()) @@ -81,7 +81,7 @@ void EntityTracker::addEntity(shared_ptr e, int range, int updateInterva { __debugbreak(); } - shared_ptr te = shared_ptr( new TrackedEntity(e, range, updateInterval, trackDeltas) ); + std::shared_ptr te = std::shared_ptr( new TrackedEntity(e, range, updateInterval, trackDeltas) ); entities.insert(te); entityMap[e->entityId] = te; te->updatePlayers(this, &level->players); @@ -89,23 +89,23 @@ void EntityTracker::addEntity(shared_ptr e, int range, int updateInterva // 4J - have split removeEntity into two bits - it used to do the equivalent of EntityTracker::removePlayer followed by EntityTracker::removeEntity. // This is to allow us to now choose to remove the player as a "seenBy" only when the player has actually been removed from the level's own player array -void EntityTracker::removeEntity(shared_ptr e) +void EntityTracker::removeEntity(std::shared_ptr e) { AUTO_VAR(it, entityMap.find(e->entityId)); if( it != entityMap.end() ) { - shared_ptr te = it->second; + std::shared_ptr te = it->second; entityMap.erase(it); entities.erase(te); te->broadcastRemoved(); } } -void EntityTracker::removePlayer(shared_ptr e) +void EntityTracker::removePlayer(std::shared_ptr e) { if (e->GetType() == eTYPE_SERVERPLAYER) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = dynamic_pointer_cast(e); for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) { (*it)->removePlayer(player); @@ -115,10 +115,10 @@ void EntityTracker::removePlayer(shared_ptr e) void EntityTracker::tick() { - vector > movedPlayers; + vector > movedPlayers; for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) { - shared_ptr te = *it; + std::shared_ptr te = *it; te->tick(this, &level->players); if (te->moved && te->e->GetType() == eTYPE_SERVERPLAYER) { @@ -132,7 +132,7 @@ void EntityTracker::tick() MinecraftServer *server = MinecraftServer::getInstance(); for( unsigned int i = 0; i < server->getPlayers()->players.size(); i++ ) { - shared_ptr ep = server->getPlayers()->players[i]; + std::shared_ptr ep = server->getPlayers()->players[i]; if( ep->dimension != level->dimension->id ) continue; if( ep->connection == NULL ) continue; @@ -142,7 +142,7 @@ void EntityTracker::tick() bool addPlayer = false; for (unsigned int j = 0; j < movedPlayers.size(); j++) { - shared_ptr sp = movedPlayers[j]; + std::shared_ptr sp = movedPlayers[j]; if( sp == ep ) break; @@ -159,11 +159,11 @@ void EntityTracker::tick() for (unsigned int i = 0; i < movedPlayers.size(); i++) { - shared_ptr player = movedPlayers[i]; + std::shared_ptr player = movedPlayers[i]; if(player->connection == NULL) continue; for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) { - shared_ptr te = *it; + std::shared_ptr te = *it; if (te->e != player) { te->updatePlayer(this, player); @@ -174,7 +174,7 @@ void EntityTracker::tick() // 4J Stu - We want to do this for dead players as they don't tick normally for(AUTO_VAR(it, level->players.begin()); it != level->players.end(); ++it) { - shared_ptr player = dynamic_pointer_cast(*it); + std::shared_ptr player = dynamic_pointer_cast(*it); if(!player->isAlive()) { player->flushEntitiesToRemove(); @@ -182,31 +182,31 @@ void EntityTracker::tick() } } -void EntityTracker::broadcast(shared_ptr e, shared_ptr packet) +void EntityTracker::broadcast(std::shared_ptr e, std::shared_ptr packet) { AUTO_VAR(it, entityMap.find( e->entityId )); if( it != entityMap.end() ) { - shared_ptr te = it->second; + std::shared_ptr te = it->second; te->broadcast(packet); } } -void EntityTracker::broadcastAndSend(shared_ptr e, shared_ptr packet) +void EntityTracker::broadcastAndSend(std::shared_ptr e, std::shared_ptr packet) { AUTO_VAR(it, entityMap.find( e->entityId )); if( it != entityMap.end() ) { - shared_ptr te = it->second; + std::shared_ptr te = it->second; te->broadcastAndSend(packet); } } -void EntityTracker::clear(shared_ptr serverPlayer) +void EntityTracker::clear(std::shared_ptr serverPlayer) { for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) { - shared_ptr te = *it; + std::shared_ptr te = *it; te->clear(serverPlayer); } } @@ -218,7 +218,7 @@ void EntityTracker::updateMaxRange() } -shared_ptr EntityTracker::getTracker(shared_ptr e) +std::shared_ptr EntityTracker::getTracker(std::shared_ptr e) { AUTO_VAR(it, entityMap.find(e->entityId)); if( it != entityMap.end() ) diff --git a/Minecraft.Client/Player/EntityTracker.h b/Minecraft.Client/Player/EntityTracker.h index ac905b108..b35b5efef 100644 --- a/Minecraft.Client/Player/EntityTracker.h +++ b/Minecraft.Client/Player/EntityTracker.h @@ -13,24 +13,24 @@ class EntityTracker { private: ServerLevel *level; - unordered_set > entities; - unordered_map , IntKeyHash2, IntKeyEq> entityMap; // was IntHashMap + unordered_set > entities; + unordered_map , IntKeyHash2, IntKeyEq> entityMap; // was IntHashMap int maxRange; public: EntityTracker(ServerLevel *level); - void addEntity(shared_ptr e); - void addEntity(shared_ptr e, int range, int updateInterval); - void addEntity(shared_ptr e, int range, int updateInterval, bool trackDeltas); - void removeEntity(shared_ptr e); - void removePlayer(shared_ptr e); // 4J added + void addEntity(std::shared_ptr e); + void addEntity(std::shared_ptr e, int range, int updateInterval); + void addEntity(std::shared_ptr e, int range, int updateInterval, bool trackDeltas); + void removeEntity(std::shared_ptr e); + void removePlayer(std::shared_ptr e); // 4J added void tick(); - void broadcast(shared_ptr e, shared_ptr packet); - void broadcastAndSend(shared_ptr e, shared_ptr packet); - void clear(shared_ptr serverPlayer); + void broadcast(std::shared_ptr e, std::shared_ptr packet); + void broadcastAndSend(std::shared_ptr e, std::shared_ptr packet); + void clear(std::shared_ptr serverPlayer); void updateMaxRange(); // AP added for Vita // 4J-JEV: Added, needed access to tracked entity of a riders mount. - shared_ptr getTracker(shared_ptr entity); + std::shared_ptr getTracker(std::shared_ptr entity); }; diff --git a/Minecraft.Client/Player/LocalPlayer.cpp b/Minecraft.Client/Player/LocalPlayer.cpp index ae3182639..d4bee1869 100644 --- a/Minecraft.Client/Player/LocalPlayer.cpp +++ b/Minecraft.Client/Player/LocalPlayer.cpp @@ -583,14 +583,14 @@ void LocalPlayer::closeContainer() ui.CloseUIScenes( m_iPad ); } -void LocalPlayer::openTextEdit(shared_ptr sign) +void LocalPlayer::openTextEdit(std::shared_ptr sign) { bool success = app.LoadSignEntryMenu(GetXboxPad(), sign ); if( success ) ui.PlayUISFX(eSFX_Press); //minecraft->setScreen(new TextEditScreen(sign)); } -bool LocalPlayer::openContainer(shared_ptr container) +bool LocalPlayer::openContainer(std::shared_ptr container) { bool success = app.LoadContainerMenu(GetXboxPad(), inventory, container ); if( success ) ui.PlayUISFX(eSFX_Press); @@ -623,7 +623,7 @@ bool LocalPlayer::startRepairing(int x, int y, int z) return success; } -bool LocalPlayer::openFurnace(shared_ptr furnace) +bool LocalPlayer::openFurnace(std::shared_ptr furnace) { bool success = app.LoadFurnaceMenu(GetXboxPad(),inventory, furnace); if( success ) ui.PlayUISFX(eSFX_Press); @@ -631,7 +631,7 @@ bool LocalPlayer::openFurnace(shared_ptr furnace) return success; } -bool LocalPlayer::openBrewingStand(shared_ptr brewingStand) +bool LocalPlayer::openBrewingStand(std::shared_ptr brewingStand) { bool success = app.LoadBrewingStandMenu(GetXboxPad(),inventory, brewingStand); if( success ) ui.PlayUISFX(eSFX_Press); @@ -639,7 +639,7 @@ bool LocalPlayer::openBrewingStand(shared_ptr brewingSta return success; } -bool LocalPlayer::openTrap(shared_ptr trap) +bool LocalPlayer::openTrap(std::shared_ptr trap) { bool success = app.LoadTrapMenu(GetXboxPad(),inventory, trap); if( success ) ui.PlayUISFX(eSFX_Press); @@ -647,7 +647,7 @@ bool LocalPlayer::openTrap(shared_ptr trap) return success; } -bool LocalPlayer::openTrading(shared_ptr traderTarget) +bool LocalPlayer::openTrading(std::shared_ptr traderTarget) { bool success = app.LoadTradingMenu(GetXboxPad(),inventory, traderTarget, level); if( success ) ui.PlayUISFX(eSFX_Press); @@ -655,23 +655,23 @@ bool LocalPlayer::openTrading(shared_ptr traderTarget) return success; } -void LocalPlayer::crit(shared_ptr e) +void LocalPlayer::crit(std::shared_ptr e) { - shared_ptr critParticle = shared_ptr( new CritParticle((Level *)minecraft->level, e) ); + std::shared_ptr critParticle = std::shared_ptr( new CritParticle((Level *)minecraft->level, e) ); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); } -void LocalPlayer::magicCrit(shared_ptr e) +void LocalPlayer::magicCrit(std::shared_ptr e) { - shared_ptr critParticle = shared_ptr( new CritParticle((Level *)minecraft->level, e, eParticleType_magicCrit) ); + std::shared_ptr critParticle = std::shared_ptr( new CritParticle((Level *)minecraft->level, e, eParticleType_magicCrit) ); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); } -void LocalPlayer::take(shared_ptr e, int orgCount) +void LocalPlayer::take(std::shared_ptr e, int orgCount) { - minecraft->particleEngine->add( shared_ptr( new TakeAnimationParticle((Level *)minecraft->level, e, shared_from_this(), -0.5f) ) ); + minecraft->particleEngine->add( std::shared_ptr( new TakeAnimationParticle((Level *)minecraft->level, e, shared_from_this(), -0.5f) ) ); } void LocalPlayer::chat(const wstring& message) @@ -1130,7 +1130,7 @@ bool LocalPlayer::hasPermission(EGameCommand command) return level->getLevelData()->getAllowCommands(); } -void LocalPlayer::onCrafted(shared_ptr item) +void LocalPlayer::onCrafted(std::shared_ptr item) { if( minecraft->localgameModes[m_iPad] != NULL ) { @@ -1408,7 +1408,7 @@ bool LocalPlayer::handleMouseClick(int button) if(lastClickState == lastClick_oldRepeat) return false; - shared_ptr mplp = dynamic_pointer_cast( shared_from_this() ); + std::shared_ptr mplp = dynamic_pointer_cast( shared_from_this() ); if(mplp && mplp->connection) mplp->StopSleeping(); @@ -1419,7 +1419,7 @@ bool LocalPlayer::handleMouseClick(int button) return false; } - shared_ptr oldItem = inventory->getSelected(); + std::shared_ptr oldItem = inventory->getSelected(); if (minecraft->hitResult == NULL) { @@ -1441,7 +1441,7 @@ bool LocalPlayer::handleMouseClick(int button) if(minecraft->hitResult->entity->GetType()==eTYPE_COW) { // If I have an empty bucket in my hand, it's going to be filled with milk, so turn off mayUse - shared_ptr item = inventory->getSelected(); + std::shared_ptr item = inventory->getSelected(); if(item && (item->id==Item::bucket_empty_Id)) { mayUse=false; @@ -1471,7 +1471,7 @@ bool LocalPlayer::handleMouseClick(int button) } else { - shared_ptr item = oldItem; + std::shared_ptr item = oldItem; int oldCount = item != NULL ? item->count : 0; bool usedItem = false; if (minecraft->gameMode->useItemOn(minecraft->localplayers[GetXboxPad()], level, item, x, y, z, face, minecraft->hitResult->pos, false, &usedItem)) @@ -1503,7 +1503,7 @@ bool LocalPlayer::handleMouseClick(int button) if (mayUse && button == 1) { - shared_ptr item = inventory->getSelected(); + std::shared_ptr item = inventory->getSelected(); if (item != NULL) { if (minecraft->gameMode->useItem(minecraft->localplayers[GetXboxPad()], level, item)) @@ -1519,7 +1519,7 @@ void LocalPlayer::updateRichPresence() { if((m_iPad!=-1)/* && !ui.GetMenuDisplayed(m_iPad)*/ ) { - shared_ptr selectedItem = inventory->getSelected(); + std::shared_ptr selectedItem = inventory->getSelected(); if(selectedItem != NULL && selectedItem->id == Item::fishingRod_Id) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_FISHING); @@ -1575,7 +1575,7 @@ float LocalPlayer::getAndResetChangeDimensionTimer() return returnVal; } -void LocalPlayer::handleCollectItem(shared_ptr item) +void LocalPlayer::handleCollectItem(std::shared_ptr item) { if(item != NULL) { diff --git a/Minecraft.Client/Player/LocalPlayer.h b/Minecraft.Client/Player/LocalPlayer.h index 9b9c77578..8abbb3657 100644 --- a/Minecraft.Client/Player/LocalPlayer.h +++ b/Minecraft.Client/Player/LocalPlayer.h @@ -99,18 +99,18 @@ public: virtual void addAdditonalSaveData(CompoundTag *entityTag); virtual void readAdditionalSaveData(CompoundTag *entityTag); virtual void closeContainer(); - virtual void openTextEdit(shared_ptr sign); - virtual bool openContainer(shared_ptr container); // 4J added bool return + virtual void openTextEdit(std::shared_ptr sign); + virtual bool openContainer(std::shared_ptr container); // 4J added bool return virtual bool startCrafting(int x, int y, int z); // 4J added bool return virtual bool startEnchanting(int x, int y, int z); // 4J added bool return virtual bool startRepairing(int x, int y, int z); - virtual bool openFurnace(shared_ptr furnace); // 4J added bool return - virtual bool openBrewingStand(shared_ptr brewingStand); // 4J added bool return - virtual bool openTrap(shared_ptr trap); // 4J added bool return - virtual bool openTrading(shared_ptr traderTarget); - virtual void crit(shared_ptr e); - virtual void magicCrit(shared_ptr e); - virtual void take(shared_ptr e, int orgCount); + virtual bool openFurnace(std::shared_ptr furnace); // 4J added bool return + virtual bool openBrewingStand(std::shared_ptr brewingStand); // 4J added bool return + virtual bool openTrap(std::shared_ptr trap); // 4J added bool return + virtual bool openTrading(std::shared_ptr traderTarget); + virtual void crit(std::shared_ptr e); + virtual void magicCrit(std::shared_ptr e); + virtual void take(std::shared_ptr e, int orgCount); virtual void chat(const wstring& message); virtual bool isSneaking(); //virtual bool isIdle(); @@ -159,7 +159,7 @@ public: int lastClickState; // 4J Stu - Added to allow callback to tutorial to stay within Minecraft.Client - virtual void onCrafted(shared_ptr item); + virtual void onCrafted(std::shared_ptr item); virtual void setAndBroadcastCustomSkin(DWORD skinId); virtual void setAndBroadcastCustomCape(DWORD capeId); @@ -189,7 +189,7 @@ public: float getAndResetChangeDimensionTimer(); - virtual void handleCollectItem(shared_ptr item); + virtual void handleCollectItem(std::shared_ptr item); void SetPlayerAdditionalModelParts(vectorpAdditionalModelParts); private: diff --git a/Minecraft.Client/Player/MultiPlayerGameMode.cpp b/Minecraft.Client/Player/MultiPlayerGameMode.cpp index 1f0c43445..c54695e6d 100644 --- a/Minecraft.Client/Player/MultiPlayerGameMode.cpp +++ b/Minecraft.Client/Player/MultiPlayerGameMode.cpp @@ -38,7 +38,7 @@ void MultiPlayerGameMode::creativeDestroyBlock(Minecraft *minecraft, MultiPlayer } } -void MultiPlayerGameMode::adjustPlayer(shared_ptr player) +void MultiPlayerGameMode::adjustPlayer(std::shared_ptr player) { localPlayerMode->updatePlayerAbilities(&player->abilities); } @@ -54,7 +54,7 @@ void MultiPlayerGameMode::setLocalMode(GameType *mode) localPlayerMode->updatePlayerAbilities(&minecraft->player->abilities); } -void MultiPlayerGameMode::initPlayer(shared_ptr player) +void MultiPlayerGameMode::initPlayer(std::shared_ptr player) { player->yRot = -180; } @@ -87,7 +87,7 @@ bool MultiPlayerGameMode::destroyBlock(int x, int y, int z, int face) if (!localPlayerMode->isCreative()) { - shared_ptr item = minecraft->player->getSelectedItem(); + std::shared_ptr item = minecraft->player->getSelectedItem(); if (item != NULL) { item->mineBlock(level, oldTile->id, x, y, z, minecraft->player); @@ -111,13 +111,13 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) if (localPlayerMode->isCreative()) { - connection->send(shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) )); + connection->send(std::shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) )); creativeDestroyBlock(minecraft, this, x, y, z, face); destroyDelay = 5; } else if (!isDestroying || x != xDestroyBlock || y != yDestroyBlock || z != zDestroyBlock) { - connection->send( shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ) ); + connection->send( std::shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ) ); int t = minecraft->level->getTile(x, y, z); if (t > 0 && destroyProgress == 0) Tile::tiles[t]->attack(minecraft->level, x, y, z, minecraft->player); if (t > 0 && @@ -147,7 +147,7 @@ void MultiPlayerGameMode::stopDestroyBlock() { if (isDestroying) { - connection->send(shared_ptr(new PlayerActionPacket(PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, yDestroyBlock, zDestroyBlock, -1))); + connection->send(std::shared_ptr(new PlayerActionPacket(PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, yDestroyBlock, zDestroyBlock, -1))); } isDestroying = false; @@ -170,7 +170,7 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) if (localPlayerMode->isCreative()) { destroyDelay = 5; - connection->send(shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ) ); + connection->send(std::shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ) ); creativeDestroyBlock(minecraft, this, x, y, z, face); return; } @@ -202,7 +202,7 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) if (destroyProgress >= 1) { isDestroying = false; - connection->send( shared_ptr( new PlayerActionPacket(PlayerActionPacket::STOP_DESTROY_BLOCK, x, y, z, face) ) ); + connection->send( std::shared_ptr( new PlayerActionPacket(PlayerActionPacket::STOP_DESTROY_BLOCK, x, y, z, face) ) ); destroyBlock(x, y, z, face); destroyProgress = 0; oDestroyProgress = 0; @@ -241,11 +241,11 @@ void MultiPlayerGameMode::ensureHasSentCarriedItem() if (newItem != carriedItem) { carriedItem = newItem; - connection->send( shared_ptr( new SetCarriedItemPacket(carriedItem) ) ); + connection->send( std::shared_ptr( new SetCarriedItemPacket(carriedItem) ) ); } } -bool MultiPlayerGameMode::useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly, bool *pbUsedItem) +bool MultiPlayerGameMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly, bool *pbUsedItem) { if( pbUsedItem ) *pbUsedItem = false; // Did we actually use the held item? @@ -338,12 +338,12 @@ bool MultiPlayerGameMode::useItemOn(shared_ptr player, Level *level, sha // Fix for #7904 - Gameplay: Players can dupe torches by throwing them repeatedly into water. if(!bTestUseOnly) { - connection->send( shared_ptr( new UseItemPacket(x, y, z, face, player->inventory->getSelected(), clickX, clickY, clickZ) ) ); + connection->send( std::shared_ptr( new UseItemPacket(x, y, z, face, player->inventory->getSelected(), clickX, clickY, clickZ) ) ); } return didSomething; } -bool MultiPlayerGameMode::useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly) +bool MultiPlayerGameMode::useItem(std::shared_ptr player, Level *level, std::shared_ptr item, bool bTestUseOnly) { if(!player->isAllowedToUse(item)) return false; @@ -366,7 +366,7 @@ bool MultiPlayerGameMode::useItem(shared_ptr player, Level *level, share else { int oldCount = item->count; - shared_ptr itemInstance = item->use(level, player); + std::shared_ptr itemInstance = item->use(level, player); if ((itemInstance != NULL && itemInstance != item) || (itemInstance != NULL && itemInstance->count != oldCount)) { player->inventory->items[player->inventory->selected] = itemInstance; @@ -380,65 +380,65 @@ bool MultiPlayerGameMode::useItem(shared_ptr player, Level *level, share if(!bTestUseOnly) { - connection->send( shared_ptr( new UseItemPacket(-1, -1, -1, 255, player->inventory->getSelected(), 0, 0, 0) ) ); + connection->send( std::shared_ptr( new UseItemPacket(-1, -1, -1, 255, player->inventory->getSelected(), 0, 0, 0) ) ); } return result; } -shared_ptr MultiPlayerGameMode::createPlayer(Level *level) +std::shared_ptr MultiPlayerGameMode::createPlayer(Level *level) { - return shared_ptr( new MultiplayerLocalPlayer(minecraft, level, minecraft->user, connection) ); + return std::shared_ptr( new MultiplayerLocalPlayer(minecraft, level, minecraft->user, connection) ); } -void MultiPlayerGameMode::attack(shared_ptr player, shared_ptr entity) +void MultiPlayerGameMode::attack(std::shared_ptr player, std::shared_ptr entity) { ensureHasSentCarriedItem(); - connection->send( shared_ptr( new InteractPacket(player->entityId, entity->entityId, InteractPacket::ATTACK) ) ); + connection->send( std::shared_ptr( new InteractPacket(player->entityId, entity->entityId, InteractPacket::ATTACK) ) ); player->attack(entity); } -bool MultiPlayerGameMode::interact(shared_ptr player, shared_ptr entity) +bool MultiPlayerGameMode::interact(std::shared_ptr player, std::shared_ptr entity) { ensureHasSentCarriedItem(); - connection->send(shared_ptr( new InteractPacket(player->entityId, entity->entityId, InteractPacket::INTERACT) ) ); + connection->send(std::shared_ptr( new InteractPacket(player->entityId, entity->entityId, InteractPacket::INTERACT) ) ); return player->interact(entity); } -shared_ptr MultiPlayerGameMode::handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, shared_ptr player) +std::shared_ptr MultiPlayerGameMode::handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, std::shared_ptr player) { short changeUid = player->containerMenu->backup(player->inventory); - shared_ptr clicked = player->containerMenu->clicked(slotNum, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, player); - connection->send( shared_ptr( new ContainerClickPacket(containerId, slotNum, buttonNum, quickKeyHeld, clicked, changeUid) ) ); + std::shared_ptr clicked = player->containerMenu->clicked(slotNum, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, player); + connection->send( std::shared_ptr( new ContainerClickPacket(containerId, slotNum, buttonNum, quickKeyHeld, clicked, changeUid) ) ); return clicked; } void MultiPlayerGameMode::handleInventoryButtonClick(int containerId, int buttonId) { - connection->send(shared_ptr( new ContainerButtonClickPacket(containerId, buttonId) )); + connection->send(std::shared_ptr( new ContainerButtonClickPacket(containerId, buttonId) )); } -void MultiPlayerGameMode::handleCreativeModeItemAdd(shared_ptr clicked, int slot) +void MultiPlayerGameMode::handleCreativeModeItemAdd(std::shared_ptr clicked, int slot) { if (localPlayerMode->isCreative()) { - connection->send(shared_ptr( new SetCreativeModeSlotPacket(slot, clicked) ) ); + connection->send(std::shared_ptr( new SetCreativeModeSlotPacket(slot, clicked) ) ); } } -void MultiPlayerGameMode::handleCreativeModeItemDrop(shared_ptr clicked) +void MultiPlayerGameMode::handleCreativeModeItemDrop(std::shared_ptr clicked) { if (localPlayerMode->isCreative() && clicked != NULL) { - connection->send(shared_ptr( new SetCreativeModeSlotPacket(-1, clicked) ) ); + connection->send(std::shared_ptr( new SetCreativeModeSlotPacket(-1, clicked) ) ); } } -void MultiPlayerGameMode::releaseUsingItem(shared_ptr player) +void MultiPlayerGameMode::releaseUsingItem(std::shared_ptr player) { ensureHasSentCarriedItem(); - connection->send(shared_ptr( new PlayerActionPacket(PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 255) ) ); + connection->send(std::shared_ptr( new PlayerActionPacket(PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 255) ) ); player->releaseUsingItem(); } @@ -462,17 +462,17 @@ bool MultiPlayerGameMode::hasFarPickRange() return localPlayerMode->isCreative(); } -bool MultiPlayerGameMode::handleCraftItem(int recipe, shared_ptr player) +bool MultiPlayerGameMode::handleCraftItem(int recipe, std::shared_ptr player) { short changeUid = player->containerMenu->backup(player->inventory); - connection->send( shared_ptr( new CraftItemPacket(recipe, changeUid) ) ); + connection->send( std::shared_ptr( new CraftItemPacket(recipe, changeUid) ) ); return true; } -void MultiPlayerGameMode::handleDebugOptions(unsigned int uiVal, shared_ptr player) +void MultiPlayerGameMode::handleDebugOptions(unsigned int uiVal, std::shared_ptr player) { player->SetDebugOptions(uiVal); - connection->send( shared_ptr( new DebugOptionsPacket(uiVal) ) ); + connection->send( std::shared_ptr( new DebugOptionsPacket(uiVal) ) ); } diff --git a/Minecraft.Client/Player/MultiPlayerGameMode.h b/Minecraft.Client/Player/MultiPlayerGameMode.h index 29326c698..19ef46af6 100644 --- a/Minecraft.Client/Player/MultiPlayerGameMode.h +++ b/Minecraft.Client/Player/MultiPlayerGameMode.h @@ -24,10 +24,10 @@ protected: public: MultiPlayerGameMode(Minecraft *minecraft, ClientConnection *connection); static void creativeDestroyBlock(Minecraft *minecraft, MultiPlayerGameMode *gameMode, int x, int y, int z, int face); - void adjustPlayer(shared_ptr player); + void adjustPlayer(std::shared_ptr player); bool isCutScene(); void setLocalMode(GameType *mode); - virtual void initPlayer(shared_ptr player); + virtual void initPlayer(std::shared_ptr player); virtual bool canHurtPlayer(); virtual bool destroyBlock(int x, int y, int z, int face); virtual void startDestroyBlock(int x, int y, int z, int face); @@ -41,24 +41,24 @@ private: private: 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 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); - virtual bool interact(shared_ptr player, shared_ptr entity); - virtual shared_ptr handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, shared_ptr player); + virtual bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); + virtual bool useItem(std::shared_ptr player, Level *level, std::shared_ptr item, bool bTestUseOnly=false); + virtual std::shared_ptr createPlayer(Level *level); + virtual void attack(std::shared_ptr player, std::shared_ptr entity); + virtual bool interact(std::shared_ptr player, std::shared_ptr entity); + virtual std::shared_ptr handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, std::shared_ptr player); virtual void handleInventoryButtonClick(int containerId, int buttonId); - virtual void handleCreativeModeItemAdd(shared_ptr clicked, int slot); - virtual void handleCreativeModeItemDrop(shared_ptr clicked); - virtual void releaseUsingItem(shared_ptr player); + virtual void handleCreativeModeItemAdd(std::shared_ptr clicked, int slot); + virtual void handleCreativeModeItemDrop(std::shared_ptr clicked); + virtual void releaseUsingItem(std::shared_ptr player); virtual bool hasExperience(); virtual bool hasMissTime(); virtual bool hasInfiniteItems(); virtual bool hasFarPickRange(); // 4J Stu - Added so we can send packets for this in the network game - virtual bool handleCraftItem(int recipe, shared_ptr player); - virtual void handleDebugOptions(unsigned int uiVal, shared_ptr player); + virtual bool handleCraftItem(int recipe, std::shared_ptr player); + virtual void handleDebugOptions(unsigned int uiVal, std::shared_ptr player); // 4J Stu - Added for tutorial checks virtual bool isInputAllowed(int mapping) { return true; } diff --git a/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp b/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp index d36e7c827..ed2c4beb8 100644 --- a/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp +++ b/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp @@ -49,8 +49,8 @@ void MultiplayerLocalPlayer::tick() /*if((app.GetGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) != m_bShownOnMaps) { m_bShownOnMaps = (app.GetGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); - if (m_bShownOnMaps) connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::SHOW_ON_MAPS) ) ); - else connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::HIDE_ON_MAPS) ) ); + if (m_bShownOnMaps) connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::SHOW_ON_MAPS) ) ); + else connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::HIDE_ON_MAPS) ) ); }*/ if (!level->hasChunkAt(Mth::floor(x), 0, Mth::floor(z))) return; @@ -75,8 +75,8 @@ void MultiplayerLocalPlayer::sendPosition() bool sprinting = isSprinting(); if (sprinting != lastSprinting) { - if (sprinting) connection->send(shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SPRINTING))); - else connection->send(shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SPRINTING))); + if (sprinting) connection->send(std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SPRINTING))); + else connection->send(std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SPRINTING))); lastSprinting = sprinting; } @@ -84,8 +84,8 @@ void MultiplayerLocalPlayer::sendPosition() bool sneaking = isSneaking(); if (sneaking != lastSneaked) { - if (sneaking) connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SNEAKING) ) ); - else connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SNEAKING) ) ); + if (sneaking) connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SNEAKING) ) ); + else connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SNEAKING) ) ); lastSneaked = sneaking; } @@ -93,8 +93,8 @@ void MultiplayerLocalPlayer::sendPosition() bool idle = isIdle(); if (idle != lastIdle) { - if (idle) connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_IDLEANIM) ) ); - else connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_IDLEANIM) ) ); + if (idle) connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_IDLEANIM) ) ); + else connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_IDLEANIM) ) ); lastIdle = idle; } @@ -110,26 +110,26 @@ void MultiplayerLocalPlayer::sendPosition() bool rot = rydd != 0 || rxdd != 0; if (riding != NULL) { - connection->send( shared_ptr( new MovePlayerPacket::PosRot(xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying) ) ); + connection->send( std::shared_ptr( new MovePlayerPacket::PosRot(xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying) ) ); move = false; } else { if (move && rot) { - connection->send( shared_ptr( new MovePlayerPacket::PosRot(x, bb->y0, y, z, yRot, xRot, onGround, abilities.flying) ) ); + connection->send( std::shared_ptr( new MovePlayerPacket::PosRot(x, bb->y0, y, z, yRot, xRot, onGround, abilities.flying) ) ); } else if (move) { - connection->send( shared_ptr( new MovePlayerPacket::Pos(x, bb->y0, y, z, onGround, abilities.flying) ) ); + connection->send( std::shared_ptr( new MovePlayerPacket::Pos(x, bb->y0, y, z, onGround, abilities.flying) ) ); } else if (rot) { - connection->send( shared_ptr( new MovePlayerPacket::Rot(yRot, xRot, onGround, abilities.flying) ) ); + connection->send( std::shared_ptr( new MovePlayerPacket::Rot(yRot, xRot, onGround, abilities.flying) ) ); } else { - connection->send( shared_ptr( new MovePlayerPacket(onGround, abilities.flying) ) ); + connection->send( std::shared_ptr( new MovePlayerPacket(onGround, abilities.flying) ) ); } } @@ -152,31 +152,31 @@ void MultiplayerLocalPlayer::sendPosition() } -shared_ptr MultiplayerLocalPlayer::drop() +std::shared_ptr MultiplayerLocalPlayer::drop() { - connection->send( shared_ptr( new PlayerActionPacket(PlayerActionPacket::DROP_ITEM, 0, 0, 0, 0) ) ); + connection->send( std::shared_ptr( new PlayerActionPacket(PlayerActionPacket::DROP_ITEM, 0, 0, 0, 0) ) ); return nullptr; } -void MultiplayerLocalPlayer::reallyDrop(shared_ptr itemEntity) +void MultiplayerLocalPlayer::reallyDrop(std::shared_ptr itemEntity) { } void MultiplayerLocalPlayer::chat(const wstring& message) { - connection->send( shared_ptr( new ChatPacket(message) ) ); + connection->send( std::shared_ptr( new ChatPacket(message) ) ); } void MultiplayerLocalPlayer::swing() { LocalPlayer::swing(); - connection->send( shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::SWING) ) ); + connection->send( std::shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::SWING) ) ); } void MultiplayerLocalPlayer::respawn() { - connection->send( shared_ptr( new ClientCommandPacket(ClientCommandPacket::PERFORM_RESPAWN))); + connection->send( std::shared_ptr( new ClientCommandPacket(ClientCommandPacket::PERFORM_RESPAWN))); } @@ -238,7 +238,7 @@ void MultiplayerLocalPlayer::onEffectRemoved(MobEffectInstance *effect) void MultiplayerLocalPlayer::closeContainer() { - connection->send( shared_ptr( new ContainerClosePacket(containerMenu->containerId) ) ); + connection->send( std::shared_ptr( new ContainerClosePacket(containerMenu->containerId) ) ); inventory->setCarried(nullptr); LocalPlayer::closeContainer(); } @@ -286,7 +286,7 @@ void MultiplayerLocalPlayer::awardStatFromServer(Stat *stat, byteArray param) void MultiplayerLocalPlayer::onUpdateAbilities() { - connection->send(shared_ptr(new PlayerAbilitiesPacket(&abilities))); + connection->send(std::shared_ptr(new PlayerAbilitiesPacket(&abilities))); } bool MultiplayerLocalPlayer::isLocalPlayer() @@ -294,7 +294,7 @@ bool MultiplayerLocalPlayer::isLocalPlayer() return true; } -void MultiplayerLocalPlayer::ride(shared_ptr e) +void MultiplayerLocalPlayer::ride(std::shared_ptr e) { bool wasRiding = riding != NULL; LocalPlayer::ride(e); @@ -344,7 +344,7 @@ void MultiplayerLocalPlayer::ride(shared_ptr e) void MultiplayerLocalPlayer::StopSleeping() { - connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SLEEPING) ) ); + connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SLEEPING) ) ); } // 4J Added @@ -355,7 +355,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(DWORD skinId) #ifndef _CONTENT_PACKAGE wprintf(L"Skin for local player %ls has changed to %ls (%d)\n", name.c_str(), customTextureUrl.c_str(), getPlayerDefaultSkin() ); #endif - if(getCustomSkin() != oldSkinIndex) connection->send( shared_ptr( new TextureAndGeometryChangePacket( shared_from_this(), app.GetPlayerSkinName(GetXboxPad()) ) ) ); + if(getCustomSkin() != oldSkinIndex) connection->send( std::shared_ptr( new TextureAndGeometryChangePacket( shared_from_this(), app.GetPlayerSkinName(GetXboxPad()) ) ) ); } void MultiplayerLocalPlayer::setAndBroadcastCustomCape(DWORD capeId) @@ -365,5 +365,5 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomCape(DWORD capeId) #ifndef _CONTENT_PACKAGE wprintf(L"Cape for local player %ls has changed to %ls\n", name.c_str(), customTextureUrl2.c_str()); #endif - if(getCustomCape() != oldCapeIndex) connection->send( shared_ptr( new TextureChangePacket( shared_from_this(), TextureChangePacket::e_TextureChange_Cape, app.GetPlayerCapeName(GetXboxPad()) ) ) ); + if(getCustomCape() != oldCapeIndex) connection->send( std::shared_ptr( new TextureChangePacket( shared_from_this(), TextureChangePacket::e_TextureChange_Cape, app.GetPlayerCapeName(GetXboxPad()) ) ) ); } diff --git a/Minecraft.Client/Player/MultiPlayerLocalPlayer.h b/Minecraft.Client/Player/MultiPlayerLocalPlayer.h index cc7dc3ae1..f8815ea43 100644 --- a/Minecraft.Client/Player/MultiPlayerLocalPlayer.h +++ b/Minecraft.Client/Player/MultiPlayerLocalPlayer.h @@ -33,9 +33,9 @@ public: void sendPosition(); using Player::drop; - virtual shared_ptr drop(); + virtual std::shared_ptr drop(); protected: - virtual void reallyDrop(shared_ptr itemEntity); + virtual void reallyDrop(std::shared_ptr itemEntity); public: virtual void chat(const wstring& message); virtual void swing(); @@ -62,7 +62,7 @@ public: //void CustomSkin(PBYTE pbData, DWORD dwBytes); // 4J Overriding this so we can flag an event for the tutorial - virtual void ride(shared_ptr e); + virtual void ride(std::shared_ptr e); // 4J - added for the Stop Sleeping virtual void StopSleeping(); diff --git a/Minecraft.Client/Player/RemotePlayer.cpp b/Minecraft.Client/Player/RemotePlayer.cpp index d798a7513..4cd436340 100644 --- a/Minecraft.Client/Player/RemotePlayer.cpp +++ b/Minecraft.Client/Player/RemotePlayer.cpp @@ -66,7 +66,7 @@ void RemotePlayer::tick() if (!hasStartedUsingItem && isUsingItemFlag() && inventory->items[inventory->selected] != NULL) { - shared_ptr item = inventory->items[inventory->selected]; + std::shared_ptr item = inventory->items[inventory->selected]; startUsingItem(inventory->items[inventory->selected], Item::items[item->id]->getUseDuration(item)); hasStartedUsingItem = true; } @@ -129,7 +129,7 @@ void RemotePlayer::aiStep() } // 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 -void RemotePlayer::setEquippedSlot(int slot, shared_ptr item) +void RemotePlayer::setEquippedSlot(int slot, std::shared_ptr item) { if (slot == 0) { diff --git a/Minecraft.Client/Player/RemotePlayer.h b/Minecraft.Client/Player/RemotePlayer.h index 6a78bab63..641bf293a 100644 --- a/Minecraft.Client/Player/RemotePlayer.h +++ b/Minecraft.Client/Player/RemotePlayer.h @@ -26,7 +26,7 @@ public: virtual void tick(); virtual float getShadowHeightOffs(); virtual void aiStep(); - virtual void setEquippedSlot(int slot, shared_ptr item);// 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 + virtual void setEquippedSlot(int slot, std::shared_ptr item);// 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 virtual void animateRespawn(); virtual float getHeadHeight(); bool hasPermission(EGameCommand command) { return false; } diff --git a/Minecraft.Client/Player/ServerPlayer.cpp b/Minecraft.Client/Player/ServerPlayer.cpp index fc5921d5e..26949313b 100644 --- a/Minecraft.Client/Player/ServerPlayer.cpp +++ b/Minecraft.Client/Player/ServerPlayer.cpp @@ -236,10 +236,10 @@ void ServerPlayer::tick() for (int i = 0; i < 5; i++) { - shared_ptr currentCarried = getCarried(i); + std::shared_ptr currentCarried = getCarried(i); if (currentCarried != lastCarried[i]) { - getLevel()->getTracker()->broadcast(shared_from_this(), shared_ptr( new SetEquippedItemPacket(this->entityId, i, currentCarried) ) ); + getLevel()->getTracker()->broadcast(shared_from_this(), std::shared_ptr( new SetEquippedItemPacket(this->entityId, i, currentCarried) ) ); lastCarried[i] = currentCarried; } } @@ -264,7 +264,7 @@ void ServerPlayer::flushEntitiesToRemove() it = entitiesToRemove.erase(it); } - connection->send(shared_ptr(new RemoveEntitiesPacket(ids))); + connection->send(std::shared_ptr(new RemoveEntitiesPacket(ids))); } } @@ -286,14 +286,14 @@ void ServerPlayer::doTickA() for (unsigned int i = 0; i < inventory->getContainerSize(); i++) { - shared_ptr ie = inventory->getItem(i); + std::shared_ptr ie = inventory->getItem(i); if (ie != NULL) { // 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() ) ) ); + std::shared_ptr packet = (dynamic_cast(Item::items[ie->id])->getUpdatePacket(ie, level, dynamic_pointer_cast( shared_from_this() ) ) ); if (packet != NULL) { connection->send(packet); @@ -402,7 +402,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { // app.DebugPrintf("Creating BRUP for %d %d\n",nearest.x, nearest.z); PIXBeginNamedEvent(0,"Creation BRUP for sending\n"); - shared_ptr packet = shared_ptr( new BlockRegionUpdatePacket(nearest.x * 16, 0, nearest.z * 16, 16, Level::maxBuildHeight, 16, level) ); + std::shared_ptr packet = std::shared_ptr( new BlockRegionUpdatePacket(nearest.x * 16, 0, nearest.z * 16, 16, Level::maxBuildHeight, 16, level) ); PIXEndNamedEvent(); if( dontDelayChunks ) packet->shouldDelay = false; @@ -441,7 +441,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) // Don't send TileEntity data until we have sent the block data if( connection->isLocal() || chunkDataSent) { - vector > *tes = level->getTileEntitiesInRegion(nearest.x * 16, 0, nearest.z * 16, nearest.x * 16 + 16, Level::maxBuildHeight, nearest.z * 16 + 16); + vector > *tes = level->getTileEntitiesInRegion(nearest.x * 16, 0, nearest.z * 16, nearest.x * 16 + 16, Level::maxBuildHeight, nearest.z * 16 + 16); for (unsigned int i = 0; i < tes->size(); i++) { // 4J Stu - Added delay param to ensure that these arrive after the BRUPs from above @@ -541,7 +541,7 @@ void ServerPlayer::doTickB(bool ignorePortal) if (getHealth() != lastSentHealth || lastSentFood != foodData.getFoodLevel() || ((foodData.getSaturationLevel() == 0) != lastFoodSaturationZero)) { // 4J Stu - Added m_lastDamageSource for telemetry - connection->send( shared_ptr( new SetHealthPacket(getHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel(), m_lastDamageSource) ) ); + connection->send( std::shared_ptr( new SetHealthPacket(getHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel(), m_lastDamageSource) ) ); lastSentHealth = getHealth(); lastSentFood = foodData.getFoodLevel(); lastFoodSaturationZero = foodData.getSaturationLevel() == 0; @@ -550,12 +550,12 @@ void ServerPlayer::doTickB(bool ignorePortal) if (totalExperience != lastSentExp) { lastSentExp = totalExperience; - connection->send( shared_ptr( new SetExperiencePacket(experienceProgress, totalExperience, experienceLevel) ) ); + connection->send( std::shared_ptr( new SetExperiencePacket(experienceProgress, totalExperience, experienceLevel) ) ); } } -shared_ptr ServerPlayer::getCarried(int slot) +std::shared_ptr ServerPlayer::getCarried(int slot) { if (slot == 0) return inventory->getSelected(); return inventory->armor[slot - 1]; @@ -575,7 +575,7 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, int dmg) { // 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. - shared_ptr source = dmgSource->getDirectEntity(); + std::shared_ptr source = dmgSource->getDirectEntity(); if (dynamic_pointer_cast(source) != NULL && (!server->pvp || !dynamic_pointer_cast(source)->isAllowedToAttackPlayers()) ) @@ -585,7 +585,7 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, int dmg) if (source != NULL && source->GetType() == eTYPE_ARROW) { - shared_ptr arrow = dynamic_pointer_cast(source); + std::shared_ptr arrow = dynamic_pointer_cast(source); if (dynamic_pointer_cast(arrow->owner) != NULL && (!server->pvp || !dynamic_pointer_cast(arrow->owner)->isAllowedToAttackPlayers()) ) { return false; @@ -608,7 +608,7 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, int dmg) else if(dmgSource == DamageSource::cactus) m_lastDamageSource = eTelemetryPlayerDeathSource_Cactus; else { - shared_ptr source = dmgSource->getEntity(); + std::shared_ptr source = dmgSource->getEntity(); if( source != NULL ) { switch(source->GetType()) @@ -647,7 +647,7 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, int dmg) case eTYPE_ARROW: if ((dynamic_pointer_cast(source))->owner != NULL) { - shared_ptr attacker = (dynamic_pointer_cast(source))->owner; + std::shared_ptr attacker = (dynamic_pointer_cast(source))->owner; if (attacker != NULL) { switch(attacker->GetType()) @@ -696,19 +696,19 @@ void ServerPlayer::changeDimension(int i) level->removeEntity(shared_from_this()); wonGame = true; m_enteredEndExitPortal = true; // We only flag this for the player in the portal - connection->send( shared_ptr( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()) ) ); + connection->send( std::shared_ptr( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()) ) ); app.DebugPrintf("Sending packet to %d\n", thisPlayer->GetUserIndex()); } if(thisPlayer != NULL) { for(AUTO_VAR(it, MinecraftServer::getInstance()->getPlayers()->players.begin()); it != MinecraftServer::getInstance()->getPlayers()->players.end(); ++it) { - shared_ptr servPlayer = *it; + std::shared_ptr servPlayer = *it; INetworkPlayer *checkPlayer = servPlayer->connection->getNetworkPlayer(); if(thisPlayer != checkPlayer && checkPlayer != NULL && thisPlayer->IsSameSystem( checkPlayer ) && !servPlayer->wonGame ) { servPlayer->wonGame = true; - servPlayer->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex() ) ) ); + servPlayer->connection->send( std::shared_ptr( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex() ) ) ); app.DebugPrintf("Sending packet to %d\n", thisPlayer->GetUserIndex()); } } @@ -733,11 +733,11 @@ void ServerPlayer::changeDimension(int i) } // 4J Added delay param -void ServerPlayer::broadcast(shared_ptr te, bool delay /*= false*/) +void ServerPlayer::broadcast(std::shared_ptr te, bool delay /*= false*/) { if (te != NULL) { - shared_ptr p = te->getUpdatePacket(); + std::shared_ptr p = te->getUpdatePacket(); if (p != NULL) { p->shouldDelay = delay; @@ -747,22 +747,22 @@ void ServerPlayer::broadcast(shared_ptr te, bool delay /*= false*/) } } -void ServerPlayer::take(shared_ptr e, int orgCount) +void ServerPlayer::take(std::shared_ptr e, int orgCount) { if (!e->removed) { EntityTracker *entityTracker = getLevel()->getTracker(); if (e->GetType() == eTYPE_ITEMENTITY) { - entityTracker->broadcast(e, shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); + entityTracker->broadcast(e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); } if (e->GetType() == eTYPE_ARROW) { - entityTracker->broadcast(e, shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); + entityTracker->broadcast(e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); } if (e->GetType() == eTYPE_EXPERIENCEORB) { - entityTracker->broadcast(e, shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); + entityTracker->broadcast(e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); } } Player::take(e, orgCount); @@ -775,7 +775,7 @@ void ServerPlayer::swing() { swingTime = -1; swinging = true; - getLevel()->getTracker()->broadcast(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::SWING) ) ); + getLevel()->getTracker()->broadcast(shared_from_this(), std::shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::SWING) ) ); } } @@ -784,7 +784,7 @@ Player::BedSleepingResult ServerPlayer::startSleepInBed(int x, int y, int z, boo BedSleepingResult result = Player::startSleepInBed(x, y, z, bTestUse); if (result == OK) { - shared_ptr p = shared_ptr( new EntityActionAtPositionPacket(shared_from_this(), EntityActionAtPositionPacket::START_SLEEP, x, y, z) ); + std::shared_ptr p = std::shared_ptr( new EntityActionAtPositionPacket(shared_from_this(), EntityActionAtPositionPacket::START_SLEEP, x, y, z) ); getLevel()->getTracker()->broadcast(shared_from_this(), p); connection->teleport(this->x, this->y, this->z, yRot, xRot); connection->send(p); @@ -796,16 +796,16 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, boo { if (isSleeping()) { - getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::WAKE_UP) ) ); + getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::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); } -void ServerPlayer::ride(shared_ptr e) +void ServerPlayer::ride(std::shared_ptr e) { Player::ride(e); - connection->send( shared_ptr( new SetRidingPacket(shared_from_this(), riding) ) ); + connection->send( std::shared_ptr( new SetRidingPacket(shared_from_this(), riding) ) ); // 4J Removed this - The act of riding will be handled on the client and will change the position // of the player. If we also teleport it then we can end up with a repeating movements, e.g. bouncing @@ -832,7 +832,7 @@ bool ServerPlayer::startCrafting(int x, int y, int z) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::WORKBENCH, 0, 9) ) ); + connection->send( std::shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::WORKBENCH, 0, 9) ) ); containerMenu = new CraftingMenu(inventory, level, x, y, z); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -850,7 +850,7 @@ bool ServerPlayer::startEnchanting(int x, int y, int z) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::ENCHANTMENT, 0, 9) )); + connection->send(std::shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::ENCHANTMENT, 0, 9) )); containerMenu = new EnchantmentMenu(inventory, level, x, y, z); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -868,7 +868,7 @@ bool ServerPlayer::startRepairing(int x, int y, int z) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(shared_ptr ( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::REPAIR_TABLE, 0, 9)) ); + connection->send(std::shared_ptr ( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::REPAIR_TABLE, 0, 9)) ); containerMenu = new RepairMenu(inventory, level, x, y, z, dynamic_pointer_cast(shared_from_this())); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -881,12 +881,12 @@ bool ServerPlayer::startRepairing(int x, int y, int z) return true; } -bool ServerPlayer::openContainer(shared_ptr container) +bool ServerPlayer::openContainer(std::shared_ptr container) { if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::CONTAINER, container->getName(), container->getContainerSize()) ) ); + connection->send( std::shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::CONTAINER, container->getName(), container->getContainerSize()) ) ); containerMenu = new ContainerMenu(inventory, container); containerMenu->containerId = containerCounter; @@ -900,12 +900,12 @@ bool ServerPlayer::openContainer(shared_ptr container) return true; } -bool ServerPlayer::openFurnace(shared_ptr furnace) +bool ServerPlayer::openFurnace(std::shared_ptr furnace) { if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FURNACE, 0, furnace->getContainerSize()) ) ); + connection->send( std::shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FURNACE, 0, furnace->getContainerSize()) ) ); containerMenu = new FurnaceMenu(inventory, furnace); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -918,12 +918,12 @@ bool ServerPlayer::openFurnace(shared_ptr furnace) return true; } -bool ServerPlayer::openTrap(shared_ptr trap) +bool ServerPlayer::openTrap(std::shared_ptr trap) { if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRAP, 0, trap->getContainerSize()) ) ); + connection->send( std::shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRAP, 0, trap->getContainerSize()) ) ); containerMenu = new TrapMenu(inventory, trap); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -936,12 +936,12 @@ bool ServerPlayer::openTrap(shared_ptr trap) return true; } -bool ServerPlayer::openBrewingStand(shared_ptr brewingStand) +bool ServerPlayer::openBrewingStand(std::shared_ptr brewingStand) { if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::BREWING_STAND, 0, brewingStand->getContainerSize()))); + connection->send(std::shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::BREWING_STAND, 0, brewingStand->getContainerSize()))); containerMenu = new BrewingStandMenu(inventory, brewingStand); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -954,7 +954,7 @@ bool ServerPlayer::openBrewingStand(shared_ptr brewingSt return true; } -bool ServerPlayer::openTrading(shared_ptr traderTarget) +bool ServerPlayer::openTrading(std::shared_ptr traderTarget) { if(containerMenu == inventoryMenu) { @@ -962,9 +962,9 @@ bool ServerPlayer::openTrading(shared_ptr traderTarget) containerMenu = new MerchantMenu(inventory, traderTarget, level); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); - shared_ptr container = ((MerchantMenu *) containerMenu)->getTradeContainer(); + std::shared_ptr container = ((MerchantMenu *) containerMenu)->getTradeContainer(); - connection->send(shared_ptr(new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRADER_NPC, container->getName(), container->getContainerSize()))); + connection->send(std::shared_ptr(new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRADER_NPC, container->getName(), container->getContainerSize()))); MerchantRecipeList *offers = traderTarget->getOffers(dynamic_pointer_cast(shared_from_this())); if (offers != NULL) @@ -976,7 +976,7 @@ bool ServerPlayer::openTrading(shared_ptr traderTarget) output.writeInt(containerCounter); offers->writeToStream(&output); - connection->send(shared_ptr( new CustomPayloadPacket(CustomPayloadPacket::TRADER_LIST_PACKET, rawOutput.toByteArray()))); + connection->send(std::shared_ptr( new CustomPayloadPacket(CustomPayloadPacket::TRADER_LIST_PACKET, rawOutput.toByteArray()))); } } else @@ -987,7 +987,7 @@ bool ServerPlayer::openTrading(shared_ptr traderTarget) return true; } -void ServerPlayer::slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr item) +void ServerPlayer::slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr item) { if (dynamic_cast(container->getSlot(slotIndex))) { @@ -1004,21 +1004,21 @@ void ServerPlayer::slotChanged(AbstractContainerMenu *container, int slotIndex, return; } - connection->send( shared_ptr( new ContainerSetSlotPacket(container->containerId, slotIndex, item) ) ); + connection->send( std::shared_ptr( new ContainerSetSlotPacket(container->containerId, slotIndex, item) ) ); } void ServerPlayer::refreshContainer(AbstractContainerMenu *menu) { - vector > *items = menu->getItems(); + vector > *items = menu->getItems(); refreshContainer(menu, items); delete items; } -void ServerPlayer::refreshContainer(AbstractContainerMenu *container, vector > *items) +void ServerPlayer::refreshContainer(AbstractContainerMenu *container, vector > *items) { - connection->send( shared_ptr( new ContainerSetContentPacket(container->containerId, items) ) ); - connection->send( shared_ptr( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) ); + connection->send( std::shared_ptr( new ContainerSetContentPacket(container->containerId, items) ) ); + connection->send( std::shared_ptr( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) ); } void ServerPlayer::setContainerData(AbstractContainerMenu *container, int id, int value) @@ -1033,12 +1033,12 @@ void ServerPlayer::setContainerData(AbstractContainerMenu *container, int id, in // client again. return; } - connection->send( shared_ptr( new ContainerSetDataPacket(container->containerId, id, value) ) ); + connection->send( std::shared_ptr( new ContainerSetDataPacket(container->containerId, id, value) ) ); } void ServerPlayer::closeContainer() { - connection->send( shared_ptr( new ContainerClosePacket(containerMenu->containerId) ) ); + connection->send( std::shared_ptr( new ContainerClosePacket(containerMenu->containerId) ) ); doCloseContainer(); } @@ -1052,7 +1052,7 @@ void ServerPlayer::broadcastCarriedItem() // client again. return; } - connection->send( shared_ptr( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) ); + connection->send( std::shared_ptr( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) ); } void ServerPlayer::doCloseContainer() @@ -1087,12 +1087,12 @@ void ServerPlayer::awardStat(Stat *stat, byteArray param) while (count > 100) { - connection->send( shared_ptr( new AwardStatPacket(stat->id, 100) ) ); + connection->send( std::shared_ptr( new AwardStatPacket(stat->id, 100) ) ); count -= 100; } - connection->send( shared_ptr( new AwardStatPacket(stat->id, count) ) ); + connection->send( std::shared_ptr( new AwardStatPacket(stat->id, count) ) ); #else - connection->send( shared_ptr( new AwardStatPacket(stat->id, param) ) ); + connection->send( std::shared_ptr( new AwardStatPacket(stat->id, param) ) ); // byteArray deleted in AwardStatPacket destructor. #endif } @@ -1122,33 +1122,33 @@ void ServerPlayer::displayClientMessage(int messageId) { case IDS_TILE_BED_OCCUPIED: messageType = ChatPacket::e_ChatBedOccupied; - connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); + connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_TILE_BED_NO_SLEEP: messageType = ChatPacket::e_ChatBedNoSleep; - connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); + connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_TILE_BED_NOT_VALID: messageType = ChatPacket::e_ChatBedNotValid; - connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); + connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_TILE_BED_NOTSAFE: messageType = ChatPacket::e_ChatBedNotSafe; - connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); + connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_TILE_BED_PLAYERSLEEP: messageType = ChatPacket::e_ChatBedPlayerSleep; // broadcast to all the other players in the game for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()!=player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatBedPlayerSleep))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatBedPlayerSleep))); } else { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatBedMeSleep))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatBedMeSleep))); } } return; @@ -1156,85 +1156,85 @@ void ServerPlayer::displayClientMessage(int messageId) case IDS_PLAYER_ENTERED_END: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()!=player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerEnteredEnd))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerEnteredEnd))); } } break; case IDS_PLAYER_LEFT_END: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()!=player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerLeftEnd))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerLeftEnd))); } } break; case IDS_TILE_BED_MESLEEP: messageType = ChatPacket::e_ChatBedMeSleep; - connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); + connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxPigsSheepCows))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxPigsSheepCows))); } } break; case IDS_MAX_CHICKENS_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxChickens))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxChickens))); } } break; case IDS_MAX_SQUID_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxSquid))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxSquid))); } } break; case IDS_MAX_WOLVES_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxWolves))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxWolves))); } } break; case IDS_MAX_MOOSHROOMS_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxMooshrooms))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxMooshrooms))); } } break; case IDS_MAX_ENEMIES_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxEnemies))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxEnemies))); } } break; @@ -1242,40 +1242,40 @@ void ServerPlayer::displayClientMessage(int messageId) case IDS_MAX_VILLAGERS_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxVillagers))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxVillagers))); } } break; case IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredPigsSheepCows))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredPigsSheepCows))); } } break; case IDS_MAX_CHICKENS_BRED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredChickens))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredChickens))); } } break; case IDS_MAX_MUSHROOMCOWS_BRED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredMooshrooms))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredMooshrooms))); } } break; @@ -1283,10 +1283,10 @@ void ServerPlayer::displayClientMessage(int messageId) case IDS_MAX_WOLVES_BRED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredWolves))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredWolves))); } } break; @@ -1294,10 +1294,10 @@ void ServerPlayer::displayClientMessage(int messageId) case IDS_CANT_SHEAR_MOOSHROOM: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerCantShearMooshroom))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerCantShearMooshroom))); } } break; @@ -1306,20 +1306,20 @@ void ServerPlayer::displayClientMessage(int messageId) case IDS_MAX_HANGINGENTITIES: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxHangingEntities))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxHangingEntities))); } } break; case IDS_CANT_SPAWN_IN_PEACEFUL: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerCantSpawnInPeaceful))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerCantSpawnInPeaceful))); } } break; @@ -1327,10 +1327,10 @@ void ServerPlayer::displayClientMessage(int messageId) case IDS_MAX_BOATS: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBoats))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBoats))); } } break; @@ -1343,26 +1343,26 @@ void ServerPlayer::displayClientMessage(int messageId) //Language *language = Language::getInstance(); //wstring languageString = app.GetString(messageId);//language->getElement(messageId); - //connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); + //connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); } void ServerPlayer::completeUsingItem() { - connection->send(shared_ptr( new EntityEventPacket(entityId, EntityEvent::USE_ITEM_COMPLETE) ) ); + connection->send(std::shared_ptr( new EntityEventPacket(entityId, EntityEvent::USE_ITEM_COMPLETE) ) ); Player::completeUsingItem(); } -void ServerPlayer::startUsingItem(shared_ptr instance, int duration) +void ServerPlayer::startUsingItem(std::shared_ptr instance, int duration) { Player::startUsingItem(instance, duration); if (instance != NULL && instance->getItem() != NULL && instance->getItem()->getUseAnimation(instance) == UseAnim_eat) { - getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::EAT) ) ); + getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::EAT) ) ); } } -void ServerPlayer::restoreFrom(shared_ptr oldPlayer, bool restoreAll) +void ServerPlayer::restoreFrom(std::shared_ptr oldPlayer, bool restoreAll) { Player::restoreFrom(oldPlayer, restoreAll); lastSentExp = -1; @@ -1374,21 +1374,21 @@ void ServerPlayer::restoreFrom(shared_ptr oldPlayer, bool restoreAll) void ServerPlayer::onEffectAdded(MobEffectInstance *effect) { Player::onEffectAdded(effect); - connection->send(shared_ptr( new UpdateMobEffectPacket(entityId, effect) ) ); + connection->send(std::shared_ptr( new UpdateMobEffectPacket(entityId, effect) ) ); } void ServerPlayer::onEffectUpdated(MobEffectInstance *effect) { Player::onEffectUpdated(effect); - connection->send(shared_ptr( new UpdateMobEffectPacket(entityId, effect) ) ); + connection->send(std::shared_ptr( new UpdateMobEffectPacket(entityId, effect) ) ); } void ServerPlayer::onEffectRemoved(MobEffectInstance *effect) { Player::onEffectRemoved(effect); - connection->send(shared_ptr( new RemoveMobEffectPacket(entityId, effect) ) ); + connection->send(std::shared_ptr( new RemoveMobEffectPacket(entityId, effect) ) ); } void ServerPlayer::teleportTo(double x, double y, double z) @@ -1396,20 +1396,20 @@ void ServerPlayer::teleportTo(double x, double y, double z) connection->teleport(x, y, z, yRot, xRot); } -void ServerPlayer::crit(shared_ptr entity) +void ServerPlayer::crit(std::shared_ptr entity) { - getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(entity, AnimatePacket::CRITICAL_HIT) )); + getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::shared_ptr( new AnimatePacket(entity, AnimatePacket::CRITICAL_HIT) )); } -void ServerPlayer::magicCrit(shared_ptr entity) +void ServerPlayer::magicCrit(std::shared_ptr entity) { - getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(entity, AnimatePacket::MAGIC_CRITICAL_HIT) )); + getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::shared_ptr( new AnimatePacket(entity, AnimatePacket::MAGIC_CRITICAL_HIT) )); } void ServerPlayer::onUpdateAbilities() { if (connection == NULL) return; - connection->send(shared_ptr(new PlayerAbilitiesPacket(&abilities))); + connection->send(std::shared_ptr(new PlayerAbilitiesPacket(&abilities))); } ServerLevel *ServerPlayer::getLevel() @@ -1420,12 +1420,12 @@ ServerLevel *ServerPlayer::getLevel() void ServerPlayer::setGameMode(GameType *mode) { gameMode->setGameModeForPlayer(mode); - connection->send(shared_ptr(new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, mode->getId()))); + connection->send(std::shared_ptr(new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, mode->getId()))); } void ServerPlayer::sendMessage(const wstring& message, ChatPacket::EChatPacketMessage type /*= e_ChatCustom*/, int customData /*= -1*/, const wstring& additionalMessage /*= L""*/) { - connection->send(shared_ptr(new ChatPacket(message,type,customData,additionalMessage))); + connection->send(std::shared_ptr(new ChatPacket(message,type,customData,additionalMessage))); } bool ServerPlayer::hasPermission(EGameCommand command) @@ -1434,7 +1434,7 @@ bool ServerPlayer::hasPermission(EGameCommand command) } // 4J - Don't use -//void ServerPlayer::updateOptions(shared_ptr packet) +//void ServerPlayer::updateOptions(std::shared_ptr packet) //{ // // 4J - Don't need // //if (language.getLanguageList().containsKey(packet.getLanguage())) @@ -1502,7 +1502,7 @@ int ServerPlayer::getPlayerViewDistanceModifier() return value; } -void ServerPlayer::handleCollectItem(shared_ptr item) +void ServerPlayer::handleCollectItem(std::shared_ptr item) { if(gameMode->getGameRules() != NULL) gameMode->getGameRules()->onCollectItem(item); } diff --git a/Minecraft.Client/Player/ServerPlayer.h b/Minecraft.Client/Player/ServerPlayer.h index c01371d9c..136d08362 100644 --- a/Minecraft.Client/Player/ServerPlayer.h +++ b/Minecraft.Client/Player/ServerPlayer.h @@ -17,7 +17,7 @@ class ServerPlayer : public Player, public net_minecraft_world_inventory::Contai { public: eINSTANCEOF GetType() { return eTYPE_SERVERPLAYER; } - shared_ptr connection; + std::shared_ptr connection; MinecraftServer *server; ServerPlayerGameMode *gameMode; double lastMoveX, lastMoveZ; @@ -59,7 +59,7 @@ public: virtual float getHeadHeight(); virtual void tick(); void flushEntitiesToRemove(); - virtual shared_ptr getCarried(int slot); + virtual std::shared_ptr getCarried(int slot); virtual void die(DamageSource *source); virtual bool hurt(DamageSource *dmgSource, int dmg); virtual bool isPlayerVersusPlayer(); @@ -69,15 +69,15 @@ public: void doTickB(bool ignorePortal); virtual void changeDimension(int i); private: - void broadcast(shared_ptr te, bool delay = false); + void broadcast(std::shared_ptr te, bool delay = false); public: - virtual void take(shared_ptr e, int orgCount); + virtual void take(std::shared_ptr e, int orgCount); virtual void swing(); virtual BedSleepingResult startSleepInBed(int x, int y, int z, bool bTestUse = false); public: virtual void stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool saveRespawnPoint); - virtual void ride(shared_ptr e); + virtual void ride(std::shared_ptr e); protected: virtual void checkFallDamage(double ya, bool onGround); public: @@ -97,14 +97,14 @@ public: virtual bool startCrafting(int x, int y, int z); // 4J added bool return virtual bool startEnchanting(int x, int y, int z); // 4J added bool return virtual bool startRepairing(int x, int y, int z); // 4J added bool return - virtual bool openContainer(shared_ptr container); // 4J added bool return - virtual bool openFurnace(shared_ptr furnace); // 4J added bool return - virtual bool openTrap(shared_ptr trap); // 4J added bool return - virtual bool openBrewingStand(shared_ptr brewingStand); // 4J added bool return - virtual bool openTrading(shared_ptr traderTarget); // 4J added bool return - virtual void slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr item); + virtual bool openContainer(std::shared_ptr container); // 4J added bool return + virtual bool openFurnace(std::shared_ptr furnace); // 4J added bool return + virtual bool openTrap(std::shared_ptr trap); // 4J added bool return + virtual bool openBrewingStand(std::shared_ptr brewingStand); // 4J added bool return + virtual bool openTrading(std::shared_ptr traderTarget); // 4J added bool return + virtual void slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr item); void refreshContainer(AbstractContainerMenu *menu); - virtual void refreshContainer(AbstractContainerMenu *container, vector > *items); + virtual void refreshContainer(AbstractContainerMenu *container, vector > *items); virtual void setContainerData(AbstractContainerMenu *container, int id, int value); virtual void closeContainer(); void broadcastCarriedItem(); @@ -121,8 +121,8 @@ protected: virtual void completeUsingItem(); public: - virtual void startUsingItem(shared_ptr instance, int duration); - virtual void restoreFrom(shared_ptr oldPlayer, bool restoreAll); + virtual void startUsingItem(std::shared_ptr instance, int duration); + virtual void restoreFrom(std::shared_ptr oldPlayer, bool restoreAll); protected: virtual void onEffectAdded(MobEffectInstance *effect); @@ -131,8 +131,8 @@ protected: public: virtual void teleportTo(double x, double y, double z); - virtual void crit(shared_ptr entity); - virtual void magicCrit(shared_ptr entity); + virtual void crit(std::shared_ptr entity); + virtual void magicCrit(std::shared_ptr entity); void onUpdateAbilities(); ServerLevel *getLevel(); @@ -140,7 +140,7 @@ public: void sendMessage(const wstring& message, ChatPacket::EChatPacketMessage type = ChatPacket::e_ChatCustom, int customData = -1, const wstring& additionalMessage = L""); bool hasPermission(EGameCommand command); // 4J - Don't use - //void updateOptions(shared_ptr packet); + //void updateOptions(std::shared_ptr packet); int getViewDistance(); //bool canChatInColor(); //int getChatVisibility(); @@ -152,7 +152,7 @@ public: public: // 4J Stu - Added hooks for the game rules - virtual void handleCollectItem(shared_ptr item); + virtual void handleCollectItem(std::shared_ptr item); #ifndef _CONTENT_PACKAGE void debug_setPosition(double,double,double,double,double); diff --git a/Minecraft.Client/Player/ServerPlayerGameMode.cpp b/Minecraft.Client/Player/ServerPlayerGameMode.cpp index 75d5e38b3..4456dbc7e 100644 --- a/Minecraft.Client/Player/ServerPlayerGameMode.cpp +++ b/Minecraft.Client/Player/ServerPlayerGameMode.cpp @@ -272,7 +272,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) if (isCreative()) { - shared_ptr tup = shared_ptr( new TileUpdatePacket(x, y, z, level) ); + std::shared_ptr tup = std::shared_ptr( new TileUpdatePacket(x, y, z, level) ); // 4J - a bit of a hack here, but if we want to tell the client that it needs to inform the renderer of a block being destroyed, then send a block 255 instead of a 0. This is handled in ClientConnection::handleTileUpdate if( tup->block == 0 ) { @@ -282,7 +282,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) } else { - shared_ptr item = player->getSelectedItem(); + std::shared_ptr item = player->getSelectedItem(); bool canDestroy = player->canDestroy(Tile::tiles[t]); if (item != NULL) { @@ -301,13 +301,13 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) } -bool ServerPlayerGameMode::useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly) +bool ServerPlayerGameMode::useItem(std::shared_ptr player, Level *level, std::shared_ptr item, bool bTestUseOnly) { if(!player->isAllowedToUse(item)) return false; int oldCount = item->count; int oldAux = item->getAuxValue(); - shared_ptr itemInstance = item->use(level, player); + std::shared_ptr itemInstance = item->use(level, player); if ((itemInstance != NULL && itemInstance != item) || (itemInstance != NULL && itemInstance->count != oldCount) || (itemInstance != NULL && itemInstance->getUseDuration() > 0)) { player->inventory->items[player->inventory->selected] = itemInstance; @@ -326,7 +326,7 @@ bool ServerPlayerGameMode::useItem(shared_ptr player, Level *level, shar } -bool ServerPlayerGameMode::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, bool *pbUsedItem) +bool ServerPlayerGameMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly, bool *pbUsedItem) { // 4J-PB - Adding a test only version to allow tooltips to be displayed int t = level->getTile(x, y, z); diff --git a/Minecraft.Client/Player/ServerPlayerGameMode.h b/Minecraft.Client/Player/ServerPlayerGameMode.h index 89b9e9b44..c590f11e8 100644 --- a/Minecraft.Client/Player/ServerPlayerGameMode.h +++ b/Minecraft.Client/Player/ServerPlayerGameMode.h @@ -10,7 +10,7 @@ class ServerPlayerGameMode { public: Level *level; - shared_ptr player; + std::shared_ptr player; private: GameType *gameModeForPlayer; @@ -53,8 +53,8 @@ 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 useItem(std::shared_ptr player, Level *level, std::shared_ptr item, bool bTestUseOnly=false); + bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false, bool *pbUsedItem=NULL); void setLevel(ServerLevel *newLevel); }; \ No newline at end of file diff --git a/Minecraft.Client/Player/TrackedEntity.cpp b/Minecraft.Client/Player/TrackedEntity.cpp index 9114eec32..7e31186fc 100644 --- a/Minecraft.Client/Player/TrackedEntity.cpp +++ b/Minecraft.Client/Player/TrackedEntity.cpp @@ -22,7 +22,7 @@ #include #endif // __linux__ -TrackedEntity::TrackedEntity(shared_ptr e, int range, int updateInterval, bool trackDelta) +TrackedEntity::TrackedEntity(std::shared_ptr e, int range, int updateInterval, bool trackDelta) { // 4J added initialisers xap = yap = zap = 0; @@ -48,7 +48,7 @@ TrackedEntity::TrackedEntity(shared_ptr e, int range, int updateInterval int c0a = 0, c0b = 0, c1a = 0, c1b = 0, c1c = 0, c2a = 0, c2b = 0; -void TrackedEntity::tick(EntityTracker *tracker, vector > *players) +void TrackedEntity::tick(EntityTracker *tracker, vector > *players) { moved = false; if (!updatedPlayerVisibility || e->distanceToSqr(xpu, ypu, zpu) > 4 * 4) @@ -64,35 +64,35 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl if (wasRiding != e->riding) { wasRiding = e->riding; - broadcast(shared_ptr(new SetRidingPacket(e, e->riding))); + broadcast(std::shared_ptr(new SetRidingPacket(e, e->riding))); } // Moving forward special case for item frames if (e->GetType()== eTYPE_ITEM_FRAME && tickCount % 10 == 0) { - shared_ptr frame = dynamic_pointer_cast (e); - shared_ptr item = frame->getItem(); + std::shared_ptr frame = dynamic_pointer_cast (e); + std::shared_ptr item = frame->getItem(); if (item != NULL && item->getItem()->id == Item::map_Id && !e->removed) { - shared_ptr data = Item::map->getSavedData(item, e->level); + std::shared_ptr data = Item::map->getSavedData(item, e->level); for (AUTO_VAR(it,players->begin() ); it != players->end(); ++it) { - shared_ptr player = dynamic_pointer_cast(*it); + std::shared_ptr player = dynamic_pointer_cast(*it); data->tickCarriedBy(player, item); if (!player->removed && player->connection && player->connection->countDelayedPackets() <= 5) { - shared_ptr packet = Item::map->getUpdatePacket(item, e->level, player); + std::shared_ptr packet = Item::map->getUpdatePacket(item, e->level, player); if (packet != NULL) player->connection->send(packet); } } } - shared_ptr entityData = e->getEntityData(); + std::shared_ptr entityData = e->getEntityData(); if (entityData->isDirty()) { - broadcastAndSend( shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); + broadcastAndSend( std::shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); } } else @@ -113,7 +113,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl int ya = yn - yp; int za = zn - zp; - shared_ptr packet = nullptr; + std::shared_ptr packet = nullptr; // 4J - this pos flag used to be set based on abs(xn) etc. but that just seems wrong bool pos = abs(xa) >= TOLERANCE_LEVEL || abs(ya) >= TOLERANCE_LEVEL || abs(za) >= TOLERANCE_LEVEL; @@ -136,7 +136,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl ) { teleportDelay = 0; - packet = shared_ptr( new TeleportEntityPacket(e->entityId, xn, yn, zn, (uint8_t) yRotn, (uint8_t) xRotn) ); + packet = std::shared_ptr( new TeleportEntityPacket(e->entityId, xn, yn, zn, (uint8_t) yRotn, (uint8_t) xRotn) ); // printf("%d: New teleport rot %d\n",e->entityId,yRotn); yRotp = yRotn; xRotp = xRotn; @@ -163,12 +163,12 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl yRotn = yRotp + yRota; } // 5 bits each for x & z, and 6 for y - packet = shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, (char) xa, (char) ya, (char) za, (char) yRota, 0 ) ); + packet = std::shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, (char) xa, (char) ya, (char) za, (char) yRota, 0 ) ); c0a++; } else { - packet = shared_ptr( new MoveEntityPacket::PosRot(e->entityId, (char) xa, (char) ya, (char) za, (char) yRota, (char) xRota) ); + packet = std::shared_ptr( new MoveEntityPacket::PosRot(e->entityId, (char) xa, (char) ya, (char) za, (char) yRota, (char) xRota) ); // printf("%d: New posrot %d + %d = %d\n",e->entityId,yRotp,yRota,yRotn); c0b++; } @@ -181,7 +181,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl ( ya >= -16 ) && ( ya <= 15 ) ) { // 4 bits each for x & z, and 5 for y - packet = shared_ptr( new MoveEntityPacketSmall::Pos(e->entityId, (char) xa, (char) ya, (char) za) ); + packet = std::shared_ptr( new MoveEntityPacketSmall::Pos(e->entityId, (char) xa, (char) ya, (char) za) ); c1a++; } @@ -190,12 +190,12 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl ( ya >= -32 ) && ( ya <= 31 ) ) { // use the packet with small packet with rotation if we can - 5 bits each for x & z, and 6 for y - still a byte less than the alternative - packet = shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, (char) xa, (char) ya, (char) za, 0, 0 )); + packet = std::shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, (char) xa, (char) ya, (char) za, 0, 0 )); c1b++; } else { - packet = shared_ptr( new MoveEntityPacket::Pos(e->entityId, (char) xa, (char) ya, (char) za) ); + packet = std::shared_ptr( new MoveEntityPacket::Pos(e->entityId, (char) xa, (char) ya, (char) za) ); c1c++; } } @@ -215,13 +215,13 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl yRota = 15; yRotn = yRotp + yRota; } - packet = shared_ptr( new MoveEntityPacketSmall::Rot(e->entityId, (char) yRota, 0) ); + packet = std::shared_ptr( new MoveEntityPacketSmall::Rot(e->entityId, (char) yRota, 0) ); c2a++; } else { // printf("%d: New rot %d + %d = %d\n",e->entityId,yRotp,yRota,yRotn); - packet = shared_ptr( new MoveEntityPacket::Rot(e->entityId, (char) yRota, (char) xRota) ); + packet = std::shared_ptr( new MoveEntityPacket::Rot(e->entityId, (char) yRota, (char) xRota) ); c2b++; } } @@ -242,7 +242,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl xap = e->xd; yap = e->yd; zap = e->zd; - broadcast( shared_ptr( new SetEntityMotionPacket(e->entityId, xap, yap, zap) ) ); + broadcast( std::shared_ptr( new SetEntityMotionPacket(e->entityId, xap, yap, zap) ) ); } } @@ -252,17 +252,17 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl broadcast(packet); } - shared_ptr entityData = e->getEntityData(); + std::shared_ptr entityData = e->getEntityData(); if (entityData->isDirty()) { - broadcastAndSend( shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); + broadcastAndSend( std::shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); } int yHeadRot = Mth::floor(e->getYHeadRot() * 256 / 360); if (abs(yHeadRot - yHeadRotp) >= TOLERANCE_LEVEL) { - broadcast(shared_ptr(new RotateHeadPacket(e->entityId, (uint8_t) yHeadRot))); + broadcast(std::shared_ptr(new RotateHeadPacket(e->entityId, (uint8_t) yHeadRot))); yHeadRotp = yHeadRot; } @@ -287,9 +287,9 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl } else // 4J-JEV: Added: Mobs in minecarts weren't synching their invisibility. { - shared_ptr entityData = e->getEntityData(); + std::shared_ptr entityData = e->getEntityData(); if (entityData->isDirty()) - broadcastAndSend( shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); + broadcastAndSend( std::shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); } e->hasImpulse = false; } @@ -297,18 +297,18 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl if (e->hurtMarked) { // broadcast(new AnimatePacket(e, AnimatePacket.HURT)); - broadcastAndSend( shared_ptr( new SetEntityMotionPacket(e) ) ); + broadcastAndSend( std::shared_ptr( new SetEntityMotionPacket(e) ) ); e->hurtMarked = false; } } -void TrackedEntity::broadcast(shared_ptr packet) +void TrackedEntity::broadcast(std::shared_ptr packet) { if( Packet::canSendToAnyClient( packet ) ) { // 4J-PB - due to the knockback on a player being hit, we need to send to all players, but limit the network traffic here to players that have not already had it sent to their system - vector< shared_ptr > sentTo; + vector< std::shared_ptr > sentTo; // 4J - don't send to a player we've already sent this data to that shares the same machine. // EntityMotionPacket used to limit themselves to sending once to each machine @@ -318,7 +318,7 @@ void TrackedEntity::broadcast(shared_ptr packet) for( AUTO_VAR(it, seenBy.begin()); it != seenBy.end(); it++ ) { - shared_ptr player = *it; + std::shared_ptr player = *it; bool dontSend = false; if( sentTo.size() ) { @@ -331,13 +331,13 @@ void TrackedEntity::broadcast(shared_ptr packet) { for(unsigned int j = 0; j < sentTo.size(); j++ ) { - shared_ptr player2 = sentTo[j]; + std::shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { dontSend = true; // #ifdef _DEBUG - // shared_ptr emp= dynamic_pointer_cast (packet); + // std::shared_ptr emp= dynamic_pointer_cast (packet); // if(emp!=NULL) // { // app.DebugPrintf("Not sending this SetEntityMotionPacket to player - it's already been sent to a player on their console\n"); @@ -368,11 +368,11 @@ void TrackedEntity::broadcast(shared_ptr packet) } } -void TrackedEntity::broadcastAndSend(shared_ptr packet) +void TrackedEntity::broadcastAndSend(std::shared_ptr packet) { - vector< shared_ptr > sentTo; + vector< std::shared_ptr > sentTo; broadcast(packet); - shared_ptr sp = dynamic_pointer_cast(e); + std::shared_ptr sp = dynamic_pointer_cast(e); if (sp != NULL && sp->connection) { sp->connection->send(packet); @@ -387,7 +387,7 @@ void TrackedEntity::broadcastRemoved() } } -void TrackedEntity::removePlayer(shared_ptr sp) +void TrackedEntity::removePlayer(std::shared_ptr sp) { AUTO_VAR(it, seenBy.find( sp )); if( it != seenBy.end() ) @@ -397,7 +397,7 @@ void TrackedEntity::removePlayer(shared_ptr sp) } // 4J-JEV: Added for code reuse. -TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shared_ptr sp, bool forRider) +TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, std::shared_ptr sp, bool forRider) { // 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. @@ -426,7 +426,7 @@ TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shar for( unsigned int i = 0; i < server->getPlayers()->players.size(); i++ ) { // Consider extra players, but not if they are the entity we are tracking, or the player we've been passed as input, or in another dimension - shared_ptr ep = server->getPlayers()->players[i]; + std::shared_ptr ep = server->getPlayers()->players[i]; if( ep == sp ) continue; if( ep == e ) continue; if( ep->dimension != sp->dimension ) continue; @@ -463,7 +463,7 @@ TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shar else return eVisibility_NotVisible; } -void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr sp) +void TrackedEntity::updatePlayer(EntityTracker *tracker, std::shared_ptr sp) { if (sp == e) return; @@ -473,14 +473,14 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr packet = getAddEntityPacket(); + std::shared_ptr packet = getAddEntityPacket(); sp->connection->send(packet); xap = e->xd; yap = e->yd; zap = e->zd; - shared_ptr plr = dynamic_pointer_cast(e); + std::shared_ptr plr = dynamic_pointer_cast(e); if (plr != NULL) { app.DebugPrintf( "TrackedEntity:: Player '%ls' is now visible to player '%ls', %s.\n", @@ -492,17 +492,17 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptrgetEntityData()->isEmpty() && !(dynamic_pointer_cast(packet))) { - sp->connection->send(shared_ptr( new SetEntityDataPacket(e->entityId, e->getEntityData(), true))); + sp->connection->send(std::shared_ptr( new SetEntityDataPacket(e->entityId, e->getEntityData(), true))); } if (this->trackDelta) { - sp->connection->send( shared_ptr( new SetEntityMotionPacket(e->entityId, e->xd, e->yd, e->zd) ) ); + sp->connection->send( std::shared_ptr( new SetEntityMotionPacket(e->entityId, e->xd, e->yd, e->zd) ) ); } if (e->riding != NULL) { - sp->connection->send(shared_ptr(new SetRidingPacket(e, e->riding))); + sp->connection->send(std::shared_ptr(new SetRidingPacket(e, e->riding))); } ItemInstanceArray equipped = e->getEquipmentSlots(); @@ -510,28 +510,28 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptrconnection->send( shared_ptr( new SetEquippedItemPacket(e->entityId, i, equipped[i]) ) ); + sp->connection->send( std::shared_ptr( new SetEquippedItemPacket(e->entityId, i, equipped[i]) ) ); } } if (dynamic_pointer_cast(e) != NULL) { - shared_ptr spe = dynamic_pointer_cast(e); + std::shared_ptr spe = dynamic_pointer_cast(e); if (spe->isSleeping()) { - sp->connection->send( shared_ptr( new EntityActionAtPositionPacket(e, EntityActionAtPositionPacket::START_SLEEP, Mth::floor(e->x), Mth::floor(e->y), Mth::floor(e->z)) ) ); + sp->connection->send( std::shared_ptr( new EntityActionAtPositionPacket(e, EntityActionAtPositionPacket::START_SLEEP, Mth::floor(e->x), Mth::floor(e->y), Mth::floor(e->z)) ) ); } } if (dynamic_pointer_cast(e) != NULL) { - shared_ptr mob = dynamic_pointer_cast(e); + std::shared_ptr mob = dynamic_pointer_cast(e); vector *activeEffects = mob->getActiveEffects(); for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it) { MobEffectInstance *effect = *it; - sp->connection->send(shared_ptr( new UpdateMobEffectPacket(e->entityId, effect) ) ); + sp->connection->send(std::shared_ptr( new UpdateMobEffectPacket(e->entityId, effect) ) ); } delete activeEffects; } @@ -548,7 +548,7 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr player) +bool TrackedEntity::canBySeenBy(std::shared_ptr player) { // 4J - for some reason this isn't currently working, and is causing players to not appear until we are really close to them. Not sure // what the conflict is between the java & our version, but removing for now as it is causing issues and we shouldn't *really* need it @@ -558,7 +558,7 @@ bool TrackedEntity::canBySeenBy(shared_ptr player) // return player->getLevel()->getChunkMap()->isPlayerIn(player, e->xChunk, e->zChunk); } -void TrackedEntity::updatePlayers(EntityTracker *tracker, vector > *players) +void TrackedEntity::updatePlayers(EntityTracker *tracker, vector > *players) { for (unsigned int i = 0; i < players->size(); i++) { @@ -566,7 +566,7 @@ void TrackedEntity::updatePlayers(EntityTracker *tracker, vector TrackedEntity::getAddEntityPacket() +std::shared_ptr TrackedEntity::getAddEntityPacket() { if (e->removed) { @@ -577,20 +577,20 @@ shared_ptr TrackedEntity::getAddEntityPacket() if (dynamic_pointer_cast(e) != NULL) { yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360); - return shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp) ); + return std::shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp) ); } switch(e->GetType()) { case eTYPE_ITEMENTITY: { - shared_ptr packet = shared_ptr( new AddEntityPacket(e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr packet = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp) ); return packet; } break; case eTYPE_SERVERPLAYER: { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = dynamic_pointer_cast(e); PlayerUID xuid = INVALID_XUID; PlayerUID OnlineXuid = INVALID_XUID; if( player != NULL ) @@ -599,76 +599,76 @@ shared_ptr TrackedEntity::getAddEntityPacket() OnlineXuid = player->getOnlineXuid(); } // 4J Added yHeadRotp param to fix #102563 - TU12: Content: Gameplay: When one of the Players is idle for a few minutes his head turns 180 degrees. - return shared_ptr( new AddPlayerPacket(dynamic_pointer_cast(e), xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp ) ); + return std::shared_ptr( new AddPlayerPacket(dynamic_pointer_cast(e), xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp ) ); } break; case eTYPE_MINECART: { - shared_ptr minecart = dynamic_pointer_cast(e); - if (minecart->type == Minecart::RIDEABLE) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_RIDEABLE, yRotp, xRotp, xp, yp, zp) ); - if (minecart->type == Minecart::CHEST) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_CHEST, yRotp, xRotp, xp, yp, zp) ); - if (minecart->type == Minecart::FURNACE) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_FURNACE, yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr minecart = dynamic_pointer_cast(e); + if (minecart->type == Minecart::RIDEABLE) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_RIDEABLE, yRotp, xRotp, xp, yp, zp) ); + if (minecart->type == Minecart::CHEST) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_CHEST, yRotp, xRotp, xp, yp, zp) ); + if (minecart->type == Minecart::FURNACE) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_FURNACE, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_BOAT: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_ENDERDRAGON: { yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360); - return shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp ) ); + return std::shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp ) ); } break; case 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) ); + std::shared_ptr owner = dynamic_pointer_cast(e)->owner; + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FISH_HOOK, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); } break; case 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) ); + std::shared_ptr owner = (dynamic_pointer_cast(e))->owner; + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::ARROW, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_SNOWBALL: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_THROWNPOTION: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_POTION, ((dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp)); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_POTION, ((dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp)); } break; case eTYPE_THROWNEXPBOTTLE: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_THROWNENDERPEARL: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_EYEOFENDERSIGNAL: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_SMALL_FIREBALL: { - shared_ptr fb = dynamic_pointer_cast(e); - shared_ptr aep = nullptr; + std::shared_ptr fb = dynamic_pointer_cast(e); + std::shared_ptr aep = nullptr; if (fb->owner != NULL) { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); } else { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); } aep->xa = (int) (fb->xPower * 8000); aep->ya = (int) (fb->yPower * 8000); @@ -678,15 +678,15 @@ shared_ptr TrackedEntity::getAddEntityPacket() break; case eTYPE_DRAGON_FIREBALL: { - shared_ptr fb = dynamic_pointer_cast(e); - shared_ptr aep = nullptr; + std::shared_ptr fb = dynamic_pointer_cast(e); + std::shared_ptr aep = nullptr; if (fb->owner != NULL) { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::DRAGON_FIRE_BALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::DRAGON_FIRE_BALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); } else { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::DRAGON_FIRE_BALL, 0, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::DRAGON_FIRE_BALL, 0, yRotp, xRotp, xp, yp, zp) ); } aep->xa = (int) (fb->xPower * 8000); aep->ya = (int) (fb->yPower * 8000); @@ -696,15 +696,15 @@ shared_ptr TrackedEntity::getAddEntityPacket() break; case eTYPE_FIREBALL: { - shared_ptr fb = dynamic_pointer_cast(e); - shared_ptr aep = nullptr; + std::shared_ptr fb = dynamic_pointer_cast(e); + std::shared_ptr aep = nullptr; if (fb->owner != NULL) { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); } else { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); } aep->xa = (int) (fb->xPower * 8000); aep->ya = (int) (fb->yPower * 8000); @@ -714,33 +714,33 @@ shared_ptr TrackedEntity::getAddEntityPacket() break; case eTYPE_THROWNEGG: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_PRIMEDTNT: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_ENDER_CRYSTAL: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_FALLINGTILE: { - shared_ptr ft = dynamic_pointer_cast(e); - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr ft = dynamic_pointer_cast(e); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_PAINTING: { - return shared_ptr( new AddPaintingPacket(dynamic_pointer_cast(e)) ); + return std::shared_ptr( new AddPaintingPacket(dynamic_pointer_cast(e)) ); } break; case eTYPE_ITEM_FRAME: { - shared_ptr frame = dynamic_pointer_cast(e); + std::shared_ptr frame = dynamic_pointer_cast(e); { int ix= (int)frame->xTile; @@ -749,7 +749,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() app.DebugPrintf("eTYPE_ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz); } - shared_ptr packet = shared_ptr(new AddEntityPacket(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp)); + std::shared_ptr packet = std::shared_ptr(new AddEntityPacket(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp)); packet->x = Mth::floor(frame->xTile * 32.0f); packet->y = Mth::floor(frame->yTile * 32.0f); packet->z = Mth::floor(frame->zTile * 32.0f); @@ -758,7 +758,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() break; case eTYPE_EXPERIENCEORB: { - return shared_ptr( new AddExperienceOrbPacket(dynamic_pointer_cast(e)) ); + return std::shared_ptr( new AddExperienceOrbPacket(dynamic_pointer_cast(e)) ); } break; default: @@ -768,8 +768,8 @@ shared_ptr TrackedEntity::getAddEntityPacket() /* if (e->GetType() == eTYPE_ITEMENTITY) { - shared_ptr itemEntity = dynamic_pointer_cast(e); - shared_ptr packet = shared_ptr( new AddItemEntityPacket(itemEntity, xp, yp, zp) ); + std::shared_ptr itemEntity = dynamic_pointer_cast(e); + std::shared_ptr packet = std::shared_ptr( new AddItemEntityPacket(itemEntity, xp, yp, zp) ); itemEntity->x = packet->x / 32.0; itemEntity->y = packet->y / 32.0; itemEntity->z = packet->z / 32.0; @@ -778,7 +778,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() if (e->GetType() == eTYPE_SERVERPLAYER ) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = dynamic_pointer_cast(e); XUID xuid = INVALID_XUID; XUID OnlineXuid = INVALID_XUID; if( player != NULL ) @@ -786,68 +786,68 @@ shared_ptr TrackedEntity::getAddEntityPacket() xuid = player->getXuid(); OnlineXuid = player->getOnlineXuid(); } - return shared_ptr( new AddPlayerPacket(dynamic_pointer_cast(e), xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp ) ); + return std::shared_ptr( new AddPlayerPacket(dynamic_pointer_cast(e), xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp ) ); } if (e->GetType() == eTYPE_MINECART) { - shared_ptr minecart = dynamic_pointer_cast(e); - if (minecart->type == Minecart::RIDEABLE) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_RIDEABLE, yRotp, xRotp, xp, yp, zp) ); - if (minecart->type == Minecart::CHEST) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_CHEST, yRotp, xRotp, xp, yp, zp) ); - if (minecart->type == Minecart::FURNACE) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_FURNACE, yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr minecart = dynamic_pointer_cast(e); + if (minecart->type == Minecart::RIDEABLE) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_RIDEABLE, yRotp, xRotp, xp, yp, zp) ); + if (minecart->type == Minecart::CHEST) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_CHEST, yRotp, xRotp, xp, yp, zp) ); + if (minecart->type == Minecart::FURNACE) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_FURNACE, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_BOAT) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp) ); } if (dynamic_pointer_cast(e) != NULL) { - return shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_ENDERDRAGON) { - return shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp ) ); + return std::shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp ) ); } if (e->GetType() == 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) ); + std::shared_ptr owner = dynamic_pointer_cast(e)->owner; + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FISH_HOOK, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == 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) ); + std::shared_ptr owner = (dynamic_pointer_cast(e))->owner; + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::ARROW, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_SNOWBALL) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_THROWNPOTION) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_POTION, ((dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp)); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_POTION, ((dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp)); } if (e->GetType() == eTYPE_THROWNEXPBOTTLE) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_THROWNENDERPEARL) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_EYEOFENDERSIGNAL) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_SMALL_FIREBALL) { - shared_ptr fb = dynamic_pointer_cast(e); - shared_ptr aep = NULL; + std::shared_ptr fb = dynamic_pointer_cast(e); + std::shared_ptr aep = NULL; if (fb->owner != NULL) { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); } else { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); } aep->xa = (int) (fb->xPower * 8000); aep->ya = (int) (fb->yPower * 8000); @@ -856,15 +856,15 @@ shared_ptr TrackedEntity::getAddEntityPacket() } if (e->GetType() == eTYPE_FIREBALL) { - shared_ptr fb = dynamic_pointer_cast(e); - shared_ptr aep = NULL; + std::shared_ptr fb = dynamic_pointer_cast(e); + std::shared_ptr aep = NULL; if (fb->owner != NULL) { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); } else { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); } aep->xa = (int) (fb->xPower * 8000); aep->ya = (int) (fb->yPower * 8000); @@ -873,30 +873,30 @@ shared_ptr TrackedEntity::getAddEntityPacket() } if (e->GetType() == eTYPE_THROWNEGG) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_PRIMEDTNT) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_ENDER_CRYSTAL) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_FALLINGTILE) { - shared_ptr ft = dynamic_pointer_cast(e); - if (ft->tile == Tile::sand_Id) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING_SAND, yRotp, xRotp, xp, yp, zp) ); - if (ft->tile == Tile::gravel_Id) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING_GRAVEL, yRotp, xRotp, xp, yp, zp) ); - if (ft->tile == Tile::dragonEgg_Id) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING_EGG, yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr ft = dynamic_pointer_cast(e); + if (ft->tile == Tile::sand_Id) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING_SAND, yRotp, xRotp, xp, yp, zp) ); + if (ft->tile == Tile::gravel_Id) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING_GRAVEL, yRotp, xRotp, xp, yp, zp) ); + if (ft->tile == Tile::dragonEgg_Id) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING_EGG, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_PAINTING) { - return shared_ptr( new AddPaintingPacket(dynamic_pointer_cast(e)) ); + return std::shared_ptr( new AddPaintingPacket(dynamic_pointer_cast(e)) ); } if (e->GetType() == eTYPE_ITEM_FRAME) { - shared_ptr frame = dynamic_pointer_cast(e); + std::shared_ptr frame = dynamic_pointer_cast(e); { int ix= (int)frame->xTile; @@ -905,7 +905,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() app.DebugPrintf("eTYPE_ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz); } - shared_ptr packet = shared_ptr(new AddEntityPacket(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp)); + std::shared_ptr packet = std::shared_ptr(new AddEntityPacket(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp)); packet->x = Mth::floor(frame->xTile * 32.0f); packet->y = Mth::floor(frame->yTile * 32.0f); packet->z = Mth::floor(frame->zTile * 32.0f); @@ -913,14 +913,14 @@ shared_ptr TrackedEntity::getAddEntityPacket() } if (e->GetType() == eTYPE_EXPERIENCEORB) { - return shared_ptr( new AddExperienceOrbPacket(dynamic_pointer_cast(e)) ); + return std::shared_ptr( new AddExperienceOrbPacket(dynamic_pointer_cast(e)) ); } assert(false); */ return nullptr; } -void TrackedEntity::clear(shared_ptr sp) +void TrackedEntity::clear(std::shared_ptr sp) { AUTO_VAR(it, seenBy.find(sp)); if (it != seenBy.end()) diff --git a/Minecraft.Client/Player/TrackedEntity.h b/Minecraft.Client/Player/TrackedEntity.h index 9fb564a4d..46294ce2b 100644 --- a/Minecraft.Client/Player/TrackedEntity.h +++ b/Minecraft.Client/Player/TrackedEntity.h @@ -15,7 +15,7 @@ private: static const int TOLERANCE_LEVEL = 4; public: - shared_ptr e; + std::shared_ptr e; int range, updateInterval; int xp, yp, zp, yRotp, xRotp, yHeadRotp; @@ -27,23 +27,23 @@ private: bool updatedPlayerVisibility; bool trackDelta; int teleportDelay; - shared_ptr wasRiding; + std::shared_ptr wasRiding; public: bool moved; - unordered_set , PlayerKeyHash, PlayerKeyEq > seenBy; + unordered_set , PlayerKeyHash, PlayerKeyEq > seenBy; - TrackedEntity(shared_ptr e, int range, int updateInterval, bool trackDelta); + TrackedEntity(std::shared_ptr e, int range, int updateInterval, bool trackDelta); - void tick(EntityTracker *tracker, vector > *players); - void broadcast(shared_ptr packet); - void broadcastAndSend(shared_ptr packet); + void tick(EntityTracker *tracker, vector > *players); + void broadcast(std::shared_ptr packet); + void broadcastAndSend(std::shared_ptr packet); void broadcastRemoved(); - void removePlayer(shared_ptr sp); + void removePlayer(std::shared_ptr sp); private: - bool canBySeenBy(shared_ptr player); + bool canBySeenBy(std::shared_ptr player); enum eVisibility { @@ -52,14 +52,14 @@ private: eVisibility_SeenAndVisible = 2, }; - eVisibility isVisible(EntityTracker *tracker, shared_ptr sp, bool forRider = false); // 4J Added forRider + eVisibility isVisible(EntityTracker *tracker, std::shared_ptr sp, bool forRider = false); // 4J Added forRider public: - void updatePlayer(EntityTracker *tracker, shared_ptr sp); - void updatePlayers(EntityTracker *tracker, vector > *players); + void updatePlayer(EntityTracker *tracker, std::shared_ptr sp); + void updatePlayers(EntityTracker *tracker, vector > *players); private: - void sendEntityData(shared_ptr conn); - shared_ptr getAddEntityPacket(); + void sendEntityData(std::shared_ptr conn); + std::shared_ptr getAddEntityPacket(); public: - void clear(shared_ptr sp); + void clear(std::shared_ptr sp); }; diff --git a/Minecraft.Client/Rendering/Camera.cpp b/Minecraft.Client/Rendering/Camera.cpp index 3951e96fc..312957376 100644 --- a/Minecraft.Client/Rendering/Camera.cpp +++ b/Minecraft.Client/Rendering/Camera.cpp @@ -21,7 +21,7 @@ float Camera::za = 0.0f; float Camera::xa2 = 0.0f; float Camera::za2 = 0.0f; -void Camera::prepare(shared_ptr player, bool mirror) +void Camera::prepare(std::shared_ptr player, bool mirror) { glGetFloat(GL_MODELVIEW_MATRIX, modelview); glGetFloat(GL_PROJECTION_MATRIX, projection); @@ -88,12 +88,12 @@ void Camera::prepare(shared_ptr player, bool mirror) ya = cosf(xRot * PI / 180.0f); } -TilePos *Camera::getCameraTilePos(shared_ptr player, double alpha) +TilePos *Camera::getCameraTilePos(std::shared_ptr player, double alpha) { return new TilePos(getCameraPos(player, alpha)); } -Vec3 *Camera::getCameraPos(shared_ptr player, double alpha) +Vec3 *Camera::getCameraPos(std::shared_ptr player, double alpha) { double xx = player->xo + (player->x - player->xo) * alpha; double yy = player->yo + (player->y - player->yo) * alpha + player->getHeadHeight(); @@ -106,7 +106,7 @@ Vec3 *Camera::getCameraPos(shared_ptr player, double alpha) return Vec3::newTemp(xt, yt, zt); } -int Camera::getBlockAt(Level *level, shared_ptr player, float alpha) +int Camera::getBlockAt(Level *level, std::shared_ptr player, float alpha) { Vec3 *p = Camera::getCameraPos(player, alpha); TilePos tp = TilePos(p); diff --git a/Minecraft.Client/Rendering/Camera.h b/Minecraft.Client/Rendering/Camera.h index b59e7436e..1d42f58fa 100644 --- a/Minecraft.Client/Rendering/Camera.h +++ b/Minecraft.Client/Rendering/Camera.h @@ -24,9 +24,9 @@ private: public: static float xa, ya, za, xa2, za2; - static void prepare(shared_ptr player, bool mirror); + static void prepare(std::shared_ptr player, bool mirror); - static TilePos *getCameraTilePos(shared_ptr player, double alpha); - static Vec3 *getCameraPos(shared_ptr player, double alpha); - static int getBlockAt(Level *level, shared_ptr player, float alpha); + static TilePos *getCameraTilePos(std::shared_ptr player, double alpha); + static Vec3 *getCameraPos(std::shared_ptr player, double alpha); + static int getBlockAt(Level *level, std::shared_ptr player, float alpha); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Chunk.cpp b/Minecraft.Client/Rendering/Chunk.cpp index 79f9dae6f..97ec6eeaf 100644 --- a/Minecraft.Client/Rendering/Chunk.cpp +++ b/Minecraft.Client/Rendering/Chunk.cpp @@ -204,10 +204,10 @@ void Chunk::rebuild() LevelChunk::touchedSky = false; -// unordered_set > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line +// unordered_set > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line // renderableTileEntities.clear(); - vector > renderableTileEntities; // 4J - added + vector > renderableTileEntities; // 4J - added int r = 1; @@ -402,7 +402,7 @@ void Chunk::rebuild() Tile *tile = Tile::tiles[tileId]; if (currentLayer == 0 && tile->isEntityTile()) { - shared_ptr et = region->getTileEntity(x, y, z); + std::shared_ptr et = region->getTileEntity(x, y, z); if (TileEntityRenderDispatcher::instance->hasRenderer(et)) { renderableTileEntities.push_back(et); @@ -554,10 +554,10 @@ void Chunk::rebuild() */ - unordered_set > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); + unordered_set > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); AUTO_VAR(endIt, oldTileEntities.end()); - for( unordered_set >::iterator it = oldTileEntities.begin(); it != endIt; it++ ) + for( unordered_set >::iterator it = oldTileEntities.begin(); it != endIt; it++ ) { newTileEntities.erase(*it); } @@ -566,7 +566,7 @@ void Chunk::rebuild() EnterCriticalSection(globalRenderableTileEntities_cs); endIt = newTileEntities.end(); - for( unordered_set >::iterator it = newTileEntities.begin(); it != endIt; it++ ) + for( unordered_set >::iterator it = newTileEntities.begin(); it != endIt; it++ ) { globalRenderableTileEntities->push_back(*it); } @@ -574,12 +574,12 @@ void Chunk::rebuild() // 4J - All these new things added to globalRenderableTileEntities AUTO_VAR(endItRTE, renderableTileEntities.end()); - for( vector >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) + for( vector >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) { oldTileEntities.erase(*it); } // 4J - oldTileEntities is now the removed items - vector >::iterator it = globalRenderableTileEntities->begin(); + vector >::iterator it = globalRenderableTileEntities->begin(); while( it != globalRenderableTileEntities->end() ) { if( oldTileEntities.find(*it) != oldTileEntities.end() ) @@ -656,10 +656,10 @@ void Chunk::rebuild_SPU() LevelChunk::touchedSky = false; -// unordered_set > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line +// unordered_set > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line // renderableTileEntities.clear(); - vector > renderableTileEntities; // 4J - added + vector > renderableTileEntities; // 4J - added // List newTileEntities = new ArrayList(); // newTileEntities.clear(); @@ -750,7 +750,7 @@ void Chunk::rebuild_SPU() { if (currentLayer == 0 && Tile::tiles[tileId]->isEntityTile()) { - shared_ptr et = region.getTileEntity(x, y, z); + std::shared_ptr et = region.getTileEntity(x, y, z); if (TileEntityRenderDispatcher::instance->hasRenderer(et)) { renderableTileEntities.push_back(et); @@ -883,10 +883,10 @@ void Chunk::rebuild_SPU() */ - unordered_set > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); + unordered_set > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); AUTO_VAR(endIt, oldTileEntities.end()); - for( unordered_set >::iterator it = oldTileEntities.begin(); it != endIt; it++ ) + for( unordered_set >::iterator it = oldTileEntities.begin(); it != endIt; it++ ) { newTileEntities.erase(*it); } @@ -895,7 +895,7 @@ void Chunk::rebuild_SPU() EnterCriticalSection(globalRenderableTileEntities_cs); endIt = newTileEntities.end(); - for( unordered_set >::iterator it = newTileEntities.begin(); it != endIt; it++ ) + for( unordered_set >::iterator it = newTileEntities.begin(); it != endIt; it++ ) { globalRenderableTileEntities.push_back(*it); } @@ -903,12 +903,12 @@ void Chunk::rebuild_SPU() // 4J - All these new things added to globalRenderableTileEntities AUTO_VAR(endItRTE, renderableTileEntities.end()); - for( vector >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) + for( vector >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) { oldTileEntities.erase(*it); } // 4J - oldTileEntities is now the removed items - vector >::iterator it = globalRenderableTileEntities->begin(); + vector >::iterator it = globalRenderableTileEntities->begin(); while( it != globalRenderableTileEntities->end() ) { if( oldTileEntities.find(*it) != oldTileEntities.end() ) @@ -941,7 +941,7 @@ void Chunk::rebuild_SPU() #endif // _PS3_ -float Chunk::distanceToSqr(shared_ptr player) const +float Chunk::distanceToSqr(std::shared_ptr player) const { float xd = (float) (player->x - xm); float yd = (float) (player->y - ym); @@ -949,7 +949,7 @@ float Chunk::distanceToSqr(shared_ptr player) const return xd * xd + yd * yd + zd * zd; } -float Chunk::squishedDistanceToSqr(shared_ptr player) +float Chunk::squishedDistanceToSqr(std::shared_ptr player) { float xd = (float) (player->x - xm); float yd = (float) (player->y - ym) * 2; diff --git a/Minecraft.Client/Rendering/Chunk.h b/Minecraft.Client/Rendering/Chunk.h index c1687769b..a80f53484 100644 --- a/Minecraft.Client/Rendering/Chunk.h +++ b/Minecraft.Client/Rendering/Chunk.h @@ -52,7 +52,7 @@ public: int id; //public: -// vector > renderableTileEntities; // 4J - removed +// vector > renderableTileEntities; // 4J - removed private: LevelRenderer::rteMap *globalRenderableTileEntities; @@ -71,8 +71,8 @@ public: #ifdef __PS3__ void rebuild_SPU(); #endif // __PS3__ - float distanceToSqr(shared_ptr player) const; - float squishedDistanceToSqr(shared_ptr player); + float distanceToSqr(std::shared_ptr player) const; + float squishedDistanceToSqr(std::shared_ptr player); void reset(); void _delete(); diff --git a/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.cpp b/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.cpp index 50eaaec7a..ae702d9a0 100644 --- a/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.cpp +++ b/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.cpp @@ -3,7 +3,7 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.entity.player.h" #include "../Chunk.h" -DirtyChunkSorter::DirtyChunkSorter(shared_ptr cameraEntity, int playerIndex) // 4J - added player index +DirtyChunkSorter::DirtyChunkSorter(std::shared_ptr cameraEntity, int playerIndex) // 4J - added player index { this->cameraEntity = cameraEntity; this->playerIndex = playerIndex; diff --git a/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.h b/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.h index 4caa2fac0..6bb80b4e9 100644 --- a/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.h +++ b/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.h @@ -5,10 +5,10 @@ class Mob; class DirtyChunkSorter : public std::binary_function { private: - shared_ptr cameraEntity; + std::shared_ptr cameraEntity; int playerIndex; // 4J added public: - DirtyChunkSorter(shared_ptr cameraEntity, int playerIndex); // 4J - added player index + DirtyChunkSorter(std::shared_ptr cameraEntity, int playerIndex); // 4J - added player index bool operator()(const Chunk *a, const Chunk *b) const; }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.cpp b/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.cpp index a88ef9d7a..9c7804d27 100644 --- a/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.cpp +++ b/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.cpp @@ -3,7 +3,7 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.entity.player.h" #include "../Chunk.h" -DistanceChunkSorter::DistanceChunkSorter(shared_ptr player) +DistanceChunkSorter::DistanceChunkSorter(std::shared_ptr player) { ix = -player->x; iy = -player->y; diff --git a/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.h b/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.h index 4789070d0..fe39edd5a 100644 --- a/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.h +++ b/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.h @@ -8,6 +8,6 @@ private: double ix, iy, iz; public: - DistanceChunkSorter(shared_ptr player); + DistanceChunkSorter(std::shared_ptr player); bool operator()(const Chunk *a, const Chunk *b) const; }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Culling/ViewportCuller.cpp b/Minecraft.Client/Rendering/Culling/ViewportCuller.cpp index a443775bd..c5a881b63 100644 --- a/Minecraft.Client/Rendering/Culling/ViewportCuller.cpp +++ b/Minecraft.Client/Rendering/Culling/ViewportCuller.cpp @@ -49,7 +49,7 @@ bool ViewportCuller::Face::fullyInFront(double x0, double y0, double z0, double return true; } -ViewportCuller::ViewportCuller(shared_ptr mob, double fogDistance, float a) +ViewportCuller::ViewportCuller(std::shared_ptr mob, double fogDistance, float a) { float yRot = mob->yRotO+(mob->yRot-mob->yRotO)*a; float xRot = mob->xRotO+(mob->xRot-mob->xRotO)*a; diff --git a/Minecraft.Client/Rendering/Culling/ViewportCuller.h b/Minecraft.Client/Rendering/Culling/ViewportCuller.h index b5035c567..251f17130 100644 --- a/Minecraft.Client/Rendering/Culling/ViewportCuller.h +++ b/Minecraft.Client/Rendering/Culling/ViewportCuller.h @@ -24,7 +24,7 @@ private: Face faces[6]; double xOff, yOff, zOff; public: - ViewportCuller(shared_ptr mob, double fogDistance, float a); + ViewportCuller(std::shared_ptr mob, double fogDistance, float a); virtual bool isVisible(AABB bb); virtual bool cubeInFrustum(double x0, double y0, double z0, double x1, double y1, double z1); virtual bool cubeFullyInFrustum(double x0, double y0, double z0, double x1, double y1, double z1); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.cpp index c01aabf97..df7ff6d02 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.cpp @@ -3,11 +3,11 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.entity.projectile.h" #include "../../../Minecraft.World/Util/Mth.h" -void ArrowRenderer::render(shared_ptr _arrow, double x, double y, double z, float rot, float a) +void ArrowRenderer::render(std::shared_ptr _arrow, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type Arrow rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Arrow rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr arrow = dynamic_pointer_cast(_arrow); + std::shared_ptr arrow = dynamic_pointer_cast(_arrow); bindTexture(TN_ITEM_ARROWS); // 4J - was L"/item/arrows.png" glPushMatrix(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.h index 2731f7c2c..3348fc332 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.h @@ -4,5 +4,5 @@ class ArrowRenderer : public EntityRenderer { public: - virtual void render(shared_ptr _arrow, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _arrow, double x, double y, double z, float rot, float a); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.cpp index aa563661d..8e3119265 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.cpp @@ -8,11 +8,11 @@ BlazeRenderer::BlazeRenderer() : MobRenderer(new BlazeModel(), 0.5f) this->modelVersion = ((BlazeModel *) model)->modelVersion(); } -void BlazeRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void BlazeRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Blaze rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); int modelVersion = ((BlazeModel *) model)->modelVersion(); if (modelVersion != this->modelVersion) diff --git a/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.h index fc575e9bc..0ee973cab 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.h @@ -10,5 +10,5 @@ private: public: BlazeRenderer(); - virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.cpp index da19ef958..3b4c3823b 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.cpp @@ -10,11 +10,11 @@ BoatRenderer::BoatRenderer() : EntityRenderer() model = new BoatModel(); } -void BoatRenderer::render(shared_ptr _boat, double x, double y, double z, float rot, float a) +void BoatRenderer::render(std::shared_ptr _boat, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Boat rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr boat = dynamic_pointer_cast(_boat); + std::shared_ptr boat = dynamic_pointer_cast(_boat); glPushMatrix(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.h index 1cc9c1d99..c4bb03128 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.h @@ -9,5 +9,5 @@ protected: public: BoatRenderer(); - virtual void render(shared_ptr boat, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr boat, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.cpp index 2a51e3edc..ad4117296 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.cpp @@ -18,10 +18,10 @@ ChestRenderer::~ChestRenderer() delete largeChestModel; } -void ChestRenderer::render(shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void ChestRenderer::render(std::shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J Convert as we aren't using a templated class - shared_ptr chest = dynamic_pointer_cast(_chest); + std::shared_ptr chest = dynamic_pointer_cast(_chest); int data; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.h index 06c6bfff9..ffd4da033 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.h @@ -14,5 +14,5 @@ public: ChestRenderer(); ~ChestRenderer(); - void render(shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param + void render(std::shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.cpp index 08937ca28..14d5169f3 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.cpp @@ -7,15 +7,15 @@ ChickenRenderer::ChickenRenderer(Model *model, float shadow) : MobRenderer(model { } -void ChickenRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void ChickenRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { MobRenderer::render(_mob, x, y, z, rot, a); } -float ChickenRenderer::getBob(shared_ptr _mob, float a) +float ChickenRenderer::getBob(std::shared_ptr _mob, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); float flap = mob->oFlap+(mob->flap-mob->oFlap)*a; float flapSpeed = mob->oFlapSpeed+(mob->flapSpeed-mob->oFlapSpeed)*a; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.h index b81c91337..2c33176d5 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.h @@ -5,7 +5,7 @@ class ChickenRenderer : public MobRenderer { public: ChickenRenderer(Model *model, float shadow); - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - virtual float getBob(shared_ptr _mob, float a); + virtual float getBob(std::shared_ptr _mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.cpp index 8b9379673..ce7b9fd06 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.cpp @@ -5,7 +5,7 @@ CowRenderer::CowRenderer(Model *model, float shadow) : MobRenderer(model, shadow { } -void CowRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void CowRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { MobRenderer::render(_mob, x, y, z, rot, a); } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.h index e99e1c124..0dabaf290 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.h @@ -5,5 +5,5 @@ class CowRenderer : public MobRenderer { public: CowRenderer(Model *model, float shadow); - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.cpp index 7a361e3e4..e4c89d55b 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.cpp @@ -9,9 +9,9 @@ CreeperRenderer::CreeperRenderer() : MobRenderer( new CreeperModel(), 0.5f ) armorModel = new CreeperModel(2); } -void CreeperRenderer::scale(shared_ptr mob, float a) +void CreeperRenderer::scale(std::shared_ptr mob, float a) { - shared_ptr creeper = dynamic_pointer_cast(mob); + std::shared_ptr creeper = dynamic_pointer_cast(mob); float g = creeper->getSwelling(a); @@ -25,9 +25,9 @@ void CreeperRenderer::scale(shared_ptr mob, float a) glScalef(s, hs, s); } -int CreeperRenderer::getOverlayColor(shared_ptr mob, float br, float a) +int CreeperRenderer::getOverlayColor(std::shared_ptr mob, float br, float a) { - shared_ptr creeper = dynamic_pointer_cast(mob); + std::shared_ptr creeper = dynamic_pointer_cast(mob); float step = creeper->getSwelling(a); @@ -44,10 +44,10 @@ int CreeperRenderer::getOverlayColor(shared_ptr mob, float br, float a) return (_a << 24) | (r << 16) | (g << 8) | b; } -int CreeperRenderer::prepareArmor(shared_ptr _mob, int layer, float a) +int CreeperRenderer::prepareArmor(std::shared_ptr _mob, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); if (mob->isPowered()) { if (mob->isInvisible()) glDepthMask(false); @@ -84,7 +84,7 @@ int CreeperRenderer::prepareArmor(shared_ptr _mob, int layer, float a) } -int CreeperRenderer::prepareArmorOverlay(shared_ptr mob, int layer, float a) +int CreeperRenderer::prepareArmorOverlay(std::shared_ptr mob, int layer, float a) { return -1; } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.h index 4d0fac100..3afd511bc 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.h @@ -9,8 +9,8 @@ private: public: CreeperRenderer(); protected: - virtual void scale(shared_ptr _mob, float a); - virtual int getOverlayColor(shared_ptr mob, float br, float a); - virtual int prepareArmor(shared_ptr mob, int layer, float a); - virtual int prepareArmorOverlay(shared_ptr _mob, int layer, float a); + virtual void scale(std::shared_ptr _mob, float a); + virtual int getOverlayColor(std::shared_ptr mob, float br, float a); + virtual int prepareArmor(std::shared_ptr mob, int layer, float a); + virtual int prepareArmorOverlay(std::shared_ptr _mob, int layer, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.cpp index 0e4203e82..435410b3f 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.cpp @@ -2,7 +2,7 @@ #include "DefaultRenderer.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.entity.h" -void DefaultRenderer::render(shared_ptr entity, double x, double y, double z, float rot, float a) +void DefaultRenderer::render(std::shared_ptr entity, double x, double y, double z, float rot, float a) { glPushMatrix(); // 4J - removed following line as doesn't really make any sense diff --git a/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.h index dcb5a9c3e..651a99c15 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.h @@ -4,5 +4,5 @@ class DefaultRenderer : public EntityRenderer { public: - virtual void render(shared_ptr entity, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr entity, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.cpp index 7a3e56815..43cf4bffd 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.cpp @@ -14,10 +14,10 @@ EnchantTableRenderer::~EnchantTableRenderer() delete bookModel; } -void EnchantTableRenderer::render(shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void EnchantTableRenderer::render(std::shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J Convert as we aren't using a templated class - shared_ptr table = dynamic_pointer_cast(_table); + std::shared_ptr table = dynamic_pointer_cast(_table); #ifdef __PSVITA__ // AP - the book pages are made with 0 depth so the front and back polys are at the same location. This can cause z-fighting if culling is disabled which can sometimes happen diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.h index 0b738ca97..774857191 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.h @@ -15,5 +15,5 @@ public: EnchantTableRenderer(); ~EnchantTableRenderer(); - virtual void render(shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); + virtual void render(std::shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.cpp index 728417741..d814fba9c 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.cpp @@ -3,10 +3,10 @@ #include "../Models/ModelPart.h" #include "EnderChestRenderer.h" -void EnderChestRenderer::render(shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void EnderChestRenderer::render(std::shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J Convert as we aren't using a templated class - shared_ptr chest = dynamic_pointer_cast(_chest); + std::shared_ptr chest = dynamic_pointer_cast(_chest); int data = 0; diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.h index 50cefecfe..ab7b65547 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.h @@ -9,5 +9,5 @@ private: ChestModel chestModel; public: - void render(shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param + void render(std::shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.cpp index 88181d3c1..41487b15c 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.cpp @@ -9,11 +9,11 @@ EnderCrystalRenderer::EnderCrystalRenderer() this->shadowRadius = 0.5f; } -void EnderCrystalRenderer::render(shared_ptr _crystal, double x, double y, double z, float rot, float a) +void EnderCrystalRenderer::render(std::shared_ptr _crystal, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type EnderCrystal rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type EnderCrystal rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr crystal = dynamic_pointer_cast(_crystal); + std::shared_ptr crystal = dynamic_pointer_cast(_crystal); if (currentModel != EnderCrystalModel::MODEL_ID) { model = new EnderCrystalModel(0); diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.h index de5dc820f..5ac644d15 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.h @@ -13,5 +13,5 @@ private: public: EnderCrystalRenderer(); - virtual void render(shared_ptr _crystal, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _crystal, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.cpp index b32ff41ff..e80c9509c 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.cpp @@ -5,7 +5,7 @@ #include "../Lighting.h" #include "EnderDragonRenderer.h" -shared_ptr EnderDragonRenderer::bossInstance; +std::shared_ptr EnderDragonRenderer::bossInstance; int EnderDragonRenderer::currentModel; EnderDragonRenderer::EnderDragonRenderer() : MobRenderer(new DragonModel(0), 0.5f) @@ -15,10 +15,10 @@ EnderDragonRenderer::EnderDragonRenderer() : MobRenderer(new DragonModel(0), 0.5 this->setArmor(model); } -void EnderDragonRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRot, float a) +void EnderDragonRenderer::setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); // 4J - reorganised a bit so we can free allocations double lpComponents[3]; @@ -46,10 +46,10 @@ void EnderDragonRenderer::setupRotations(shared_ptr _mob, float bob, float } } -void EnderDragonRenderer::renderModel(shared_ptr _mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale) +void EnderDragonRenderer::renderModel(std::shared_ptr _mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); if (mob->dragonDeathTime > 0) { @@ -87,10 +87,10 @@ void EnderDragonRenderer::renderModel(shared_ptr _mob, float wp, float w } } -void EnderDragonRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void EnderDragonRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); EnderDragonRenderer::bossInstance = mob; if (currentModel != DragonModel::MODEL_ID) { @@ -167,10 +167,10 @@ void EnderDragonRenderer::render(shared_ptr _mob, double x, double y, do } } -void EnderDragonRenderer::additionalRendering(shared_ptr _mob, float a) +void EnderDragonRenderer::additionalRendering(std::shared_ptr _mob, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); MobRenderer::additionalRendering(mob, a); Tesselator *t = Tesselator::getInstance(); @@ -227,10 +227,10 @@ void EnderDragonRenderer::additionalRendering(shared_ptr _mob, float a) } -int EnderDragonRenderer::prepareArmor(shared_ptr _mob, int layer, float a) +int EnderDragonRenderer::prepareArmor(std::shared_ptr _mob, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); if (layer == 1) { diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.h index ab508d993..095e2cf28 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.h @@ -10,7 +10,7 @@ class DragonModel; class EnderDragonRenderer : public MobRenderer { public: - static shared_ptr bossInstance; + static std::shared_ptr bossInstance; private: static int currentModel; @@ -22,15 +22,15 @@ public: EnderDragonRenderer(); protected: - virtual void setupRotations(shared_ptr _mob, float bob, float bodyRot, float a); + virtual void setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a); protected: - void renderModel(shared_ptr _mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale); + void renderModel(std::shared_ptr _mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale); public: - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - virtual void additionalRendering(shared_ptr _mob, float a); - virtual int prepareArmor(shared_ptr _mob, int layer, float a); + virtual void additionalRendering(std::shared_ptr _mob, float a); + virtual int prepareArmor(std::shared_ptr _mob, int layer, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.cpp index e5334b853..e5e4481fc 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.cpp @@ -10,11 +10,11 @@ EndermanRenderer::EndermanRenderer() : MobRenderer(new EndermanModel(), 0.5f) this->setArmor(model); } -void EndermanRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void EndermanRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Boat rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); model->carrying = mob->getCarryingTile() > 0; model->creepy = mob->isCreepy(); @@ -29,11 +29,11 @@ void EndermanRenderer::render(shared_ptr _mob, double x, double y, doubl MobRenderer::render(mob, x, y, z, rot, a); } -void EndermanRenderer::additionalRendering(shared_ptr _mob, float a) +void EndermanRenderer::additionalRendering(std::shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Boat rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); MobRenderer::additionalRendering(_mob, a); @@ -68,11 +68,11 @@ void EndermanRenderer::additionalRendering(shared_ptr _mob, float a) } } -int EndermanRenderer::prepareArmor(shared_ptr _mob, int layer, float a) +int EndermanRenderer::prepareArmor(std::shared_ptr _mob, int layer, float a) { - // 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Boat rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); if (layer != 0) return -1; diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.h index 6f5126bd1..eaf6393e7 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.h @@ -14,9 +14,9 @@ private: public: EndermanRenderer(); - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); - virtual void additionalRendering(shared_ptr _mob, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void additionalRendering(std::shared_ptr _mob, float a); protected: - virtual int prepareArmor(shared_ptr _mob, int layer, float a); + virtual int prepareArmor(std::shared_ptr _mob, int layer, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp index c8275864e..545cb47b7 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp @@ -168,12 +168,12 @@ EntityRenderer *EntityRenderDispatcher::getRenderer(eINSTANCEOF e) return it->second; } -EntityRenderer *EntityRenderDispatcher::getRenderer(shared_ptr e) +EntityRenderer *EntityRenderDispatcher::getRenderer(std::shared_ptr e) { return getRenderer(e->GetType()); } -void EntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *font, shared_ptr player, Options *options, float a) +void EntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *font, std::shared_ptr player, Options *options, float a) { this->level = level; this->textures = textures; @@ -197,7 +197,7 @@ void EntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *fon playerRotX = player->xRotO + (player->xRot - player->xRotO) * a; } - shared_ptr pl = dynamic_pointer_cast(player); + std::shared_ptr pl = dynamic_pointer_cast(player); if (pl->ThirdPersonView() == 2) { playerRotY += 180; @@ -209,7 +209,7 @@ void EntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *fon } -void EntityRenderDispatcher::render(shared_ptr entity, float a) +void EntityRenderDispatcher::render(std::shared_ptr entity, float a) { double x = entity->xOld + (entity->x - entity->xOld) * a; double y = entity->yOld + (entity->y - entity->yOld) * a; @@ -244,7 +244,7 @@ void EntityRenderDispatcher::render(shared_ptr entity, float a) render(entity, x - xOff, y - yOff, z - zOff, r, a); } -void EntityRenderDispatcher::render(shared_ptr entity, double x, double y, double z, float rot, float a, bool bItemFrame, bool bRenderPlayerShadow) +void EntityRenderDispatcher::render(std::shared_ptr entity, double x, double y, double z, float rot, float a, bool bItemFrame, bool bRenderPlayerShadow) { EntityRenderer *renderer = getRenderer(entity); if (renderer != NULL) diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h index 275e07ba1..f68c43695 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h @@ -26,7 +26,7 @@ public: Textures *textures; ItemInHandRenderer *itemInHandRenderer; Level *level; - shared_ptr cameraEntity; + std::shared_ptr cameraEntity; float playerRotY; float playerRotX; Options *options; @@ -38,10 +38,10 @@ private: EntityRenderDispatcher(); public: EntityRenderer *getRenderer(eINSTANCEOF e); - EntityRenderer *getRenderer(shared_ptr e); - void prepare(Level *level, Textures *textures, Font *font, shared_ptr player, Options *options, float a); - void render(shared_ptr entity, float a); - void render(shared_ptr entity, double x, double y, double z, float rot, float a, bool bItemFrame = false, bool bRenderPlayerShadow = true); + EntityRenderer *getRenderer(std::shared_ptr e); + void prepare(Level *level, Textures *textures, Font *font, std::shared_ptr player, Options *options, float a); + void render(std::shared_ptr entity, float a); + void render(std::shared_ptr entity, double x, double y, double z, float rot, float a, bool bItemFrame = false, bool bRenderPlayerShadow = true); void setLevel(Level *level); double distanceToSqr(double x, double y, double z); Font *getFont(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.cpp index 73529268b..5d0208fad 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.cpp @@ -78,7 +78,7 @@ bool EntityRenderer::bindTexture(const wstring& urlTexture, const wstring& backu } } -void EntityRenderer::renderFlame(shared_ptr e, double x, double y, double z, float a) +void EntityRenderer::renderFlame(std::shared_ptr e, double x, double y, double z, float a) { glDisable(GL_LIGHTING); @@ -146,7 +146,7 @@ void EntityRenderer::renderFlame(shared_ptr e, double x, double y, doubl glEnable(GL_LIGHTING); } -void EntityRenderer::renderShadow(shared_ptr e, double x, double y, double z, float pow, float a) +void EntityRenderer::renderShadow(std::shared_ptr e, double x, double y, double z, float pow, float a) { glDisable(GL_LIGHTING); glEnable(GL_BLEND); @@ -160,17 +160,17 @@ void EntityRenderer::renderShadow(shared_ptr e, double x, double y, doub glDepthMask(false); float r = shadowRadius; - shared_ptr mob = dynamic_pointer_cast(e); + std::shared_ptr mob = dynamic_pointer_cast(e); bool isLocalPlayer = false; float fYLocalPlayerShadowOffset=0.0f; //if (dynamic_pointer_cast(e) != NULL) if (mob != NULL) { - //shared_ptr mob = dynamic_pointer_cast(e); + //std::shared_ptr mob = dynamic_pointer_cast(e); r *= mob->getSizeScale(); - shared_ptr animal = dynamic_pointer_cast(mob); + std::shared_ptr animal = dynamic_pointer_cast(mob); if (animal != NULL) { if (animal->isBaby()) @@ -383,7 +383,7 @@ void EntityRenderer::init(EntityRenderDispatcher *entityRenderDispatcher) this->entityRenderDispatcher = entityRenderDispatcher; } -void EntityRenderer::postRender(shared_ptr entity, double x, double y, double z, float rot, float a, bool bRenderPlayerShadow) +void EntityRenderer::postRender(std::shared_ptr entity, double x, double y, double z, float rot, float a, bool bRenderPlayerShadow) { if( !entityRenderDispatcher->isGuiRender ) // 4J - added, don't render shadow in gui as it uses its own blending, and we have globally enabled blending for interface opacity { diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.h index 44d7d45d0..529d905ac 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.h @@ -36,7 +36,7 @@ public: EntityRenderer(); // 4J - added virtual ~EntityRenderer(); public: - virtual void render(shared_ptr entity, double x, double y, double z, float rot, float a) = 0; + virtual void render(std::shared_ptr entity, double x, double y, double z, float rot, float a) = 0; protected: virtual void bindTexture(int resourceName); // 4J - added virtual void bindTexture(const wstring& resourceName); @@ -44,8 +44,8 @@ protected: virtual bool bindTexture(const wstring& urlTexture, int backupTexture); // 4J added virtual bool bindTexture(const wstring& urlTexture, const wstring& backupTexture); private: - virtual void renderFlame(shared_ptr e, double x, double y, double z, float a); - virtual void renderShadow(shared_ptr e, double x, double y, double z, float pow, float a); + virtual void renderFlame(std::shared_ptr e, double x, double y, double z, float a); + virtual void renderShadow(std::shared_ptr e, double x, double y, double z, float pow, float a); virtual Level *getLevel(); virtual void renderTileShadow(Tile *tt, double x, double y, double z, int xt, int yt, int zt, float pow, float r, double xo, double yo, double zo); @@ -54,7 +54,7 @@ public: static void renderFlat(AABB *bb); static void renderFlat(float x0, float y0, float z0, float x1, float y1, float z1); virtual void init(EntityRenderDispatcher *entityRenderDispatcher); - virtual void postRender(shared_ptr entity, double x, double y, double z, float rot, float a, bool bRenderPlayerShadow); + virtual void postRender(std::shared_ptr entity, double x, double y, double z, float rot, float a, bool bRenderPlayerShadow); virtual Font *getFont(); virtual void registerTerrainTextures(IconRegister *iconRegister); diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.cpp index c268dfe19..572d3a6c0 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.cpp @@ -7,8 +7,8 @@ EntityTileRenderer *EntityTileRenderer::instance = new EntityTileRenderer; EntityTileRenderer::EntityTileRenderer() { - chest = shared_ptr(new ChestTileEntity()); - enderChest = shared_ptr(new EnderChestTileEntity()); + chest = std::shared_ptr(new ChestTileEntity()); + enderChest = std::shared_ptr(new EnderChestTileEntity()); } void EntityTileRenderer::render(Tile *tile, int data, float brightness, float alpha, bool setColor, bool useCompiled) diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.h index cc572cadf..14ba6bfc6 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.h @@ -10,8 +10,8 @@ class EntityTileRenderer static EntityTileRenderer *instance; private: - shared_ptr chest; - shared_ptr enderChest; + std::shared_ptr chest; + std::shared_ptr enderChest; public: EntityTileRenderer(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.cpp index aa150a743..0d03fa1d6 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.cpp @@ -19,9 +19,9 @@ ExperienceOrbRenderer::ExperienceOrbRenderer() } -void ExperienceOrbRenderer::render(shared_ptr _orb, double x, double y, double z, float rot, float a) +void ExperienceOrbRenderer::render(std::shared_ptr _orb, double x, double y, double z, float rot, float a) { - shared_ptr orb = dynamic_pointer_cast(_orb); + std::shared_ptr orb = dynamic_pointer_cast(_orb); glPushMatrix(); glTranslatef((float) x, (float) y, (float) z); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.h index ebd166f49..5237ecb8d 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.h @@ -12,6 +12,6 @@ public: ExperienceOrbRenderer(); - void render(shared_ptr _orb, double x, double y, double z, float rot, float a); + void render(std::shared_ptr _orb, double x, double y, double z, float rot, float a); void blit(int x, int y, int sx, int sy, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.cpp index 26fc40486..a7dc677d3 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.cpp @@ -12,10 +12,10 @@ FallingTileRenderer::FallingTileRenderer() : EntityRenderer() this->shadowRadius = 0.5f; } -void FallingTileRenderer::render(shared_ptr _tile, double x, double y, double z, float rot, float a) +void FallingTileRenderer::render(std::shared_ptr _tile, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr tile = dynamic_pointer_cast(_tile); + std::shared_ptr tile = dynamic_pointer_cast(_tile); glPushMatrix(); glTranslatef((float) x, (float) y, (float) z); diff --git a/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.h index 0ece60337..c3181c968 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.h @@ -10,5 +10,5 @@ private: public: FallingTileRenderer(); - virtual void render(shared_ptr _tile, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _tile, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.cpp index 6761196e8..428ff3dff 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.cpp @@ -12,10 +12,10 @@ FireballRenderer::FireballRenderer(float scale) this->scale = scale; } -void FireballRenderer::render(shared_ptr _fireball, double x, double y, double z, float rot, float a) +void FireballRenderer::render(std::shared_ptr _fireball, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr fireball = dynamic_pointer_cast(_fireball); + std::shared_ptr fireball = dynamic_pointer_cast(_fireball); glPushMatrix(); @@ -54,7 +54,7 @@ void FireballRenderer::render(shared_ptr _fireball, double x, double y, } // 4J Added override. Based on EntityRenderer::renderFlame -void FireballRenderer::renderFlame(shared_ptr e, double x, double y, double z, float a) +void FireballRenderer::renderFlame(std::shared_ptr e, double x, double y, double z, float a) { glDisable(GL_LIGHTING); Icon *tex = Tile::fire->getTextureLayer(0); diff --git a/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.h index 9b22e74a4..201e3aad1 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.h @@ -9,9 +9,9 @@ private: public: FireballRenderer(float scale); - virtual void render(shared_ptr _fireball, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _fireball, double x, double y, double z, float rot, float a); private: // 4J Added override - virtual void renderFlame(shared_ptr e, double x, double y, double z, float a); + virtual void renderFlame(std::shared_ptr e, double x, double y, double z, float a); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.cpp index c2cf0cb83..fe3912ab0 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.cpp @@ -8,10 +8,10 @@ #include "../../../Minecraft.World/Util/Mth.h" #include "../../Player/MultiPlayerLocalPlayer.h" -void FishingHookRenderer::render(shared_ptr _hook, double x, double y, double z, float rot, float a) +void FishingHookRenderer::render(std::shared_ptr _hook, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr hook = dynamic_pointer_cast(_hook); + std::shared_ptr hook = dynamic_pointer_cast(_hook); glPushMatrix(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.h index 2683f1871..338bc6046 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.h @@ -4,5 +4,5 @@ class FishingHookRenderer : public EntityRenderer { public: - virtual void render(shared_ptr _hook, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _hook, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.cpp index 4b8bf54d9..85648e745 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.cpp @@ -7,9 +7,9 @@ GhastRenderer::GhastRenderer() : MobRenderer(new GhastModel(), 0.5f) { } -void GhastRenderer::scale(shared_ptr mob, float a) +void GhastRenderer::scale(std::shared_ptr mob, float a) { - shared_ptr ghast = dynamic_pointer_cast(mob); + std::shared_ptr ghast = dynamic_pointer_cast(mob); float ss = (ghast->oCharge+(ghast->charge-ghast->oCharge)*a)/20.0f; if (ss<0) ss = 0; diff --git a/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.h index 6778b9a5a..1bd3131f8 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.h @@ -7,5 +7,5 @@ public: GhastRenderer(); protected: - virtual void scale(shared_ptr mob, float a); + virtual void scale(std::shared_ptr mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.cpp index 9bcd34459..e674e9d34 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.cpp @@ -6,7 +6,7 @@ GiantMobRenderer::GiantMobRenderer(Model *model, float shadow, float _scale) : M this->_scale = _scale; } -void GiantMobRenderer::scale(shared_ptr mob, float a) +void GiantMobRenderer::scale(std::shared_ptr mob, float a) { glScalef(_scale, _scale, _scale); } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.h index 5b1cce1d3..c40708631 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.h @@ -10,5 +10,5 @@ public: GiantMobRenderer(Model *model, float shadow, float scale); protected: - virtual void scale(shared_ptr mob, float a); + virtual void scale(std::shared_ptr mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.cpp index 67fd9e71a..0de9da0c5 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.cpp @@ -36,12 +36,12 @@ void HumanoidMobRenderer::createArmorParts() armorParts2 = new HumanoidModel(0.5f); } -void HumanoidMobRenderer::additionalRendering(shared_ptr mob, float a) +void HumanoidMobRenderer::additionalRendering(std::shared_ptr mob, float a) { float brightness = SharedConstants::TEXTURE_LIGHTING ? 1 : mob->getBrightness(a); glColor3f(brightness, brightness, brightness); - shared_ptr item = mob->getCarriedItem(); - shared_ptr headGear = mob->getArmor(3); + std::shared_ptr item = mob->getCarriedItem(); + std::shared_ptr headGear = mob->getArmor(3); if (headGear != NULL) { @@ -144,7 +144,7 @@ void HumanoidMobRenderer::additionalRendering(shared_ptr mob, float a) } -void HumanoidMobRenderer::scale(shared_ptr mob, float a) +void HumanoidMobRenderer::scale(std::shared_ptr mob, float a) { glScalef(_scale, _scale, _scale); } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.h index 6c718fb92..76c9169b5 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.h @@ -17,6 +17,6 @@ public: HumanoidMobRenderer(HumanoidModel *humanoidModel, float shadow, float scale); protected: virtual void createArmorParts(); - virtual void additionalRendering(shared_ptr mob, float a); - void scale(shared_ptr mob, float a); + virtual void additionalRendering(std::shared_ptr mob, float a); + void scale(std::shared_ptr mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.cpp index 8b3f92499..cc54ac039 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.cpp @@ -23,11 +23,11 @@ void ItemFrameRenderer::registerTerrainTextures(IconRegister *iconRegister) backTexture = iconRegister->registerIcon(L"itemframe_back"); } -void ItemFrameRenderer::render(shared_ptr _itemframe, double x, double y, double z, float rot, float a) +void ItemFrameRenderer::render(std::shared_ptr _itemframe, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type EnderCrystal rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type EnderCrystal rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr itemFrame = dynamic_pointer_cast(_itemframe); + std::shared_ptr itemFrame = dynamic_pointer_cast(_itemframe); glPushMatrix(); float xOffs = (float) (itemFrame->x - x) - 0.5f; @@ -47,7 +47,7 @@ void ItemFrameRenderer::render(shared_ptr _itemframe, double x, double } -void ItemFrameRenderer::drawFrame(shared_ptr itemFrame) +void ItemFrameRenderer::drawFrame(std::shared_ptr itemFrame) { Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -102,14 +102,14 @@ void ItemFrameRenderer::drawFrame(shared_ptr itemFrame) glPopMatrix(); } -void ItemFrameRenderer::drawItem(shared_ptr entity) +void ItemFrameRenderer::drawItem(std::shared_ptr entity) { Minecraft *pMinecraft=Minecraft::GetInstance(); - shared_ptr instance = entity->getItem(); + std::shared_ptr instance = entity->getItem(); if (instance == NULL) return; - shared_ptr itemEntity = shared_ptr(new ItemEntity(entity->level, 0, 0, 0, instance)); + std::shared_ptr itemEntity = std::shared_ptr(new ItemEntity(entity->level, 0, 0, 0, instance)); itemEntity->getItem()->count = 1; itemEntity->bobOffs = 0; @@ -150,7 +150,7 @@ void ItemFrameRenderer::drawItem(shared_ptr entity) t->vertexUV(0 - vo, 0 - vo, 0, 0, 0); t->end(); - shared_ptr data = Item::map->getSavedData(itemEntity->getItem(), entity->level); + std::shared_ptr data = Item::map->getSavedData(itemEntity->getItem(), entity->level); if (data != NULL) { entityRenderDispatcher->itemInHandRenderer->minimap->render(nullptr, entityRenderDispatcher->textures, data, entity->entityId); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.h index 47f2fe90b..263344138 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.h @@ -9,9 +9,9 @@ private: //@Override public: void registerTerrainTextures(IconRegister *iconRegister); - virtual void render(shared_ptr _itemframe, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _itemframe, double x, double y, double z, float rot, float a); private: - void drawFrame(shared_ptr itemFrame); - void drawItem(shared_ptr entity); + void drawFrame(std::shared_ptr itemFrame); + void drawItem(std::shared_ptr entity); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp index 48fe302f3..e243925a0 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp @@ -158,7 +158,7 @@ ItemInHandRenderer::ItemInHandRenderer(Minecraft *mc, bool optimisedMinimap) } -void ItemInHandRenderer::renderItem(shared_ptr mob, shared_ptr item, int layer, bool setColor/* = true*/) +void ItemInHandRenderer::renderItem(std::shared_ptr mob, std::shared_ptr item, int layer, bool setColor/* = true*/) { // 4J - code borrowed from render method below, although not factoring in brightness as that should already be being taken into account // by texture lighting. This is for colourising things held in 3rd person view. @@ -312,14 +312,14 @@ void ItemInHandRenderer::renderItem3D(Tesselator *t, float u0, float v0, float u void ItemInHandRenderer::render(float a) { float h = oHeight + (height - oHeight) * a; - shared_ptr player = mc->player; + std::shared_ptr player = mc->player; // 4J - added so we can adjust the position of the hands for horizontal & vertical split screens float fudgeX = 0.0f; float fudgeY = 0.0f; float fudgeZ = 0.0f; bool splitHoriz = false; - shared_ptr localPlayer = dynamic_pointer_cast(player); + std::shared_ptr localPlayer = dynamic_pointer_cast(player); if( localPlayer ) { if( localPlayer->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM || @@ -353,7 +353,7 @@ void ItemInHandRenderer::render(float a) glRotatef((yr - yrr) * 0.1f, 0, 1, 0); } - shared_ptr item = selectedItem; + std::shared_ptr item = selectedItem; float br = mc->level->getBrightness(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); // 4J - change brought forward from 1.8.2 @@ -433,7 +433,7 @@ void ItemInHandRenderer::render(float a) glScalef(ss, ss, ss); // Can't turn off the hand if the player is holding a map - shared_ptr itemInstance = player->inventory->getSelected(); + std::shared_ptr itemInstance = player->inventory->getSelected(); if ((itemInstance && (itemInstance->getItem()->id==Item::map_Id)) || app.GetGameSettings(localPlayer->GetXboxPad(),eGameSetting_DisplayHand)!=0 ) { playerRenderer->renderHand(); @@ -477,7 +477,7 @@ void ItemInHandRenderer::render(float a) t->vertexUV((float)(0 - vo), (float)( 0 - vo), (float)( 0), (float)( 0), (float)( 0)); t->end(); - shared_ptr data = Item::map->getSavedData(item, mc->level); + std::shared_ptr data = Item::map->getSavedData(item, mc->level); PIXBeginNamedEvent(0,"Minimap render"); if(data != NULL) minimap->render(mc->player, mc->textures, data, mc->player->entityId); PIXEndNamedEvent(); @@ -652,7 +652,7 @@ void ItemInHandRenderer::render(float a) glScalef(ss, ss, ss); MemSect(31); // Can't turn off the hand if the player is holding a map - shared_ptr itemInstance = player->inventory->getSelected(); + std::shared_ptr itemInstance = player->inventory->getSelected(); if ( (itemInstance && (itemInstance->getItem()->id==Item::map_Id)) || app.GetGameSettings(localPlayer->GetXboxPad(),eGameSetting_DisplayHand)!=0 ) { @@ -837,8 +837,8 @@ void ItemInHandRenderer::tick() oHeight = height; - shared_ptr player = mc->player; - shared_ptr nextTile = player->inventory->getSelected(); + std::shared_ptr player = mc->player; + std::shared_ptr nextTile = player->inventory->getSelected(); bool matches = lastSlot == player->inventory->selected && nextTile == selectedItem; if (selectedItem == NULL && nextTile == NULL) diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.h index dee51a7f1..975dd3606 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.h @@ -11,7 +11,7 @@ class ItemInHandRenderer { private: Minecraft *mc; - shared_ptr selectedItem; + std::shared_ptr selectedItem; float height; float oHeight; TileRenderer *tileRenderer; @@ -23,7 +23,7 @@ public: public: ItemInHandRenderer(Minecraft *mc, bool optimisedMinimap = true); // 4J Added optimisedMinimap param - void renderItem(shared_ptr mob, shared_ptr item, int layer, bool setColor = true); // 4J added setColor parameter + void renderItem(std::shared_ptr mob, std::shared_ptr item, int layer, bool setColor = true); // 4J added setColor parameter static void renderItem3D(Tesselator *t, float u0, float v0, float u1, float v1, int width, int height, float depth, bool isGlint); // 4J added isGlint parameter public: void render(float a); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp index f8a6e2c54..a64d2e792 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp @@ -29,13 +29,13 @@ ItemRenderer::~ItemRenderer() delete random; } -void ItemRenderer::render(shared_ptr _itemEntity, double x, double y, double z, float rot, float a) +void ItemRenderer::render(std::shared_ptr _itemEntity, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr itemEntity = dynamic_pointer_cast(_itemEntity); + std::shared_ptr itemEntity = dynamic_pointer_cast(_itemEntity); random->setSeed(187); - shared_ptr item = itemEntity->getItem(); + std::shared_ptr item = itemEntity->getItem(); glPushMatrix(); float bob = Mth::sin((itemEntity->age + a) / 10.0f + itemEntity->bobOffs) * 0.1f + 0.1f; @@ -172,7 +172,7 @@ void ItemRenderer::render(shared_ptr _itemEntity, double x, double y, do } } -void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon, int count, float a, float red, float green, float blue) +void ItemRenderer::renderItemBillboard(std::shared_ptr entity, Icon *icon, int count, float a, float red, float green, float blue) { Tesselator *t = Tesselator::getInstance(); @@ -213,7 +213,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon float width = 1 / 16.0f; float margin = 0.35f / 16.0f; - shared_ptr item = entity->getItem(); + std::shared_ptr item = entity->getItem(); int items = item->count; if (items < 2) @@ -315,7 +315,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon } } -void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr item, float x, float y, float fScale, float fAlpha) +void ItemRenderer::renderGuiItem(Font *font, Textures *textures, std::shared_ptr item, float x, float y, float fScale, float fAlpha) { renderGuiItem(font,textures,item,x,y,fScale,fScale,fAlpha, true); } @@ -325,7 +325,7 @@ extern IDirect3DDevice9 *g_pD3DDevice; #endif // 4J - this used to take x and y as ints, and no scale and alpha - but this interface is now implemented as a wrapper round this more fully featured one -void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr item, float x, float y, float fScaleX,float fScaleY, float fAlpha, bool useCompiled) +void ItemRenderer::renderGuiItem(Font *font, Textures *textures, std::shared_ptr item, float x, float y, float fScaleX,float fScaleY, float fAlpha, bool useCompiled) { int itemId = item->id; int itemAuxValue = item->getAuxValue(); @@ -447,13 +447,13 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr item, int x, int y) +void ItemRenderer::renderGuiItem(Font *font, Textures *textures, std::shared_ptr item, int x, int y) { renderGuiItem(font, textures, item, (float)x, (float)y, 1.0f, 1.0f ); } // 4J - this used to take x and y as ints, and no scale, alpha or foil - but this interface is now implemented as a wrapper round this more fully featured one -void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, float x, float y,float fScale,float fAlpha, bool isFoil) +void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const std::shared_ptr item, float x, float y,float fScale,float fAlpha, bool isFoil) { if(item==NULL) return; renderAndDecorateItem(font, textures, item, x, y,fScale, fScale, fAlpha, isFoil, true); @@ -461,7 +461,7 @@ void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const s // 4J - added isConstantBlended and blendFactor parameters. This is true if the gui item is being rendered from a context where it already has blending enabled to do general interface fading // (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) +void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const std::shared_ptr item, float x, float y,float fScaleX, float fScaleY,float fAlpha, bool isFoil, bool isConstantBlended, bool useCompiled) { if (item == NULL) { @@ -507,7 +507,7 @@ void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const s } // 4J - original interface, now just a wrapper for preceding overload -void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, int x, int y) +void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const std::shared_ptr item, int x, int y) { renderAndDecorateItem( font, textures, item, (float)x, (float)y, 1.0f, 1.0f, item->isFoil() ); } @@ -560,12 +560,12 @@ void ItemRenderer::blitGlint(int id, float x, float y, float w, float h) } } -void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shared_ptr item, int x, int y, float fAlpha) +void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, float fAlpha) { renderGuiItemDecorations(font, textures, item, x, y, L"", fAlpha); } -void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shared_ptr item, int x, int y, const wstring &countText, float fAlpha) +void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, const wstring &countText, float fAlpha) { if (item == NULL) { diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h index 9690f77cc..830e85100 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h @@ -18,20 +18,20 @@ public: ItemRenderer(); virtual ~ItemRenderer(); - virtual void render(shared_ptr _itemEntity, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _itemEntity, double x, double y, double z, float rot, float a); private: - virtual void renderItemBillboard(shared_ptr entity, Icon *icon, int count, float a, float red, float green, float blue); + virtual void renderItemBillboard(std::shared_ptr entity, Icon *icon, int count, float a, float red, float green, float blue); public: // 4J - original 2 interface variants - void renderGuiItem(Font *font, Textures *textures, shared_ptr item, int x, int y); - void renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, int x, int y); + void renderGuiItem(Font *font, Textures *textures, std::shared_ptr item, int x, int y); + void renderAndDecorateItem(Font *font, Textures *textures, const std::shared_ptr item, int x, int y); // 4J - new interfaces added - void renderGuiItem(Font *font, Textures *textures, shared_ptr item, float x, float y, float fScale, float fAlpha); - void renderGuiItem(Font *font, Textures *textures, shared_ptr item, float x, float y, float fScaleX,float fScaleY, float fAlpha, bool useCompiled); // 4J Added useCompiled - void renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, float x, float y, float fScale, float fAlpha, bool isFoil); - void 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 = true); // 4J - added isConstantBlended and useCompiled + void renderGuiItem(Font *font, Textures *textures, std::shared_ptr item, float x, float y, float fScale, float fAlpha); + void renderGuiItem(Font *font, Textures *textures, std::shared_ptr item, float x, float y, float fScaleX,float fScaleY, float fAlpha, bool useCompiled); // 4J Added useCompiled + void renderAndDecorateItem(Font *font, Textures *textures, const std::shared_ptr item, float x, float y, float fScale, float fAlpha, bool isFoil); + void renderAndDecorateItem(Font *font, Textures *textures, const std::shared_ptr item, float x, float y, float fScaleX, float fScaleY, float fAlpha, bool isFoil, bool isConstantBlended, bool useCompiled = true); // 4J - added isConstantBlended and useCompiled // 4J Added virtual void SetItemFrame(bool bSet) {m_bItemFrame=bSet;} @@ -42,8 +42,8 @@ private: void blitGlint(int id, float x, float y, float w, float h); // 4J - changed x,y,w,h to floats public: - void renderGuiItemDecorations(Font *font, Textures *textures, shared_ptr item, int x, int y, float fAlpha = 1.0f); - void renderGuiItemDecorations(Font *font, Textures *textures, shared_ptr item, int x, int y, const wstring &countText, float fAlpha = 1.0f); + void renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, float fAlpha = 1.0f); + void renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, const wstring &countText, float fAlpha = 1.0f); private: void fillRect(Tesselator *t, int x, int y, int w, int h, int c); public: diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.cpp index e21c6b961..f9d68a60e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.cpp @@ -17,7 +17,7 @@ ItemSpriteRenderer::ItemSpriteRenderer(Item *sourceItem, int sourceItemAuxValue // this(sourceItem, 0); //} -void ItemSpriteRenderer::render(shared_ptr e, double x, double y, double z, float rot, float a) +void ItemSpriteRenderer::render(std::shared_ptr e, double x, double y, double z, float rot, float a) { // 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); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.h index e60feece3..e83597839 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.h @@ -11,7 +11,7 @@ private: public: ItemSpriteRenderer(Item *sourceItem, int sourceItemAuxValue = 0); //ItemSpriteRenderer(Item *icon); - virtual void render(shared_ptr e, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr e, double x, double y, double z, float rot, float a); private: void renderIcon(Tesselator *t, Icon *icon); diff --git a/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.cpp index bfa0db720..c6113cf15 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.cpp @@ -8,11 +8,11 @@ LavaSlimeRenderer::LavaSlimeRenderer() : MobRenderer(new LavaSlimeModel(), .25f) this->modelVersion = ((LavaSlimeModel *) model)->getModelVersion(); } -void LavaSlimeRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void LavaSlimeRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type LavaSlime rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type LavaSlime rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); int modelVersion = ((LavaSlimeModel *) model)->getModelVersion(); if (modelVersion != this->modelVersion) { @@ -23,11 +23,11 @@ void LavaSlimeRenderer::render(shared_ptr _mob, double x, double y, doub MobRenderer::render(mob, x, y, z, rot, a); } -void LavaSlimeRenderer::scale(shared_ptr _slime, float a) +void LavaSlimeRenderer::scale(std::shared_ptr _slime, float a) { - // 4J - original version used generics and thus had an input parameter of type LavaSlime rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type LavaSlime rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr slime = dynamic_pointer_cast(_slime); + std::shared_ptr slime = dynamic_pointer_cast(_slime); int size = slime->getSize(); float ss = (slime->oSquish + (slime->squish - slime->oSquish) * a) / (size * 0.5f + 1); float w = 1 / (ss + 1); diff --git a/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.h index b0c44d1e2..29afb390e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.h @@ -10,8 +10,8 @@ private: public: LavaSlimeRenderer(); - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - virtual void scale(shared_ptr _slime, float a); + virtual void scale(std::shared_ptr _slime, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.cpp index 53651c94c..7648586fa 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.cpp @@ -3,10 +3,10 @@ #include "../Tesselator.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.entity.global.h" -void LightningBoltRenderer::render(shared_ptr _bolt, double x, double y, double z, float rot, float a) +void LightningBoltRenderer::render(std::shared_ptr _bolt, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr bolt = dynamic_pointer_cast(_bolt); + std::shared_ptr bolt = dynamic_pointer_cast(_bolt); Tesselator *t = Tesselator::getInstance(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.h index 5a2b33a3e..bf5c7c82c 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.h @@ -4,5 +4,5 @@ class LightningBoltRenderer : public EntityRenderer { public: - virtual void render(shared_ptr bolt, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr bolt, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.cpp index 1daf1b79e..be16ddaa3 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.cpp @@ -10,10 +10,10 @@ MinecartRenderer::MinecartRenderer() model = new MinecartModel(); } -void MinecartRenderer::render(shared_ptr _cart, double x, double y, double z, float rot, float a) +void MinecartRenderer::render(std::shared_ptr _cart, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr cart = dynamic_pointer_cast(_cart); + std::shared_ptr cart = dynamic_pointer_cast(_cart); glPushMatrix(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.h index 0335ba8de..6902a3bf2 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.h @@ -8,5 +8,5 @@ protected: public: MinecartRenderer(); - void render(shared_ptr _cart, double x, double y, double z, float rot, float a); + void render(std::shared_ptr _cart, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.cpp index 0f0da4389..b2cb23ebf 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.cpp @@ -31,11 +31,11 @@ float MobRenderer::rotlerp(float from, float to, float a) return from + a * diff; } -void MobRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void MobRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { // 4J - added - this used to use generics so the input parameter could be a mob (or derived type), but we aren't // able to do that so dynamically casting to get the more specific type here. - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); glPushMatrix(); glDisable(GL_CULL_FACE); @@ -54,7 +54,7 @@ void MobRenderer::render(shared_ptr _mob, double x, double y, double z, if (mob->isRiding() && dynamic_pointer_cast(mob->riding)) { - shared_ptr riding = dynamic_pointer_cast(mob->riding); + std::shared_ptr riding = dynamic_pointer_cast(mob->riding); bodyRot = rotlerp(riding->yBodyRotO, riding->yBodyRot, a); float headDiff = Mth::wrapDegrees(headRot - bodyRot); @@ -233,9 +233,9 @@ void MobRenderer::render(shared_ptr _mob, double x, double y, double z, MemSect(0); } -void MobRenderer::renderModel(shared_ptr mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale) +void MobRenderer::renderModel(std::shared_ptr mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale) { - shared_ptr player = dynamic_pointer_cast(Minecraft::GetInstance()->player); + std::shared_ptr player = dynamic_pointer_cast(Minecraft::GetInstance()->player); bindTexture(mob->customTextureUrl, mob->getTexture()); if (!mob->isInvisible()) @@ -262,12 +262,12 @@ void MobRenderer::renderModel(shared_ptr mob, float wp, float ws, float } } -void MobRenderer::setupPosition(shared_ptr mob, double x, double y, double z) +void MobRenderer::setupPosition(std::shared_ptr mob, double x, double y, double z) { glTranslatef((float) x, (float) y, (float) z); } -void MobRenderer::setupRotations(shared_ptr mob, float bob, float bodyRot, float a) +void MobRenderer::setupRotations(std::shared_ptr mob, float bob, float bodyRot, float a) { glRotatef(180 - bodyRot, 0, 1, 0); if (mob->deathTime > 0) @@ -279,49 +279,49 @@ void MobRenderer::setupRotations(shared_ptr mob, float bob, float bodyRot, } } -float MobRenderer::getAttackAnim(shared_ptr mob, float a) +float MobRenderer::getAttackAnim(std::shared_ptr mob, float a) { return mob->getAttackAnim(a); } -float MobRenderer::getBob(shared_ptr mob, float a) +float MobRenderer::getBob(std::shared_ptr mob, float a) { return (mob->tickCount + a); } -void MobRenderer::additionalRendering(shared_ptr mob, float a) +void MobRenderer::additionalRendering(std::shared_ptr mob, float a) { } -int MobRenderer::prepareArmorOverlay(shared_ptr mob, int layer, float a) +int MobRenderer::prepareArmorOverlay(std::shared_ptr mob, int layer, float a) { return prepareArmor(mob, layer, a); } -int MobRenderer::prepareArmor(shared_ptr mob, int layer, float a) +int MobRenderer::prepareArmor(std::shared_ptr mob, int layer, float a) { return -1; } -void MobRenderer::prepareSecondPassArmor(shared_ptr mob, int layer, float a) +void MobRenderer::prepareSecondPassArmor(std::shared_ptr mob, int layer, float a) { } -float MobRenderer::getFlipDegrees(shared_ptr mob) +float MobRenderer::getFlipDegrees(std::shared_ptr mob) { return 90; } -int MobRenderer::getOverlayColor(shared_ptr mob, float br, float a) +int MobRenderer::getOverlayColor(std::shared_ptr mob, float br, float a) { return 0; } -void MobRenderer::scale(shared_ptr mob, float a) +void MobRenderer::scale(std::shared_ptr mob, float a) { } -void MobRenderer::renderName(shared_ptr mob, double x, double y, double z) +void MobRenderer::renderName(std::shared_ptr mob, double x, double y, double z) { if (Minecraft::renderDebug()) { @@ -330,7 +330,7 @@ void MobRenderer::renderName(shared_ptr mob, double x, double y, double z) } // 4J Added parameter for color here so that we can colour players names -void MobRenderer::renderNameTag(shared_ptr mob, const wstring& OriginalName, double x, double y, double z, int maxDist, int color /*= 0xffffffff*/) +void MobRenderer::renderNameTag(std::shared_ptr mob, const wstring& OriginalName, double x, double y, double z, int maxDist, int color /*= 0xffffffff*/) { if ( app.GetGameSettings(eGameSetting_DisplayHUD)==0 ) @@ -396,7 +396,7 @@ void MobRenderer::renderNameTag(shared_ptr mob, const wstring& OriginalName Tesselator *t = Tesselator::getInstance(); int offs = 0; - shared_ptr player = dynamic_pointer_cast(mob); + std::shared_ptr player = dynamic_pointer_cast(mob); if (player != NULL && app.isXuidDeadmau5( player->getXuid() ) ) offs = -10; wstring playerName; diff --git a/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.h index a8b2b93e7..6a5df478e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.h @@ -23,22 +23,22 @@ public: private: float rotlerp(float from, float to, float a); public: - virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); protected: - virtual void renderModel(shared_ptr mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale); - virtual void setupPosition(shared_ptr mob, double x, double y, double z); - virtual void setupRotations(shared_ptr mob, float bob, float bodyRot, float a); - virtual float getAttackAnim(shared_ptr mob, float a); - virtual float getBob(shared_ptr mob, float a); - virtual void additionalRendering(shared_ptr mob, float a); - virtual int prepareArmorOverlay(shared_ptr mob, int layer, float a); - virtual int prepareArmor(shared_ptr mob, int layer, float a); - virtual void prepareSecondPassArmor(shared_ptr mob, int layer, float a); - virtual float getFlipDegrees(shared_ptr mob); - virtual int getOverlayColor(shared_ptr mob, float br, float a); - virtual void scale(shared_ptr mob, float a); - virtual void renderName(shared_ptr mob, double x, double y, double z); - virtual void renderNameTag(shared_ptr mob, const wstring& name, double x, double y, double z, int maxDist, int color = 0xff000000); + virtual void renderModel(std::shared_ptr mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale); + virtual void setupPosition(std::shared_ptr mob, double x, double y, double z); + virtual void setupRotations(std::shared_ptr mob, float bob, float bodyRot, float a); + virtual float getAttackAnim(std::shared_ptr mob, float a); + virtual float getBob(std::shared_ptr mob, float a); + virtual void additionalRendering(std::shared_ptr mob, float a); + virtual int prepareArmorOverlay(std::shared_ptr mob, int layer, float a); + virtual int prepareArmor(std::shared_ptr mob, int layer, float a); + virtual void prepareSecondPassArmor(std::shared_ptr mob, int layer, float a); + virtual float getFlipDegrees(std::shared_ptr mob); + virtual int getOverlayColor(std::shared_ptr mob, float br, float a); + virtual void scale(std::shared_ptr mob, float a); + virtual void renderName(std::shared_ptr mob, double x, double y, double z); + virtual void renderNameTag(std::shared_ptr mob, const wstring& name, double x, double y, double z, int maxDist, int color = 0xff000000); public: // 4J Added diff --git a/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.cpp index 9b8b8225b..072a54bcc 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.cpp @@ -5,15 +5,15 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.entity.h" -void MobSpawnerRenderer::render(shared_ptr _spawner, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void MobSpawnerRenderer::render(std::shared_ptr _spawner, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr spawner = dynamic_pointer_cast(_spawner); + std::shared_ptr spawner = dynamic_pointer_cast(_spawner); glPushMatrix(); glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f); - shared_ptr e = spawner->getDisplayEntity(); + std::shared_ptr e = spawner->getDisplayEntity(); if (e != NULL) { e->setLevel(spawner->level); diff --git a/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h index ad7dfe675..c8b392adf 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h @@ -5,7 +5,7 @@ using namespace std; class MobSpawnerRenderer : public TileEntityRenderer { private: - unordered_map > models; + unordered_map > models; public: - virtual void render(shared_ptr _spawner, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param + virtual void render(std::shared_ptr _spawner, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.cpp index 14f66f763..0ab520d8f 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.cpp @@ -9,21 +9,21 @@ MushroomCowRenderer::MushroomCowRenderer(Model *model, float shadow) : MobRender { } -void MushroomCowRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void MushroomCowRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type MushroomCow rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type MushroomCow rather than std::shared_ptr we have here - // do some casting around instead - //shared_ptr mob = dynamic_pointer_cast(_mob); + //std::shared_ptr mob = dynamic_pointer_cast(_mob); // 4J Stu - No need to do the cast, just pass through as-is MobRenderer::render(_mob, x, y, z, rot, a); } -void MushroomCowRenderer::additionalRendering(shared_ptr _mob, float a) +void MushroomCowRenderer::additionalRendering(std::shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type MushroomCow rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type MushroomCow rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); MobRenderer::additionalRendering(mob, a); if (mob->isBaby()) return; bindTexture(TN_TERRAIN); // 4J was "/terrain.png" diff --git a/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.h index c5f6f3c49..8d01ea818 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.h @@ -7,8 +7,8 @@ class MushroomCowRenderer : public MobRenderer public: MushroomCowRenderer(Model *model, float shadow); - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - virtual void additionalRendering(shared_ptr _mob, float a); + virtual void additionalRendering(std::shared_ptr _mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.cpp index ed3f3ba45..b1cf46be3 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.cpp @@ -6,16 +6,16 @@ OzelotRenderer::OzelotRenderer(Model *model, float shadow) : MobRenderer(model, { } -void OzelotRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void OzelotRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { MobRenderer::render(_mob, x, y, z, rot, a); } -void OzelotRenderer::scale(shared_ptr _mob, float a) +void OzelotRenderer::scale(std::shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Blaze rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); MobRenderer::scale(mob, a); if (mob->isTame()) { diff --git a/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.h index 9627b4f19..a9fc1223b 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.h @@ -7,8 +7,8 @@ class OzelotRenderer : public MobRenderer public: OzelotRenderer(Model *model, float shadow); - void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - void scale(shared_ptr _mob, float a); + void scale(std::shared_ptr _mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.cpp index 146bfa47c..e61ecda78 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.cpp @@ -11,10 +11,10 @@ PaintingRenderer::PaintingRenderer() random = new Random(); } -void PaintingRenderer::render(shared_ptr _painting, double x, double y, double z, float rot, float a) +void PaintingRenderer::render(std::shared_ptr _painting, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr painting = dynamic_pointer_cast(_painting); + std::shared_ptr painting = dynamic_pointer_cast(_painting); random->setSeed(187); @@ -33,7 +33,7 @@ void PaintingRenderer::render(shared_ptr _painting, double x, double y, glPopMatrix(); } -void PaintingRenderer::renderPainting(shared_ptr painting, int w, int h, int uo, int vo) +void PaintingRenderer::renderPainting(std::shared_ptr painting, int w, int h, int uo, int vo) { float xx0 = -w / 2.0f; float yy0 = -h / 2.0f; @@ -113,7 +113,7 @@ void PaintingRenderer::renderPainting(shared_ptr painting, int w, int } -void PaintingRenderer::setBrightness(shared_ptr painting, float ss, float ya) +void PaintingRenderer::setBrightness(std::shared_ptr painting, float ss, float ya) { int x = Mth::floor(painting->x); int y = Mth::floor(painting->y + ya/16.0f); diff --git a/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.h index a750e1287..f940c1694 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.h @@ -11,9 +11,9 @@ private: public: PaintingRenderer(); // 4J -added - virtual void render(shared_ptr _painting, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _painting, double x, double y, double z, float rot, float a); private: - void renderPainting(shared_ptr painting, int w, int h, int uo, int vo); - void setBrightness(shared_ptr painting, float ss, float ya); + void renderPainting(std::shared_ptr painting, int w, int h, int uo, int vo); + void setBrightness(std::shared_ptr painting, float ss, float ya); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.cpp index 6872b0f3d..88c46faf4 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.cpp @@ -7,10 +7,10 @@ PigRenderer::PigRenderer(Model *model, Model *armor, float shadow) : MobRenderer setArmor(armor); } -int PigRenderer::prepareArmor(shared_ptr _pig, int layer, float a) +int PigRenderer::prepareArmor(std::shared_ptr _pig, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr pig = dynamic_pointer_cast(_pig); + std::shared_ptr pig = dynamic_pointer_cast(_pig); MemSect(31); bindTexture(TN_MOB_SADDLE); // 4J was L"/mob/saddle.png" @@ -18,7 +18,7 @@ int PigRenderer::prepareArmor(shared_ptr _pig, int layer, float a) return (layer == 0 && pig->hasSaddle()) ? 1 : -1; } -void PigRenderer::render(shared_ptr mob, double x, double y, double z, float rot, float a) +void PigRenderer::render(std::shared_ptr mob, double x, double y, double z, float rot, float a) { MobRenderer::render(mob, x, y, z, rot, a); } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.h index e674b5084..9dc3edfac 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.h @@ -6,8 +6,8 @@ class PigRenderer : public MobRenderer public: PigRenderer(Model *model, Model *armor, float shadow); protected: - virtual int prepareArmor(shared_ptr _pig, int layer, float a); + virtual int prepareArmor(std::shared_ptr _pig, int layer, float a); public: - virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.cpp index 6406e2bfe..f5720e05b 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.cpp @@ -12,10 +12,10 @@ PistonPieceRenderer::PistonPieceRenderer() tileRenderer = NULL; } -void PistonPieceRenderer::render(shared_ptr _entity, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void PistonPieceRenderer::render(std::shared_ptr _entity, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr entity = dynamic_pointer_cast(_entity); + std::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 diff --git a/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.h index 0588a9730..90061b109 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.h @@ -10,6 +10,6 @@ private: public: PistonPieceRenderer(); - virtual void render(shared_ptr _entity, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param + virtual void render(std::shared_ptr _entity, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param virtual void onNewLevel(Level *level); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp index 760a29f61..3f938f302 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp @@ -46,10 +46,10 @@ unsigned int PlayerRenderer::getNametagColour(int index) return 0xFF000000; } -int PlayerRenderer::prepareArmor(shared_ptr _player, int layer, float a) +int PlayerRenderer::prepareArmor(std::shared_ptr _player, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr player = dynamic_pointer_cast(_player); + std::shared_ptr player = dynamic_pointer_cast(_player); // 4J-PB - need to disable rendering armour for some special skins (Daleks) unsigned int uiAnimOverrideBitmask=player->getAnimOverrideBitmask(); @@ -58,7 +58,7 @@ int PlayerRenderer::prepareArmor(shared_ptr _player, int layer, float a) return -1; } - shared_ptr itemInstance = player->inventory->getArmor(3 - layer); + std::shared_ptr itemInstance = player->inventory->getArmor(3 - layer); if (itemInstance != NULL) { Item *item = itemInstance->getItem(); @@ -108,11 +108,11 @@ int PlayerRenderer::prepareArmor(shared_ptr _player, int layer, float a) } -void PlayerRenderer::prepareSecondPassArmor(shared_ptr _player, int layer, float a) +void PlayerRenderer::prepareSecondPassArmor(std::shared_ptr _player, int layer, float a) { // 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); + std::shared_ptr player = dynamic_pointer_cast(_player); + std::shared_ptr itemInstance = player->inventory->getArmor(3 - layer); if (itemInstance != NULL) { Item *item = itemInstance->getItem(); @@ -127,14 +127,14 @@ void PlayerRenderer::prepareSecondPassArmor(shared_ptr _player, int layer, } } -void PlayerRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void PlayerRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); if(mob->hasInvisiblePrivilege()) return; - shared_ptr item = mob->inventory->getSelected(); + std::shared_ptr item = mob->inventory->getSelected(); armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != NULL ? 1 : 0; if (item != NULL) { @@ -228,10 +228,10 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double } -void PlayerRenderer::renderName(shared_ptr _mob, double x, double y, double z) +void PlayerRenderer::renderName(std::shared_ptr _mob, double x, double y, double z) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); if (Minecraft::renderNames() && mob != entityRenderDispatcher->cameraEntity && !mob->isInvisibleTo(Minecraft::GetInstance()->player) ) // 4J-JEV: Todo, move to LivingEntityRenderer. @@ -316,14 +316,14 @@ void PlayerRenderer::renderName(shared_ptr _mob, double x, double y, double } -void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) +void PlayerRenderer::additionalRendering(std::shared_ptr _mob, float a) { MobRenderer::additionalRendering(_mob,a); // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); - shared_ptr headGear = mob->inventory->getArmor(3); + std::shared_ptr headGear = mob->inventory->getArmor(3); if (headGear != NULL) { // don't render the pumpkin for the skins @@ -428,7 +428,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) } - shared_ptr item = mob->inventory->getSelected(); + std::shared_ptr item = mob->inventory->getSelected(); if (item != NULL) { @@ -438,7 +438,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) if (mob->fishing != NULL) { - item = shared_ptr( new ItemInstance(Item::stick) ); + item = std::shared_ptr( new ItemInstance(Item::stick) ); } UseAnim anim = UseAnim_none;//null; @@ -521,7 +521,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) } -void PlayerRenderer::scale(shared_ptr player, float a) +void PlayerRenderer::scale(std::shared_ptr player, float a) { float s = 15 / 16.0f; glScalef(s, s, s); @@ -540,10 +540,10 @@ void PlayerRenderer::renderHand() } } -void PlayerRenderer::setupPosition(shared_ptr _mob, double x, double y, double z) +void PlayerRenderer::setupPosition(std::shared_ptr _mob, double x, double y, double z) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); if (mob->isAlive() && mob->isSleeping()) { @@ -556,10 +556,10 @@ void PlayerRenderer::setupPosition(shared_ptr _mob, double x, double y, dou } } -void PlayerRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRot, float a) +void PlayerRenderer::setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); if (mob->isAlive() && mob->isSleeping()) { @@ -574,11 +574,11 @@ void PlayerRenderer::setupRotations(shared_ptr _mob, float bob, float bodyR } // 4J Added override to stop rendering shadow if player is invisible -void PlayerRenderer::renderShadow(shared_ptr e, double x, double y, double z, float pow, float a) +void PlayerRenderer::renderShadow(std::shared_ptr e, double x, double y, double z, float pow, float a) { if(app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) > 0) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = dynamic_pointer_cast(e); if(player != NULL && player->hasInvisiblePrivilege()) return; } EntityRenderer::renderShadow(e,x,y,z,pow,a); diff --git a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.h index 8e42d97e7..6ed16f260 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.h @@ -23,20 +23,20 @@ private: static const wstring MATERIAL_NAMES[5]; protected: - virtual int prepareArmor(shared_ptr _player, int layer, float a); - virtual void prepareSecondPassArmor(shared_ptr mob, int layer, float a); + virtual int prepareArmor(std::shared_ptr _player, int layer, float a); + virtual void prepareSecondPassArmor(std::shared_ptr mob, int layer, float a); public: - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - virtual void renderName(shared_ptr _mob, double x, double y, double z); - virtual void additionalRendering(shared_ptr _mob, float a); - virtual void scale(shared_ptr _player, float a); + virtual void renderName(std::shared_ptr _mob, double x, double y, double z); + virtual void additionalRendering(std::shared_ptr _mob, float a); + virtual void scale(std::shared_ptr _player, float a); public: void renderHand(); protected: - virtual void setupPosition(shared_ptr _mob, double x, double y, double z); - virtual void setupRotations(shared_ptr _mob, float bob, float bodyRot, float a); + virtual void setupPosition(std::shared_ptr _mob, double x, double y, double z); + virtual void setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a); private: - virtual void renderShadow(shared_ptr e, double x, double y, double z, float pow, float a); // 4J Added override + virtual void renderShadow(std::shared_ptr e, double x, double y, double z, float pow, float a); // 4J Added override }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.cpp index 8a05bb458..337bbfcc4 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.cpp @@ -8,10 +8,10 @@ SheepRenderer::SheepRenderer(Model *model, Model *armor, float shadow) : MobRend setArmor(armor); } -int SheepRenderer::prepareArmor(shared_ptr _sheep, int layer, float a) +int SheepRenderer::prepareArmor(std::shared_ptr _sheep, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr sheep = dynamic_pointer_cast(_sheep); + std::shared_ptr sheep = dynamic_pointer_cast(_sheep); if (layer == 0 && !sheep->isSheared() && !sheep->isInvisibleTo(Minecraft::GetInstance()->player)) // 4J-JEV: Todo, merge with java fix (for invisible sheep armour) in '1.7.5'. @@ -28,7 +28,7 @@ int SheepRenderer::prepareArmor(shared_ptr _sheep, int layer, float a) return -1; } -void SheepRenderer::render(shared_ptr mob, double x, double y, double z, float rot, float a) +void SheepRenderer::render(std::shared_ptr mob, double x, double y, double z, float rot, float a) { MobRenderer::render(mob, x, y, z, rot, a); } diff --git a/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.h index c0dea04fe..637c53d04 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.h @@ -7,8 +7,8 @@ public: SheepRenderer(Model *model, Model *armor, float shadow); protected: - virtual int prepareArmor(shared_ptr _sheep, int layer, float a); + virtual int prepareArmor(std::shared_ptr _sheep, int layer, float a); public: - virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp index ce5042eb7..5c88b92ed 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp @@ -13,10 +13,10 @@ SignRenderer::SignRenderer() signModel = new SignModel(); } -void SignRenderer::render(shared_ptr _sign, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void SignRenderer::render(std::shared_ptr _sign, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr sign = dynamic_pointer_cast(_sign); + std::shared_ptr sign = dynamic_pointer_cast(_sign); Tile *tile = sign->getTile(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.h index 48d4d9542..d7411af43 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.h @@ -8,5 +8,5 @@ private: SignModel *signModel; public: SignRenderer(); // 4J - added - virtual void render(shared_ptr sign, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param + virtual void render(std::shared_ptr sign, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.cpp index 07f0ab431..1356cbdbc 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.cpp @@ -7,17 +7,17 @@ SilverfishRenderer::SilverfishRenderer() : MobRenderer(new SilverfishModel(), 0. { } -float SilverfishRenderer::getFlipDegrees(shared_ptr spider) +float SilverfishRenderer::getFlipDegrees(std::shared_ptr spider) { return 180; } -void SilverfishRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void SilverfishRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { MobRenderer::render(_mob, x, y, z, rot, a); } -int SilverfishRenderer::prepareArmor(shared_ptr _silverfish, int layer, float a) +int SilverfishRenderer::prepareArmor(std::shared_ptr _silverfish, int layer, float a) { return -1; } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.h index c1df4505a..91ff2e456 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.h @@ -13,11 +13,11 @@ public: SilverfishRenderer(); protected: - float getFlipDegrees(shared_ptr spider); + float getFlipDegrees(std::shared_ptr spider); public: - void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - int prepareArmor(shared_ptr _silverfish, int layer, float a); + int prepareArmor(std::shared_ptr _silverfish, int layer, float a); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.cpp index 03d0b332f..873c268fa 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.cpp @@ -19,9 +19,9 @@ SkullTileRenderer::~SkullTileRenderer() delete zombieModel; } -void SkullTileRenderer::render(shared_ptr _skull, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void SkullTileRenderer::render(std::shared_ptr _skull, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { - shared_ptr skull = dynamic_pointer_cast(_skull); + std::shared_ptr skull = dynamic_pointer_cast(_skull); renderSkull((float) x, (float) y, (float) z, skull->getData() & SkullTile::PLACEMENT_MASK, skull->getRotation() * 360 / 16.0f, skull->getSkullType(), skull->getExtraType()); } diff --git a/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.h index 09c83f9df..e9d2bf0f6 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.h @@ -18,7 +18,7 @@ public: SkullTileRenderer(); ~SkullTileRenderer(); - void render(shared_ptr skull, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled = true); + void render(std::shared_ptr skull, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled = true); void init(TileEntityRenderDispatcher *tileEntityRenderDispatcher); void renderSkull(float x, float y, float z, int face, float rot, int type, const wstring &extra); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.cpp index 82f08b7bf..f4d84c61c 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.cpp @@ -7,10 +7,10 @@ SlimeRenderer::SlimeRenderer(Model *model, Model *armor, float shadow) : MobRend this->armor = armor; } -int SlimeRenderer::prepareArmor(shared_ptr _slime, int layer, float a) +int SlimeRenderer::prepareArmor(std::shared_ptr _slime, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr slime = dynamic_pointer_cast(_slime); + std::shared_ptr slime = dynamic_pointer_cast(_slime); if (slime->isInvisible()) return 0; @@ -32,10 +32,10 @@ int SlimeRenderer::prepareArmor(shared_ptr _slime, int layer, float a) return -1; } -void SlimeRenderer::scale(shared_ptr _slime, float a) +void SlimeRenderer::scale(std::shared_ptr _slime, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr slime = dynamic_pointer_cast(_slime); + std::shared_ptr slime = dynamic_pointer_cast(_slime); float size = (float) slime->getSize(); float ss = (slime->oSquish + (slime->squish - slime->oSquish) * a) / (size * 0.5f + 1); diff --git a/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.h index 58f510aa1..86de3a76e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.h @@ -8,6 +8,6 @@ private: public: SlimeRenderer(Model *model, Model *armor, float shadow); protected: - virtual int prepareArmor(shared_ptr _slime, int layer, float a); - virtual void scale(shared_ptr _slime, float a); + virtual int prepareArmor(std::shared_ptr _slime, int layer, float a); + virtual void scale(std::shared_ptr _slime, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.cpp index 164cd8d57..e08b61570 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.cpp @@ -13,14 +13,14 @@ SnowManRenderer::SnowManRenderer() : MobRenderer(new SnowManModel(), 0.5f) this->setArmor(model); } -void SnowManRenderer::additionalRendering(shared_ptr _mob, float a) +void SnowManRenderer::additionalRendering(std::shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type SnowMan rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type SnowMan rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); MobRenderer::additionalRendering(mob, a); - shared_ptr headGear = shared_ptr( new ItemInstance(Tile::pumpkin, 1) ); + std::shared_ptr headGear = std::shared_ptr( new ItemInstance(Tile::pumpkin, 1) ); if (headGear != NULL && headGear->getItem()->id < 256) { glPushMatrix(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.h index 9bdecb4db..ab003fe68 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.h @@ -13,5 +13,5 @@ public: SnowManRenderer(); protected: - virtual void additionalRendering(shared_ptr _mob, float a); + virtual void additionalRendering(std::shared_ptr _mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.cpp index fc2ac137c..d9d7e9fd7 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.cpp @@ -8,15 +8,15 @@ SpiderRenderer::SpiderRenderer() : MobRenderer(new SpiderModel(), 1.0f) this->setArmor(new SpiderModel()); } -float SpiderRenderer::getFlipDegrees(shared_ptr spider) +float SpiderRenderer::getFlipDegrees(std::shared_ptr spider) { return 180; } -int SpiderRenderer::prepareArmor(shared_ptr _spider, int layer, float a) +int SpiderRenderer::prepareArmor(std::shared_ptr _spider, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr spider = dynamic_pointer_cast(_spider); + std::shared_ptr spider = dynamic_pointer_cast(_spider); if (layer!=0) return -1; MemSect(31); @@ -52,10 +52,10 @@ int SpiderRenderer::prepareArmor(shared_ptr _spider, int layer, float a) return 1; } -void SpiderRenderer::scale(shared_ptr _mob, float a) +void SpiderRenderer::scale(std::shared_ptr _mob, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); float scale = mob->getModelScale(); glScalef(scale, scale, scale); } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.h index 3b937458b..7946ed467 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.h @@ -6,7 +6,7 @@ class SpiderRenderer : public MobRenderer public: SpiderRenderer(); protected: - virtual float getFlipDegrees(shared_ptr spider); - virtual int prepareArmor(shared_ptr _spider, int layer, float a); - void scale(shared_ptr _mob, float a); + virtual float getFlipDegrees(std::shared_ptr spider); + virtual int prepareArmor(std::shared_ptr _spider, int layer, float a); + void scale(std::shared_ptr _mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.cpp index 9083e7e41..81ec4b5f8 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.cpp @@ -6,15 +6,15 @@ SquidRenderer::SquidRenderer(Model *model, float shadow) : MobRenderer(model, sh { } -void SquidRenderer::render(shared_ptr mob, double x, double y, double z, float rot, float a) +void SquidRenderer::render(std::shared_ptr mob, double x, double y, double z, float rot, float a) { MobRenderer::render(mob, x, y, z, rot, a); } -void SquidRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRot, float a) +void SquidRenderer::setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); float bodyXRot = (mob->xBodyRotO + (mob->xBodyRot - mob->xBodyRotO) * a); float bodyZRot = (mob->zBodyRotO + (mob->zBodyRot - mob->zBodyRotO) * a); @@ -26,10 +26,10 @@ void SquidRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRo glTranslatef(0, -1.2f, 0); } -float SquidRenderer::getBob(shared_ptr _mob, float a) +float SquidRenderer::getBob(std::shared_ptr _mob, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); return mob->oldTentacleAngle + (mob->tentacleAngle - mob->oldTentacleAngle) * a; } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.h index ccc81944d..13270b5f1 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.h @@ -7,9 +7,9 @@ public: SquidRenderer(Model *model, float shadow); public: - virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); protected: - virtual void setupRotations(shared_ptr _mob, float bob, float bodyRot, float a); - virtual float getBob(shared_ptr _mob, float a); + virtual void setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a); + virtual float getBob(std::shared_ptr _mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.cpp index 24cafe83e..8877b9d77 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.cpp @@ -7,10 +7,10 @@ #include "../../../Minecraft.World/IO/Streams/FloatBuffer.h" #include "TheEndPortalRenderer.h" -void TheEndPortalRenderer::render(shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void TheEndPortalRenderer::render(std::shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J Convert as we aren't using a templated class - shared_ptr table = dynamic_pointer_cast(_table); + std::shared_ptr table = dynamic_pointer_cast(_table); float xx = (float) (tileEntityRenderDispatcher->xPlayer); float yy = (float) (tileEntityRenderDispatcher->yPlayer); float zz = (float) (tileEntityRenderDispatcher->zPlayer); diff --git a/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.h index 1e4ca546c..fe489275e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.h @@ -5,7 +5,7 @@ class TheEndPortalRenderer : public TileEntityRenderer { public: - virtual void render(shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); + virtual void render(std::shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); FloatBuffer *lb; diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp index a9ef50899..86032f2ea 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp @@ -80,18 +80,18 @@ TileEntityRenderer *TileEntityRenderDispatcher::getRenderer(eINSTANCEOF e) return it->second; } -bool TileEntityRenderDispatcher::hasRenderer(shared_ptr e) +bool TileEntityRenderDispatcher::hasRenderer(std::shared_ptr e) { return getRenderer(e) != NULL; } -TileEntityRenderer *TileEntityRenderDispatcher::getRenderer(shared_ptr e) +TileEntityRenderer *TileEntityRenderDispatcher::getRenderer(std::shared_ptr e) { if (e == NULL) return NULL; return getRenderer(e->GetType()); } -void TileEntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *font, shared_ptr player, float a) +void TileEntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *font, std::shared_ptr player, float a) { if( this->level != level ) { @@ -109,7 +109,7 @@ void TileEntityRenderDispatcher::prepare(Level *level, Textures *textures, Font zPlayer = player->zOld + (player->z - player->zOld) * a; } -void TileEntityRenderDispatcher::render(shared_ptr e, float a, bool setColor/*=true*/) +void TileEntityRenderDispatcher::render(std::shared_ptr e, float a, bool setColor/*=true*/) { if (e->distanceToSqr(xPlayer, yPlayer, zPlayer) < 64 * 64) { @@ -131,7 +131,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) +void TileEntityRenderDispatcher::render(std::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) diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.h b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.h index 993228948..f8412860e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.h @@ -25,7 +25,7 @@ public: Textures *textures; Level *level; - shared_ptr cameraEntity; + std::shared_ptr cameraEntity; float playerRotY; float playerRotX; double xPlayer, yPlayer, zPlayer; @@ -35,11 +35,11 @@ private: public: TileEntityRenderer *getRenderer(eINSTANCEOF e); - bool hasRenderer(shared_ptr e); - TileEntityRenderer * getRenderer(shared_ptr e); - void prepare(Level *level, Textures *textures, Font *font, shared_ptr player, float a); - void render(shared_ptr e, float a, bool setColor = true); - void render(shared_ptr entity, double x, double y, double z, float a, bool setColor = true, float alpha=1.0f, bool useCompiled = true); // 4J Added useCompiled + bool hasRenderer(std::shared_ptr e); + TileEntityRenderer * getRenderer(std::shared_ptr e); + void prepare(Level *level, Textures *textures, Font *font, std::shared_ptr player, float a); + void render(std::shared_ptr e, float a, bool setColor = true); + void render(std::shared_ptr entity, double x, double y, double z, float a, bool setColor = true, float alpha=1.0f, bool useCompiled = true); // 4J Added useCompiled void setLevel(Level *level); double distanceToSqr(double x, double y, double z); Font *getFont(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.h index 347d6fc46..7e01b4964 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.h @@ -10,7 +10,7 @@ class TileEntityRenderer protected: TileEntityRenderDispatcher *tileEntityRenderDispatcher; public: - virtual void render(shared_ptr entity, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) = 0; // 4J added setColor param and alpha and useCompiled + virtual void render(std::shared_ptr entity, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) = 0; // 4J added setColor param and alpha and useCompiled virtual void onNewLevel(Level *level) {} protected: void bindTexture(int resourceName); // 4J - changed from wstring to int diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.cpp index 64f126fda..4a908cae5 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.cpp @@ -244,7 +244,7 @@ void TileRenderer::tesselateInWorldFixedTexture( Tile* tile, int x, int y, int z } void TileRenderer::tesselateInWorldNoCulling( Tile* tile, int x, int y, int z, int forceData, - shared_ptr< TileEntity > forceEntity ) // 4J added forceData, forceEntity param + std::shared_ptr< TileEntity > forceEntity ) // 4J added forceData, forceEntity param { noCulling = true; tesselateInWorld( tile, x, y, z, forceData ); @@ -252,7 +252,7 @@ void TileRenderer::tesselateInWorldNoCulling( Tile* tile, int x, int y, int z, i } bool TileRenderer::tesselateInWorld( Tile* tt, int x, int y, int z, int forceData, - shared_ptr< TileEntity > forceEntity ) // 4J added forceData, forceEntity param + std::shared_ptr< TileEntity > forceEntity ) // 4J added forceData, forceEntity param { Tesselator* t = Tesselator::getInstance(); int shape = tt->getRenderShape(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h index 4045ece24..ec369939c 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h @@ -79,9 +79,9 @@ public: void tesselateInWorldFixedTexture( Tile* tile, int x, int y, int z, Icon *fixedTexture ); // 4J renamed to differentiate from tesselateInWorld void tesselateInWorldNoCulling( Tile* tile, int x, int y, int z, int forceData = -1, - shared_ptr< TileEntity > forceEntity = shared_ptr< TileEntity >() ); // 4J added forceData, forceEntity param - bool tesselateInWorld( Tile* tt, int x, int y, int z, int forceData = -1, shared_ptr< TileEntity > forceEntity = - shared_ptr< TileEntity >() ); // 4J added forceData, forceEntity param + std::shared_ptr< TileEntity > forceEntity = std::shared_ptr< TileEntity >() ); // 4J added forceData, forceEntity param + bool tesselateInWorld( Tile* tt, int x, int y, int z, int forceData = -1, std::shared_ptr< TileEntity > forceEntity = + std::shared_ptr< TileEntity >() ); // 4J added forceData, forceEntity param private: bool tesselateAirPortalFrameInWorld(TheEndPortalFrameTile *tt, int x, int y, int z); diff --git a/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.cpp index e78961e41..963d8af9f 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.cpp @@ -10,10 +10,10 @@ TntRenderer::TntRenderer() this->shadowRadius = 0.5f; } -void TntRenderer::render(shared_ptr _tnt, double x, double y, double z, float rot, float a) +void TntRenderer::render(std::shared_ptr _tnt, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr tnt = dynamic_pointer_cast(_tnt); + std::shared_ptr tnt = dynamic_pointer_cast(_tnt); glPushMatrix(); glTranslatef((float) x, (float) y, (float) z); diff --git a/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.h index 4d9c029cd..1f70c8dae 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.h @@ -8,5 +8,5 @@ private: public: TntRenderer(); - virtual void render(shared_ptr _tnt, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _tnt, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.cpp index 41f397c8f..23330c1e7 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.cpp @@ -15,16 +15,16 @@ int VillagerGolemRenderer::prepareArmor(VillagerGolemModel *villagerGolem, int l return -1; } -void VillagerGolemRenderer::render(shared_ptr mob, double x, double y, double z, float rot, float a) +void VillagerGolemRenderer::render(std::shared_ptr mob, double x, double y, double z, float rot, float a) { MobRenderer::render(mob, x, y, z, rot, a); } -void VillagerGolemRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRot, float a) +void VillagerGolemRenderer::setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a) { - // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Blaze rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); MobRenderer::setupRotations(mob, bob, bodyRot, a); if (mob->walkAnimSpeed < 0.01) return; @@ -34,11 +34,11 @@ void VillagerGolemRenderer::setupRotations(shared_ptr _mob, float bob, floa glRotatef(6.5f * triangleWave, 0, 0, 1); } -void VillagerGolemRenderer::additionalRendering(shared_ptr _mob, float a) +void VillagerGolemRenderer::additionalRendering(std::shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Blaze rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); MobRenderer::additionalRendering(mob, a); if (mob->getOfferFlowerTick() == 0) return; diff --git a/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.h index 4bc3fd9c9..185e38d4c 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.h @@ -16,9 +16,9 @@ protected: int prepareArmor(VillagerGolemModel *villagerGolem, int layer, float a); public: - void render(shared_ptr mob, double x, double y, double z, float rot, float a); + void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); protected: - void setupRotations(shared_ptr _mob, float bob, float bodyRot, float a); - void additionalRendering(shared_ptr mob, float a); + void setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a); + void additionalRendering(std::shared_ptr mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.cpp index a62994b31..6cace8f59 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.cpp @@ -8,30 +8,30 @@ VillagerRenderer::VillagerRenderer() : MobRenderer(new VillagerModel(0), 0.5f) villagerModel = (VillagerModel *) model; } -int VillagerRenderer::prepareArmor(shared_ptr villager, int layer, float a) +int VillagerRenderer::prepareArmor(std::shared_ptr villager, int layer, float a) { return -1; } -void VillagerRenderer::render(shared_ptr mob, double x, double y, double z, float rot, float a) +void VillagerRenderer::render(std::shared_ptr mob, double x, double y, double z, float rot, float a) { MobRenderer::render(mob, x, y, z, rot, a); } -void VillagerRenderer::renderName(shared_ptr mob, double x, double y, double z) +void VillagerRenderer::renderName(std::shared_ptr mob, double x, double y, double z) { } -void VillagerRenderer::additionalRendering(shared_ptr mob, float a) +void VillagerRenderer::additionalRendering(std::shared_ptr mob, float a) { MobRenderer::additionalRendering(mob, a); } -void VillagerRenderer::scale(shared_ptr _mob, float a) +void VillagerRenderer::scale(std::shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Blaze rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); float s = 15 / 16.0f; if (mob->getAge() < 0) { diff --git a/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.h index 21c2a6316..1263f4850 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.h @@ -13,13 +13,13 @@ public: VillagerRenderer(); protected: - virtual int prepareArmor(shared_ptr villager, int layer, float a); + virtual int prepareArmor(std::shared_ptr villager, int layer, float a); public: - virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); protected: - virtual void renderName(shared_ptr mob, double x, double y, double z); - virtual void additionalRendering(shared_ptr mob, float a); - virtual void scale(shared_ptr player, float a); + virtual void renderName(std::shared_ptr mob, double x, double y, double z); + virtual void additionalRendering(std::shared_ptr mob, float a); + virtual void scale(std::shared_ptr player, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.cpp index 9869bfdda..150c8698b 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.cpp @@ -8,19 +8,19 @@ WolfRenderer::WolfRenderer(Model *model, Model *armor, float shadow) : MobRender setArmor(armor); } -float WolfRenderer::getBob(shared_ptr _mob, float a) +float WolfRenderer::getBob(std::shared_ptr _mob, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); return mob->getTailAngle(); } -int WolfRenderer::prepareArmor(shared_ptr mob, int layer, float a) +int WolfRenderer::prepareArmor(std::shared_ptr mob, int layer, float a) { if (mob->isInvisibleTo(Minecraft::GetInstance()->player)) return -1; // 4J-JEV: Todo, merge with java fix in '1.7.5'. - shared_ptr wolf = dynamic_pointer_cast(mob); + std::shared_ptr wolf = dynamic_pointer_cast(mob); if (layer == 0 && wolf->isWet()) { float brightness = wolf->getBrightness(a) * wolf->getWetShade(a); diff --git a/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.h index 9cdf8caa3..218951c9e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.h @@ -6,6 +6,6 @@ class WolfRenderer : public MobRenderer public: WolfRenderer(Model *model, Model *armor, float shadow); protected: - virtual float getBob(shared_ptr _mob, float a); - virtual int prepareArmor(shared_ptr mob, int layer, float a); + virtual float getBob(std::shared_ptr _mob, float a); + virtual int prepareArmor(std::shared_ptr mob, int layer, float a); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.cpp index df65ae872..265b8acde 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.cpp @@ -34,28 +34,28 @@ void ZombieRenderer::createArmorParts() villagerArmorParts2 = new VillagerZombieModel(0.5f, 0, true); } -int ZombieRenderer::prepareArmor(shared_ptr _mob, int layer, float a) +int ZombieRenderer::prepareArmor(std::shared_ptr _mob, int layer, float a) { - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); swapArmor(mob); return HumanoidMobRenderer::prepareArmor(_mob, layer, a); } -void ZombieRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void ZombieRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); swapArmor(mob); HumanoidMobRenderer::render(_mob, x, y, z, rot, a); } -void ZombieRenderer::additionalRendering(shared_ptr _mob, float a) +void ZombieRenderer::additionalRendering(std::shared_ptr _mob, float a) { - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); swapArmor(mob); HumanoidMobRenderer::additionalRendering(_mob, a); } -void ZombieRenderer::swapArmor(shared_ptr mob) +void ZombieRenderer::swapArmor(std::shared_ptr mob) { if (mob->isVillager()) { @@ -80,9 +80,9 @@ void ZombieRenderer::swapArmor(shared_ptr mob) humanoidModel = (HumanoidModel *) model; } -void ZombieRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRot, float a) +void ZombieRenderer::setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a) { - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = dynamic_pointer_cast(_mob); if (mob->isConverting()) { bodyRot += (float) (cos(mob->tickCount * 3.25) * PI * .25f); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.h index e070cc7bb..b727659a6 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.h @@ -25,17 +25,17 @@ public: protected: void createArmorParts(); - int prepareArmor(shared_ptr _mob, int layer, float a); + int prepareArmor(std::shared_ptr _mob, int layer, float a); public: - void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - void additionalRendering(shared_ptr _mob, float a); + void additionalRendering(std::shared_ptr _mob, float a); private: - void swapArmor(shared_ptr mob); + void swapArmor(std::shared_ptr mob); protected: - void setupRotations(shared_ptr _mob, float bob, float bodyRot, float a); + void setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/GameRenderer.cpp b/Minecraft.Client/Rendering/GameRenderer.cpp index 6dcf16d98..d7663f48f 100644 --- a/Minecraft.Client/Rendering/GameRenderer.cpp +++ b/Minecraft.Client/Rendering/GameRenderer.cpp @@ -352,13 +352,13 @@ void GameRenderer::pick(float a) Vec3 *to = from->add(b->x * range, b->y * range, b->z * range); hovered = nullptr; float overlap = 1; - vector > *objects = mc->level->getEntities(mc->cameraTargetPlayer, mc->cameraTargetPlayer->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap)); + vector > *objects = mc->level->getEntities(mc->cameraTargetPlayer, mc->cameraTargetPlayer->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap)); double nearest = dist; AUTO_VAR(itEnd, objects->end()); for (AUTO_VAR(it, objects->begin()); it != itEnd; it++) { - shared_ptr e = *it; //objects->at(i); + std::shared_ptr e = *it; //objects->at(i); if (!e->isPickable()) continue; float rr = e->getPickRadius(); @@ -407,7 +407,7 @@ float GameRenderer::GetFovVal() void GameRenderer::tickFov() { - shared_ptrplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); + std::shared_ptrplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); int playerIdx = player ? player->GetXboxPad() : 0; tFov[playerIdx] = player->getFieldOfViewModifier(); @@ -420,7 +420,7 @@ float GameRenderer::getFov(float a, bool applyEffects) { if (cameraFlip > 0 ) return 90; - shared_ptr player = dynamic_pointer_cast(mc->cameraTargetPlayer); + std::shared_ptr player = dynamic_pointer_cast(mc->cameraTargetPlayer); int playerIdx = player ? player->GetXboxPad() : 0; float fov = m_fov;//70; if (applyEffects) @@ -444,7 +444,7 @@ float GameRenderer::getFov(float a, bool applyEffects) void GameRenderer::bobHurt(float a) { - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; float hurt = player->hurtTime - a; @@ -470,12 +470,12 @@ void GameRenderer::bobHurt(float a) void GameRenderer::bobView(float a) { - shared_ptr player = dynamic_pointer_cast(mc->cameraTargetPlayer); + std::shared_ptr player = dynamic_pointer_cast(mc->cameraTargetPlayer); if(player==NULL) { return; } - //shared_ptr player = dynamic_pointer_cast(mc->cameraTargetPlayer); + //std::shared_ptr player = dynamic_pointer_cast(mc->cameraTargetPlayer); float wda = player->walkDist - player->walkDistO; float b = -(player->walkDist + wda * a); @@ -489,8 +489,8 @@ void GameRenderer::bobView(float a) void GameRenderer::moveCameraToPlayer(float a) { - shared_ptr player = mc->cameraTargetPlayer; - shared_ptr localplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); + std::shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr localplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); float heightOffset = player->heightOffset - 1.62f; double x = player->xo + (player->x - player->xo) * a; @@ -719,12 +719,12 @@ void GameRenderer::renderItemInHand(float a, int eye) { if (cameraFlip > 0) return; - shared_ptr localplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); + std::shared_ptr localplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); // 4J-PB - to turn off the hand for screenshots, but not when the item held is a map if ( localplayer!=NULL) { - shared_ptr item = localplayer->inventory->getSelected(); + std::shared_ptr item = localplayer->inventory->getSelected(); if(!(item && item->getItem()->id==Item::map_Id) && app.GetGameSettings(localplayer->GetXboxPad(),eGameSetting_DisplayHand)==0 ) return; } @@ -869,7 +869,7 @@ void GameRenderer::updateLightTexture(float a) for(int j = 0; j < XUSER_MAX_COUNT; j++ ) { // Loop over all the players - shared_ptr player = Minecraft::GetInstance()->localplayers[j]; + std::shared_ptr player = Minecraft::GetInstance()->localplayers[j]; if (player == NULL) continue; Level *level = player->level; // 4J - was mc->level when it was just to update the one light texture @@ -974,7 +974,7 @@ void GameRenderer::updateLightTexture(float a) } } -float GameRenderer::getNightVisionScale(shared_ptr player, float a) +float GameRenderer::getNightVisionScale(std::shared_ptr player, float a) { int duration = player->getEffect(MobEffect::nightVision)->getDuration(); if (duration > (SharedConstants::TICKS_PER_SECOND * 10)) @@ -1275,7 +1275,7 @@ void GameRenderer::renderLevel(float a, __int64 until) } pick(a); - shared_ptr cameraEntity = mc->cameraTargetPlayer; + std::shared_ptr cameraEntity = mc->cameraTargetPlayer; LevelRenderer *levelRenderer = mc->levelRenderer; ParticleEngine *particleEngine = mc->particleEngine; double xOff = cameraEntity->xOld + (cameraEntity->x - cameraEntity->xOld) * a; @@ -1389,10 +1389,10 @@ void GameRenderer::renderLevel(float a, __int64 until) PIXEndNamedEvent(); turnOffLightLayer(a); // 4J - brought forward from 1.8.2 - shared_ptr player = dynamic_pointer_cast(cameraEntity); + std::shared_ptr player = dynamic_pointer_cast(cameraEntity); if (mc->hitResult != NULL && cameraEntity->isUnderLiquid(Material::water) && player!=NULL) //&& !mc->options.hideGui) { - //shared_ptr player = dynamic_pointer_cast(cameraEntity); + //std::shared_ptr player = dynamic_pointer_cast(cameraEntity); glDisable(GL_ALPHA_TEST); levelRenderer->renderHit(player, mc->hitResult, 0, player->inventory->getSelected(), a); levelRenderer->renderHitOutline(player, mc->hitResult, 0, player->inventory->getSelected(), a); @@ -1451,7 +1451,7 @@ void GameRenderer::renderLevel(float a, __int64 until) { if (mc->hitResult != NULL && !cameraEntity->isUnderLiquid(Material::water)) { - shared_ptr player = dynamic_pointer_cast(cameraEntity); + std::shared_ptr player = dynamic_pointer_cast(cameraEntity); glDisable(GL_ALPHA_TEST); levelRenderer->renderHit(player, mc->hitResult, 0, player->inventory->getSelected(), a); levelRenderer->renderHitOutline(player, mc->hitResult, 0, player->inventory->getSelected(), a); @@ -1518,7 +1518,7 @@ void GameRenderer::tickRain() rainLevel /= ( mc->levelRenderer->activePlayers() + 1 ); random->setSeed(_tick * 312987231l); - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; Level *level = mc->level; int x0 = Mth::floor(player->x); @@ -1555,7 +1555,7 @@ void GameRenderer::tickRain() { if (Tile::tiles[t]->material == Material::lava) { - mc->particleEngine->add( shared_ptr( new SmokeParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0) ) ); + mc->particleEngine->add( std::shared_ptr( new SmokeParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0) ) ); } else { @@ -1565,7 +1565,7 @@ void GameRenderer::tickRain() rainPosY = y + 0.1f - Tile::tiles[t]->getShapeY0(); rainPosZ = z + za; } - mc->particleEngine->add( shared_ptr( new WaterDropParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za) ) ); + mc->particleEngine->add( std::shared_ptr( new WaterDropParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za) ) ); } } } @@ -1618,7 +1618,7 @@ void GameRenderer::renderSnowAndRain(float a) } } - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; Level *level = mc->level; int x0 = Mth::floor(player->x); @@ -1802,7 +1802,7 @@ void GameRenderer::setupGuiScreen(int forceScale /*=-1*/) void GameRenderer::setupClearColor(float a) { Level *level = mc->level; - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; float whiteness = 1.0f / (4 - mc->options->viewDistance); whiteness = 1 - (float) pow((double)whiteness, 0.25); @@ -1959,7 +1959,7 @@ void GameRenderer::setupClearColor(float a) void GameRenderer::setupFog(int i, float alpha) { - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; // 4J - check for creative mode brought forward from 1.2.3 bool creative = false; diff --git a/Minecraft.Client/Rendering/GameRenderer.h b/Minecraft.Client/Rendering/GameRenderer.h index 6e38161ba..d575952b6 100644 --- a/Minecraft.Client/Rendering/GameRenderer.h +++ b/Minecraft.Client/Rendering/GameRenderer.h @@ -25,7 +25,7 @@ public: ItemInHandRenderer *itemInHandRenderer; private: int _tick; - shared_ptr hovered; + std::shared_ptr hovered; // smooth camera movement SmoothFloat smoothTurnX; @@ -108,7 +108,7 @@ public: private: void tickLightTexture(); void updateLightTexture(float a); - float getNightVisionScale(shared_ptr player, float a); + float getNightVisionScale(std::shared_ptr player, float a); public: void render(float a, bool bFirst); // 4J added bFirst void renderLevel(float a); diff --git a/Minecraft.Client/Rendering/LevelRenderer.cpp b/Minecraft.Client/Rendering/LevelRenderer.cpp index 18ac4c6f3..0db005a01 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.cpp +++ b/Minecraft.Client/Rendering/LevelRenderer.cpp @@ -475,7 +475,7 @@ void LevelRenderer::allChanged(int playerIndex) if (level != NULL) { - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; if (player != NULL) { this->resortChunks(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); @@ -509,7 +509,7 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a) renderedEntities = 0; culledEntities = 0; - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; EntityRenderDispatcher::xOff = (player->xOld + (player->x - player->xOld) * a); EntityRenderDispatcher::yOff = (player->yOld + (player->y - player->yOld) * a); @@ -520,13 +520,13 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a) mc->gameRenderer->turnOnLightLayer(a); // 4J - brought forward from 1.8.2 - vector > entities = level[playerIndex]->getAllEntities(); + vector > entities = level[playerIndex]->getAllEntities(); totalEntities = (int)entities.size(); AUTO_VAR(itEndGE, level[playerIndex]->globalEntities.end()); for (AUTO_VAR(it, level[playerIndex]->globalEntities.begin()); it != itEndGE; it++) { - shared_ptr entity = *it; //level->globalEntities[i]; + std::shared_ptr entity = *it; //level->globalEntities[i]; renderedEntities++; if (entity->shouldRender(cam)) EntityRenderDispatcher::instance->render(entity, a); } @@ -534,13 +534,13 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a) AUTO_VAR(itEndEnts, entities.end()); for (AUTO_VAR(it, entities.begin()); it != itEndEnts; it++) { - shared_ptr entity = *it; //entities[i]; + std::shared_ptr entity = *it; //entities[i]; if ((entity->shouldRender(cam) && (entity->noCulling || culler->isVisible(entity->bb)))) { // 4J-PB - changing this to be per player //if (entity == mc->cameraTargetPlayer && !mc->options->thirdPersonView && !mc->cameraTargetPlayer->isSleeping()) continue; - shared_ptr localplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); + std::shared_ptr localplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); if (localplayer && entity == mc->cameraTargetPlayer && !localplayer->ThirdPersonView() && !mc->cameraTargetPlayer->isSleeping()) continue; @@ -669,7 +669,7 @@ void LevelRenderer::resortChunks(int xc, int yc, int zc) LeaveCriticalSection(&m_csDirtyChunks); } -int LevelRenderer::render(shared_ptr player, int layer, double alpha, bool updateChunks) +int LevelRenderer::render(std::shared_ptr player, int layer, double alpha, bool updateChunks) { int playerIndex = mc->player->GetXboxPad(); @@ -741,7 +741,7 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) #if 1 // 4J - cut down version, we're not using offsetted render lists, or a sorted chunk list, anymore mc->gameRenderer->turnOnLightLayer(alpha); // 4J - brought forward from 1.8.2 - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; double xOff = player->xOld + (player->x - player->xOld) * alpha; double yOff = player->yOld + (player->y - player->yOld) * alpha; double zOff = player->zOld + (player->z - player->zOld) * alpha; @@ -864,7 +864,7 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) } } - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; double xOff = player->xOld + (player->x - player->xOld) * alpha; double yOff = player->yOld + (player->y - player->yOld) * alpha; double zOff = player->zOld + (player->z - player->zOld) * alpha; @@ -1919,8 +1919,8 @@ bool LevelRenderer::updateDirtyChunks() 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 - // 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]; + // So take a reference to the player object now. As it is a std::shared_ptr it should live as long as we need it + std::shared_ptr player = mc->localplayers[p]; if( player == NULL ) continue; if( chunks[p].data == NULL ) continue; if( level[p] == NULL ) continue; @@ -2171,7 +2171,7 @@ bool LevelRenderer::updateDirtyChunks() } -void LevelRenderer::renderHit(shared_ptr player, HitResult *h, int mode, shared_ptr inventoryItem, float a) +void LevelRenderer::renderHit(std::shared_ptr player, HitResult *h, int mode, std::shared_ptr inventoryItem, float a) { Tesselator *t = Tesselator::getInstance(); glEnable(GL_BLEND); @@ -2190,7 +2190,7 @@ void LevelRenderer::renderHit(shared_ptr player, HitResult *h, int mode, glDisable(GL_ALPHA_TEST); } -void LevelRenderer::renderDestroyAnimation(Tesselator *t, shared_ptr player, float a) +void LevelRenderer::renderDestroyAnimation(Tesselator *t, std::shared_ptr player, float a) { double xo = player->xOld + (player->x - player->xOld) * a; double yo = player->yOld + (player->y - player->yOld) * a; @@ -2256,7 +2256,7 @@ void LevelRenderer::renderDestroyAnimation(Tesselator *t, shared_ptr pla } } -void LevelRenderer::renderHitOutline(shared_ptr player, HitResult *h, int mode, shared_ptr inventoryItem, float a) +void LevelRenderer::renderHitOutline(std::shared_ptr player, HitResult *h, int mode, std::shared_ptr inventoryItem, float a) { if (mode == 0 && h->type == HitResult::TILE) @@ -2596,7 +2596,7 @@ void LevelRenderer::playSound(int iSound, double x, double y, double z, float vo } */ } -void LevelRenderer::playSound(shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist) +void LevelRenderer::playSound(std::shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist) { } @@ -2616,21 +2616,21 @@ if (xd * xd + yd * yd + zd * zd > particleDistance * particleDistance) return; int playerIndex = mc->player->GetXboxPad(); // 4J added -if (name== L"bubble") mc->particleEngine->add(shared_ptr( new BubbleParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"smoke") mc->particleEngine->add(shared_ptr( new SmokeParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"note") mc->particleEngine->add(shared_ptr( new NoteParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"portal") mc->particleEngine->add(shared_ptr( new PortalParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"explode") mc->particleEngine->add(shared_ptr( new ExplodeParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"flame") mc->particleEngine->add(shared_ptr( new FlameParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"lava") mc->particleEngine->add(shared_ptr( new LavaParticle(level[playerIndex], x, y, z) ) ); -else if (name== L"footstep") mc->particleEngine->add(shared_ptr( new FootstepParticle(textures, level[playerIndex], x, y, z) ) ); -else if (name== L"splash") mc->particleEngine->add(shared_ptr( new SplashParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"largesmoke") mc->particleEngine->add(shared_ptr( new SmokeParticle(level[playerIndex], x, y, z, xa, ya, za, 2.5f) ) ); -else if (name== L"reddust") mc->particleEngine->add(shared_ptr( new RedDustParticle(level[playerIndex], x, y, z, (float) xa, (float) ya, (float) za) ) ); -else if (name== L"snowballpoof") mc->particleEngine->add(shared_ptr( new BreakingItemParticle(level[playerIndex], x, y, z, Item::snowBall) ) ); -else if (name== L"snowshovel") mc->particleEngine->add(shared_ptr( new SnowShovelParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"slime") mc->particleEngine->add(shared_ptr( new BreakingItemParticle(level[playerIndex], x, y, z, Item::slimeBall)) ) ; -else if (name== L"heart") mc->particleEngine->add(shared_ptr( new HeartParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +if (name== L"bubble") mc->particleEngine->add(std::shared_ptr( new BubbleParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"smoke") mc->particleEngine->add(std::shared_ptr( new SmokeParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"note") mc->particleEngine->add(std::shared_ptr( new NoteParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"portal") mc->particleEngine->add(std::shared_ptr( new PortalParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"explode") mc->particleEngine->add(std::shared_ptr( new ExplodeParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"flame") mc->particleEngine->add(std::shared_ptr( new FlameParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"lava") mc->particleEngine->add(std::shared_ptr( new LavaParticle(level[playerIndex], x, y, z) ) ); +else if (name== L"footstep") mc->particleEngine->add(std::shared_ptr( new FootstepParticle(textures, level[playerIndex], x, y, z) ) ); +else if (name== L"splash") mc->particleEngine->add(std::shared_ptr( new SplashParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"largesmoke") mc->particleEngine->add(std::shared_ptr( new SmokeParticle(level[playerIndex], x, y, z, xa, ya, za, 2.5f) ) ); +else if (name== L"reddust") mc->particleEngine->add(std::shared_ptr( new RedDustParticle(level[playerIndex], x, y, z, (float) xa, (float) ya, (float) za) ) ); +else if (name== L"snowballpoof") mc->particleEngine->add(std::shared_ptr( new BreakingItemParticle(level[playerIndex], x, y, z, Item::snowBall) ) ); +else if (name== L"snowshovel") mc->particleEngine->add(std::shared_ptr( new SnowShovelParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"slime") mc->particleEngine->add(std::shared_ptr( new BreakingItemParticle(level[playerIndex], x, y, z, Item::slimeBall)) ) ; +else if (name== L"heart") mc->particleEngine->add(std::shared_ptr( new HeartParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); } */ @@ -2639,7 +2639,7 @@ void LevelRenderer::addParticle(ePARTICLE_TYPE eParticleType, double x, double y addParticleInternal( eParticleType, x, y, z, xa, ya, za ); } -shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticleType, double x, double y, double z, double xa, double ya, double za) +std::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) { @@ -2693,7 +2693,7 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle bool inRange = false; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - shared_ptr thisPlayer = mc->localplayers[i]; + std::shared_ptr thisPlayer = mc->localplayers[i]; if(thisPlayer != NULL && level[i] == lev) { xd = thisPlayer->x - x; @@ -2716,35 +2716,35 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle return nullptr; } - shared_ptr particle; + std::shared_ptr particle; switch(eParticleType) { case eParticleType_hugeexplosion: - particle = shared_ptr(new HugeExplosionSeedParticle(lev, x, y, z, xa, ya, za)); + particle = std::shared_ptr(new HugeExplosionSeedParticle(lev, x, y, z, xa, ya, za)); break; case eParticleType_largeexplode: - particle = shared_ptr(new HugeExplosionParticle(textures, lev, x, y, z, xa, ya, za)); + particle = std::shared_ptr(new HugeExplosionParticle(textures, lev, x, y, z, xa, ya, za)); break; case eParticleType_bubble: - particle = shared_ptr( new BubbleParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new BubbleParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_suspended: - particle = shared_ptr( new SuspendedParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SuspendedParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_depthsuspend: - particle = shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_townaura: - particle = shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_crit: { - shared_ptr critParticle2 = shared_ptr(new CritParticle2(lev, x, y, z, xa, ya, za)); + std::shared_ptr critParticle2 = std::shared_ptr(new CritParticle2(lev, x, y, z, xa, ya, za)); critParticle2->CritParticle2PostConstructor(); - particle = shared_ptr( critParticle2 ); + particle = std::shared_ptr( critParticle2 ); // request from 343 to set pink for the needler in the Halo Texture Pack // Set particle colour from colour-table. unsigned int cStart = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Particle_CritStart ); @@ -2768,15 +2768,15 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle break; case eParticleType_magicCrit: { - shared_ptr critParticle2 = shared_ptr(new CritParticle2(lev, x, y, z, xa, ya, za)); + std::shared_ptr critParticle2 = std::shared_ptr(new CritParticle2(lev, x, y, z, xa, ya, za)); critParticle2->CritParticle2PostConstructor(); - particle = shared_ptr(critParticle2); + particle = std::shared_ptr(critParticle2); particle->setColor(particle->getRedCol() * 0.3f, particle->getGreenCol() * 0.8f, particle->getBlueCol()); particle->setNextMiscAnimTex(); } break; case eParticleType_smoke: - particle = shared_ptr( new SmokeParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SmokeParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_endportal: // 4J - Added. { @@ -2786,94 +2786,94 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle unsigned int col = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Particle_EnderPortal ); tmp->setColor( ( (col>>16)&0xFF )/255.0f, ( (col>>8)&0xFF )/255.0, ( col&0xFF )/255.0 ); - particle = shared_ptr(tmp); + particle = std::shared_ptr(tmp); } break; case eParticleType_mobSpell: - particle = shared_ptr(new SpellParticle(lev, x, y, z, 0, 0, 0)); + particle = std::shared_ptr(new SpellParticle(lev, x, y, z, 0, 0, 0)); particle->setColor((float) xa, (float) ya, (float) za); break; case eParticleType_spell: - particle = shared_ptr( new SpellParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SpellParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_instantSpell: - particle = shared_ptr(new SpellParticle(lev, x, y, z, xa, ya, za)); + particle = std::shared_ptr(new SpellParticle(lev, x, y, z, xa, ya, za)); dynamic_pointer_cast(particle)->setBaseTex(9 * 16); break; case eParticleType_note: - particle = shared_ptr( new NoteParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new NoteParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_netherportal: - particle = shared_ptr( new NetherPortalParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new NetherPortalParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_ender: - particle = shared_ptr( new EnderParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new EnderParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_enchantmenttable: - particle = shared_ptr(new EchantmentTableParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr(new EchantmentTableParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_explode: - particle = shared_ptr( new ExplodeParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new ExplodeParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_flame: - particle = shared_ptr( new FlameParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new FlameParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_lava: - particle = shared_ptr( new LavaParticle(lev, x, y, z) ); + particle = std::shared_ptr( new LavaParticle(lev, x, y, z) ); break; case eParticleType_footstep: - particle = shared_ptr( new FootstepParticle(textures, lev, x, y, z) ); + particle = std::shared_ptr( new FootstepParticle(textures, lev, x, y, z) ); break; case eParticleType_splash: - particle = shared_ptr( new SplashParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SplashParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_largesmoke: - particle = shared_ptr( new SmokeParticle(lev, x, y, z, xa, ya, za, 2.5f) ); + particle = std::shared_ptr( new SmokeParticle(lev, x, y, z, xa, ya, za, 2.5f) ); break; case eParticleType_reddust: - particle = shared_ptr( new RedDustParticle(lev, x, y, z, (float) xa, (float) ya, (float) za) ); + particle = std::shared_ptr( new RedDustParticle(lev, x, y, z, (float) xa, (float) ya, (float) za) ); break; case eParticleType_snowballpoof: - particle = shared_ptr( new BreakingItemParticle(lev, x, y, z, Item::snowBall, textures) ); + particle = std::shared_ptr( new BreakingItemParticle(lev, x, y, z, Item::snowBall, textures) ); break; case eParticleType_dripWater: - particle = shared_ptr( new DripParticle(lev, x, y, z, Material::water) ); + particle = std::shared_ptr( new DripParticle(lev, x, y, z, Material::water) ); break; case eParticleType_dripLava: - particle = shared_ptr( new DripParticle(lev, x, y, z, Material::lava) ); + particle = std::shared_ptr( new DripParticle(lev, x, y, z, Material::lava) ); break; case eParticleType_snowshovel: - particle = shared_ptr( new SnowShovelParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SnowShovelParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_slime: - particle = shared_ptr( new BreakingItemParticle(lev, x, y, z, Item::slimeBall, textures)); + particle = std::shared_ptr( new BreakingItemParticle(lev, x, y, z, Item::slimeBall, textures)); break; case eParticleType_heart: - particle = shared_ptr( new HeartParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new HeartParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_angryVillager: - particle = shared_ptr( new HeartParticle(lev, x, y + 0.5f, z, xa, ya, za) ); + particle = std::shared_ptr( new HeartParticle(lev, x, y + 0.5f, z, xa, ya, za) ); particle->setMiscTex(1 + 16 * 5); particle->setColor(1, 1, 1); break; case eParticleType_happyVillager: - particle = shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); particle->setMiscTex(2 + 16 * 5); particle->setColor(1, 1, 1); break; case eParticleType_dragonbreath: - particle = shared_ptr( new DragonBreathParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new DragonBreathParticle(lev, x, y, z, xa, ya, za) ); break; default: if( ( eParticleType >= eParticleType_iconcrack_base ) && ( eParticleType <= eParticleType_iconcrack_last ) ) { int id = PARTICLE_CRACK_ID(eParticleType), data = PARTICLE_CRACK_DATA(eParticleType); - particle = shared_ptr(new BreakingItemParticle(lev, x, y, z, xa, ya, za, Item::items[id], textures, data)); + particle = std::shared_ptr(new BreakingItemParticle(lev, x, y, z, xa, ya, za, Item::items[id], textures, data)); } else if( ( eParticleType >= eParticleType_tilecrack_base ) && ( eParticleType <= eParticleType_tilecrack_last ) ) { int id = PARTICLE_CRACK_ID(eParticleType), data = PARTICLE_CRACK_DATA(eParticleType); - particle = dynamic_pointer_cast( shared_ptr(new TerrainParticle(lev, x, y, z, xa, ya, za, Tile::tiles[id], 0, data, textures))->init(data) ); + particle = dynamic_pointer_cast( std::shared_ptr(new TerrainParticle(lev, x, y, z, xa, ya, za, Tile::tiles[id], 0, data, textures))->init(data) ); } } @@ -2885,7 +2885,7 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle return particle; } -void LevelRenderer::entityAdded(shared_ptr entity) +void LevelRenderer::entityAdded(std::shared_ptr entity) { entity->prepareCustomTextures(); // 4J - these empty string comparisons used to check for NULL references, but we don't have string pointers (currently) in entities, @@ -2909,7 +2909,7 @@ void LevelRenderer::entityAdded(shared_ptr entity) } -void LevelRenderer::entityRemoved(shared_ptr entity) +void LevelRenderer::entityRemoved(std::shared_ptr entity) { /* 4J - removed temp if (entity->customTextureUrl != L"") textures->removeHttpTexture(entity->customTextureUrl); @@ -2946,7 +2946,7 @@ void LevelRenderer::clear() MemoryTracker::releaseLists(chunkLists); } -void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y, int z, int data) +void LevelRenderer::levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data) { int playerIndex = mc->player->GetXboxPad(); // 4J added Random *random = level[playerIndex]->random; @@ -3058,7 +3058,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y double ys = 0.01 + random->nextDouble() * 0.5; double zs = sin(angle) * dist; - shared_ptr spellParticle = addParticleInternal(particleName, xp + xs * 0.1, yp + 0.3, zp + zs * 0.1, xs, ys, zs); + std::shared_ptr spellParticle = addParticleInternal(particleName, xp + xs * 0.1, yp + 0.3, zp + zs * 0.1, xs, ys, zs); if (spellParticle != NULL) { float randBrightness = 0.75f + random->nextFloat() * 0.25f; @@ -3085,7 +3085,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y double ys = 0.01 + random->nextDouble() * 0.5; double zs = sin(angle) * dist; - shared_ptr acidParticle = addParticleInternal(particleName, xp + xs * 0.1, yp + 0.3, zp + zs * 0.1, xs, ys, zs); + std::shared_ptr acidParticle = addParticleInternal(particleName, xp + xs * 0.1, yp + 0.3, zp + zs * 0.1, xs, ys, zs); if (acidParticle != NULL) { float randBrightness = 0.75f + random->nextFloat() * 0.25f; diff --git a/Minecraft.Client/Rendering/LevelRenderer.h b/Minecraft.Client/Rendering/LevelRenderer.h index 6e7cf6ed5..780e13b7a 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.h +++ b/Minecraft.Client/Rendering/LevelRenderer.h @@ -73,7 +73,7 @@ public: private: void resortChunks(int xc, int yc, int zc); public: - int render(shared_ptr player, int layer, double alpha, bool updateChunks); + int render(std::shared_ptr player, int layer, double alpha, bool updateChunks); private: int renderChunks(int from, int to, int layer, double alpha); public: @@ -89,9 +89,9 @@ public: bool updateDirtyChunks(); public: - void renderHit(shared_ptr player, HitResult *h, int mode, shared_ptr inventoryItem, float a); - void renderDestroyAnimation(Tesselator *t, shared_ptr player, float a); - void renderHitOutline(shared_ptr player, HitResult *h, int mode, shared_ptr inventoryItem, float a); + void renderHit(std::shared_ptr player, HitResult *h, int mode, std::shared_ptr inventoryItem, float a); + void renderDestroyAnimation(Tesselator *t, std::shared_ptr player, float a); + void renderHitOutline(std::shared_ptr player, HitResult *h, int mode, std::shared_ptr inventoryItem, float a); void render(AABB *b); void setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Level *level); // 4J - added level param void tileChanged(int x, int y, int z); @@ -108,26 +108,26 @@ public: void cull(Culler *culler, float a); void playStreamingMusic(const wstring& name, int x, int y, int z); void playSound(int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f); - void playSound(shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f); + void playSound(std::shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f); void addParticle(ePARTICLE_TYPE eParticleType, double x, double y, double z, double xa, double ya, double za); // 4J added - shared_ptr addParticleInternal(ePARTICLE_TYPE eParticleType, double x, double y, double z, double xa, double ya, double za); // 4J added - void entityAdded(shared_ptr entity); - void entityRemoved(shared_ptr entity); - void playerRemoved(shared_ptr entity) {} // 4J added - for when a player is removed from the level's player array, not just the entity storage + std::shared_ptr addParticleInternal(ePARTICLE_TYPE eParticleType, double x, double y, double z, double xa, double ya, double za); // 4J added + void entityAdded(std::shared_ptr entity); + void entityRemoved(std::shared_ptr entity); + void playerRemoved(std::shared_ptr entity) {} // 4J added - for when a player is removed from the level's player array, not just the entity storage void skyColorChanged(); void clear(); - void levelEvent(shared_ptr source, int type, int x, int y, int z, int data); + void levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data); void destroyTileProgress(int id, int x, int y, int z, int progress); void registerTextures(IconRegister *iconRegister); - typedef unordered_map >, IntKeyHash, IntKeyEq> rteMap; + typedef unordered_map >, IntKeyHash, IntKeyEq> rteMap; private: // debug int m_freezeticks; // used to freeze the clouds // 4J - this block of declarations was scattered round the code but have gathered everything into one place - rteMap renderableTileEntities; // 4J - changed - was vector, now hashed by chunk so we can find them + rteMap renderableTileEntities; // 4J - changed - was vector, now hashed by chunk so we can find them CRITICAL_SECTION m_csRenderableTileEntities; MultiPlayerLevel *level[4]; // 4J - now one per player Textures *textures; diff --git a/Minecraft.Client/Rendering/Minimap.cpp b/Minecraft.Client/Rendering/Minimap.cpp index ce287b40a..a4da8ca19 100644 --- a/Minecraft.Client/Rendering/Minimap.cpp +++ b/Minecraft.Client/Rendering/Minimap.cpp @@ -98,7 +98,7 @@ void Minimap::reloadColours() } // 4J added entityId -void Minimap::render(shared_ptr player, Textures *textures, shared_ptr data, int entityId) +void Minimap::render(std::shared_ptr player, Textures *textures, std::shared_ptr data, int entityId) { // 4J - only update every 8 renders, as an optimisation // We don't want to use this for ItemFrame renders of maps, as then we can't have different maps together diff --git a/Minecraft.Client/Rendering/Minimap.h b/Minecraft.Client/Rendering/Minimap.h index 931e5e562..2743f03d5 100644 --- a/Minecraft.Client/Rendering/Minimap.h +++ b/Minecraft.Client/Rendering/Minimap.h @@ -31,5 +31,5 @@ private: public: Minimap(Font *font, Options *options, Textures *textures, bool optimised = true); // 4J Added optimised param static void reloadColours(); - void render(shared_ptr player, Textures *textures, shared_ptr data, int entityId); // 4J added entityId param + void render(std::shared_ptr player, Textures *textures, std::shared_ptr data, int entityId); // 4J added entityId param }; diff --git a/Minecraft.Client/Rendering/Models/BlazeModel.cpp b/Minecraft.Client/Rendering/Models/BlazeModel.cpp index 497ae6d15..09dfbebaf 100644 --- a/Minecraft.Client/Rendering/Models/BlazeModel.cpp +++ b/Minecraft.Client/Rendering/Models/BlazeModel.cpp @@ -30,7 +30,7 @@ int BlazeModel::modelVersion() return 8; } -void BlazeModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void BlazeModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/BlazeModel.h b/Minecraft.Client/Rendering/Models/BlazeModel.h index 27ee20602..9e702ecb4 100644 --- a/Minecraft.Client/Rendering/Models/BlazeModel.h +++ b/Minecraft.Client/Rendering/Models/BlazeModel.h @@ -11,6 +11,6 @@ private: public: BlazeModel(); int modelVersion(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; diff --git a/Minecraft.Client/Rendering/Models/BoatModel.cpp b/Minecraft.Client/Rendering/Models/BoatModel.cpp index 16a81cd65..bd39f0f8d 100644 --- a/Minecraft.Client/Rendering/Models/BoatModel.cpp +++ b/Minecraft.Client/Rendering/Models/BoatModel.cpp @@ -42,7 +42,7 @@ BoatModel::BoatModel() : Model() cubes[4]->compile(1.0f/16.0f); } -void BoatModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void BoatModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { for (int i = 0; i < 5; i++) { diff --git a/Minecraft.Client/Rendering/Models/BoatModel.h b/Minecraft.Client/Rendering/Models/BoatModel.h index 4298b6437..192e140f3 100644 --- a/Minecraft.Client/Rendering/Models/BoatModel.h +++ b/Minecraft.Client/Rendering/Models/BoatModel.h @@ -7,5 +7,5 @@ class BoatModel : public Model public: ModelPart *cubes[5]; BoatModel(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/BookModel.cpp b/Minecraft.Client/Rendering/Models/BookModel.cpp index fea92b26a..a10f42ec4 100644 --- a/Minecraft.Client/Rendering/Models/BookModel.cpp +++ b/Minecraft.Client/Rendering/Models/BookModel.cpp @@ -33,7 +33,7 @@ BookModel::BookModel() } -void BookModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void BookModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/BookModel.h b/Minecraft.Client/Rendering/Models/BookModel.h index 8b367a34a..411d2df55 100644 --- a/Minecraft.Client/Rendering/Models/BookModel.h +++ b/Minecraft.Client/Rendering/Models/BookModel.h @@ -11,6 +11,6 @@ public: ModelPart *seam; BookModel(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; diff --git a/Minecraft.Client/Rendering/Models/ChickenModel.cpp b/Minecraft.Client/Rendering/Models/ChickenModel.cpp index 2abfee485..93ecc5d28 100644 --- a/Minecraft.Client/Rendering/Models/ChickenModel.cpp +++ b/Minecraft.Client/Rendering/Models/ChickenModel.cpp @@ -49,7 +49,7 @@ ChickenModel::ChickenModel() : Model() wing1->compile(1.0f/16.0f); } -void ChickenModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void ChickenModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); if (young) diff --git a/Minecraft.Client/Rendering/Models/ChickenModel.h b/Minecraft.Client/Rendering/Models/ChickenModel.h index 18b9dd335..7ef7e99b4 100644 --- a/Minecraft.Client/Rendering/Models/ChickenModel.h +++ b/Minecraft.Client/Rendering/Models/ChickenModel.h @@ -7,6 +7,6 @@ public: ModelPart *head, *hair, *body, *leg0, *leg1, *wing0,* wing1, *beak, *redThing; ChickenModel(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; diff --git a/Minecraft.Client/Rendering/Models/CowModel.h b/Minecraft.Client/Rendering/Models/CowModel.h index 617bb94f3..dcd7671c6 100644 --- a/Minecraft.Client/Rendering/Models/CowModel.h +++ b/Minecraft.Client/Rendering/Models/CowModel.h @@ -5,6 +5,6 @@ class CowModel : public QuadrupedModel { public: CowModel(); -// virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); +// virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); // virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale); }; diff --git a/Minecraft.Client/Rendering/Models/CreeperModel.cpp b/Minecraft.Client/Rendering/Models/CreeperModel.cpp index 8e0f9a388..5af5bb088 100644 --- a/Minecraft.Client/Rendering/Models/CreeperModel.cpp +++ b/Minecraft.Client/Rendering/Models/CreeperModel.cpp @@ -56,7 +56,7 @@ CreeperModel::CreeperModel(float g) : Model() _init(g); } -void CreeperModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void CreeperModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/CreeperModel.h b/Minecraft.Client/Rendering/Models/CreeperModel.h index 06231d0ea..0c4e9448e 100644 --- a/Minecraft.Client/Rendering/Models/CreeperModel.h +++ b/Minecraft.Client/Rendering/Models/CreeperModel.h @@ -9,6 +9,6 @@ public: void _init(float g); // 4J added CreeperModel(); CreeperModel(float g); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/DragonModel.cpp b/Minecraft.Client/Rendering/Models/DragonModel.cpp index 944a61f5e..63887a15f 100644 --- a/Minecraft.Client/Rendering/Models/DragonModel.cpp +++ b/Minecraft.Client/Rendering/Models/DragonModel.cpp @@ -106,15 +106,15 @@ DragonModel::DragonModel(float g) : Model() rearFoot->compile(1.0f/16.0f); } -void DragonModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void DragonModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { this->a = a; } -void DragonModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void DragonModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { glPushMatrix(); - shared_ptr dragon = dynamic_pointer_cast(entity); + std::shared_ptr dragon = dynamic_pointer_cast(entity); float ttt = dragon->oFlapTime + (dragon->flapTime - dragon->oFlapTime) * a; jaw->xRot = (float) (Mth::sin(ttt * PI * 2) + 1) * 0.2f; diff --git a/Minecraft.Client/Rendering/Models/DragonModel.h b/Minecraft.Client/Rendering/Models/DragonModel.h index 47c20cba3..baee83dec 100644 --- a/Minecraft.Client/Rendering/Models/DragonModel.h +++ b/Minecraft.Client/Rendering/Models/DragonModel.h @@ -26,8 +26,8 @@ public: ModelPart *cubes[5]; DragonModel(float g); - void prepareMobModel(shared_ptr mob, float time, float r, float a); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void prepareMobModel(std::shared_ptr mob, float time, float r, float a); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); private: float rotWrap(double d); diff --git a/Minecraft.Client/Rendering/Models/EnderCrystalModel.cpp b/Minecraft.Client/Rendering/Models/EnderCrystalModel.cpp index 10769f279..9eb7f1e07 100644 --- a/Minecraft.Client/Rendering/Models/EnderCrystalModel.cpp +++ b/Minecraft.Client/Rendering/Models/EnderCrystalModel.cpp @@ -21,7 +21,7 @@ EnderCrystalModel::EnderCrystalModel(float g) } -void EnderCrystalModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void EnderCrystalModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { glPushMatrix(); glScalef(2, 2, 2); diff --git a/Minecraft.Client/Rendering/Models/EnderCrystalModel.h b/Minecraft.Client/Rendering/Models/EnderCrystalModel.h index 71f1db106..42ae1b3d1 100644 --- a/Minecraft.Client/Rendering/Models/EnderCrystalModel.h +++ b/Minecraft.Client/Rendering/Models/EnderCrystalModel.h @@ -14,5 +14,5 @@ private: public: EnderCrystalModel(float g); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/GhastModel.cpp b/Minecraft.Client/Rendering/Models/GhastModel.cpp index 2b4fad1e6..388cac7f3 100644 --- a/Minecraft.Client/Rendering/Models/GhastModel.cpp +++ b/Minecraft.Client/Rendering/Models/GhastModel.cpp @@ -42,7 +42,7 @@ void GhastModel::setupAnim(float time, float r, float bob, float yRot, float xRo } } -void GhastModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void GhastModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/GhastModel.h b/Minecraft.Client/Rendering/Models/GhastModel.h index 22e9023c7..59ce7b7df 100644 --- a/Minecraft.Client/Rendering/Models/GhastModel.h +++ b/Minecraft.Client/Rendering/Models/GhastModel.h @@ -10,5 +10,5 @@ public: GhastModel(); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/HumanoidModel.cpp b/Minecraft.Client/Rendering/Models/HumanoidModel.cpp index 94b0f022d..2fcf1c7e8 100644 --- a/Minecraft.Client/Rendering/Models/HumanoidModel.cpp +++ b/Minecraft.Client/Rendering/Models/HumanoidModel.cpp @@ -140,7 +140,7 @@ HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight _init(g,yOffset,texWidth,texHeight); } -void HumanoidModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void HumanoidModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { if(entity!=NULL) { diff --git a/Minecraft.Client/Rendering/Models/HumanoidModel.h b/Minecraft.Client/Rendering/Models/HumanoidModel.h index 0ca10f4bf..2f9fcff57 100644 --- a/Minecraft.Client/Rendering/Models/HumanoidModel.h +++ b/Minecraft.Client/Rendering/Models/HumanoidModel.h @@ -53,7 +53,7 @@ public: HumanoidModel(); HumanoidModel(float g); HumanoidModel(float g, float yOffset, int texWidth, int texHeight); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); void renderHair(float scale, bool usecompiled); void renderEars(float scale, bool usecompiled); diff --git a/Minecraft.Client/Rendering/Models/LavaSlimeModel.cpp b/Minecraft.Client/Rendering/Models/LavaSlimeModel.cpp index 1d37a5303..1407325cf 100644 --- a/Minecraft.Client/Rendering/Models/LavaSlimeModel.cpp +++ b/Minecraft.Client/Rendering/Models/LavaSlimeModel.cpp @@ -41,9 +41,9 @@ int LavaSlimeModel::getModelVersion() return 5; } -void LavaSlimeModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void LavaSlimeModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { - shared_ptr lavaSlime = dynamic_pointer_cast(mob); + std::shared_ptr lavaSlime = dynamic_pointer_cast(mob); float slimeSquish = (lavaSlime->oSquish + (lavaSlime->squish - lavaSlime->oSquish) * a); if (slimeSquish < 0) @@ -57,7 +57,7 @@ void LavaSlimeModel::prepareMobModel(shared_ptr mob, float time, float r, f } } -void LavaSlimeModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void LavaSlimeModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/LavaSlimeModel.h b/Minecraft.Client/Rendering/Models/LavaSlimeModel.h index 44bd1663a..4fcce75de 100644 --- a/Minecraft.Client/Rendering/Models/LavaSlimeModel.h +++ b/Minecraft.Client/Rendering/Models/LavaSlimeModel.h @@ -10,6 +10,6 @@ class LavaSlimeModel : public Model public: LavaSlimeModel(); int getModelVersion(); - virtual void prepareMobModel(shared_ptr mob, float time, float r, float a); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void prepareMobModel(std::shared_ptr mob, float time, float r, float a); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; diff --git a/Minecraft.Client/Rendering/Models/MinecartModel.cpp b/Minecraft.Client/Rendering/Models/MinecartModel.cpp index b189d61dd..4cabfb418 100644 --- a/Minecraft.Client/Rendering/Models/MinecartModel.cpp +++ b/Minecraft.Client/Rendering/Models/MinecartModel.cpp @@ -47,7 +47,7 @@ MinecartModel::MinecartModel() : Model() } } -void MinecartModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void MinecartModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { cubes[5]->y = 4 - bob; for (int i = 0; i < MINECART_LENGTH; i++) diff --git a/Minecraft.Client/Rendering/Models/MinecartModel.h b/Minecraft.Client/Rendering/Models/MinecartModel.h index de925566c..2cf6d0efb 100644 --- a/Minecraft.Client/Rendering/Models/MinecartModel.h +++ b/Minecraft.Client/Rendering/Models/MinecartModel.h @@ -9,5 +9,5 @@ public: ModelPart *cubes[MINECART_LENGTH]; MinecartModel(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; diff --git a/Minecraft.Client/Rendering/Models/Model.h b/Minecraft.Client/Rendering/Models/Model.h index fdcf096d7..2762d9124 100644 --- a/Minecraft.Client/Rendering/Models/Model.h +++ b/Minecraft.Client/Rendering/Models/Model.h @@ -19,9 +19,9 @@ public: int texHeight; Model(); // 4J added - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) {} + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) {} virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0) {} - virtual void prepareMobModel(shared_ptr mob, float time, float r, float a) {} + virtual void prepareMobModel(std::shared_ptr mob, float time, float r, float a) {} virtual ModelPart *getRandomCube(Random random) {return cubes.at(random.nextInt((int)cubes.size()));} virtual ModelPart * AddOrRetrievePart(SKIN_BOX *pBox) { return NULL;} diff --git a/Minecraft.Client/Rendering/Models/OcelotModel.cpp b/Minecraft.Client/Rendering/Models/OcelotModel.cpp index 1102b7b33..a58647540 100644 --- a/Minecraft.Client/Rendering/Models/OcelotModel.cpp +++ b/Minecraft.Client/Rendering/Models/OcelotModel.cpp @@ -78,7 +78,7 @@ OzelotModel::OzelotModel() backLegR->compile(1.0f/16.0f); } -void OzelotModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void OzelotModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); if (young) @@ -180,9 +180,9 @@ void OzelotModel::setupAnim(float time, float r, float bob, float yRot, float xR } } -void OzelotModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void OzelotModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { - shared_ptr ozelot = dynamic_pointer_cast(mob); + std::shared_ptr ozelot = dynamic_pointer_cast(mob); body->y = bodyWalkY; body->z = bodyWalkZ; diff --git a/Minecraft.Client/Rendering/Models/OcelotModel.h b/Minecraft.Client/Rendering/Models/OcelotModel.h index 2c08f3dfb..cdccc8fe8 100644 --- a/Minecraft.Client/Rendering/Models/OcelotModel.h +++ b/Minecraft.Client/Rendering/Models/OcelotModel.h @@ -36,8 +36,8 @@ private: public: OzelotModel(); - void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); void render(OzelotModel *model, float scale, bool usecompiled); void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); - void prepareMobModel(shared_ptr mob, float time, float r, float a); + void prepareMobModel(std::shared_ptr mob, float time, float r, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/QuadrupedModel.cpp b/Minecraft.Client/Rendering/Models/QuadrupedModel.cpp index 093cdf735..9a13a11aa 100644 --- a/Minecraft.Client/Rendering/Models/QuadrupedModel.cpp +++ b/Minecraft.Client/Rendering/Models/QuadrupedModel.cpp @@ -41,7 +41,7 @@ QuadrupedModel::QuadrupedModel(int legSize, float g) : Model() leg3->compile(1.0f/16.0f); } -void QuadrupedModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void QuadrupedModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/QuadrupedModel.h b/Minecraft.Client/Rendering/Models/QuadrupedModel.h index 47c50599f..d1c24de78 100644 --- a/Minecraft.Client/Rendering/Models/QuadrupedModel.h +++ b/Minecraft.Client/Rendering/Models/QuadrupedModel.h @@ -7,7 +7,7 @@ public: ModelPart *head, *body, *leg0, *leg1, *leg2, *leg3; QuadrupedModel(int legSize, float g); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); void render(QuadrupedModel *model, float scale, bool usecompiled); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SheepFurModel.cpp b/Minecraft.Client/Rendering/Models/SheepFurModel.cpp index 2b85fa7cf..4bc4e935b 100644 --- a/Minecraft.Client/Rendering/Models/SheepFurModel.cpp +++ b/Minecraft.Client/Rendering/Models/SheepFurModel.cpp @@ -41,11 +41,11 @@ SheepFurModel::SheepFurModel() : QuadrupedModel(12, 0) leg3->compile(1.0f/16.0f); } -void SheepFurModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void SheepFurModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { QuadrupedModel::prepareMobModel(mob, time, r, a); - shared_ptr sheep = dynamic_pointer_cast(mob); + std::shared_ptr sheep = dynamic_pointer_cast(mob); head->y = 6 + sheep->getHeadEatPositionScale(a) * 9.0f; headXRot = sheep->getHeadEatAngleScale(a); } diff --git a/Minecraft.Client/Rendering/Models/SheepFurModel.h b/Minecraft.Client/Rendering/Models/SheepFurModel.h index c614765eb..65bb913ed 100644 --- a/Minecraft.Client/Rendering/Models/SheepFurModel.h +++ b/Minecraft.Client/Rendering/Models/SheepFurModel.h @@ -8,6 +8,6 @@ private: public: SheepFurModel(); - virtual void prepareMobModel(shared_ptr mob, float time, float r, float a); + virtual void prepareMobModel(std::shared_ptr mob, float time, float r, float a); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SheepModel.cpp b/Minecraft.Client/Rendering/Models/SheepModel.cpp index 21af40739..3c1af09a0 100644 --- a/Minecraft.Client/Rendering/Models/SheepModel.cpp +++ b/Minecraft.Client/Rendering/Models/SheepModel.cpp @@ -20,11 +20,11 @@ SheepModel::SheepModel() : QuadrupedModel(12, 0) body->compile(1.0f/16.0f); } -void SheepModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void SheepModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { QuadrupedModel::prepareMobModel(mob, time, r, a); - shared_ptr sheep = dynamic_pointer_cast(mob); + std::shared_ptr sheep = dynamic_pointer_cast(mob); head->y = 6 + sheep->getHeadEatPositionScale(a) * 9.0f; headXRot = sheep->getHeadEatAngleScale(a); } diff --git a/Minecraft.Client/Rendering/Models/SheepModel.h b/Minecraft.Client/Rendering/Models/SheepModel.h index d4136c25c..78c3b7c8b 100644 --- a/Minecraft.Client/Rendering/Models/SheepModel.h +++ b/Minecraft.Client/Rendering/Models/SheepModel.h @@ -8,6 +8,6 @@ private: public: SheepModel(); - virtual void prepareMobModel(shared_ptr mob, float time, float r, float a); + virtual void prepareMobModel(std::shared_ptr mob, float time, float r, float a); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SilverfishModel.cpp b/Minecraft.Client/Rendering/Models/SilverfishModel.cpp index 06b4d3820..e5031a695 100644 --- a/Minecraft.Client/Rendering/Models/SilverfishModel.cpp +++ b/Minecraft.Client/Rendering/Models/SilverfishModel.cpp @@ -82,7 +82,7 @@ int SilverfishModel::modelVersion() return 38; } -void SilverfishModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void SilverfishModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/SilverfishModel.h b/Minecraft.Client/Rendering/Models/SilverfishModel.h index d6be30590..4ce0e16ee 100644 --- a/Minecraft.Client/Rendering/Models/SilverfishModel.h +++ b/Minecraft.Client/Rendering/Models/SilverfishModel.h @@ -21,6 +21,6 @@ public: SilverfishModel(); int modelVersion(); - void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SkeletonHeadModel.cpp b/Minecraft.Client/Rendering/Models/SkeletonHeadModel.cpp index 3c9733b6a..e2598e809 100644 --- a/Minecraft.Client/Rendering/Models/SkeletonHeadModel.cpp +++ b/Minecraft.Client/Rendering/Models/SkeletonHeadModel.cpp @@ -27,7 +27,7 @@ SkeletonHeadModel::SkeletonHeadModel(int u, int v, int tw, int th) _init(u,v,tw,th); } -void SkeletonHeadModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void SkeletonHeadModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/SkeletonHeadModel.h b/Minecraft.Client/Rendering/Models/SkeletonHeadModel.h index 6f136c46a..aa045571e 100644 --- a/Minecraft.Client/Rendering/Models/SkeletonHeadModel.h +++ b/Minecraft.Client/Rendering/Models/SkeletonHeadModel.h @@ -14,6 +14,6 @@ public: SkeletonHeadModel(); SkeletonHeadModel(int u, int v, int tw, int th); - void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SlimeModel.cpp b/Minecraft.Client/Rendering/Models/SlimeModel.cpp index 32871d41e..523f9874c 100644 --- a/Minecraft.Client/Rendering/Models/SlimeModel.cpp +++ b/Minecraft.Client/Rendering/Models/SlimeModel.cpp @@ -34,7 +34,7 @@ SlimeModel::SlimeModel(int vOffs) cube->compile(1.0f/16.0f); } -void SlimeModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void SlimeModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/SlimeModel.h b/Minecraft.Client/Rendering/Models/SlimeModel.h index 9eee5eb1d..fe2a4fc2b 100644 --- a/Minecraft.Client/Rendering/Models/SlimeModel.h +++ b/Minecraft.Client/Rendering/Models/SlimeModel.h @@ -9,5 +9,5 @@ public: SlimeModel(int vOffs); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SnowManModel.cpp b/Minecraft.Client/Rendering/Models/SnowManModel.cpp index 10f69b70a..2923f23e9 100644 --- a/Minecraft.Client/Rendering/Models/SnowManModel.cpp +++ b/Minecraft.Client/Rendering/Models/SnowManModel.cpp @@ -58,7 +58,7 @@ void SnowManModel::setupAnim(float time, float r, float bob, float yRot, float x arm2->z = (s) * 5; } -void SnowManModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void SnowManModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/SnowManModel.h b/Minecraft.Client/Rendering/Models/SnowManModel.h index eb31e5036..b2d8229ac 100644 --- a/Minecraft.Client/Rendering/Models/SnowManModel.h +++ b/Minecraft.Client/Rendering/Models/SnowManModel.h @@ -9,5 +9,5 @@ public: SnowManModel() ; virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); - void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; diff --git a/Minecraft.Client/Rendering/Models/SpiderModel.cpp b/Minecraft.Client/Rendering/Models/SpiderModel.cpp index 3efc0cc5d..7ceec04df 100644 --- a/Minecraft.Client/Rendering/Models/SpiderModel.cpp +++ b/Minecraft.Client/Rendering/Models/SpiderModel.cpp @@ -68,7 +68,7 @@ SpiderModel::SpiderModel() : Model() leg7->compile(1.0f/16.0f); } -void SpiderModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void SpiderModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/SpiderModel.h b/Minecraft.Client/Rendering/Models/SpiderModel.h index 616669836..2d9d15273 100644 --- a/Minecraft.Client/Rendering/Models/SpiderModel.h +++ b/Minecraft.Client/Rendering/Models/SpiderModel.h @@ -7,6 +7,6 @@ public: ModelPart *head, *body0, *body1, *leg0, *leg1, *leg2, *leg3, *leg4, *leg5, *leg6, *leg7; SpiderModel(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SquidModel.cpp b/Minecraft.Client/Rendering/Models/SquidModel.cpp index d23812d20..56637a8d6 100644 --- a/Minecraft.Client/Rendering/Models/SquidModel.cpp +++ b/Minecraft.Client/Rendering/Models/SquidModel.cpp @@ -43,7 +43,7 @@ void SquidModel::setupAnim(float time, float r, float bob, float yRot, float xRo } } -void SquidModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void SquidModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/SquidModel.h b/Minecraft.Client/Rendering/Models/SquidModel.h index 8f43950fa..0b7948a80 100644 --- a/Minecraft.Client/Rendering/Models/SquidModel.h +++ b/Minecraft.Client/Rendering/Models/SquidModel.h @@ -10,5 +10,5 @@ public: SquidModel(); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/VillagerGolemModel.cpp b/Minecraft.Client/Rendering/Models/VillagerGolemModel.cpp index bc4693b18..0e5308038 100644 --- a/Minecraft.Client/Rendering/Models/VillagerGolemModel.cpp +++ b/Minecraft.Client/Rendering/Models/VillagerGolemModel.cpp @@ -36,7 +36,7 @@ VillagerGolemModel::VillagerGolemModel(float g, float yOffset) leg1->addBox(-3.5f, -3, -3, 6, 16, 5, g); } -void VillagerGolemModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void VillagerGolemModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); @@ -59,9 +59,9 @@ void VillagerGolemModel::setupAnim(float time, float r, float bob, float yRot, f leg1->yRot = 0; } -void VillagerGolemModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void VillagerGolemModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { - shared_ptr vg = dynamic_pointer_cast(mob); + std::shared_ptr vg = dynamic_pointer_cast(mob); int attackTick = vg->getAttackAnimationTick(); if (attackTick > 0) { diff --git a/Minecraft.Client/Rendering/Models/VillagerGolemModel.h b/Minecraft.Client/Rendering/Models/VillagerGolemModel.h index 83e736163..80c822d5c 100644 --- a/Minecraft.Client/Rendering/Models/VillagerGolemModel.h +++ b/Minecraft.Client/Rendering/Models/VillagerGolemModel.h @@ -21,9 +21,9 @@ public: VillagerGolemModel(float g = 0.0f, float yOffset = -7.0f); - void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); - void prepareMobModel(shared_ptr mob, float time, float r, float a); + void prepareMobModel(std::shared_ptr mob, float time, float r, float a); private: float triangleWave(float bob, float period); diff --git a/Minecraft.Client/Rendering/Models/VillagerModel.cpp b/Minecraft.Client/Rendering/Models/VillagerModel.cpp index 090907c6e..351efff71 100644 --- a/Minecraft.Client/Rendering/Models/VillagerModel.cpp +++ b/Minecraft.Client/Rendering/Models/VillagerModel.cpp @@ -55,7 +55,7 @@ VillagerModel::VillagerModel(float g, float yOffset) : Model() _init(g,yOffset); } -void VillagerModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void VillagerModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/VillagerModel.h b/Minecraft.Client/Rendering/Models/VillagerModel.h index 24c8b858b..cfb4b1d9f 100644 --- a/Minecraft.Client/Rendering/Models/VillagerModel.h +++ b/Minecraft.Client/Rendering/Models/VillagerModel.h @@ -10,6 +10,6 @@ public: void _init(float g, float yOffset); // 4J added VillagerModel(float g, float yOffset); VillagerModel(float g); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) ; + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) ; virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; diff --git a/Minecraft.Client/Rendering/Models/WolfModel.cpp b/Minecraft.Client/Rendering/Models/WolfModel.cpp index 0add0152d..b822fce04 100644 --- a/Minecraft.Client/Rendering/Models/WolfModel.cpp +++ b/Minecraft.Client/Rendering/Models/WolfModel.cpp @@ -57,7 +57,7 @@ WolfModel::WolfModel() tail->compile(1.0f/16.0f); } -void WolfModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void WolfModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { Model::render(entity, time, r, bob, yRot, xRot, scale, usecompiled); setupAnim(time, r, bob, yRot, xRot, scale); @@ -94,9 +94,9 @@ void WolfModel::render(shared_ptr entity, float time, float r, float bob } } -void WolfModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void WolfModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { - shared_ptr wolf = dynamic_pointer_cast(mob); + std::shared_ptr wolf = dynamic_pointer_cast(mob); if (wolf->isAngry()) { diff --git a/Minecraft.Client/Rendering/Models/WolfModel.h b/Minecraft.Client/Rendering/Models/WolfModel.h index 0bf806da0..809259906 100644 --- a/Minecraft.Client/Rendering/Models/WolfModel.h +++ b/Minecraft.Client/Rendering/Models/WolfModel.h @@ -15,7 +15,7 @@ private: static const int legSize = 8; public: WolfModel(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); - void prepareMobModel(shared_ptr mob, float time, float r, float a); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void prepareMobModel(std::shared_ptr mob, float time, float r, float a); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Particles/CritParticle.cpp b/Minecraft.Client/Rendering/Particles/CritParticle.cpp index b2d1ac4f5..7a1de6ac6 100644 --- a/Minecraft.Client/Rendering/Particles/CritParticle.cpp +++ b/Minecraft.Client/Rendering/Particles/CritParticle.cpp @@ -5,7 +5,7 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.phys.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.level.h" -void CritParticle::_init(Level *level, shared_ptr entity, ePARTICLE_TYPE type) +void CritParticle::_init(Level *level, std::shared_ptr entity, ePARTICLE_TYPE type) { life = 0; this->entity = entity; @@ -15,17 +15,17 @@ void CritParticle::_init(Level *level, shared_ptr entity, ePARTICLE_TYPE //tick(); } -CritParticle::CritParticle(Level *level, shared_ptr entity) : Particle(level, entity->x, entity->bb->y0 + entity->bbHeight / 2, entity->z, entity->xd, entity->yd, entity->zd) +CritParticle::CritParticle(Level *level, std::shared_ptr entity) : Particle(level, entity->x, entity->bb->y0 + entity->bbHeight / 2, entity->z, entity->xd, entity->yd, entity->zd) { _init(level,entity,eParticleType_crit); } -CritParticle::CritParticle(Level *level, shared_ptr entity, ePARTICLE_TYPE type) : Particle(level, entity->x, entity->bb->y0 + entity->bbHeight / 2, entity->z, entity->xd, entity->yd, entity->zd) +CritParticle::CritParticle(Level *level, std::shared_ptr entity, ePARTICLE_TYPE type) : Particle(level, entity->x, entity->bb->y0 + entity->bbHeight / 2, entity->z, entity->xd, entity->yd, entity->zd) { _init(level, entity, type); } -// 4J - Added this so that we can use some shared_ptr functions that were needed in the ctor +// 4J - Added this so that we can use some std::shared_ptr functions that were needed in the ctor void CritParticle::CritParticlePostConstructor(void) { tick(); diff --git a/Minecraft.Client/Rendering/Particles/CritParticle.h b/Minecraft.Client/Rendering/Particles/CritParticle.h index 23f30339e..5bad1c251 100644 --- a/Minecraft.Client/Rendering/Particles/CritParticle.h +++ b/Minecraft.Client/Rendering/Particles/CritParticle.h @@ -7,17 +7,17 @@ class Entity; class CritParticle : public Particle { private: - shared_ptr entity; + std::shared_ptr entity; int life; int lifeTime; ePARTICLE_TYPE particleName; - void _init(Level *level, shared_ptr entity, ePARTICLE_TYPE type); + void _init(Level *level, std::shared_ptr entity, ePARTICLE_TYPE type); public: virtual eINSTANCEOF GetType() { return eType_CRITPARTICLE; } - CritParticle(Level *level, shared_ptr entity); - CritParticle(Level *level, shared_ptr entity, ePARTICLE_TYPE type); + CritParticle(Level *level, std::shared_ptr entity); + CritParticle(Level *level, std::shared_ptr entity, ePARTICLE_TYPE type); void CritParticlePostConstructor(void); void render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2); void tick(); diff --git a/Minecraft.Client/Rendering/Particles/Particle.cpp b/Minecraft.Client/Rendering/Particles/Particle.cpp index 33994a7ac..0cc278286 100644 --- a/Minecraft.Client/Rendering/Particles/Particle.cpp +++ b/Minecraft.Client/Rendering/Particles/Particle.cpp @@ -61,7 +61,7 @@ Particle::Particle(Level *level, double x, double y, double z, double xa, double yd = yd / dd * speed * 0.4f + 0.1f; zd = zd / dd * speed * 0.4f;} -shared_ptr Particle::setPower(float power) +std::shared_ptr Particle::setPower(float power) { xd *= power; yd = (yd - 0.1f) * power + 0.1f; @@ -69,7 +69,7 @@ shared_ptr Particle::setPower(float power) return dynamic_pointer_cast( shared_from_this() ); } -shared_ptr Particle::scale(float scale) +std::shared_ptr Particle::scale(float scale) { setSize(0.2f * scale, 0.2f * scale); size *= scale; diff --git a/Minecraft.Client/Rendering/Particles/Particle.h b/Minecraft.Client/Rendering/Particles/Particle.h index 358559107..abf2aa0f7 100644 --- a/Minecraft.Client/Rendering/Particles/Particle.h +++ b/Minecraft.Client/Rendering/Particles/Particle.h @@ -28,8 +28,8 @@ protected: Particle(Level *level, double x, double y, double z); public: Particle(Level *level, double x, double y, double z, double xa, double ya, double za); - virtual shared_ptr setPower(float power); - virtual shared_ptr scale(float scale); + virtual std::shared_ptr setPower(float power); + virtual std::shared_ptr scale(float scale); void setColor(float r, float g, float b); void setAlpha(float alpha); float getRedCol(); diff --git a/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp b/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp index 1e3b9a59a..073bf105e 100644 --- a/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp +++ b/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp @@ -27,7 +27,7 @@ ParticleEngine::~ParticleEngine() delete random; } -void ParticleEngine::add(shared_ptr p) +void ParticleEngine::add(std::shared_ptr p) { int t = p->getParticleTexture(); int l = p->level->dimension->id == 0 ? 0 : ( p->level->dimension->id == -1 ? 1 : 2); @@ -43,7 +43,7 @@ void ParticleEngine::tick() { for (unsigned int i = 0; i < particles[l][tt].size(); i++) { - shared_ptr p = particles[l][tt][i]; + std::shared_ptr p = particles[l][tt][i]; p->tick(); if (p->removed) { @@ -56,7 +56,7 @@ void ParticleEngine::tick() } } -void ParticleEngine::render(shared_ptr player, float a) +void ParticleEngine::render(std::shared_ptr player, float a) { // 4J - change brought forward from 1.2.3 float xa = Camera::xa; @@ -99,7 +99,7 @@ void ParticleEngine::render(shared_ptr player, float a) t->end(); t->begin(); } - shared_ptr p = particles[l][tt][i]; + std::shared_ptr p = particles[l][tt][i]; if (SharedConstants::TEXTURE_LIGHTING) // 4J - change brought forward from 1.8.2 { @@ -118,7 +118,7 @@ void ParticleEngine::render(shared_ptr player, float a) } -void ParticleEngine::renderLit(shared_ptr player, float a) +void ParticleEngine::renderLit(std::shared_ptr player, float a) { // 4J - added. We call this before ParticleEngine::render in the general render per player, so if we // don't set this here then the offsets will be from the previous player - a single frame lag for the @@ -142,7 +142,7 @@ void ParticleEngine::renderLit(shared_ptr player, float a) Tesselator *t = Tesselator::getInstance(); for (unsigned int i = 0; i < particles[l][tt].size(); i++) { - shared_ptr p = particles[l][tt][i]; + std::shared_ptr p = particles[l][tt][i]; if (SharedConstants::TEXTURE_LIGHTING) // 4J - change brought forward from 1.8.2 { @@ -182,7 +182,7 @@ void ParticleEngine::destroy(int x, int y, int z, int tid, int data) double yp = y + (yy + 0.5) / SD; double zp = z + (zz + 0.5) / SD; int face = random->nextInt(6); - add(( shared_ptr(new TerrainParticle(level, xp, yp, zp, xp - x - 0.5f, yp - y - 0.5f, zp - z - 0.5f, tile, face, data, textures) ) )->init(x, y, z, data)); + add(( std::shared_ptr(new TerrainParticle(level, xp, yp, zp, xp - x - 0.5f, yp - y - 0.5f, zp - z - 0.5f, tile, face, data, textures) ) )->init(x, y, z, data)); } } @@ -201,7 +201,7 @@ void ParticleEngine::crack(int x, int y, int z, int face) if (face == 3) zp = z + tile->getShapeZ1() + r; if (face == 4) xp = x + tile->getShapeX0() - r; if (face == 5) xp = x + tile->getShapeX1() + r; - add(( shared_ptr(new TerrainParticle(level, xp, yp, zp, 0, 0, 0, tile, face, level->getData(x, y, z), textures) ) )->init(x, y, z, level->getData(x, y, z))->setPower(0.2f)->scale(0.6f)); + add(( std::shared_ptr(new TerrainParticle(level, xp, yp, zp, 0, 0, 0, tile, face, level->getData(x, y, z), textures) ) )->init(x, y, z, level->getData(x, y, z))->setPower(0.2f)->scale(0.6f)); } diff --git a/Minecraft.Client/Rendering/Particles/ParticleEngine.h b/Minecraft.Client/Rendering/Particles/ParticleEngine.h index 09e3685be..0fee7a165 100644 --- a/Minecraft.Client/Rendering/Particles/ParticleEngine.h +++ b/Minecraft.Client/Rendering/Particles/ParticleEngine.h @@ -26,17 +26,17 @@ public: protected: Level *level; private: - deque > particles[3][TEXTURE_COUNT]; // 4J made two arrays to cope with simultaneous two dimensions + deque > particles[3][TEXTURE_COUNT]; // 4J made two arrays to cope with simultaneous two dimensions Textures *textures; Random *random; public: ParticleEngine(Level *level, Textures *textures); ~ParticleEngine(); - void add(shared_ptr p); + void add(std::shared_ptr p); void tick(); - void render(shared_ptr player, float a); - void renderLit(shared_ptr player, float a); + void render(std::shared_ptr player, float a); + void renderLit(std::shared_ptr player, float a); void setLevel(Level *level); void destroy(int x, int y, int z, int tid, int data); void crack(int x, int y, int z, int face); diff --git a/Minecraft.Client/Rendering/Particles/PlayerCloudParticle.cpp b/Minecraft.Client/Rendering/Particles/PlayerCloudParticle.cpp index b14e45df6..c112be7eb 100644 --- a/Minecraft.Client/Rendering/Particles/PlayerCloudParticle.cpp +++ b/Minecraft.Client/Rendering/Particles/PlayerCloudParticle.cpp @@ -49,7 +49,7 @@ void PlayerCloudParticle::tick() xd *= 0.96f; yd *= 0.96f; zd *= 0.96f; - shared_ptr p = level->getNearestPlayer(shared_from_this(), 2); + std::shared_ptr p = level->getNearestPlayer(shared_from_this(), 2); if (p != NULL) { if (y > p->bb->y0) diff --git a/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.cpp b/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.cpp index 7da250587..8f185d021 100644 --- a/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.cpp +++ b/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.cpp @@ -5,7 +5,7 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.level.h" #include "../../../Minecraft.World/Util/Mth.h" -TakeAnimationParticle::TakeAnimationParticle(Level *level, shared_ptr item, shared_ptr target, float yOffs) : Particle(level, item->x, item->y, item->z, item->xd, item->yd, item->zd) +TakeAnimationParticle::TakeAnimationParticle(Level *level, std::shared_ptr item, std::shared_ptr target, float yOffs) : Particle(level, item->x, item->y, item->z, item->xd, item->yd, item->zd) { // 4J - added initialisers life = 0; diff --git a/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.h b/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.h index 10026fdaa..33c4535f3 100644 --- a/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.h +++ b/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.h @@ -7,14 +7,14 @@ class TakeAnimationParticle : public Particle public: virtual eINSTANCEOF GetType() { return eType_TAKEANIMATIONPARTICLE; } private: - shared_ptr item; - shared_ptr target; + std::shared_ptr item; + std::shared_ptr target; int life; int lifeTime; float yOffs; public: - TakeAnimationParticle(Level *level, shared_ptr item, shared_ptr target, float yOffs); + TakeAnimationParticle(Level *level, std::shared_ptr item, std::shared_ptr target, float yOffs); ~TakeAnimationParticle(); virtual void render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2); virtual void tick(); diff --git a/Minecraft.Client/Rendering/Particles/TerrainParticle.cpp b/Minecraft.Client/Rendering/Particles/TerrainParticle.cpp index 31e4f4051..3dca572cf 100644 --- a/Minecraft.Client/Rendering/Particles/TerrainParticle.cpp +++ b/Minecraft.Client/Rendering/Particles/TerrainParticle.cpp @@ -14,7 +14,7 @@ TerrainParticle::TerrainParticle(Level *level, double x, double y, double z, dou size /= 2; } -shared_ptr TerrainParticle::init(int x, int y, int z, int data) // 4J - added data parameter +std::shared_ptr TerrainParticle::init(int x, int y, int z, int data) // 4J - added data parameter { if (tile == Tile::grass) return dynamic_pointer_cast( shared_from_this() ); int col = tile->getColor(level, x, y, z, data); // 4J - added data parameter @@ -24,7 +24,7 @@ shared_ptr TerrainParticle::init(int x, int y, int z, int data) return dynamic_pointer_cast( shared_from_this() ); } -shared_ptr TerrainParticle::init(int data) +std::shared_ptr TerrainParticle::init(int data) { if (tile == Tile::grass) return dynamic_pointer_cast( shared_from_this() ); int col = tile->getColor(data); diff --git a/Minecraft.Client/Rendering/Particles/TerrainParticle.h b/Minecraft.Client/Rendering/Particles/TerrainParticle.h index 5d4a743ff..df9ca42fe 100644 --- a/Minecraft.Client/Rendering/Particles/TerrainParticle.h +++ b/Minecraft.Client/Rendering/Particles/TerrainParticle.h @@ -11,8 +11,8 @@ private: public: TerrainParticle(Level *level, double x, double y, double z, double xa, double ya, double za, Tile *tile, int face, int data, Textures *textures); - shared_ptr init(int x, int y, int z, int data); // 4J - added data parameter - shared_ptr init(int data); + std::shared_ptr init(int x, int y, int z, int data); // 4J - added data parameter + std::shared_ptr init(int data); virtual int getParticleTexture(); virtual void render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2); }; \ No newline at end of file diff --git a/Minecraft.Client/UI/Gui.cpp b/Minecraft.Client/UI/Gui.cpp index d9c2f564d..a2b096283 100644 --- a/Minecraft.Client/UI/Gui.cpp +++ b/Minecraft.Client/UI/Gui.cpp @@ -225,7 +225,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) // Display the pumpkin screen effect ///////////////////////////////////////////////////////////////////////////////////// - shared_ptr headGear = minecraft->player->inventory->getArmor(3); + std::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); @@ -302,7 +302,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) minecraft->textures->bindTexture(TN_GUI_GUI); // 4J was L"/gui/gui.png" MemSect(0); - shared_ptr inventory = minecraft->player->inventory; + std::shared_ptr inventory = minecraft->player->inventory; if(bTwoPlayerSplitscreen) { // need to apply scale factors depending on the mode @@ -1027,7 +1027,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) // { // if (EnderDragonRenderer::bossInstance == NULL) return; // -// shared_ptr boss = EnderDragonRenderer::bossInstance; +// std::shared_ptr boss = EnderDragonRenderer::bossInstance; // EnderDragonRenderer::bossInstance = NULL; // // Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -1148,7 +1148,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]; + std::shared_ptr item = minecraft->player->inventory->items[slot]; if (item == NULL) return; float pop = item->popTime - a; diff --git a/Minecraft.Client/UI/Screens/AbstractContainerScreen.cpp b/Minecraft.Client/UI/Screens/AbstractContainerScreen.cpp index 4149231ab..06cda6045 100644 --- a/Minecraft.Client/UI/Screens/AbstractContainerScreen.cpp +++ b/Minecraft.Client/UI/Screens/AbstractContainerScreen.cpp @@ -75,7 +75,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a) } } - shared_ptr inventory = minecraft->player->inventory; + std::shared_ptr inventory = minecraft->player->inventory; if (inventory->getCarried() != NULL) { glTranslatef(0, 0, 32); @@ -128,7 +128,7 @@ void AbstractContainerScreen::renderSlot(Slot *slot) #if 0 int x = slot->x; int y = slot->y; - shared_ptr item = slot->getItem(); + std::shared_ptr item = slot->getItem(); if (item == NULL) { @@ -218,7 +218,7 @@ void AbstractContainerScreen::removed() if (minecraft->player == NULL) return; } -void AbstractContainerScreen::slotsChanged(shared_ptr container) +void AbstractContainerScreen::slotsChanged(std::shared_ptr container) { } diff --git a/Minecraft.Client/UI/Screens/AbstractContainerScreen.h b/Minecraft.Client/UI/Screens/AbstractContainerScreen.h index 39d702f0b..8086837ef 100644 --- a/Minecraft.Client/UI/Screens/AbstractContainerScreen.h +++ b/Minecraft.Client/UI/Screens/AbstractContainerScreen.h @@ -32,7 +32,7 @@ protected: virtual void keyPressed(wchar_t eventCharacter, int eventKey); public: virtual void removed(); - virtual void slotsChanged(shared_ptr container); + virtual void slotsChanged(std::shared_ptr container); virtual bool isPauseScreen(); virtual void tick(); }; \ No newline at end of file diff --git a/Minecraft.Client/UI/Screens/ConnectScreen.cpp b/Minecraft.Client/UI/Screens/ConnectScreen.cpp index e43a2c15b..9a5af6412 100644 --- a/Minecraft.Client/UI/Screens/ConnectScreen.cpp +++ b/Minecraft.Client/UI/Screens/ConnectScreen.cpp @@ -17,7 +17,7 @@ ConnectScreen::ConnectScreen(Minecraft *minecraft, const wstring& ip, int port) // 4J - removed from separate thread, but need to investigate what we actually need here connection = new ClientConnection(minecraft, ip, port); if (aborted) return; - connection->send( shared_ptr( new PreLoginPacket(minecraft->user->name) ) ); + connection->send( std::shared_ptr( new PreLoginPacket(minecraft->user->name) ) ); #else new Thread() { diff --git a/Minecraft.Client/UI/Screens/ContainerScreen.cpp b/Minecraft.Client/UI/Screens/ContainerScreen.cpp index 9e4060f9f..84451b4fc 100644 --- a/Minecraft.Client/UI/Screens/ContainerScreen.cpp +++ b/Minecraft.Client/UI/Screens/ContainerScreen.cpp @@ -3,7 +3,7 @@ #include "../../Textures/Textures.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.inventory.h" -ContainerScreen::ContainerScreen(shared_ptr inventory, shared_ptr container) : AbstractContainerScreen(new ContainerMenu(inventory, container)) +ContainerScreen::ContainerScreen(std::shared_ptr inventory, std::shared_ptr container) : AbstractContainerScreen(new ContainerMenu(inventory, container)) { this->inventory = inventory; this->container = container; diff --git a/Minecraft.Client/UI/Screens/ContainerScreen.h b/Minecraft.Client/UI/Screens/ContainerScreen.h index 38806c1e4..314026aef 100644 --- a/Minecraft.Client/UI/Screens/ContainerScreen.h +++ b/Minecraft.Client/UI/Screens/ContainerScreen.h @@ -5,13 +5,13 @@ class Container; class ContainerScreen : public AbstractContainerScreen { private: - shared_ptr inventory; - shared_ptr container; + std::shared_ptr inventory; + std::shared_ptr container; int containerRows; public: - ContainerScreen(shared_ptrinventory, shared_ptrcontainer); + ContainerScreen(std::shared_ptrinventory, std::shared_ptrcontainer); protected: virtual void renderLabels(); diff --git a/Minecraft.Client/UI/Screens/CraftingScreen.cpp b/Minecraft.Client/UI/Screens/CraftingScreen.cpp index 624fcefd6..631a661d3 100644 --- a/Minecraft.Client/UI/Screens/CraftingScreen.cpp +++ b/Minecraft.Client/UI/Screens/CraftingScreen.cpp @@ -4,7 +4,7 @@ #include "../../Player/MultiPlayerLocalPlayer.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.inventory.h" -CraftingScreen::CraftingScreen(shared_ptr inventory, Level *level, int x, int y, int z) : AbstractContainerScreen(new CraftingMenu(inventory, level, x, y, z)) +CraftingScreen::CraftingScreen(std::shared_ptr inventory, Level *level, int x, int y, int z) : AbstractContainerScreen(new CraftingMenu(inventory, level, x, y, z)) { } diff --git a/Minecraft.Client/UI/Screens/CraftingScreen.h b/Minecraft.Client/UI/Screens/CraftingScreen.h index 2de1681f4..42b2623a8 100644 --- a/Minecraft.Client/UI/Screens/CraftingScreen.h +++ b/Minecraft.Client/UI/Screens/CraftingScreen.h @@ -6,7 +6,7 @@ class Level; class CraftingScreen : public AbstractContainerScreen { public: - CraftingScreen(shared_ptr inventory, Level *level, int x, int y, int z); + CraftingScreen(std::shared_ptr inventory, Level *level, int x, int y, int z); virtual void removed(); protected: virtual void renderLabels(); diff --git a/Minecraft.Client/UI/Screens/FurnaceScreen.cpp b/Minecraft.Client/UI/Screens/FurnaceScreen.cpp index 4d2e486a2..a4eedadde 100644 --- a/Minecraft.Client/UI/Screens/FurnaceScreen.cpp +++ b/Minecraft.Client/UI/Screens/FurnaceScreen.cpp @@ -6,7 +6,7 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.inventory.h" #include "../../../Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.h" -FurnaceScreen::FurnaceScreen(shared_ptr inventory, shared_ptr furnace) : AbstractContainerScreen(new FurnaceMenu(inventory, furnace)) +FurnaceScreen::FurnaceScreen(std::shared_ptr inventory, std::shared_ptr furnace) : AbstractContainerScreen(new FurnaceMenu(inventory, furnace)) { this->furnace = furnace; } diff --git a/Minecraft.Client/UI/Screens/FurnaceScreen.h b/Minecraft.Client/UI/Screens/FurnaceScreen.h index f018093fd..98c0bba7c 100644 --- a/Minecraft.Client/UI/Screens/FurnaceScreen.h +++ b/Minecraft.Client/UI/Screens/FurnaceScreen.h @@ -7,10 +7,10 @@ class Inventory; class FurnaceScreen : public AbstractContainerScreen { private: - shared_ptr furnace; + std::shared_ptr furnace; public: - FurnaceScreen(shared_ptr inventory, shared_ptr furnace); + FurnaceScreen(std::shared_ptr inventory, std::shared_ptr furnace); protected: virtual void renderLabels(); virtual void renderBg(float a); diff --git a/Minecraft.Client/UI/Screens/InventoryScreen.cpp b/Minecraft.Client/UI/Screens/InventoryScreen.cpp index 02c80224c..cb31a973d 100644 --- a/Minecraft.Client/UI/Screens/InventoryScreen.cpp +++ b/Minecraft.Client/UI/Screens/InventoryScreen.cpp @@ -10,7 +10,7 @@ #include "StatsScreen.h" #include "../../../Minecraft.World/Headers/net.minecraft.stats.h" -InventoryScreen::InventoryScreen(shared_ptr player) : AbstractContainerScreen(player->inventoryMenu) +InventoryScreen::InventoryScreen(std::shared_ptr player) : AbstractContainerScreen(player->inventoryMenu) { xMouse = yMouse = 0.0f; // 4J added diff --git a/Minecraft.Client/UI/Screens/InventoryScreen.h b/Minecraft.Client/UI/Screens/InventoryScreen.h index c39edfe04..4f62ce35a 100644 --- a/Minecraft.Client/UI/Screens/InventoryScreen.h +++ b/Minecraft.Client/UI/Screens/InventoryScreen.h @@ -6,7 +6,7 @@ class Button; class InventoryScreen : public AbstractContainerScreen { public: - InventoryScreen(shared_ptr player); + InventoryScreen(std::shared_ptr player); virtual void init(); protected: virtual void renderLabels(); diff --git a/Minecraft.Client/UI/Screens/ReceivingLevelScreen.cpp b/Minecraft.Client/UI/Screens/ReceivingLevelScreen.cpp index 26f97916a..c1b7e46b0 100644 --- a/Minecraft.Client/UI/Screens/ReceivingLevelScreen.cpp +++ b/Minecraft.Client/UI/Screens/ReceivingLevelScreen.cpp @@ -23,7 +23,7 @@ void ReceivingLevelScreen::tick() tickCount++; if (tickCount % 20 == 0) { - connection->send( shared_ptr( new KeepAlivePacket() ) ); + connection->send( std::shared_ptr( new KeepAlivePacket() ) ); } if (connection != NULL) { diff --git a/Minecraft.Client/UI/Screens/TextEditScreen.cpp b/Minecraft.Client/UI/Screens/TextEditScreen.cpp index 917ec9678..667d1eb09 100644 --- a/Minecraft.Client/UI/Screens/TextEditScreen.cpp +++ b/Minecraft.Client/UI/Screens/TextEditScreen.cpp @@ -13,7 +13,7 @@ const wstring TextEditScreen::allowedChars = SharedConstants::readAcceptableChars(); -TextEditScreen::TextEditScreen(shared_ptr sign) +TextEditScreen::TextEditScreen(std::shared_ptr sign) { // 4J - added initialisers line = 0; @@ -35,7 +35,7 @@ void TextEditScreen::removed() Keyboard::enableRepeatEvents(false); if (minecraft->level->isClientSide) { - minecraft->getConnection(0)->send( shared_ptr( new SignUpdatePacket(sign->x, sign->y, sign->z, sign->IsVerified(), sign->IsCensored(), sign->GetMessages()) ) ); + minecraft->getConnection(0)->send( std::shared_ptr( new SignUpdatePacket(sign->x, sign->y, sign->z, sign->IsVerified(), sign->IsCensored(), sign->GetMessages()) ) ); } } diff --git a/Minecraft.Client/UI/Screens/TextEditScreen.h b/Minecraft.Client/UI/Screens/TextEditScreen.h index 685715450..706817f66 100644 --- a/Minecraft.Client/UI/Screens/TextEditScreen.h +++ b/Minecraft.Client/UI/Screens/TextEditScreen.h @@ -8,12 +8,12 @@ class TextEditScreen : public Screen protected: wstring title; private: - shared_ptr sign; + std::shared_ptr sign; int frame; int line; public: - TextEditScreen(shared_ptr sign); + TextEditScreen(std::shared_ptr sign); virtual void init(); virtual void removed(); virtual void tick(); diff --git a/Minecraft.Client/UI/Screens/TrapScreen.cpp b/Minecraft.Client/UI/Screens/TrapScreen.cpp index af32b5e1d..f54261862 100644 --- a/Minecraft.Client/UI/Screens/TrapScreen.cpp +++ b/Minecraft.Client/UI/Screens/TrapScreen.cpp @@ -6,7 +6,7 @@ #include "../../../Minecraft.World/Blocks/TileEntities/DispenserTileEntity.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.h" -TrapScreen::TrapScreen(shared_ptr inventory, shared_ptr trap) : AbstractContainerScreen(new TrapMenu(inventory, trap)) +TrapScreen::TrapScreen(std::shared_ptr inventory, std::shared_ptr trap) : AbstractContainerScreen(new TrapMenu(inventory, trap)) { } diff --git a/Minecraft.Client/UI/Screens/TrapScreen.h b/Minecraft.Client/UI/Screens/TrapScreen.h index bda3158fd..a993805d1 100644 --- a/Minecraft.Client/UI/Screens/TrapScreen.h +++ b/Minecraft.Client/UI/Screens/TrapScreen.h @@ -6,7 +6,7 @@ class Inventory; class TrapScreen : public AbstractContainerScreen { public: - TrapScreen(shared_ptr inventory, shared_ptr trap); + TrapScreen(std::shared_ptr inventory, std::shared_ptr trap); protected: virtual void renderLabels(); virtual void renderBg(float a); diff --git a/Minecraft.World/AI/Control/LookControl.cpp b/Minecraft.World/AI/Control/LookControl.cpp index 818cc987c..f17a43298 100644 --- a/Minecraft.World/AI/Control/LookControl.cpp +++ b/Minecraft.World/AI/Control/LookControl.cpp @@ -13,10 +13,10 @@ LookControl::LookControl(Mob *mob) this->mob = mob; } -void LookControl::setLookAt(shared_ptr target, float yMax, float xMax) +void LookControl::setLookAt(std::shared_ptr target, float yMax, float xMax) { this->wantedX = target->x; - shared_ptr targetMob = dynamic_pointer_cast(target); + std::shared_ptr targetMob = dynamic_pointer_cast(target); if (targetMob != NULL) this->wantedY = target->y + targetMob->getHeadHeight(); else this->wantedY = (target->bb->y0 + target->bb->y1) / 2; this->wantedZ = target->z; diff --git a/Minecraft.World/AI/Control/LookControl.h b/Minecraft.World/AI/Control/LookControl.h index add64e4a3..fe182e7c7 100644 --- a/Minecraft.World/AI/Control/LookControl.h +++ b/Minecraft.World/AI/Control/LookControl.h @@ -16,7 +16,7 @@ private: public: LookControl(Mob *mob); - void setLookAt(shared_ptr target, float yMax, float xMax); + void setLookAt(std::shared_ptr target, float yMax, float xMax); void setLookAt(double x, double y, double z, float yMax, float xMax); virtual void tick(); diff --git a/Minecraft.World/AI/Control/Sensing.cpp b/Minecraft.World/AI/Control/Sensing.cpp index f733071a4..4c343bd95 100644 --- a/Minecraft.World/AI/Control/Sensing.cpp +++ b/Minecraft.World/AI/Control/Sensing.cpp @@ -13,7 +13,7 @@ void Sensing::tick() unseen.clear(); } -bool Sensing::canSee(shared_ptr target) +bool Sensing::canSee(std::shared_ptr target) { //if ( find(seen.begin(), seen.end(), target) != seen.end() ) return true; //if ( find(unseen.begin(), unseen.end(), target) != unseen.end()) return false; diff --git a/Minecraft.World/AI/Control/Sensing.h b/Minecraft.World/AI/Control/Sensing.h index d6428515e..844a3e60a 100644 --- a/Minecraft.World/AI/Control/Sensing.h +++ b/Minecraft.World/AI/Control/Sensing.h @@ -11,5 +11,5 @@ public: Sensing(Mob *mob); void tick(); - bool canSee(shared_ptr target); + bool canSee(std::shared_ptr target); }; \ No newline at end of file diff --git a/Minecraft.World/AI/Goals/ArrowAttackGoal.cpp b/Minecraft.World/AI/Goals/ArrowAttackGoal.cpp index c28a63d42..f9e2a01a8 100644 --- a/Minecraft.World/AI/Goals/ArrowAttackGoal.cpp +++ b/Minecraft.World/AI/Goals/ArrowAttackGoal.cpp @@ -26,7 +26,7 @@ ArrowAttackGoal::ArrowAttackGoal(Mob *mob, float speed, int projectileType, int bool ArrowAttackGoal::canUse() { - shared_ptr bestTarget = mob->getTarget(); + std::shared_ptr bestTarget = mob->getTarget(); if (bestTarget == NULL) return false; target = weak_ptr(bestTarget); return true; @@ -45,7 +45,7 @@ void ArrowAttackGoal::stop() void ArrowAttackGoal::tick() { double attackRadiusSqr = 10 * 10; - shared_ptr tar = target.lock(); + std::shared_ptr tar = target.lock(); double targetDistSqr = mob->distanceToSqr(tar->x, tar->bb->y0, tar->z); bool canSee = mob->getSensing()->canSee(tar); @@ -69,16 +69,16 @@ void ArrowAttackGoal::tick() void ArrowAttackGoal::fireAtTarget() { - shared_ptr tar = target.lock(); + std::shared_ptr tar = target.lock(); if (projectileType == ArrowType) { - shared_ptr arrow = shared_ptr( new Arrow(level, dynamic_pointer_cast(mob->shared_from_this()), tar, 1.60f, 12) ); + std::shared_ptr arrow = std::shared_ptr( new Arrow(level, dynamic_pointer_cast(mob->shared_from_this()), tar, 1.60f, 12) ); level->playSound(mob->shared_from_this(), eSoundType_RANDOM_BOW, 1.0f, 1 / (mob->getRandom()->nextFloat() * 0.4f + 0.8f)); level->addEntity(arrow); } else if (projectileType == SnowballType) { - shared_ptr snowball = shared_ptr( new Snowball(level, dynamic_pointer_cast(mob->shared_from_this())) ); + std::shared_ptr snowball = std::shared_ptr( new Snowball(level, dynamic_pointer_cast(mob->shared_from_this())) ); double xd = tar->x - mob->x; double yd = (tar->y + tar->getHeadHeight() - 1.1f) - snowball->y; double zd = tar->z - mob->z; diff --git a/Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp b/Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp index 5dbf64a89..12cb71eb1 100644 --- a/Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp +++ b/Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp @@ -33,14 +33,14 @@ bool AvoidPlayerGoal::canUse() { if (avoidType == typeid(Player)) { - shared_ptr tamableAnimal = dynamic_pointer_cast(mob->shared_from_this()); + std::shared_ptr tamableAnimal = dynamic_pointer_cast(mob->shared_from_this()); if (tamableAnimal != NULL && tamableAnimal->isTame()) return false; toAvoid = weak_ptr(mob->level->getNearestPlayer(mob->shared_from_this(), maxDist)); if (toAvoid.lock() == NULL) return false; } else { - vector > *entities = mob->level->getEntitiesOfClass(avoidType, mob->bb->grow(maxDist, 3, maxDist)); + vector > *entities = mob->level->getEntitiesOfClass(avoidType, mob->bb->grow(maxDist, 3, maxDist)); if (entities->empty()) { delete entities; diff --git a/Minecraft.World/AI/Goals/BegGoal.cpp b/Minecraft.World/AI/Goals/BegGoal.cpp index 1bbb1f695..3ade2dae5 100644 --- a/Minecraft.World/AI/Goals/BegGoal.cpp +++ b/Minecraft.World/AI/Goals/BegGoal.cpp @@ -51,9 +51,9 @@ void BegGoal::tick() --lookTime; } -bool BegGoal::playerHoldingInteresting(shared_ptr player) +bool BegGoal::playerHoldingInteresting(std::shared_ptr player) { - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); if (item == NULL) return false; if (!wolf->isTame() && item->id == Item::bone_Id) return true; return wolf->isFood(item); diff --git a/Minecraft.World/AI/Goals/BegGoal.h b/Minecraft.World/AI/Goals/BegGoal.h index 607937a79..b80a68a58 100644 --- a/Minecraft.World/AI/Goals/BegGoal.h +++ b/Minecraft.World/AI/Goals/BegGoal.h @@ -23,7 +23,7 @@ public: virtual void tick(); private: - bool playerHoldingInteresting(shared_ptr player); + bool playerHoldingInteresting(std::shared_ptr player); public: // 4J Added override to update ai elements when loading entity from schematics diff --git a/Minecraft.World/AI/Goals/BreedGoal.cpp b/Minecraft.World/AI/Goals/BreedGoal.cpp index a954b1306..e3b5c3048 100644 --- a/Minecraft.World/AI/Goals/BreedGoal.cpp +++ b/Minecraft.World/AI/Goals/BreedGoal.cpp @@ -46,13 +46,13 @@ void BreedGoal::tick() if (loveTime == 20 * 3) breed(); } -shared_ptr BreedGoal::getFreePartner() +std::shared_ptr BreedGoal::getFreePartner() { float r = 8; - vector > *others = level->getEntitiesOfClass(typeid(*animal), animal->bb->grow(r, r, r)); + vector > *others = level->getEntitiesOfClass(typeid(*animal), animal->bb->grow(r, r, r)); for(AUTO_VAR(it, others->begin()); it != others->end(); ++it) { - shared_ptr p = dynamic_pointer_cast(*it); + std::shared_ptr p = dynamic_pointer_cast(*it); if (animal->canMate(p)) { delete others; @@ -65,7 +65,7 @@ shared_ptr BreedGoal::getFreePartner() void BreedGoal::breed() { - shared_ptr offspring = animal->getBreedOffspring(partner.lock()); + std::shared_ptr offspring = animal->getBreedOffspring(partner.lock()); animal->setDespawnProtected(); partner.lock()->setDespawnProtected(); if (offspring == NULL) @@ -76,7 +76,7 @@ void BreedGoal::breed() return; } - shared_ptr loveCause = animal->getLoveCause(); + std::shared_ptr loveCause = animal->getLoveCause(); if (loveCause == NULL && partner.lock()->getLoveCause() != NULL) { loveCause = partner.lock()->getLoveCause(); @@ -112,5 +112,5 @@ void BreedGoal::breed() * animal->bbWidth * 2 - animal->bbWidth, xa, ya, za); } // 4J-PB - Fix for 106869- Customer Encountered: TU12: Content: Gameplay: Breeding animals does not give any Experience Orbs. - level->addEntity( shared_ptr( new ExperienceOrb(level, animal->x, animal->y, animal->z, random->nextInt(7) + 1) ) ); + level->addEntity( std::shared_ptr( new ExperienceOrb(level, animal->x, animal->y, animal->z, random->nextInt(7) + 1) ) ); } diff --git a/Minecraft.World/AI/Goals/BreedGoal.h b/Minecraft.World/AI/Goals/BreedGoal.h index d2b47e7dd..0e07119d5 100644 --- a/Minecraft.World/AI/Goals/BreedGoal.h +++ b/Minecraft.World/AI/Goals/BreedGoal.h @@ -23,7 +23,7 @@ public: virtual void tick(); private: - shared_ptr getFreePartner(); + std::shared_ptr getFreePartner(); void breed(); public: diff --git a/Minecraft.World/AI/Goals/ControlledByPlayerGoal.cpp b/Minecraft.World/AI/Goals/ControlledByPlayerGoal.cpp index 1a8a9e5a3..7c437ac08 100644 --- a/Minecraft.World/AI/Goals/ControlledByPlayerGoal.cpp +++ b/Minecraft.World/AI/Goals/ControlledByPlayerGoal.cpp @@ -36,13 +36,13 @@ void ControlledByPlayerGoal::stop() bool ControlledByPlayerGoal::canUse() { - shared_ptr player = dynamic_pointer_cast( mob->rider.lock() ); + std::shared_ptr player = dynamic_pointer_cast( mob->rider.lock() ); return mob->isAlive() && player && (boosting || mob->canBeControlledByRider()); } void ControlledByPlayerGoal::tick() { - shared_ptr player = dynamic_pointer_cast(mob->rider.lock()); + std::shared_ptr player = dynamic_pointer_cast(mob->rider.lock()); PathfinderMob *pig = (PathfinderMob *)mob; float yrd = Mth::wrapDegrees(player->yRot - mob->yRot) * 0.5f; @@ -116,7 +116,7 @@ void ControlledByPlayerGoal::tick() if (!player->abilities.instabuild && speed >= maxSpeed * 0.5f && mob->getRandom()->nextFloat() < 0.006f && !boosting) { - shared_ptr carriedItem = player->getCarriedItem(); + std::shared_ptr carriedItem = player->getCarriedItem(); if (carriedItem != NULL && carriedItem->id == Item::carrotOnAStick_Id) { @@ -124,7 +124,7 @@ void ControlledByPlayerGoal::tick() if (carriedItem->count == 0) { - shared_ptr replacement = shared_ptr(new ItemInstance(Item::fishingRod)); + std::shared_ptr replacement = std::shared_ptr(new ItemInstance(Item::fishingRod)); replacement->setTag(carriedItem->tag); player->inventory->items[player->inventory->selected] = replacement; } diff --git a/Minecraft.World/AI/Goals/DefendVillageTargetGoal.cpp b/Minecraft.World/AI/Goals/DefendVillageTargetGoal.cpp index d7031a4b0..b47684cb9 100644 --- a/Minecraft.World/AI/Goals/DefendVillageTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/DefendVillageTargetGoal.cpp @@ -11,7 +11,7 @@ DefendVillageTargetGoal::DefendVillageTargetGoal(VillagerGolem *golem) : TargetG bool DefendVillageTargetGoal::canUse() { - shared_ptr village = golem->getVillage(); + std::shared_ptr village = golem->getVillage(); if (village == NULL) return false; potentialTarget = weak_ptr(village->getClosestAggressor(dynamic_pointer_cast(golem->shared_from_this()))); return canAttack(potentialTarget.lock(), false); diff --git a/Minecraft.World/AI/Goals/FollowOwnerGoal.cpp b/Minecraft.World/AI/Goals/FollowOwnerGoal.cpp index 571148e78..9b9ad7ecb 100644 --- a/Minecraft.World/AI/Goals/FollowOwnerGoal.cpp +++ b/Minecraft.World/AI/Goals/FollowOwnerGoal.cpp @@ -24,7 +24,7 @@ FollowOwnerGoal::FollowOwnerGoal(TamableAnimal *tamable, float speed, float star bool FollowOwnerGoal::canUse() { - shared_ptr owner = tamable->getOwner(); + std::shared_ptr owner = tamable->getOwner(); if (owner == NULL) return false; if (tamable->isSitting()) return false; if (tamable->distanceToSqr(owner) < startDistance * startDistance) return false; diff --git a/Minecraft.World/AI/Goals/FollowParentGoal.cpp b/Minecraft.World/AI/Goals/FollowParentGoal.cpp index 3d83a0e8e..d22841136 100644 --- a/Minecraft.World/AI/Goals/FollowParentGoal.cpp +++ b/Minecraft.World/AI/Goals/FollowParentGoal.cpp @@ -18,13 +18,13 @@ bool FollowParentGoal::canUse() { if (animal->getAge() >= 0) return false; - vector > *parents = animal->level->getEntitiesOfClass(typeid(*animal), animal->bb->grow(8, 4, 8)); + vector > *parents = animal->level->getEntitiesOfClass(typeid(*animal), animal->bb->grow(8, 4, 8)); - shared_ptr closest = nullptr; + std::shared_ptr closest = nullptr; double closestDistSqr = Double::MAX_VALUE; for(AUTO_VAR(it, parents->begin()); it != parents->end(); ++it) { - shared_ptr parent = dynamic_pointer_cast(*it); + std::shared_ptr parent = dynamic_pointer_cast(*it); if (parent->getAge() < 0) continue; double distSqr = animal->distanceToSqr(parent); if (distSqr > closestDistSqr) continue; diff --git a/Minecraft.World/AI/Goals/HurtByTargetGoal.cpp b/Minecraft.World/AI/Goals/HurtByTargetGoal.cpp index 04c1f6cf5..9185a593d 100644 --- a/Minecraft.World/AI/Goals/HurtByTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/HurtByTargetGoal.cpp @@ -22,10 +22,10 @@ void HurtByTargetGoal::start() if (alertSameType) { - vector > *nearby = mob->level->getEntitiesOfClass(typeid(*mob), AABB::newTemp(mob->x, mob->y, mob->z, mob->x + 1, mob->y + 1, mob->z + 1)->grow(within, 4, within)); + vector > *nearby = mob->level->getEntitiesOfClass(typeid(*mob), AABB::newTemp(mob->x, mob->y, mob->z, mob->x + 1, mob->y + 1, mob->z + 1)->grow(within, 4, within)); for(AUTO_VAR(it, nearby->begin()); it != nearby->end(); ++it) { - shared_ptr other = dynamic_pointer_cast(*it); + std::shared_ptr other = dynamic_pointer_cast(*it); if (this->mob->shared_from_this() == other) continue; if (other->getTarget() != NULL) continue; other->setTarget(mob->getLastHurtByMob()); diff --git a/Minecraft.World/AI/Goals/HurtByTargetGoal.h b/Minecraft.World/AI/Goals/HurtByTargetGoal.h index 4c6ee5fe4..b731fc398 100644 --- a/Minecraft.World/AI/Goals/HurtByTargetGoal.h +++ b/Minecraft.World/AI/Goals/HurtByTargetGoal.h @@ -6,7 +6,7 @@ class HurtByTargetGoal : public TargetGoal { private: bool alertSameType; - shared_ptr oldHurtByMob; + std::shared_ptr oldHurtByMob; public: HurtByTargetGoal(Mob *mob, bool alertSameType); diff --git a/Minecraft.World/AI/Goals/MakeLoveGoal.cpp b/Minecraft.World/AI/Goals/MakeLoveGoal.cpp index 8efd7a8a0..75046bf27 100644 --- a/Minecraft.World/AI/Goals/MakeLoveGoal.cpp +++ b/Minecraft.World/AI/Goals/MakeLoveGoal.cpp @@ -29,7 +29,7 @@ bool MakeLoveGoal::canUse() if (village.lock() == NULL) return false; if (!villageNeedsMoreVillagers()) return false; - shared_ptr mate = level->getClosestEntityOfClass(typeid(Villager), villager->bb->grow(8, 3, 8), villager->shared_from_this()); + std::shared_ptr mate = level->getClosestEntityOfClass(typeid(Villager), villager->bb->grow(8, 3, 8), villager->shared_from_this()); if (mate == NULL) return false; partner = weak_ptr(dynamic_pointer_cast(mate)); @@ -75,7 +75,7 @@ void MakeLoveGoal::tick() bool MakeLoveGoal::villageNeedsMoreVillagers() { - shared_ptr _village = village.lock(); + std::shared_ptr _village = village.lock(); if( _village == NULL ) return false; int idealSize = (int) ((float) _village->getDoorCount() * 0.35); @@ -93,7 +93,7 @@ void MakeLoveGoal::breed() // 4J - added limit to number of animals that can be bred if(level->canCreateMore( eTYPE_VILLAGER, Level::eSpawnType_Breed) ) { - shared_ptr child = shared_ptr( new Villager(level) ); + std::shared_ptr child = std::shared_ptr( new Villager(level) ); child->setAge(-20 * 60 * 20); child->setProfession(villager->getRandom()->nextInt(Villager::PROFESSION_MAX)); child->moveTo(villager->x, villager->y, villager->z, 0, 0); diff --git a/Minecraft.World/AI/Goals/MeleeAttackGoal.cpp b/Minecraft.World/AI/Goals/MeleeAttackGoal.cpp index 658d5ab3f..29ea99988 100644 --- a/Minecraft.World/AI/Goals/MeleeAttackGoal.cpp +++ b/Minecraft.World/AI/Goals/MeleeAttackGoal.cpp @@ -41,7 +41,7 @@ MeleeAttackGoal::~MeleeAttackGoal() bool MeleeAttackGoal::canUse() { - shared_ptr bestTarget = mob->getTarget(); + std::shared_ptr bestTarget = mob->getTarget(); if (bestTarget == NULL) return false; if(!bestTarget->isAlive()) return false; if (attackType != eTYPE_NOTSET && (attackType & bestTarget->GetType()) != attackType) return false; @@ -53,7 +53,7 @@ bool MeleeAttackGoal::canUse() bool MeleeAttackGoal::canContinueToUse() { - shared_ptr bestTarget = mob->getTarget(); + std::shared_ptr bestTarget = mob->getTarget(); if (bestTarget == NULL) return false; if (target.lock() == NULL || !target.lock()->isAlive()) return false; if (!trackTarget) return !mob->getNavigation()->isDone(); diff --git a/Minecraft.World/AI/Goals/MoveIndoorsGoal.cpp b/Minecraft.World/AI/Goals/MoveIndoorsGoal.cpp index 3793accf1..3077d36f5 100644 --- a/Minecraft.World/AI/Goals/MoveIndoorsGoal.cpp +++ b/Minecraft.World/AI/Goals/MoveIndoorsGoal.cpp @@ -21,9 +21,9 @@ bool MoveIndoorsGoal::canUse() if ((mob->level->isDay() && !mob->level->isRaining()) || mob->level->dimension->hasCeiling) return false; 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); + std::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; - shared_ptr _doorInfo = village->getBestDoorInfo(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)); + std::shared_ptr _doorInfo = village->getBestDoorInfo(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)); doorInfo = _doorInfo; return _doorInfo != NULL; } @@ -36,7 +36,7 @@ bool MoveIndoorsGoal::canContinueToUse() void MoveIndoorsGoal::start() { insideX = -1; - shared_ptr _doorInfo = doorInfo.lock(); + std::shared_ptr _doorInfo = doorInfo.lock(); if( _doorInfo == NULL ) { doorInfo = weak_ptr(); @@ -52,7 +52,7 @@ void MoveIndoorsGoal::start() void MoveIndoorsGoal::stop() { - shared_ptr _doorInfo = doorInfo.lock(); + std::shared_ptr _doorInfo = doorInfo.lock(); if( _doorInfo == NULL ) { doorInfo = weak_ptr(); diff --git a/Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp b/Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp index 31c3c332c..509b63095 100644 --- a/Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp +++ b/Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp @@ -31,10 +31,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); + std::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; - shared_ptr _doorInfo = getNextDoorInfo(village); + std::shared_ptr _doorInfo = getNextDoorInfo(village); if (_doorInfo == NULL) return false; doorInfo = _doorInfo; @@ -59,7 +59,7 @@ bool MoveThroughVillageGoal::canContinueToUse() { if (mob->getNavigation()->isDone()) return false; float dist = mob->bbWidth + 4.f; - shared_ptr _doorInfo = doorInfo.lock(); + std::shared_ptr _doorInfo = doorInfo.lock(); if( _doorInfo == NULL ) return false; return mob->distanceToSqr(_doorInfo->x, _doorInfo->y, _doorInfo->z) > dist * dist; @@ -73,7 +73,7 @@ void MoveThroughVillageGoal::start() void MoveThroughVillageGoal::stop() { - shared_ptr _doorInfo = doorInfo.lock(); + std::shared_ptr _doorInfo = doorInfo.lock(); if( _doorInfo == NULL ) return; if (mob->getNavigation()->isDone() || mob->distanceToSqr(_doorInfo->x, _doorInfo->y, _doorInfo->z) < 4 * 4) @@ -82,15 +82,15 @@ void MoveThroughVillageGoal::stop() } } -shared_ptr MoveThroughVillageGoal::getNextDoorInfo(shared_ptr village) +std::shared_ptr MoveThroughVillageGoal::getNextDoorInfo(std::shared_ptr village) { - shared_ptr closest = nullptr; + std::shared_ptr closest = nullptr; int closestDistSqr = Integer::MAX_VALUE; - vector > *doorInfos = village->getDoorInfos(); + vector > *doorInfos = village->getDoorInfos(); //for (DoorInfo di : doorInfos) for(AUTO_VAR(it, doorInfos->begin()); it != doorInfos->end(); ++it) { - shared_ptr di = *it; + std::shared_ptr di = *it; int distSqr = di->distanceToSqr(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)); if (distSqr < closestDistSqr) { @@ -102,12 +102,12 @@ shared_ptr MoveThroughVillageGoal::getNextDoorInfo(shared_ptr return closest; } -bool MoveThroughVillageGoal::hasVisited(shared_ptrdi) +bool MoveThroughVillageGoal::hasVisited(std::shared_ptrdi) { //for (DoorInfo di2 : visited) for(AUTO_VAR(it, visited.begin()); it != visited.end(); ) { - shared_ptr di2 = (*it).lock(); + std::shared_ptr di2 = (*it).lock(); if( di2 == NULL ) { it = visited.erase(it); diff --git a/Minecraft.World/AI/Goals/MoveThroughVillageGoal.h b/Minecraft.World/AI/Goals/MoveThroughVillageGoal.h index a087e5220..1d14d587e 100644 --- a/Minecraft.World/AI/Goals/MoveThroughVillageGoal.h +++ b/Minecraft.World/AI/Goals/MoveThroughVillageGoal.h @@ -26,7 +26,7 @@ public: virtual void stop(); private: - shared_ptr getNextDoorInfo(shared_ptr village); - bool hasVisited(shared_ptr di); + std::shared_ptr getNextDoorInfo(std::shared_ptr village); + bool hasVisited(std::shared_ptr di); void updateVisited(); }; \ No newline at end of file diff --git a/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.cpp b/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.cpp index 3cc6abd61..ab7575b79 100644 --- a/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.cpp @@ -9,7 +9,7 @@ NearestAttackableTargetGoal::DistComp::DistComp(Entity *source) this->source = source; } -bool NearestAttackableTargetGoal::DistComp::operator() (shared_ptr e1, shared_ptr e2) +bool NearestAttackableTargetGoal::DistComp::operator() (std::shared_ptr e1, std::shared_ptr e2) { // Should return true if e1 comes before e2 in the sorted list double distSqr1 = source->distanceToSqr(e1); @@ -38,7 +38,7 @@ bool NearestAttackableTargetGoal::canUse() if (randomInterval > 0 && mob->getRandom()->nextInt(randomInterval) != 0) return false; if (targetType == typeid(Player)) { - shared_ptr potentialTarget = mob->level->getNearestAttackablePlayer(mob->shared_from_this(), within); + std::shared_ptr potentialTarget = mob->level->getNearestAttackablePlayer(mob->shared_from_this(), within); if (canAttack(potentialTarget, false)) { target = weak_ptr(potentialTarget); @@ -47,12 +47,12 @@ bool NearestAttackableTargetGoal::canUse() } else { - vector > *entities = mob->level->getEntitiesOfClass(targetType, mob->bb->grow(within, 4, within)); + vector > *entities = mob->level->getEntitiesOfClass(targetType, mob->bb->grow(within, 4, within)); //Collections.sort(entities, distComp); std::sort(entities->begin(), entities->end(), *distComp); for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { - shared_ptr potTarget = dynamic_pointer_cast(*it); + std::shared_ptr potTarget = dynamic_pointer_cast(*it); if (canAttack(potTarget, false)) { target = weak_ptr(potTarget); diff --git a/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.h b/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.h index a10e9264b..af7968407 100644 --- a/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.h +++ b/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.h @@ -13,7 +13,7 @@ public: public: DistComp(Entity *source); - bool operator() (shared_ptr e1, shared_ptr e2); + bool operator() (std::shared_ptr e1, std::shared_ptr e2); }; private: diff --git a/Minecraft.World/AI/Goals/OcelotAttackGoal.cpp b/Minecraft.World/AI/Goals/OcelotAttackGoal.cpp index 2573e86f7..c868e5bdb 100644 --- a/Minecraft.World/AI/Goals/OcelotAttackGoal.cpp +++ b/Minecraft.World/AI/Goals/OcelotAttackGoal.cpp @@ -20,7 +20,7 @@ OzelotAttackGoal::OzelotAttackGoal(Mob *mob) bool OzelotAttackGoal::canUse() { - shared_ptr bestTarget = mob->getTarget(); + std::shared_ptr bestTarget = mob->getTarget(); if (bestTarget == NULL) return false; target = weak_ptr(bestTarget); return true; diff --git a/Minecraft.World/AI/Goals/OcelotSitOnTileGoal.cpp b/Minecraft.World/AI/Goals/OcelotSitOnTileGoal.cpp index 33dfdd44c..280da8c70 100644 --- a/Minecraft.World/AI/Goals/OcelotSitOnTileGoal.cpp +++ b/Minecraft.World/AI/Goals/OcelotSitOnTileGoal.cpp @@ -107,7 +107,7 @@ bool OcelotSitOnTileGoal::isValidTarget(Level *level, int x, int y, int z) if (tile == Tile::chest_Id) { - shared_ptr chest = dynamic_pointer_cast(level->getTileEntity(x, y, z)); + std::shared_ptr chest = dynamic_pointer_cast(level->getTileEntity(x, y, z)); if (chest->openCount < 1) { diff --git a/Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.cpp b/Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.cpp index 27ef835d2..d45f0f2ae 100644 --- a/Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.cpp @@ -12,7 +12,7 @@ OwnerHurtByTargetGoal::OwnerHurtByTargetGoal(TamableAnimal *tameAnimal) : Target bool OwnerHurtByTargetGoal::canUse() { if (!tameAnimal->isTame()) return false; - shared_ptr owner = tameAnimal->getOwner(); + std::shared_ptr owner = tameAnimal->getOwner(); if (owner == NULL) return false; ownerLastHurtBy = weak_ptr(owner->getLastHurtByMob()); return canAttack(ownerLastHurtBy.lock(), false); diff --git a/Minecraft.World/AI/Goals/OwnerHurtTargetGoal.cpp b/Minecraft.World/AI/Goals/OwnerHurtTargetGoal.cpp index 107cd1f58..29f0965fc 100644 --- a/Minecraft.World/AI/Goals/OwnerHurtTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/OwnerHurtTargetGoal.cpp @@ -12,7 +12,7 @@ OwnerHurtTargetGoal::OwnerHurtTargetGoal(TamableAnimal *tameAnimal) : TargetGoal bool OwnerHurtTargetGoal::canUse() { if (!tameAnimal->isTame()) return false; - shared_ptr owner = tameAnimal->getOwner(); + std::shared_ptr owner = tameAnimal->getOwner(); if (owner == NULL) return false; ownerLastHurt = weak_ptr(owner->getLastHurtMob()); return canAttack(ownerLastHurt.lock(), false); diff --git a/Minecraft.World/AI/Goals/PlayGoal.cpp b/Minecraft.World/AI/Goals/PlayGoal.cpp index 204419831..ce04832b2 100644 --- a/Minecraft.World/AI/Goals/PlayGoal.cpp +++ b/Minecraft.World/AI/Goals/PlayGoal.cpp @@ -25,14 +25,14 @@ bool PlayGoal::canUse() if (mob->getAge() >= 0) return false; if (mob->getRandom()->nextInt(400) != 0) return false; - vector > *children = mob->level->getEntitiesOfClass(typeid(Villager), mob->bb->grow(6, 3, 6)); + vector > *children = mob->level->getEntitiesOfClass(typeid(Villager), mob->bb->grow(6, 3, 6)); double closestDistSqr = Double::MAX_VALUE; //for (Entity c : children) for(AUTO_VAR(it, children->begin()); it != children->end(); ++it) { - shared_ptr c = *it; + std::shared_ptr c = *it; if (c.get() == mob) continue; - shared_ptr friendV = dynamic_pointer_cast(c); + std::shared_ptr friendV = dynamic_pointer_cast(c); if (friendV->isChasing()) continue; if (friendV->getAge() >= 0) continue; double distSqr = friendV->distanceToSqr(mob->shared_from_this()); diff --git a/Minecraft.World/AI/Goals/RestrictOpenDoorGoal.cpp b/Minecraft.World/AI/Goals/RestrictOpenDoorGoal.cpp index 06bb5f917..0b1588184 100644 --- a/Minecraft.World/AI/Goals/RestrictOpenDoorGoal.cpp +++ b/Minecraft.World/AI/Goals/RestrictOpenDoorGoal.cpp @@ -13,9 +13,9 @@ RestrictOpenDoorGoal::RestrictOpenDoorGoal(PathfinderMob *mob) 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); + std::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; - shared_ptr _doorInfo = village->getClosestDoorInfo(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)); + std::shared_ptr _doorInfo = village->getClosestDoorInfo(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)); if (_doorInfo == NULL) return false; doorInfo = _doorInfo; return _doorInfo->distanceToInsideSqr(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)) < 1.5 * 1.5; @@ -24,7 +24,7 @@ bool RestrictOpenDoorGoal::canUse() bool RestrictOpenDoorGoal::canContinueToUse() { if (mob->level->isDay()) return false; - shared_ptr _doorInfo = doorInfo.lock(); + std::shared_ptr _doorInfo = doorInfo.lock(); if ( _doorInfo == NULL ) return false; return !_doorInfo->removed && _doorInfo->isInsideSide(Mth::floor(mob->x), Mth::floor(mob->z)); } @@ -44,6 +44,6 @@ void RestrictOpenDoorGoal::stop() void RestrictOpenDoorGoal::tick() { - shared_ptr _doorInfo = doorInfo.lock(); + std::shared_ptr _doorInfo = doorInfo.lock(); if ( _doorInfo ) _doorInfo->incBookingCount(); } \ No newline at end of file diff --git a/Minecraft.World/AI/Goals/SitGoal.cpp b/Minecraft.World/AI/Goals/SitGoal.cpp index 4b48b232b..2b0862eef 100644 --- a/Minecraft.World/AI/Goals/SitGoal.cpp +++ b/Minecraft.World/AI/Goals/SitGoal.cpp @@ -20,7 +20,7 @@ bool SitGoal::canUse() if (mob->isInWater()) return false; if (!mob->onGround) return false; - shared_ptr owner = mob->getOwner(); + std::shared_ptr owner = mob->getOwner(); if (owner == NULL) return true; // owner not on level if (mob->distanceToSqr(owner) < FollowOwnerGoal::TeleportDistance * FollowOwnerGoal::TeleportDistance && owner->getLastHurtByMob() != NULL) return false; diff --git a/Minecraft.World/AI/Goals/SwellGoal.cpp b/Minecraft.World/AI/Goals/SwellGoal.cpp index 0d9afeea2..3589a3972 100644 --- a/Minecraft.World/AI/Goals/SwellGoal.cpp +++ b/Minecraft.World/AI/Goals/SwellGoal.cpp @@ -15,7 +15,7 @@ SwellGoal::SwellGoal(Creeper *creeper) bool SwellGoal::canUse() { - shared_ptr target = creeper->getTarget(); + std::shared_ptr target = creeper->getTarget(); return creeper->getSwellDir() > 0 || (target != NULL && (creeper->distanceToSqr(target) < 3 * 3)); } diff --git a/Minecraft.World/AI/Goals/TakeFlowerGoal.cpp b/Minecraft.World/AI/Goals/TakeFlowerGoal.cpp index e9772e313..a15308578 100644 --- a/Minecraft.World/AI/Goals/TakeFlowerGoal.cpp +++ b/Minecraft.World/AI/Goals/TakeFlowerGoal.cpp @@ -23,7 +23,7 @@ bool TakeFlowerGoal::canUse() if (villager->getAge() >= 0) return false; if (!villager->level->isDay()) return false; - vector > *golems = villager->level->getEntitiesOfClass(typeid(VillagerGolem), villager->bb->grow(6, 2, 6)); + vector > *golems = villager->level->getEntitiesOfClass(typeid(VillagerGolem), villager->bb->grow(6, 2, 6)); if (golems->size() == 0) { delete golems; @@ -33,7 +33,7 @@ bool TakeFlowerGoal::canUse() //for (Entity e : golems) for(AUTO_VAR(it,golems->begin()); it != golems->end(); ++it) { - shared_ptr vg = dynamic_pointer_cast(*it); + std::shared_ptr vg = dynamic_pointer_cast(*it); if (vg->getOfferFlowerTick() > 0) { golem = weak_ptr(vg); diff --git a/Minecraft.World/AI/Goals/TargetGoal.cpp b/Minecraft.World/AI/Goals/TargetGoal.cpp index 135a331bf..0fdd880c1 100644 --- a/Minecraft.World/AI/Goals/TargetGoal.cpp +++ b/Minecraft.World/AI/Goals/TargetGoal.cpp @@ -32,7 +32,7 @@ TargetGoal::TargetGoal(Mob *mob, float within, bool mustSee, bool mustReach) bool TargetGoal::canContinueToUse() { - shared_ptr target = mob->getTarget(); + std::shared_ptr target = mob->getTarget(); if (target == NULL) return false; if (!target->isAlive()) return false; if (mob->distanceToSqr(target) > within * within) return false; @@ -62,17 +62,17 @@ void TargetGoal::stop() mob->setTarget(nullptr); } -bool TargetGoal::canAttack(shared_ptr target, bool allowInvulnerable) +bool TargetGoal::canAttack(std::shared_ptr target, bool allowInvulnerable) { if (target == NULL) return false; if (target == mob->shared_from_this()) return false; if (!target->isAlive()) return false; if (!mob->canAttackType(target->GetType())) return false; - shared_ptr tamableAnimal = dynamic_pointer_cast(mob->shared_from_this()); + std::shared_ptr tamableAnimal = dynamic_pointer_cast(mob->shared_from_this()); if (tamableAnimal != NULL && tamableAnimal->isTame()) { - shared_ptr tamableTarget = dynamic_pointer_cast(target); + std::shared_ptr tamableTarget = dynamic_pointer_cast(target); if (tamableTarget != NULL && tamableTarget->isTame()) return false; if (target == tamableAnimal->getOwner()) return false; } @@ -95,7 +95,7 @@ bool TargetGoal::canAttack(shared_ptr target, bool allowInvulnerable) return true; } -bool TargetGoal::canReach(shared_ptr target) +bool TargetGoal::canReach(std::shared_ptr target) { reachCacheTime = 10 + mob->getRandom()->nextInt(5); Path *path = mob->getNavigation()->createPath(target); diff --git a/Minecraft.World/AI/Goals/TargetGoal.h b/Minecraft.World/AI/Goals/TargetGoal.h index 3bb9da099..2e6765fec 100644 --- a/Minecraft.World/AI/Goals/TargetGoal.h +++ b/Minecraft.World/AI/Goals/TargetGoal.h @@ -37,8 +37,8 @@ public: virtual void stop(); protected: - virtual bool canAttack(shared_ptr target, bool allowInvulnerable); + virtual bool canAttack(std::shared_ptr target, bool allowInvulnerable); private: - bool canReach(shared_ptr target); + bool canReach(std::shared_ptr target); }; \ No newline at end of file diff --git a/Minecraft.World/AI/Goals/TemptGoal.cpp b/Minecraft.World/AI/Goals/TemptGoal.cpp index 1f8b29711..3d703db42 100644 --- a/Minecraft.World/AI/Goals/TemptGoal.cpp +++ b/Minecraft.World/AI/Goals/TemptGoal.cpp @@ -31,7 +31,7 @@ bool TemptGoal::canUse() player = weak_ptr(mob->level->getNearestPlayer(mob->shared_from_this(), 10)); if (player.lock() == NULL) 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(); + std::shared_ptr item = player.lock()->getSelectedItem(); if (item == NULL) return false; if (item->id != itemId) return false; return true; diff --git a/Minecraft.World/AI/Goals/TradeWithPlayerGoal.cpp b/Minecraft.World/AI/Goals/TradeWithPlayerGoal.cpp index 03f98779d..be2a580b6 100644 --- a/Minecraft.World/AI/Goals/TradeWithPlayerGoal.cpp +++ b/Minecraft.World/AI/Goals/TradeWithPlayerGoal.cpp @@ -18,7 +18,7 @@ bool TradeWithPlayerGoal::canUse() if (!mob->onGround) return false; if (mob->hurtMarked) return false; - shared_ptr trader = mob->getTradingPlayer(); + std::shared_ptr trader = mob->getTradingPlayer(); if (trader == NULL) { // no interaction diff --git a/Minecraft.World/AI/Navigation/Path.cpp b/Minecraft.World/AI/Navigation/Path.cpp index 253a60245..c1bb79f28 100644 --- a/Minecraft.World/AI/Navigation/Path.cpp +++ b/Minecraft.World/AI/Navigation/Path.cpp @@ -74,7 +74,7 @@ void Path::setIndex(int index) this->index = index; } -Vec3 *Path::getPos(shared_ptr e, int index) +Vec3 *Path::getPos(std::shared_ptr e, int index) { double x = nodes[index]->x + (int) (e->bbWidth + 1) * 0.5; double y = nodes[index]->y; @@ -82,7 +82,7 @@ Vec3 *Path::getPos(shared_ptr e, int index) return Vec3::newTemp(x, y, z); } -Vec3 *Path::currentPos(shared_ptr e) +Vec3 *Path::currentPos(std::shared_ptr e) { return getPos(e, index); } diff --git a/Minecraft.World/AI/Navigation/Path.h b/Minecraft.World/AI/Navigation/Path.h index 01f56e722..b579a7b8a 100644 --- a/Minecraft.World/AI/Navigation/Path.h +++ b/Minecraft.World/AI/Navigation/Path.h @@ -21,9 +21,9 @@ public: void setSize(int length); int getIndex(); void setIndex(int index); - Vec3 *getPos(shared_ptr e, int index); + Vec3 *getPos(std::shared_ptr e, int index); NodeArray Getarray(); - Vec3 *currentPos(shared_ptr e); + Vec3 *currentPos(std::shared_ptr e); Vec3 *currentPos(); bool sameAs(Path *path); bool endsIn(Vec3 *pos); diff --git a/Minecraft.World/AI/Navigation/PathNavigation.cpp b/Minecraft.World/AI/Navigation/PathNavigation.cpp index fc40e0d18..4e046b1a4 100644 --- a/Minecraft.World/AI/Navigation/PathNavigation.cpp +++ b/Minecraft.World/AI/Navigation/PathNavigation.cpp @@ -92,13 +92,13 @@ bool PathNavigation::moveTo(double x, double y, double z, float speed) return moveTo(newPath, speed); } -Path *PathNavigation::createPath(shared_ptr target) +Path *PathNavigation::createPath(std::shared_ptr target) { if (!canUpdatePath()) return NULL; return level->findPath(mob->shared_from_this(), target, maxDist, _canPassDoors, _canOpenDoors, avoidWater, canFloat); } -bool PathNavigation::moveTo(shared_ptr target, float speed) +bool PathNavigation::moveTo(std::shared_ptr target, float speed) { MemSect(53); Path *newPath = createPath(target); diff --git a/Minecraft.World/AI/Navigation/PathNavigation.h b/Minecraft.World/AI/Navigation/PathNavigation.h index b8a8cfd6f..9dd40c1d0 100644 --- a/Minecraft.World/AI/Navigation/PathNavigation.h +++ b/Minecraft.World/AI/Navigation/PathNavigation.h @@ -37,8 +37,8 @@ public: void setCanFloat(bool canFloat); Path *createPath(double x, double y, double z); bool moveTo(double x, double y, double z, float speed); - Path *createPath(shared_ptr target); - bool moveTo(shared_ptr target, float speed); + Path *createPath(std::shared_ptr target); + bool moveTo(std::shared_ptr target, float speed); bool moveTo(Path *newPath, float speed); Path *getPath(); void tick(); diff --git a/Minecraft.World/AI/Navigation/RandomPos.cpp b/Minecraft.World/AI/Navigation/RandomPos.cpp index 7c9a5f061..6ddf8b294 100644 --- a/Minecraft.World/AI/Navigation/RandomPos.cpp +++ b/Minecraft.World/AI/Navigation/RandomPos.cpp @@ -5,12 +5,12 @@ Vec3 *RandomPos::tempDir = Vec3::newPermanent(0, 0, 0); -Vec3 *RandomPos::getPos(shared_ptr mob, int xzDist, int yDist, int quadrant/*=-1*/) // 4J - added quadrant +Vec3 *RandomPos::getPos(std::shared_ptr mob, int xzDist, int yDist, int quadrant/*=-1*/) // 4J - added quadrant { return generateRandomPos(mob, xzDist, yDist, NULL, quadrant); } -Vec3 *RandomPos::getPosTowards(shared_ptr mob, int xzDist, int yDist, Vec3 *towardsPos) +Vec3 *RandomPos::getPosTowards(std::shared_ptr mob, int xzDist, int yDist, Vec3 *towardsPos) { tempDir->x = towardsPos->x - mob->x; tempDir->y = towardsPos->y - mob->y; @@ -18,7 +18,7 @@ Vec3 *RandomPos::getPosTowards(shared_ptr mob, int xzDist, int yD return generateRandomPos(mob, xzDist, yDist, tempDir); } -Vec3 *RandomPos::getPosAvoid(shared_ptr mob, int xzDist, int yDist, Vec3 *avoidPos) +Vec3 *RandomPos::getPosAvoid(std::shared_ptr mob, int xzDist, int yDist, Vec3 *avoidPos) { tempDir->x = mob->x - avoidPos->x; tempDir->y = mob->y - avoidPos->y; @@ -26,7 +26,7 @@ Vec3 *RandomPos::getPosAvoid(shared_ptr mob, int xzDist, int yDis return generateRandomPos(mob, xzDist, yDist, tempDir); } -Vec3 *RandomPos::generateRandomPos(shared_ptr mob, int xzDist, int yDist, Vec3 *dir, int quadrant/*=-1*/) // 4J - added quadrant +Vec3 *RandomPos::generateRandomPos(std::shared_ptr mob, int xzDist, int yDist, Vec3 *dir, int quadrant/*=-1*/) // 4J - added quadrant { Random *random = mob->getRandom(); bool hasBest = false; diff --git a/Minecraft.World/AI/Navigation/RandomPos.h b/Minecraft.World/AI/Navigation/RandomPos.h index eceed17e3..a5ee447ba 100644 --- a/Minecraft.World/AI/Navigation/RandomPos.h +++ b/Minecraft.World/AI/Navigation/RandomPos.h @@ -8,10 +8,10 @@ private: static Vec3 *tempDir; public: - static Vec3 *getPos(shared_ptr mob, int xzDist, int yDist, int quadrant = -1); // 4J added quadrant - static Vec3 *getPosTowards(shared_ptr mob, int xzDist, int yDist, Vec3 *towardsPos); - static Vec3 *getPosAvoid(shared_ptr mob, int xzDist, int yDist, Vec3 *avoidPos); + static Vec3 *getPos(std::shared_ptr mob, int xzDist, int yDist, int quadrant = -1); // 4J added quadrant + static Vec3 *getPosTowards(std::shared_ptr mob, int xzDist, int yDist, Vec3 *towardsPos); + static Vec3 *getPosAvoid(std::shared_ptr mob, int xzDist, int yDist, Vec3 *avoidPos); private: - static Vec3 *generateRandomPos(shared_ptr mob, int xzDist, int yDist, Vec3 *dir, int quadrant = -1); // 4J added quadrant + static Vec3 *generateRandomPos(std::shared_ptr mob, int xzDist, int yDist, Vec3 *dir, int quadrant = -1); // 4J added quadrant }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/AnvilTile.cpp b/Minecraft.World/Blocks/AnvilTile.cpp index f23fb3fcb..761b1a03b 100644 --- a/Minecraft.World/Blocks/AnvilTile.cpp +++ b/Minecraft.World/Blocks/AnvilTile.cpp @@ -55,7 +55,7 @@ void AnvilTile::registerIcons(IconRegister *iconRegister) } } -void AnvilTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void AnvilTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int dir = (Mth::floor(by->yRot * 4 / (360) + 0.5)) & 3; int dmg = level->getData(x, y, z) >> 2; @@ -67,7 +67,7 @@ void AnvilTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr b if (dir == 3) level->setData(x, y, z, Direction::WEST | (dmg << 2)); } -bool AnvilTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly) +bool AnvilTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly) { if (level->isClientSide) { @@ -87,7 +87,7 @@ int AnvilTile::getSpawnResourcesAuxValue(int data) return data >> 2; } -void AnvilTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) +void AnvilTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) { int dir = level->getData(x, y, z) & 3; @@ -101,7 +101,7 @@ void AnvilTile::updateShape(LevelSource *level, int x, int y, int z, int forceDa } } -void AnvilTile::falling(shared_ptr entity) +void AnvilTile::falling(std::shared_ptr entity) { entity->setHurtsEntities(true); } diff --git a/Minecraft.World/Blocks/AnvilTile.h b/Minecraft.World/Blocks/AnvilTile.h index 1a4f0ed77..e625777d9 100644 --- a/Minecraft.World/Blocks/AnvilTile.h +++ b/Minecraft.World/Blocks/AnvilTile.h @@ -35,14 +35,14 @@ public: bool isSolidRender(bool isServerLevel = false); Icon *getTexture(int face, int data); void registerIcons(IconRegister *iconRegister); - void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); - bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); + void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); + bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); int getRenderShape(); int getSpawnResourcesAuxValue(int data); - void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); + void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); protected: - void falling(shared_ptr entity); + void falling(std::shared_ptr entity); public: void onLand(Level *level, int xt, int yt, int zt, int data); diff --git a/Minecraft.World/Blocks/BedTile.cpp b/Minecraft.World/Blocks/BedTile.cpp index a7a61c4dd..2075df8f2 100644 --- a/Minecraft.World/Blocks/BedTile.cpp +++ b/Minecraft.World/Blocks/BedTile.cpp @@ -28,7 +28,7 @@ void BedTile::updateDefaultShape() } // 4J-PB - Adding a TestUse for tooltip display -bool BedTile::TestUse(Level *level, int x, int y, int z, shared_ptr player) +bool BedTile::TestUse(Level *level, int x, int y, int z, std::shared_ptr player) { //if (level->isClientSide) return true; @@ -65,7 +65,7 @@ bool BedTile::TestUse(Level *level, int x, int y, int z, shared_ptr play return false; } -bool BedTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool BedTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if( soundOnly) return false; if (level->isClientSide) return true; @@ -106,11 +106,11 @@ bool BedTile::use(Level *level, int x, int y, int z, shared_ptr player, if (BedTile::isOccupied(data)) { - shared_ptr sleepingPlayer = nullptr; + std::shared_ptr sleepingPlayer = nullptr; AUTO_VAR(itEnd, level->players.end()); for (AUTO_VAR(it, level->players.begin()); it != itEnd; it++ ) { - shared_ptr p = *it; + std::shared_ptr p = *it; if (p->isSleeping()) { Pos pos = p->bedPosition; @@ -211,7 +211,7 @@ bool BedTile::isSolidRender(bool isServerLevel) return false; } -void BedTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void BedTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { setShape(); } diff --git a/Minecraft.World/Blocks/BedTile.h b/Minecraft.World/Blocks/BedTile.h index 339080d32..8cd68ba90 100644 --- a/Minecraft.World/Blocks/BedTile.h +++ b/Minecraft.World/Blocks/BedTile.h @@ -25,15 +25,15 @@ public: BedTile(int id); virtual void updateDefaultShape(); - virtual bool TestUse(Level *level, int x, int y, int z, shared_ptr player); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual bool TestUse(Level *level, int x, int y, int z, std::shared_ptr player); + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param virtual Icon *getTexture(int face, int data); //@Override void registerIcons(IconRegister *iconRegister); virtual int getRenderShape(); virtual bool isCubeShaped(); virtual bool isSolidRender(bool isServerLevel = 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 + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual void neighborChanged(Level *level, int x, int y, int z, int type); virtual int getResource(int data, Random *random,int playerBonusLevel); diff --git a/Minecraft.World/Blocks/BrewingStandTile.cpp b/Minecraft.World/Blocks/BrewingStandTile.cpp index 5e453738a..fcdff6e91 100644 --- a/Minecraft.World/Blocks/BrewingStandTile.cpp +++ b/Minecraft.World/Blocks/BrewingStandTile.cpp @@ -29,9 +29,9 @@ int BrewingStandTile::getRenderShape() return SHAPE_BREWING_STAND; } -shared_ptr BrewingStandTile::newTileEntity(Level *level) +std::shared_ptr BrewingStandTile::newTileEntity(Level *level) { - return shared_ptr(new BrewingStandTileEntity()); + return std::shared_ptr(new BrewingStandTileEntity()); } bool BrewingStandTile::isCubeShaped() @@ -39,7 +39,7 @@ bool BrewingStandTile::isCubeShaped() return false; } -void BrewingStandTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void BrewingStandTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source) { setShape(7.0f / 16.0f, 0, 7.0f / 16.0f, 9.0f / 16.0f, 14.0f / 16.0f, 9.0f / 16.0f); EntityTile::addAABBs(level, x, y, z, box, boxes, source); @@ -52,7 +52,7 @@ void BrewingStandTile::updateDefaultShape() setShape(0, 0, 0, 1, 2.0f / 16.0f, 1); } -bool BrewingStandTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool BrewingStandTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if(soundOnly) return false; @@ -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)); + std::shared_ptr brewingStand = dynamic_pointer_cast(level->getTileEntity(x, y, z)); if (brewingStand != NULL) player->openBrewingStand(brewingStand); return true; @@ -78,13 +78,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); + std::shared_ptr tileEntity = level->getTileEntity(x, y, z); if (tileEntity != NULL && ( dynamic_pointer_cast(tileEntity) != NULL) ) { - shared_ptr container = dynamic_pointer_cast(tileEntity); + std::shared_ptr container = dynamic_pointer_cast(tileEntity); for (int i = 0; i < container->getContainerSize(); i++) { - shared_ptr item = container->getItem(i); + std::shared_ptr item = container->getItem(i); if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; @@ -97,7 +97,7 @@ void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int d if (count > item->count) count = item->count; item->count -= count; - shared_ptr itemEntity = shared_ptr(new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr( new ItemInstance(item->id, count, item->getAuxValue())))); + std::shared_ptr itemEntity = std::shared_ptr(new ItemEntity(level, x + xo, y + yo, z + zo, std::shared_ptr( new ItemInstance(item->id, count, item->getAuxValue())))); float pow = 0.05f; itemEntity->xd = (float) random->nextGaussian() * pow; itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; diff --git a/Minecraft.World/Blocks/BrewingStandTile.h b/Minecraft.World/Blocks/BrewingStandTile.h index c58c9b8e2..29824c375 100644 --- a/Minecraft.World/Blocks/BrewingStandTile.h +++ b/Minecraft.World/Blocks/BrewingStandTile.h @@ -18,11 +18,11 @@ public: ~BrewingStandTile(); virtual bool isSolidRender(bool isServerLevel = false); virtual int getRenderShape(); - virtual shared_ptr newTileEntity(Level *level); + virtual std::shared_ptr newTileEntity(Level *level); virtual bool isCubeShaped(); - virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source); + virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source); virtual void updateDefaultShape(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param virtual void animateTick(Level *level, int xt, int yt, int zt, Random *random); virtual void onRemove(Level *level, int x, int y, int z, int id, int data); virtual int getResource(int data, Random *random, int playerBonusLevel); diff --git a/Minecraft.World/Blocks/ButtonTile.cpp b/Minecraft.World/Blocks/ButtonTile.cpp index 6a7cd3043..6abbd41c3 100644 --- a/Minecraft.World/Blocks/ButtonTile.cpp +++ b/Minecraft.World/Blocks/ButtonTile.cpp @@ -141,7 +141,7 @@ bool ButtonTile::checkCanSurvive(Level *level, int x, int y, int z) return true; } -void ButtonTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void ButtonTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { int data = level->getData(x, y, z); updateShape(data); @@ -176,7 +176,7 @@ void ButtonTile::updateShape(int data) } } -void ButtonTile::attack(Level *level, int x, int y, int z, shared_ptr player) +void ButtonTile::attack(Level *level, int x, int y, int z, std::shared_ptr player) { //use(level, x, y, z, player, 0, 0, 0, 0); } @@ -187,7 +187,7 @@ bool ButtonTile::TestUse() return true; } -bool ButtonTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool ButtonTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if( soundOnly) { @@ -279,7 +279,7 @@ void ButtonTile::updateDefaultShape() setShape(0.5f - x, 0.5f - y, 0.5f - z, 0.5f + x, 0.5f + y, 0.5f + z); } -void ButtonTile::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +void ButtonTile::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) { if (level->isClientSide) return; if (!sensitive) return; @@ -301,7 +301,7 @@ void ButtonTile::checkPressed(Level *level, int x, int y, int z) updateShape(data); Tile::ThreadStorage *tls = (Tile::ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); - vector > *entities = level->getEntitiesOfClass(typeid(Arrow), AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1)); + vector > *entities = level->getEntitiesOfClass(typeid(Arrow), AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1)); shouldBePressed = !entities->empty(); delete entities; diff --git a/Minecraft.World/Blocks/ButtonTile.h b/Minecraft.World/Blocks/ButtonTile.h index 6c1703033..fb84c3455 100644 --- a/Minecraft.World/Blocks/ButtonTile.h +++ b/Minecraft.World/Blocks/ButtonTile.h @@ -37,22 +37,22 @@ private: bool checkCanSurvive(Level *level, int x, int y, int z); public: - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param private: void updateShape(int data); public: - virtual void attack(Level *level, int x, int y, int z, shared_ptr player); + virtual void attack(Level *level, int x, int y, int z, std::shared_ptr player); virtual bool TestUse(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param virtual void onRemove(Level *level, int x, int y, int z, int id, int data); virtual bool getSignal(LevelSource *level, int x, int y, int z, int dir); virtual bool getDirectSignal(Level *level, int x, int y, int z, int dir); virtual bool isSignalSource(); virtual void tick(Level *level, int x, int y, int z, Random *random); virtual void updateDefaultShape(); - void entityInside(Level *level, int x, int y, int z, shared_ptr entity); + void entityInside(Level *level, int x, int y, int z, std::shared_ptr entity); private: void checkPressed(Level *level, int x, int y, int z); diff --git a/Minecraft.World/Blocks/CactusTile.cpp b/Minecraft.World/Blocks/CactusTile.cpp index 74a300a13..5c020ac57 100644 --- a/Minecraft.World/Blocks/CactusTile.cpp +++ b/Minecraft.World/Blocks/CactusTile.cpp @@ -100,7 +100,7 @@ bool CactusTile::canSurvive(Level *level, int x, int y, int z) return below == Tile::cactus_Id || below == Tile::sand_Id; } -void CactusTile::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +void CactusTile::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) { entity->hurt(DamageSource::cactus, 1); } diff --git a/Minecraft.World/Blocks/CactusTile.h b/Minecraft.World/Blocks/CactusTile.h index 344267c65..cf95bb936 100644 --- a/Minecraft.World/Blocks/CactusTile.h +++ b/Minecraft.World/Blocks/CactusTile.h @@ -30,7 +30,7 @@ public: virtual bool mayPlace(Level *level, int x, int y, int z); virtual void neighborChanged(Level *level, int x, int y, int z, int type); virtual bool canSurvive(Level *level, int x, int y, int z); - virtual void entityInside(Level *level, int x, int y, int z, shared_ptr entity); + virtual void entityInside(Level *level, int x, int y, int z, std::shared_ptr entity); //@Override void registerIcons(IconRegister *iconRegister); diff --git a/Minecraft.World/Blocks/CakeTile.cpp b/Minecraft.World/Blocks/CakeTile.cpp index 183ddea84..26c7ad5f9 100644 --- a/Minecraft.World/Blocks/CakeTile.cpp +++ b/Minecraft.World/Blocks/CakeTile.cpp @@ -18,7 +18,7 @@ CakeTile::CakeTile(int id) : Tile(id, Material::cake,isSolidRender()) iconInner = NULL; } -void CakeTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void CakeTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { int d = level->getData(x, y, z); float r = 1 / 16.0f; @@ -84,19 +84,19 @@ bool CakeTile::TestUse() return true; } -bool CakeTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool CakeTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if( soundOnly ) return false; eat(level, x, y, z, player); return true; } -void CakeTile::attack(Level *level, int x, int y, int z, shared_ptr player) +void CakeTile::attack(Level *level, int x, int y, int z, std::shared_ptr player) { eat(level, x, y, z, player); } -void CakeTile::eat(Level *level, int x, int y, int z, shared_ptr player) +void CakeTile::eat(Level *level, int x, int y, int z, std::shared_ptr player) { if (player->canEat(false)) { diff --git a/Minecraft.World/Blocks/CakeTile.h b/Minecraft.World/Blocks/CakeTile.h index f3ce50cbd..b6f6bf84d 100644 --- a/Minecraft.World/Blocks/CakeTile.h +++ b/Minecraft.World/Blocks/CakeTile.h @@ -20,7 +20,7 @@ private: protected: CakeTile(int id); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual void updateDefaultShape(); virtual AABB *getAABB(Level *level, int x, int y, int z); virtual AABB *getTileAABB(Level *level, int x, int y, int z); @@ -30,10 +30,10 @@ protected: virtual bool isCubeShaped(); virtual bool isSolidRender(bool isServerLevel = false); virtual bool TestUse(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param - virtual void attack(Level *level, int x, int y, int z, shared_ptr player); + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual void attack(Level *level, int x, int y, int z, std::shared_ptr player); private: - void eat(Level *level, int x, int y, int z, shared_ptr player); + void eat(Level *level, int x, int y, int z, std::shared_ptr player); public: virtual bool mayPlace(Level *level, int x, int y, int z); virtual void neighborChanged(Level *level, int x, int y, int z, int type); diff --git a/Minecraft.World/Blocks/CauldronTile.cpp b/Minecraft.World/Blocks/CauldronTile.cpp index 4ad9e145e..8111aa9ab 100644 --- a/Minecraft.World/Blocks/CauldronTile.cpp +++ b/Minecraft.World/Blocks/CauldronTile.cpp @@ -46,7 +46,7 @@ Icon *CauldronTile::getTexture(const wstring &name) return NULL; } -void CauldronTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void CauldronTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source) { setShape(0, 0, 0, 1, 5.0f / 16.0f, 1); Tile::addAABBs(level, x, y, z, box, boxes, source); @@ -83,7 +83,7 @@ bool CauldronTile::isCubeShaped() return false; } -bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool CauldronTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if(soundOnly) return false; @@ -92,7 +92,7 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr pla return true; } - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); if (item == NULL) { return true; @@ -106,7 +106,7 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr pla { if (!player->abilities.instabuild) { - player->inventory->setItem(player->inventory->selected, shared_ptr(new ItemInstance(Item::bucket_empty))); + player->inventory->setItem(player->inventory->selected, std::shared_ptr(new ItemInstance(Item::bucket_empty))); } level->setData(x, y, z, 3); @@ -117,10 +117,10 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr pla { if (currentData > 0) { - shared_ptr potion = shared_ptr(new ItemInstance(Item::potion, 1, 0)); + std::shared_ptr potion = std::shared_ptr(new ItemInstance(Item::potion, 1, 0)); if (!player->inventory->add(potion)) { - level->addEntity(shared_ptr(new ItemEntity(level, x + 0.5, y + 1.5, z + 0.5, potion))); + level->addEntity(std::shared_ptr(new ItemEntity(level, x + 0.5, y + 1.5, z + 0.5, potion))); } // 4J Stu - Brought forward change to update inventory when filling bottles with water else if (dynamic_pointer_cast( player ) != NULL) diff --git a/Minecraft.World/Blocks/CauldronTile.h b/Minecraft.World/Blocks/CauldronTile.h index 4ed3fc90e..61c98de35 100644 --- a/Minecraft.World/Blocks/CauldronTile.h +++ b/Minecraft.World/Blocks/CauldronTile.h @@ -21,12 +21,12 @@ public: //@Override void registerIcons(IconRegister *iconRegister); static Icon *getTexture(const wstring &name); - virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source); + virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source); virtual void updateDefaultShape(); virtual bool isSolidRender(bool isServerLevel = false); virtual int getRenderShape(); virtual bool isCubeShaped(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param virtual void handleRain(Level *level, int x, int y, int z); virtual int getResource(int data, Random *random, int playerBonusLevel); virtual int cloneTileId(Level *level, int x, int y, int z); diff --git a/Minecraft.World/Blocks/ChestTile.cpp b/Minecraft.World/Blocks/ChestTile.cpp index b3b417aa4..38d236b6d 100644 --- a/Minecraft.World/Blocks/ChestTile.cpp +++ b/Minecraft.World/Blocks/ChestTile.cpp @@ -37,7 +37,7 @@ int ChestTile::getRenderShape() return Tile::SHAPE_ENTITYTILE_ANIMATED; } -void ChestTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) +void ChestTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) { if (level->getTile(x, y, z - 1) == id) { @@ -76,7 +76,7 @@ void ChestTile::onPlace(Level *level, int x, int y, int z) if (e == id) recalcLockDir(level, x + 1, y, z); } -void ChestTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void ChestTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int n = level->getTile(x, y, z - 1); // face = 2 int s = level->getTile(x, y, z + 1); // face = 3 @@ -200,18 +200,18 @@ bool ChestTile::isFullChest(Level *level, int x, int y, int z) void ChestTile::neighborChanged(Level *level, int x, int y, int z, int type) { EntityTile::neighborChanged(level, x, y, z, type); - shared_ptr(cte) = dynamic_pointer_cast(level->getTileEntity(x, y, z)); + std::shared_ptr(cte) = dynamic_pointer_cast(level->getTileEntity(x, y, z)); if (cte != NULL) 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) ); + std::shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); if (container != NULL ) { for (unsigned int i = 0; i < container->getContainerSize(); i++) { - shared_ptr item = container->getItem(i); + std::shared_ptr item = container->getItem(i); if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; @@ -224,9 +224,9 @@ void ChestTile::onRemove(Level *level, int x, int y, int z, int id, int data) if (count > item->count) count = item->count; item->count -= count; - shared_ptr newItem = shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ); + std::shared_ptr newItem = std::shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ); newItem->set4JData( item->get4JData() ); - shared_ptr itemEntity = shared_ptr(new ItemEntity(level, x + xo, y + yo, z + zo, newItem ) ); + std::shared_ptr itemEntity = std::shared_ptr(new ItemEntity(level, x + xo, y + yo, z + zo, newItem ) ); float pow = 0.05f; itemEntity->xd = (float) random->nextGaussian() * pow; itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; @@ -254,7 +254,7 @@ bool ChestTile::TestUse() } // 4J-PB - changing to 1.5 equivalent -bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool ChestTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if( soundOnly ) return true; @@ -263,7 +263,7 @@ bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr player return true; } - shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); + std::shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); if (container == NULL) return true; if (level->isSolidBlockingTile(x, y + 1, z)) return true; @@ -274,10 +274,10 @@ bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr player if (level->getTile(x, y, z - 1) == id && (level->isSolidBlockingTile(x, y + 1, z - 1) || isCatSittingOnChest(level, x, y, z - 1))) return true; if (level->getTile(x, y, z + 1) == id && (level->isSolidBlockingTile(x, y + 1, z + 1) || isCatSittingOnChest(level, x, y, z + 1))) return true; - if (level->getTile(x - 1, y, z) == id) container = shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast( level->getTileEntity(x - 1, y, z) ), container) ); - if (level->getTile(x + 1, y, z) == id) container = shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast( level->getTileEntity(x + 1, y, z) )) ); - if (level->getTile(x, y, z - 1) == id) container = shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast( level->getTileEntity(x, y, z - 1) ), container) ); - if (level->getTile(x, y, z + 1) == id) container = shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast( level->getTileEntity(x, y, z + 1) )) ); + if (level->getTile(x - 1, y, z) == id) container = std::shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast( level->getTileEntity(x - 1, y, z) ), container) ); + if (level->getTile(x + 1, y, z) == id) container = std::shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast( level->getTileEntity(x + 1, y, z) )) ); + if (level->getTile(x, y, z - 1) == id) container = std::shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast( level->getTileEntity(x, y, z - 1) ), container) ); + if (level->getTile(x, y, z + 1) == id) container = std::shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast( level->getTileEntity(x, y, z + 1) )) ); player->openContainer(container); @@ -287,10 +287,10 @@ bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr player // 4J-PB - added from 1.5 bool ChestTile::isCatSittingOnChest(Level *level, int x, int y, int z) { - vector > *entities = level->getEntitiesOfClass(typeid(Ozelot), AABB::newTemp(x, y + 1, z, x + 1, y + 2, z + 1)); + vector > *entities = level->getEntitiesOfClass(typeid(Ozelot), AABB::newTemp(x, y + 1, z, x + 1, y + 2, z + 1)); for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { - shared_ptr ocelot = dynamic_pointer_cast(*it); + std::shared_ptr ocelot = dynamic_pointer_cast(*it); if(ocelot->isSitting()) { return true; @@ -300,10 +300,10 @@ bool ChestTile::isCatSittingOnChest(Level *level, int x, int y, int z) return false; } -shared_ptr ChestTile::newTileEntity(Level *level) +std::shared_ptr ChestTile::newTileEntity(Level *level) { MemSect(50); - shared_ptr retval = shared_ptr( new ChestTileEntity() ); + std::shared_ptr retval = std::shared_ptr( new ChestTileEntity() ); MemSect(0); return retval; } diff --git a/Minecraft.World/Blocks/ChestTile.h b/Minecraft.World/Blocks/ChestTile.h index 0e96b5c5d..eae9821a1 100644 --- a/Minecraft.World/Blocks/ChestTile.h +++ b/Minecraft.World/Blocks/ChestTile.h @@ -19,9 +19,9 @@ public: virtual bool isSolidRender(bool isServerLevel = false); virtual bool isCubeShaped(); virtual int getRenderShape(); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity = shared_ptr()); + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity = std::shared_ptr()); virtual void onPlace(Level *level, int x, int y, int z); - virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); + virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); void recalcLockDir(Level *level, int x, int y, int z); virtual bool mayPlace(Level *level, int x, int y, int z); private: @@ -31,8 +31,8 @@ public: virtual void neighborChanged(Level *level, int x, int y, int z, int type); virtual void onRemove(Level *level, int x, int y, int z, int id, int data); virtual bool TestUse(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param - shared_ptr newTileEntity(Level *level); + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + std::shared_ptr newTileEntity(Level *level); //@Override void registerIcons(IconRegister *iconRegister); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/CocoaTile.cpp b/Minecraft.World/Blocks/CocoaTile.cpp index 26155b0f5..7c24edde4 100644 --- a/Minecraft.World/Blocks/CocoaTile.cpp +++ b/Minecraft.World/Blocks/CocoaTile.cpp @@ -84,7 +84,7 @@ AABB *CocoaTile::getTileAABB(Level *level, int x, int y, int z) return DirectionalTile::getTileAABB(level, x, y, z); } -void CocoaTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) +void CocoaTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) { int data = level->getData(x, y, z); int dir = getDirection(data); @@ -112,7 +112,7 @@ void CocoaTile::updateShape(LevelSource *level, int x, int y, int z, int forceDa } } -void CocoaTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by, shared_ptr itemInstance) +void CocoaTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by, std::shared_ptr itemInstance) { int dir = (((Mth::floor(by->yRot * 4 / (360) + 0.5)) & 3) + 0) % 4; level->setData(x, y, z, dir); @@ -151,7 +151,7 @@ void CocoaTile::spawnResources(Level *level, int x, int y, int z, int data, floa } for (int i = 0; i < count; i++) { - popResource(level, x, y, z, shared_ptr( new ItemInstance(Item::dye_powder, 1, DyePowderItem::BROWN) )); + popResource(level, x, y, z, std::shared_ptr( new ItemInstance(Item::dye_powder, 1, DyePowderItem::BROWN) )); } } diff --git a/Minecraft.World/Blocks/CocoaTile.h b/Minecraft.World/Blocks/CocoaTile.h index 267225ea4..81de72ead 100644 --- a/Minecraft.World/Blocks/CocoaTile.h +++ b/Minecraft.World/Blocks/CocoaTile.h @@ -25,8 +25,8 @@ public: virtual bool isSolidRender(bool isServerLevel = false); virtual AABB *getAABB(Level *level, int x, int y, int z); virtual AABB *getTileAABB(Level *level, int x, int y, int z); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); - virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by, shared_ptr itemInstance); + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); + virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by, std::shared_ptr itemInstance); virtual int getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, int itemValue); virtual void neighborChanged(Level *level, int x, int y, int z, int type); static int getAge(int data); diff --git a/Minecraft.World/Blocks/CropTile.cpp b/Minecraft.World/Blocks/CropTile.cpp index d397d2e6e..672599fc6 100644 --- a/Minecraft.World/Blocks/CropTile.cpp +++ b/Minecraft.World/Blocks/CropTile.cpp @@ -133,7 +133,7 @@ void CropTile::spawnResources(Level *level, int x, int y, int z, int data, float for (int i = 0; i < count; i++) { if (level->random->nextInt(5 * 3) > data) continue; - popResource(level, x, y, z, shared_ptr(new ItemInstance(getBaseSeedId(), 1, 0))); + popResource(level, x, y, z, std::shared_ptr(new ItemInstance(getBaseSeedId(), 1, 0))); } } } diff --git a/Minecraft.World/Blocks/DeadBushTile.cpp b/Minecraft.World/Blocks/DeadBushTile.cpp index 6ba90735b..c20762053 100644 --- a/Minecraft.World/Blocks/DeadBushTile.cpp +++ b/Minecraft.World/Blocks/DeadBushTile.cpp @@ -27,7 +27,7 @@ int DeadBushTile::getResource(int data, Random *random, int playerBonusLevel) return -1; } -void DeadBushTile::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) +void DeadBushTile::playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data) { if (!level->isClientSide && player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears_Id) { @@ -37,7 +37,7 @@ void DeadBushTile::playerDestroy(Level *level, shared_ptr player, int x, ); // drop leaf block instead of sapling - popResource(level, x, y, z, shared_ptr(new ItemInstance(Tile::deadBush, 1, data))); + popResource(level, x, y, z, std::shared_ptr(new ItemInstance(Tile::deadBush, 1, data))); } else { diff --git a/Minecraft.World/Blocks/DeadBushTile.h b/Minecraft.World/Blocks/DeadBushTile.h index cff3de256..3e46ff82e 100644 --- a/Minecraft.World/Blocks/DeadBushTile.h +++ b/Minecraft.World/Blocks/DeadBushTile.h @@ -12,5 +12,5 @@ protected: public: virtual void updateDefaultShape(); // 4J Added override virtual int getResource(int data, Random *random, int playerBonusLevel); - virtual void playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data); + virtual void playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data); }; diff --git a/Minecraft.World/Blocks/DetectorRailTile.cpp b/Minecraft.World/Blocks/DetectorRailTile.cpp index 26a63a5aa..bb3ed15b6 100644 --- a/Minecraft.World/Blocks/DetectorRailTile.cpp +++ b/Minecraft.World/Blocks/DetectorRailTile.cpp @@ -23,7 +23,7 @@ bool DetectorRailTile::isSignalSource() return true; } -void DetectorRailTile::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +void DetectorRailTile::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) { if (level->isClientSide) { @@ -69,7 +69,7 @@ void DetectorRailTile::checkPressed(Level *level, int x, int y, int z, int curre bool shouldBePressed = false; float b = 2 / 16.0f; - vector > *entities = level->getEntitiesOfClass(typeid(Minecart), AABB::newTemp(x + b, y, z + b, x + 1 - b, y + 1 - b, z + 1 - b)); + vector > *entities = level->getEntitiesOfClass(typeid(Minecart), AABB::newTemp(x + b, y, z + b, x + 1 - b, y + 1 - b, z + 1 - b)); if (!entities->empty()) { shouldBePressed = true; diff --git a/Minecraft.World/Blocks/DetectorRailTile.h b/Minecraft.World/Blocks/DetectorRailTile.h index dd0e63747..1dcca19b5 100644 --- a/Minecraft.World/Blocks/DetectorRailTile.h +++ b/Minecraft.World/Blocks/DetectorRailTile.h @@ -16,7 +16,7 @@ public: DetectorRailTile(int id); virtual int getTickDelay(); virtual bool isSignalSource(); - virtual void entityInside(Level *level, int x, int y, int z, shared_ptr entity); + virtual void entityInside(Level *level, int x, int y, int z, std::shared_ptr entity); virtual void tick(Level *level, int x, int y, int z, Random *random); virtual bool getSignal(LevelSource *level, int x, int y, int z, int dir); virtual bool getDirectSignal(Level *level, int x, int y, int z, int facing); diff --git a/Minecraft.World/Blocks/DiodeTile.cpp b/Minecraft.World/Blocks/DiodeTile.cpp index 46df57898..19fc2e1db 100644 --- a/Minecraft.World/Blocks/DiodeTile.cpp +++ b/Minecraft.World/Blocks/DiodeTile.cpp @@ -174,7 +174,7 @@ bool DiodeTile::TestUse() return true; } -bool DiodeTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool DiodeTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if( soundOnly) return false; @@ -191,7 +191,7 @@ bool DiodeTile::isSignalSource() return true; } -void DiodeTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void DiodeTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int dir = (((Mth::floor(by->yRot * 4 / (360) + 0.5)) & 3) + 2) % 4; level->setData(x, y, z, dir); diff --git a/Minecraft.World/Blocks/DiodeTile.h b/Minecraft.World/Blocks/DiodeTile.h index 003b011f2..ff3b7e88d 100644 --- a/Minecraft.World/Blocks/DiodeTile.h +++ b/Minecraft.World/Blocks/DiodeTile.h @@ -38,9 +38,9 @@ private: virtual bool getSourceSignal(Level *level, int x, int y, int z, int data); public: virtual bool TestUse(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param virtual bool isSignalSource(); - virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); + virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); virtual void onPlace(Level *level, int x, int y, int z); virtual void destroy(Level *level, int x, int y, int z, int data); virtual bool isSolidRender(bool isServerLevel = false); diff --git a/Minecraft.World/Blocks/DispenserTile.cpp b/Minecraft.World/Blocks/DispenserTile.cpp index 2155a6877..4a7eda55c 100644 --- a/Minecraft.World/Blocks/DispenserTile.cpp +++ b/Minecraft.World/Blocks/DispenserTile.cpp @@ -98,7 +98,7 @@ bool DispenserTile::TestUse() return true; } -bool DispenserTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool DispenserTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if( soundOnly) return false; @@ -107,7 +107,7 @@ bool DispenserTile::use(Level *level, int x, int y, int z, shared_ptr pl return true; } - shared_ptr trap = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); + std::shared_ptr trap = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); player->openTrap(trap); return true; @@ -138,7 +138,7 @@ void DispenserTile::fireArrow(Level *level, int x, int y, int z, Random *random) xd = -1; } - shared_ptr trap = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); + std::shared_ptr trap = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); if(trap != NULL) { int slot=trap->getRandomSlot(); @@ -152,7 +152,7 @@ void DispenserTile::fireArrow(Level *level, int x, int y, int z, Random *random) double xp = x + xd * 0.6 + 0.5; double yp = y + 0.5; double zp = z + zd * 0.6 + 0.5; - shared_ptr item=trap->getItem(slot); + std::shared_ptr item=trap->getItem(slot); int result = dispenseItem(trap, level, item, random, x, y, z, xd, zd, xp, yp, zp); if (result == REMOVE_ITEM) { @@ -190,12 +190,12 @@ void DispenserTile::tick(Level *level, int x, int y, int z, Random *random) } } -shared_ptr DispenserTile::newTileEntity(Level *level) +std::shared_ptr DispenserTile::newTileEntity(Level *level) { - return shared_ptr( new DispenserTileEntity() ); + return std::shared_ptr( new DispenserTileEntity() ); } -void DispenserTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void DispenserTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int dir = (Mth::floor(by->yRot * 4 / (360) + 0.5)) & 3; @@ -207,12 +207,12 @@ void DispenserTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); + std::shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); if (container != NULL ) { for (unsigned int i = 0; i < container->getContainerSize(); i++) { - shared_ptr item = container->getItem(i); + std::shared_ptr item = container->getItem(i); if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; @@ -225,9 +225,9 @@ void DispenserTile::onRemove(Level *level, int x, int y, int z, int id, int data if (count > item->count) count = item->count; item->count -= count; - shared_ptr newItem = shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ); + std::shared_ptr newItem = std::shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ); newItem->set4JData( item->get4JData() ); - shared_ptr itemEntity = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, newItem ) ); + std::shared_ptr itemEntity = std::shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, newItem ) ); float pow = 0.05f; itemEntity->xd = (float) random->nextGaussian() * pow; itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; @@ -247,9 +247,9 @@ void DispenserTile::onRemove(Level *level, int x, int y, int z, int id, int data EntityTile::onRemove(level, x, y, z, id, data); } -void DispenserTile::throwItem(Level *level, shared_ptr item, Random *random, int accuracy, int xd, int zd, double xp, double yp, double zp) +void DispenserTile::throwItem(Level *level, std::shared_ptr item, Random *random, int accuracy, int xd, int zd, double xp, double yp, double zp) { - shared_ptr itemEntity = shared_ptr(new ItemEntity(level, xp, yp - 0.3, zp, item)); + std::shared_ptr itemEntity = std::shared_ptr(new ItemEntity(level, xp, yp - 0.3, zp, item)); double pow = random->nextDouble() * 0.1 + 0.2; itemEntity->xd = xd * pow; @@ -263,7 +263,7 @@ void DispenserTile::throwItem(Level *level, shared_ptr item, Rando level->addEntity(itemEntity); } -int DispenserTile::dispenseItem(shared_ptr trap, Level *level, shared_ptr item, Random *random, int x, int y, int z, int xd, int zd, double xp, double yp, double zp) +int DispenserTile::dispenseItem(std::shared_ptr trap, Level *level, std::shared_ptr item, Random *random, int x, int y, int z, int xd, int zd, double xp, double yp, double zp) { float power = 1.1f; int accuracy = 6; @@ -276,7 +276,7 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev int currentProjectiles = level->countInstanceOf(eTYPE_PROJECTILE,false); if(currentProjectiles < Level::MAX_DISPENSABLE_PROJECTILES) // 4J - added limit { - shared_ptr arrow = shared_ptr( new Arrow(level, xp, yp, zp) ); + std::shared_ptr arrow = std::shared_ptr( new Arrow(level, xp, yp, zp) ); arrow->shoot(xd, .1f, zd, power, (float) accuracy); arrow->pickup = Arrow::PICKUP_ALLOWED; level->addEntity(arrow); @@ -298,7 +298,7 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev int currentProjectiles = level->countInstanceOf(eTYPE_PROJECTILE,false); if(currentProjectiles < Level::MAX_DISPENSABLE_PROJECTILES) // 4J - added limit { - shared_ptr egg = shared_ptr( new ThrownEgg(level, xp, yp, zp) ); + std::shared_ptr egg = std::shared_ptr( new ThrownEgg(level, xp, yp, zp) ); egg->shoot(xd, .1f, zd, power, (float) accuracy); level->addEntity(egg); level->levelEvent(LevelEvent::SOUND_LAUNCH, x, y, z, 0); @@ -319,7 +319,7 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev int currentProjectiles = level->countInstanceOf(eTYPE_PROJECTILE,false); if(currentProjectiles < Level::MAX_DISPENSABLE_PROJECTILES) // 4J - added limit { - shared_ptr snowball = shared_ptr( new Snowball(level, xp, yp, zp) ); + std::shared_ptr snowball = std::shared_ptr( new Snowball(level, xp, yp, zp) ); snowball->shoot(xd, .1f, zd, power, (float) accuracy); level->addEntity(snowball); level->levelEvent(LevelEvent::SOUND_LAUNCH, x, y, z, 0); @@ -342,14 +342,14 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev { if(PotionItem::isThrowable(item->getAuxValue())) { - shared_ptr potion = shared_ptr(new ThrownPotion(level, xp, yp, zp, item->getAuxValue())); + std::shared_ptr potion = std::shared_ptr(new ThrownPotion(level, xp, yp, zp, item->getAuxValue())); potion->shoot(xd, .1f, zd, power * 1.25f, accuracy * .5f); level->addEntity(potion); level->levelEvent(LevelEvent::SOUND_LAUNCH, x, y, z, 0); } else { - shared_ptr itemEntity = shared_ptr( new ItemEntity(level, xp, yp - 0.3, zp, item) ); + std::shared_ptr itemEntity = std::shared_ptr( new ItemEntity(level, xp, yp - 0.3, zp, item) ); double pow = random->nextDouble() * 0.1 + 0.2; itemEntity->xd = xd * pow; @@ -380,7 +380,7 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev int currentProjectiles = level->countInstanceOf(eTYPE_PROJECTILE,false); if(currentProjectiles < Level::MAX_DISPENSABLE_PROJECTILES) // 4J - added limit { - shared_ptr expBottle = shared_ptr( new ThrownExpBottle(level, xp, yp, zp) ); + std::shared_ptr expBottle = std::shared_ptr( new ThrownExpBottle(level, xp, yp, zp) ); expBottle->shoot(xd, .1f, zd, power * 1.25f, accuracy * .5f); level->addEntity(expBottle); level->levelEvent(LevelEvent::SOUND_LAUNCH, x, y, z, 0); @@ -401,7 +401,7 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev int currentFireballs = level->countInstanceOf(eTYPE_SMALL_FIREBALL,true); if(currentFireballs < Level::MAX_DISPENSABLE_FIREBALLS) // 4J - added limit { - shared_ptr fireball = shared_ptr( new SmallFireball(level, xp + xd * .3, yp, zp + zd * .3, xd + random->nextGaussian() * .05, random->nextGaussian() * .05, zd + random->nextGaussian() * .05)); + std::shared_ptr fireball = std::shared_ptr( new SmallFireball(level, xp + xd * .3, yp, zp + zd * .3, xd + random->nextGaussian() * .05, random->nextGaussian() * .05, zd + random->nextGaussian() * .05)); level->addEntity(fireball); level->levelEvent(LevelEvent::SOUND_BLAZE_FIREBALL, x, y, z, 0); return REMOVE_ITEM; @@ -420,9 +420,9 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev { int iResult=0; //MonsterPlacerItem *spawnEgg = (MonsterPlacerItem *)item->getItem(); - shared_ptr newEntity = MonsterPlacerItem::canSpawn(item->getAuxValue(), level,&iResult); + std::shared_ptr newEntity = MonsterPlacerItem::canSpawn(item->getAuxValue(), level,&iResult); - shared_ptr mob = dynamic_pointer_cast(newEntity); + std::shared_ptr mob = dynamic_pointer_cast(newEntity); if (mob != NULL) { // 4J-PB - Changed the line below slightly since mobs were sticking to the dispenser rather than dropping down when fired @@ -472,9 +472,9 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev item->id = Item::bucket_water_Id; item->count = 1; } - else if (trap->addItem(shared_ptr(new ItemInstance(Item::bucket_water))) < 0) + else if (trap->addItem(std::shared_ptr(new ItemInstance(Item::bucket_water))) < 0) { - throwItem(level, shared_ptr(new ItemInstance(Item::bucket_water)), random, 6, xd, zd, xp, yp, zp); + throwItem(level, std::shared_ptr(new ItemInstance(Item::bucket_water)), random, 6, xd, zd, xp, yp, zp); } return LEAVE_ITEM; @@ -488,9 +488,9 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev item->id = Item::bucket_lava_Id; item->count = 1; } - else if (trap->addItem(shared_ptr(new ItemInstance(Item::bucket_lava))) < 0) + else if (trap->addItem(std::shared_ptr(new ItemInstance(Item::bucket_lava))) < 0) { - throwItem(level, shared_ptr(new ItemInstance(Item::bucket_lava)), random, 6, xd, zd, xp, yp, zp); + throwItem(level, std::shared_ptr(new ItemInstance(Item::bucket_lava)), random, 6, xd, zd, xp, yp, zp); } return LEAVE_ITEM; @@ -522,7 +522,7 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev if( level->countInstanceOf(eTYPE_MINECART, true) < Level::MAX_CONSOLE_MINECARTS ) // 4J - added limit { - shared_ptr minecart = shared_ptr(new Minecart(level, xp, yp, zp, ((MinecartItem *) item->getItem())->type)); + std::shared_ptr minecart = std::shared_ptr(new Minecart(level, xp, yp, zp, ((MinecartItem *) item->getItem())->type)); level->addEntity(minecart); level->levelEvent(LevelEvent::SOUND_CLICK, x, y, z, 0); @@ -556,7 +556,7 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev // check the limit on boats if( bLaunchBoat && level->countInstanceOf(eTYPE_BOAT, true) < Level::MAX_XBOX_BOATS ) // 4J - added limit { - shared_ptr boat = shared_ptr(new Boat(level, xp, yp, zp)); + std::shared_ptr boat = std::shared_ptr(new Boat(level, xp, yp, zp)); level->addEntity(boat); level->levelEvent(LevelEvent::SOUND_CLICK, x, y, z, 0); return REMOVE_ITEM; diff --git a/Minecraft.World/Blocks/DispenserTile.h b/Minecraft.World/Blocks/DispenserTile.h index dd9df6929..d36967dbc 100644 --- a/Minecraft.World/Blocks/DispenserTile.h +++ b/Minecraft.World/Blocks/DispenserTile.h @@ -40,7 +40,7 @@ public: //@Override void registerIcons(IconRegister *iconRegister); virtual bool TestUse(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param private: void fireArrow(Level *level, int x, int y, int z, Random *random); @@ -48,11 +48,11 @@ private: public: virtual void neighborChanged(Level *level, int x, int y, int z, int type); virtual void tick(Level *level, int x, int y, int z, Random *random); - virtual shared_ptr newTileEntity(Level *level); - virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); + virtual std::shared_ptr newTileEntity(Level *level); + virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); virtual void onRemove(Level *level, int x, int y, int z, int id, int data); private: - static void throwItem(Level *level, shared_ptr item, Random *random, int accuracy, int xd, int zd, double xp, double yp, double zp); - static int dispenseItem(shared_ptr trap, Level *level, shared_ptr item, Random *random, int x, int y, int z, int xd, int zd, double xp, double yp, double zp); + static void throwItem(Level *level, std::shared_ptr item, Random *random, int accuracy, int xd, int zd, double xp, double yp, double zp); + static int dispenseItem(std::shared_ptr trap, Level *level, std::shared_ptr item, Random *random, int x, int y, int z, int xd, int zd, double xp, double yp, double zp); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/DoorTile.cpp b/Minecraft.World/Blocks/DoorTile.cpp index 2ef2ae11a..e973bc842 100644 --- a/Minecraft.World/Blocks/DoorTile.cpp +++ b/Minecraft.World/Blocks/DoorTile.cpp @@ -107,7 +107,7 @@ AABB *DoorTile::getAABB(Level *level, int x, int y, int z) return retval; } -void DoorTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void DoorTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { setShape(getCompositeData(level,x, y, z)); } @@ -167,7 +167,7 @@ void DoorTile::setShape(int compositeData) } } -void DoorTile::attack(Level *level, int x, int y, int z, shared_ptr player) +void DoorTile::attack(Level *level, int x, int y, int z, std::shared_ptr player) { // Fix for #92957 - TU11: Content: Multiplayer: Wooden Doors splits in half and glitch in open / close motion while being mined. // In lastest PC version this is commented out, so do that now to fix bug above @@ -180,7 +180,7 @@ bool DoorTile::TestUse() return true; } -bool DoorTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool DoorTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if(soundOnly) { diff --git a/Minecraft.World/Blocks/DoorTile.h b/Minecraft.World/Blocks/DoorTile.h index 0296fd1d8..d9f84a60a 100644 --- a/Minecraft.World/Blocks/DoorTile.h +++ b/Minecraft.World/Blocks/DoorTile.h @@ -38,16 +38,16 @@ public: virtual int getRenderShape(); virtual AABB *getTileAABB(Level *level, int x, int y, int z); virtual AABB *getAABB(Level *level, int x, int y, int z); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param int getDir(LevelSource *level, int x, int y, int z); bool isOpen(LevelSource *level, int x, int y, int z); private: using Tile::setShape; virtual void setShape(int compositeData); public: - virtual void attack(Level *level, int x, int y, int z, shared_ptr player); + virtual void attack(Level *level, int x, int y, int z, std::shared_ptr player); virtual bool TestUse(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param void setOpen(Level *level, int x, int y, int z, bool shouldOpen); virtual void neighborChanged(Level *level, int x, int y, int z, int type); virtual int getResource(int data, Random *random, int playerBonusLevel); diff --git a/Minecraft.World/Blocks/EggTile.cpp b/Minecraft.World/Blocks/EggTile.cpp index a39248c75..ce6a5a63f 100644 --- a/Minecraft.World/Blocks/EggTile.cpp +++ b/Minecraft.World/Blocks/EggTile.cpp @@ -40,13 +40,13 @@ void EggTile::checkSlide(Level *level, int x, int y, int z) } else { - shared_ptr e = shared_ptr(new FallingTile(level, x + 0.5f, y + 0.5f, z + 0.5f, id)); + std::shared_ptr e = std::shared_ptr(new FallingTile(level, x + 0.5f, y + 0.5f, z + 0.5f, id)); level->addEntity(e); } } } -bool EggTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool EggTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if(soundOnly) return false; @@ -54,7 +54,7 @@ bool EggTile::use(Level *level, int x, int y, int z, shared_ptr player, return true; } -void EggTile::attack(Level *level, int x, int y, int z, shared_ptr player) +void EggTile::attack(Level *level, int x, int y, int z, std::shared_ptr player) { teleport(level, x, y, z); } diff --git a/Minecraft.World/Blocks/EggTile.h b/Minecraft.World/Blocks/EggTile.h index c8929cbe5..7102bd8dd 100644 --- a/Minecraft.World/Blocks/EggTile.h +++ b/Minecraft.World/Blocks/EggTile.h @@ -11,8 +11,8 @@ public: private: void checkSlide(Level *level, int x, int y, int z); public: - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param - virtual void attack(Level *level, int x, int y, int z, shared_ptr player); + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual void attack(Level *level, int x, int y, int z, std::shared_ptr player); private: void teleport(Level *level, int x, int y, int z); public: diff --git a/Minecraft.World/Blocks/EnchantmentTableTile.cpp b/Minecraft.World/Blocks/EnchantmentTableTile.cpp index 7eafd993a..5c111ebe6 100644 --- a/Minecraft.World/Blocks/EnchantmentTableTile.cpp +++ b/Minecraft.World/Blocks/EnchantmentTableTile.cpp @@ -67,12 +67,12 @@ Icon *EnchantmentTableTile::getTexture(int face, int data) return icon; } -shared_ptr EnchantmentTableTile::newTileEntity(Level *level) +std::shared_ptr EnchantmentTableTile::newTileEntity(Level *level) { - return shared_ptr(new EnchantmentTableEntity()); + return std::shared_ptr(new EnchantmentTableEntity()); } -bool EnchantmentTableTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool EnchantmentTableTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if(soundOnly) return false; diff --git a/Minecraft.World/Blocks/EnchantmentTableTile.h b/Minecraft.World/Blocks/EnchantmentTableTile.h index 145869a43..a789c5a01 100644 --- a/Minecraft.World/Blocks/EnchantmentTableTile.h +++ b/Minecraft.World/Blocks/EnchantmentTableTile.h @@ -22,8 +22,8 @@ public: void animateTick(Level *level, int x, int y, int z, Random *random); bool isSolidRender(bool isServerLevel = false); Icon *getTexture(int face, int data); - shared_ptr newTileEntity(Level *level); - bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + std::shared_ptr newTileEntity(Level *level); + bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param //@Override void registerIcons(IconRegister *iconRegister); }; diff --git a/Minecraft.World/Blocks/EnderChestTile.cpp b/Minecraft.World/Blocks/EnderChestTile.cpp index 6ab9d3782..764f706ac 100644 --- a/Minecraft.World/Blocks/EnderChestTile.cpp +++ b/Minecraft.World/Blocks/EnderChestTile.cpp @@ -48,7 +48,7 @@ bool EnderChestTile::isSilkTouchable() return true; } -void EnderChestTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void EnderChestTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int facing = 0; int dir = (Mth::floor(by->yRot * 4 / (360) + 0.5f)) & 3; @@ -61,10 +61,10 @@ void EnderChestTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptrsetData(x, y, z, facing); } -bool EnderChestTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly) +bool EnderChestTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly) { - shared_ptr container = player->getEnderChestInventory(); - shared_ptr enderChest = dynamic_pointer_cast(level->getTileEntity(x, y, z)); + std::shared_ptr container = player->getEnderChestInventory(); + std::shared_ptr enderChest = dynamic_pointer_cast(level->getTileEntity(x, y, z)); if (container == NULL || enderChest == NULL) return true; if (level->isSolidBlockingTile(x, y + 1, z)) return true; @@ -80,9 +80,9 @@ bool EnderChestTile::use(Level *level, int x, int y, int z, shared_ptr p return true; } -shared_ptr EnderChestTile::newTileEntity(Level *level) +std::shared_ptr EnderChestTile::newTileEntity(Level *level) { - return shared_ptr(new EnderChestTileEntity()); + return std::shared_ptr(new EnderChestTileEntity()); } void EnderChestTile::animateTick(Level *level, int xt, int yt, int zt, Random *random) diff --git a/Minecraft.World/Blocks/EnderChestTile.h b/Minecraft.World/Blocks/EnderChestTile.h index b608eb98e..45074a608 100644 --- a/Minecraft.World/Blocks/EnderChestTile.h +++ b/Minecraft.World/Blocks/EnderChestTile.h @@ -21,9 +21,9 @@ protected: bool isSilkTouchable(); public: - void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); - bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); - shared_ptr newTileEntity(Level *level); + void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); + bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); + std::shared_ptr newTileEntity(Level *level); void animateTick(Level *level, int xt, int yt, int zt, Random *random); virtual void registerIcons(IconRegister *iconRegister); }; diff --git a/Minecraft.World/Blocks/FallingTile.cpp b/Minecraft.World/Blocks/FallingTile.cpp index 87967ede8..cd7d0c50b 100644 --- a/Minecraft.World/Blocks/FallingTile.cpp +++ b/Minecraft.World/Blocks/FallingTile.cpp @@ -134,7 +134,7 @@ void FallingTile::tick() } else { - if(dropItem && !cancelDrop) spawnAtLocation( shared_ptr(new ItemInstance(tile, 1, Tile::tiles[tile]->getSpawnResourcesAuxValue(data))), 0); + if(dropItem && !cancelDrop) spawnAtLocation( std::shared_ptr(new ItemInstance(tile, 1, Tile::tiles[tile]->getSpawnResourcesAuxValue(data))), 0); } } } @@ -153,7 +153,7 @@ void FallingTile::causeFallDamage(float distance) int dmg = Mth::ceil(distance - 1); if (dmg > 0) { - vector > *entities = level->getEntities(shared_from_this(), bb); + vector > *entities = level->getEntities(shared_from_this(), bb); DamageSource *source = tile == Tile::anvil_Id ? DamageSource::anvil : DamageSource::fallingBlock; //for (Entity entity : entities) diff --git a/Minecraft.World/Blocks/FarmTile.cpp b/Minecraft.World/Blocks/FarmTile.cpp index 299fb0ae3..7f5ff4f66 100644 --- a/Minecraft.World/Blocks/FarmTile.cpp +++ b/Minecraft.World/Blocks/FarmTile.cpp @@ -74,14 +74,14 @@ void FarmTile::tick(Level *level, int x, int y, int z, Random *random) } } -void FarmTile::fallOn(Level *level, int x, int y, int z, shared_ptr entity, float fallDistance) +void FarmTile::fallOn(Level *level, int x, int y, int z, std::shared_ptr entity, float fallDistance) { // 4J Stu - Fix for #86148 - Code: Gameplay: Jumping on Farmland does not always result in turning to Dirt Block // We should not be setting tiles on the client based on random values! if (!level->isClientSide && level->random->nextFloat() < (fallDistance - .5f)) { // Fix for #60547 - TU7: Content: Gameplay: Players joining a game can destroy crops even with Trust Players option disabled. - shared_ptr player = dynamic_pointer_cast(entity); + std::shared_ptr player = dynamic_pointer_cast(entity); if(player == NULL || player->isAllowedToMine()) level->setTile(x, y, z, Tile::dirt_Id); } } diff --git a/Minecraft.World/Blocks/FarmTile.h b/Minecraft.World/Blocks/FarmTile.h index 095cd47c3..9f69a2d1a 100644 --- a/Minecraft.World/Blocks/FarmTile.h +++ b/Minecraft.World/Blocks/FarmTile.h @@ -22,7 +22,7 @@ public: virtual bool isCubeShaped(); virtual Icon *getTexture(int face, int data); virtual void tick(Level *level, int x, int y, int z, Random *random); - virtual void fallOn(Level *level, int x, int y, int z, shared_ptr entity, float fallDistance); + virtual void fallOn(Level *level, int x, int y, int z, std::shared_ptr entity, float fallDistance); private: virtual bool isUnderCrops(Level *level, int x, int y, int z); virtual bool isNearWater(Level *level, int x, int y, int z); diff --git a/Minecraft.World/Blocks/FenceGateTile.cpp b/Minecraft.World/Blocks/FenceGateTile.cpp index 69f79551e..1e915cf35 100644 --- a/Minecraft.World/Blocks/FenceGateTile.cpp +++ b/Minecraft.World/Blocks/FenceGateTile.cpp @@ -37,7 +37,7 @@ AABB *FenceGateTile::getAABB(Level *level, int x, int y, int z) } // 4J - Brought forward from 1.2.3 to fix hit box rotation -void FenceGateTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void FenceGateTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { int data = getDirection(level->getData(x, y, z)); if (data == Direction::NORTH || data == Direction::SOUTH) @@ -75,13 +75,13 @@ int FenceGateTile::getRenderShape() return Tile::SHAPE_FENCE_GATE; } -void FenceGateTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void FenceGateTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int dir = (((Mth::floor(by->yRot * 4 / (360) + 0.5)) & 3)) % 4; level->setData(x, y, z, dir); } -bool FenceGateTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool FenceGateTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if( soundOnly ) { diff --git a/Minecraft.World/Blocks/FenceGateTile.h b/Minecraft.World/Blocks/FenceGateTile.h index 277fcd4d5..83cc378bd 100644 --- a/Minecraft.World/Blocks/FenceGateTile.h +++ b/Minecraft.World/Blocks/FenceGateTile.h @@ -11,15 +11,15 @@ public: Icon *getTexture(int face, int data); virtual bool mayPlace(Level *level, int x, int y, int z); virtual AABB *getAABB(Level *level, int x, int y, int z); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param // Brought forward from 1.2.3 + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param // Brought forward from 1.2.3 virtual bool blocksLight(); virtual bool isSolidRender(bool isServerLevel = false); virtual bool isCubeShaped(); virtual bool isPathfindable(LevelSource *level, int x, int y, int z); virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face); virtual int getRenderShape(); - virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param virtual void neighborChanged(Level *level, int x, int y, int z, int type); static bool isOpen(int data); void registerIcons(IconRegister *iconRegister); diff --git a/Minecraft.World/Blocks/FenceTile.cpp b/Minecraft.World/Blocks/FenceTile.cpp index 3667a14c0..ee95c95e9 100644 --- a/Minecraft.World/Blocks/FenceTile.cpp +++ b/Minecraft.World/Blocks/FenceTile.cpp @@ -41,7 +41,7 @@ AABB *FenceTile::getAABB(Level *level, int x, int y, int z) return AABB::newTemp(x + west, y, z + north, x + east, y + 1.5f, z + south); } -void FenceTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void FenceTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { bool n = connectsTo(level, x, y, z - 1); bool s = connectsTo(level, x, y, z + 1); diff --git a/Minecraft.World/Blocks/FenceTile.h b/Minecraft.World/Blocks/FenceTile.h index 479cb13a4..d42465205 100644 --- a/Minecraft.World/Blocks/FenceTile.h +++ b/Minecraft.World/Blocks/FenceTile.h @@ -10,7 +10,7 @@ private: public: FenceTile(int id, const wstring &texture, Material *material); virtual AABB *getAABB(Level *level, int x, int y, int z); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual bool blocksLight(); virtual bool isSolidRender(bool isServerLevel = false); virtual bool isCubeShaped(); diff --git a/Minecraft.World/Blocks/FlowerPotTile.cpp b/Minecraft.World/Blocks/FlowerPotTile.cpp index 5597b4d93..03756c682 100644 --- a/Minecraft.World/Blocks/FlowerPotTile.cpp +++ b/Minecraft.World/Blocks/FlowerPotTile.cpp @@ -33,9 +33,9 @@ bool FlowerPotTile::isCubeShaped() return false; } -bool FlowerPotTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly) +bool FlowerPotTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly) { - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); if (item == NULL) return false; if (level->getData(x, y, z) != 0) return false; int type = getTypeFromItem(item); @@ -60,7 +60,7 @@ bool FlowerPotTile::use(Level *level, int x, int y, int z, shared_ptr pl int FlowerPotTile::cloneTileId(Level *level, int x, int y, int z) { - shared_ptr item = getItemFromType(level->getData(x, y, z)); + std::shared_ptr item = getItemFromType(level->getData(x, y, z)); if (item == NULL) { @@ -74,7 +74,7 @@ int FlowerPotTile::cloneTileId(Level *level, int x, int y, int z) int FlowerPotTile::cloneTileData(Level *level, int x, int y, int z) { - shared_ptr item = getItemFromType(level->getData(x, y, z)); + std::shared_ptr item = getItemFromType(level->getData(x, y, z)); if (item == NULL) { @@ -112,7 +112,7 @@ void FlowerPotTile::spawnResources(Level *level, int x, int y, int z, int data, if (data > 0) { - shared_ptr item = getItemFromType(data); + std::shared_ptr item = getItemFromType(data); if (item != NULL) popResource(level, x, y, z, item); } } @@ -122,38 +122,38 @@ int FlowerPotTile::getResource(int data, Random *random, int playerBonusLevel) return Item::flowerPot_Id; } -shared_ptr FlowerPotTile::getItemFromType(int type) +std::shared_ptr FlowerPotTile::getItemFromType(int type) { switch (type) { case TYPE_FLOWER_RED: - return shared_ptr( new ItemInstance(Tile::rose) ); + return std::shared_ptr( new ItemInstance(Tile::rose) ); case TYPE_FLOWER_YELLOW: - return shared_ptr( new ItemInstance(Tile::flower) ); + return std::shared_ptr( new ItemInstance(Tile::flower) ); case TYPE_CACTUS: - return shared_ptr( new ItemInstance(Tile::cactus) ); + return std::shared_ptr( new ItemInstance(Tile::cactus) ); case TYPE_MUSHROOM_BROWN: - return shared_ptr( new ItemInstance(Tile::mushroom1) ); + return std::shared_ptr( new ItemInstance(Tile::mushroom1) ); case TYPE_MUSHROOM_RED: - return shared_ptr( new ItemInstance(Tile::mushroom2) ); + return std::shared_ptr( new ItemInstance(Tile::mushroom2) ); case TYPE_DEAD_BUSH: - return shared_ptr( new ItemInstance(Tile::deadBush) ); + return std::shared_ptr( new ItemInstance(Tile::deadBush) ); case TYPE_SAPLING_DEFAULT: - return shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_DEFAULT) ); + return std::shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_DEFAULT) ); case TYPE_SAPLING_BIRCH: - return shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_BIRCH) ); + return std::shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_BIRCH) ); case TYPE_SAPLING_EVERGREEN: - return shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_EVERGREEN) ); + return std::shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_EVERGREEN) ); case TYPE_SAPLING_JUNGLE: - return shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_JUNGLE) ); + return std::shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_JUNGLE) ); case TYPE_FERN: - return shared_ptr( new ItemInstance(Tile::tallgrass, 1, TallGrass::FERN) ); + return std::shared_ptr( new ItemInstance(Tile::tallgrass, 1, TallGrass::FERN) ); } return nullptr; } -int FlowerPotTile::getTypeFromItem(shared_ptr item) +int FlowerPotTile::getTypeFromItem(std::shared_ptr item) { int id = item->getItem()->id; diff --git a/Minecraft.World/Blocks/FlowerPotTile.h b/Minecraft.World/Blocks/FlowerPotTile.h index 50dc18c46..5a615c077 100644 --- a/Minecraft.World/Blocks/FlowerPotTile.h +++ b/Minecraft.World/Blocks/FlowerPotTile.h @@ -23,7 +23,7 @@ public: bool isSolidRender(bool isServerLevel = false); int getRenderShape(); bool isCubeShaped(); - bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); + bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); int cloneTileId(Level *level, int x, int y, int z); int cloneTileData(Level *level, int x, int y, int z); bool useOwnCloneData(); @@ -32,6 +32,6 @@ public: using Tile::spawnResources; void spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel); int getResource(int data, Random *random, int playerBonusLevel); - static shared_ptr getItemFromType(int type); - static int getTypeFromItem(shared_ptr item); + static std::shared_ptr getItemFromType(int type); + static int getTypeFromItem(std::shared_ptr item); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/FurnaceTile.cpp b/Minecraft.World/Blocks/FurnaceTile.cpp index 81fc534b7..8e3cb2c66 100644 --- a/Minecraft.World/Blocks/FurnaceTile.cpp +++ b/Minecraft.World/Blocks/FurnaceTile.cpp @@ -104,7 +104,7 @@ bool FurnaceTile::TestUse() return true; } -bool FurnaceTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool FurnaceTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if( soundOnly) return false; @@ -112,7 +112,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) ); + std::shared_ptr furnace = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); if (furnace != NULL ) player->openFurnace(furnace); return true; } @@ -120,7 +120,7 @@ bool FurnaceTile::use(Level *level, int x, int y, int z, shared_ptr play void FurnaceTile::setLit(bool lit, Level *level, int x, int y, int z) { int data = level->getData(x, y, z); - shared_ptr te = level->getTileEntity(x, y, z); + std::shared_ptr te = level->getTileEntity(x, y, z); noDrop = true; if (lit) level->setTile(x, y, z, Tile::furnace_lit_Id); @@ -135,12 +135,12 @@ void FurnaceTile::setLit(bool lit, Level *level, int x, int y, int z) } } -shared_ptr FurnaceTile::newTileEntity(Level *level) +std::shared_ptr FurnaceTile::newTileEntity(Level *level) { - return shared_ptr( new FurnaceTileEntity() ); + return std::shared_ptr( new FurnaceTileEntity() ); } -void FurnaceTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void FurnaceTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int dir = (Mth::floor(by->yRot * 4 / (360) + 0.5)) & 3; @@ -154,12 +154,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) ); + std::shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); if( container != NULL ) { for (unsigned int i = 0; i < container->getContainerSize(); i++) { - shared_ptr item = container->getItem(i); + std::shared_ptr item = container->getItem(i); if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; @@ -183,9 +183,9 @@ void FurnaceTile::onRemove(Level *level, int x, int y, int z, int id, int data) } #endif - shared_ptr newItem = shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ); + std::shared_ptr newItem = std::shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ); newItem->set4JData( item->get4JData() ); - shared_ptr itemEntity = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, newItem) ); + std::shared_ptr itemEntity = std::shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, newItem) ); float pow = 0.05f; itemEntity->xd = (float) random->nextGaussian() * pow; itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; diff --git a/Minecraft.World/Blocks/FurnaceTile.h b/Minecraft.World/Blocks/FurnaceTile.h index d5e90cddd..9513e9741 100644 --- a/Minecraft.World/Blocks/FurnaceTile.h +++ b/Minecraft.World/Blocks/FurnaceTile.h @@ -29,11 +29,11 @@ public: void registerIcons(IconRegister *iconRegister); virtual void animateTick(Level *level, int xt, int yt, int zt, Random *random); virtual bool TestUse(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param static void setLit(bool lit, Level *level, int x, int y, int z); protected: - virtual shared_ptr newTileEntity(Level *level); + virtual std::shared_ptr newTileEntity(Level *level); public: - virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); + virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); virtual void onRemove(Level *level, int x, int y, int z, int id, int data); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/HalfSlabTile.cpp b/Minecraft.World/Blocks/HalfSlabTile.cpp index 13f82ed53..b14077e09 100644 --- a/Minecraft.World/Blocks/HalfSlabTile.cpp +++ b/Minecraft.World/Blocks/HalfSlabTile.cpp @@ -33,7 +33,7 @@ HalfSlabTile::HalfSlabTile(int id, bool fullSize, Material *material) : Tile(id, setLightBlock(255); } -void HalfSlabTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void HalfSlabTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { if (fullSize) { @@ -65,7 +65,7 @@ void HalfSlabTile::updateDefaultShape() } } -void HalfSlabTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void HalfSlabTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source) { updateShape(level, x, y, z); Tile::addAABBs(level, x, y, z, box, boxes, source); diff --git a/Minecraft.World/Blocks/HalfSlabTile.h b/Minecraft.World/Blocks/HalfSlabTile.h index 183a4adda..bd5f6dfc6 100644 --- a/Minecraft.World/Blocks/HalfSlabTile.h +++ b/Minecraft.World/Blocks/HalfSlabTile.h @@ -16,9 +16,9 @@ protected: public: HalfSlabTile(int id, bool fullSize, Material *material); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual void updateDefaultShape(); - virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source); + virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source); virtual bool isSolidRender(bool isServerLevel); virtual int getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, int itemValue); virtual int getResourceCount(Random *random); diff --git a/Minecraft.World/Blocks/HeavyTile.cpp b/Minecraft.World/Blocks/HeavyTile.cpp index 518b83ea4..57e28b38a 100644 --- a/Minecraft.World/Blocks/HeavyTile.cpp +++ b/Minecraft.World/Blocks/HeavyTile.cpp @@ -59,14 +59,14 @@ void HeavyTile::checkSlide(Level *level, int x, int y, int z) return; } - shared_ptr e = shared_ptr( new FallingTile(level, x + 0.5f, y + 0.5f, z + 0.5f, id, level->getData(x, y, z)) ); + std::shared_ptr e = std::shared_ptr( new FallingTile(level, x + 0.5f, y + 0.5f, z + 0.5f, id, level->getData(x, y, z)) ); falling(e); level->addEntity(e); } } } -void HeavyTile::falling(shared_ptr entity) +void HeavyTile::falling(std::shared_ptr entity) { } diff --git a/Minecraft.World/Blocks/HeavyTile.h b/Minecraft.World/Blocks/HeavyTile.h index a9186eaea..739d3ea09 100644 --- a/Minecraft.World/Blocks/HeavyTile.h +++ b/Minecraft.World/Blocks/HeavyTile.h @@ -18,7 +18,7 @@ public: private: void checkSlide(Level *level, int x, int y, int z); protected: - virtual void falling(shared_ptr entity); + virtual void falling(std::shared_ptr entity); public: virtual int getTickDelay(); static bool isFree(Level *level, int x, int y, int z); diff --git a/Minecraft.World/Blocks/HellSandTile.cpp b/Minecraft.World/Blocks/HellSandTile.cpp index 4d4718b41..3b387013a 100644 --- a/Minecraft.World/Blocks/HellSandTile.cpp +++ b/Minecraft.World/Blocks/HellSandTile.cpp @@ -14,7 +14,7 @@ AABB *HellSandTile::getAABB(Level *level, int x, int y, int z) return AABB::newTemp(x, y, z, x + 1, y + 1 - r, z + 1); } -void HellSandTile::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +void HellSandTile::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) { entity->xd*=0.4; entity->zd*=0.4; diff --git a/Minecraft.World/Blocks/HellSandTile.h b/Minecraft.World/Blocks/HellSandTile.h index 0b44b3965..865c34871 100644 --- a/Minecraft.World/Blocks/HellSandTile.h +++ b/Minecraft.World/Blocks/HellSandTile.h @@ -7,5 +7,5 @@ class HellSandTile : public Tile public: HellSandTile(int id); virtual AABB *getAABB(Level *level, int x, int y, int z); - virtual void entityInside(Level *level, int x, int y, int z, shared_ptr entity); + virtual void entityInside(Level *level, int x, int y, int z, std::shared_ptr entity); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/IceTile.cpp b/Minecraft.World/Blocks/IceTile.cpp index 314d1f879..8f66c8bd9 100644 --- a/Minecraft.World/Blocks/IceTile.cpp +++ b/Minecraft.World/Blocks/IceTile.cpp @@ -22,14 +22,14 @@ bool IceTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face return HalfTransparentTile::shouldRenderFace(level, x, y, z, 1 - face); } -void IceTile::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) +void IceTile::playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data) { player->awardStat(GenericStats::blocksMined(id), GenericStats::param_blocksMined(id,data,1) ); player->causeFoodExhaustion(FoodConstants::EXHAUSTION_MINE); if (isSilkTouchable() && EnchantmentHelper::hasSilkTouch(player->inventory)) { - shared_ptr item = getSilkTouchItemInstance(data); + std::shared_ptr item = getSilkTouchItemInstance(data); if (item != NULL) { popResource(level, x, y, z, item); diff --git a/Minecraft.World/Blocks/IceTile.h b/Minecraft.World/Blocks/IceTile.h index b3f1a5e6b..3fa9d6d6b 100644 --- a/Minecraft.World/Blocks/IceTile.h +++ b/Minecraft.World/Blocks/IceTile.h @@ -9,7 +9,7 @@ public: IceTile(int id); virtual int getRenderLayer(); virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face); - virtual void playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data); + virtual void playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data); virtual int getResourceCount(Random *random); virtual void tick(Level *level, int x, int y, int z, Random *random); virtual int getPistonPushReaction(); diff --git a/Minecraft.World/Blocks/LadderTile.cpp b/Minecraft.World/Blocks/LadderTile.cpp index 89e5e65fc..759148bd3 100644 --- a/Minecraft.World/Blocks/LadderTile.cpp +++ b/Minecraft.World/Blocks/LadderTile.cpp @@ -19,7 +19,7 @@ AABB *LadderTile::getTileAABB(Level *level, int x, int y, int z) return Tile::getTileAABB(level, x, y, z); } -void LadderTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void LadderTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { setShape(level->getData(x, y, z)); } diff --git a/Minecraft.World/Blocks/LadderTile.h b/Minecraft.World/Blocks/LadderTile.h index e61c953fe..e75b9650c 100644 --- a/Minecraft.World/Blocks/LadderTile.h +++ b/Minecraft.World/Blocks/LadderTile.h @@ -12,7 +12,7 @@ protected: public: virtual AABB *getAABB(Level *level, int x, int y, int z); virtual AABB *getTileAABB(Level *level, int x, int y, int z); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param using Tile::setShape; virtual void setShape(int data); virtual bool blocksLight(); diff --git a/Minecraft.World/Blocks/LeafTile.cpp b/Minecraft.World/Blocks/LeafTile.cpp index 30e9abb82..cd928fed4 100644 --- a/Minecraft.World/Blocks/LeafTile.cpp +++ b/Minecraft.World/Blocks/LeafTile.cpp @@ -241,17 +241,17 @@ void LeafTile::spawnResources(Level *level, int x, int y, int z, int data, float if (level->random->nextInt(chance) == 0) { int type = getResource(data, level->random,playerBonusLevel); - popResource(level, x, y, z, shared_ptr( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data)))); + popResource(level, x, y, z, std::shared_ptr( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data)))); } if ((data & LEAF_TYPE_MASK) == NORMAL_LEAF && level->random->nextInt(200) == 0) { - popResource(level, x, y, z, shared_ptr(new ItemInstance(Item::apple_Id, 1, 0))); + popResource(level, x, y, z, std::shared_ptr(new ItemInstance(Item::apple_Id, 1, 0))); } } } -void LeafTile::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) +void LeafTile::playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data) { if (!level->isClientSide && player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears->id) { @@ -261,7 +261,7 @@ void LeafTile::playerDestroy(Level *level, shared_ptr player, int x, int ); // drop leaf block instead of sapling - popResource(level, x, y, z, shared_ptr(new ItemInstance(Tile::leaves_Id, 1, data & LEAF_TYPE_MASK))); + popResource(level, x, y, z, std::shared_ptr(new ItemInstance(Tile::leaves_Id, 1, data & LEAF_TYPE_MASK))); } else { @@ -301,12 +301,12 @@ void LeafTile::setFancy(bool fancyGraphics) fancyTextureSet = (fancyGraphics ? 0 : 1); } -shared_ptr LeafTile::getSilkTouchItemInstance(int data) +std::shared_ptr LeafTile::getSilkTouchItemInstance(int data) { - return shared_ptr( new ItemInstance(id, 1, data & LEAF_TYPE_MASK) ); + return std::shared_ptr( new ItemInstance(id, 1, data & LEAF_TYPE_MASK) ); } -void LeafTile::stepOn(Level *level, int x, int y, int z, shared_ptr entity) +void LeafTile::stepOn(Level *level, int x, int y, int z, std::shared_ptr entity) { TransparentTile::stepOn(level, x, y, z, entity); } diff --git a/Minecraft.World/Blocks/LeafTile.h b/Minecraft.World/Blocks/LeafTile.h index e6c39a7f3..428a293f1 100644 --- a/Minecraft.World/Blocks/LeafTile.h +++ b/Minecraft.World/Blocks/LeafTile.h @@ -54,7 +54,7 @@ public: // 4J DCR: Brought forward from 1.2 virtual void spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel); - virtual void playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data); + virtual void playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data); protected: virtual int getSpawnResourcesAuxValue(int data); public: @@ -63,10 +63,10 @@ public: void setFancy(bool fancyGraphics); protected: - virtual shared_ptr getSilkTouchItemInstance(int data); + virtual std::shared_ptr getSilkTouchItemInstance(int data); public: - virtual void stepOn(Level *level, int x, int y, int z, shared_ptr entity); + virtual void stepOn(Level *level, int x, int y, int z, std::shared_ptr entity); // 4J Added so we can check before we try to add a tile to the tick list if it's actually going to do seomthing virtual bool shouldTileTick(Level *level, int x,int y,int z); diff --git a/Minecraft.World/Blocks/LeverTile.cpp b/Minecraft.World/Blocks/LeverTile.cpp index c6152c731..09fa1ea29 100644 --- a/Minecraft.World/Blocks/LeverTile.cpp +++ b/Minecraft.World/Blocks/LeverTile.cpp @@ -144,7 +144,7 @@ bool LeverTile::checkCanSurvive(Level *level, int x, int y, int z) return true; } -void LeverTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void LeverTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { int dir = level->getData(x, y, z) & 7; float r = 3 / 16.0f; @@ -176,7 +176,7 @@ void LeverTile::updateShape(LevelSource *level, int x, int y, int z, int forceDa } } -void LeverTile::attack(Level *level, int x, int y, int z, shared_ptr player) +void LeverTile::attack(Level *level, int x, int y, int z, std::shared_ptr player) { use(level, x, y, z, player, 0, 0, 0, 0); } @@ -187,7 +187,7 @@ bool LeverTile::TestUse() return true; } -bool LeverTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool LeverTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if( soundOnly ) { diff --git a/Minecraft.World/Blocks/LeverTile.h b/Minecraft.World/Blocks/LeverTile.h index 4d00db781..3c0140b56 100644 --- a/Minecraft.World/Blocks/LeverTile.h +++ b/Minecraft.World/Blocks/LeverTile.h @@ -20,10 +20,10 @@ public: private: virtual bool checkCanSurvive(Level *level, int x, int y, int z); public: - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param - virtual void attack(Level *level, int x, int y, int z, shared_ptr player); + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param + virtual void attack(Level *level, int x, int y, int z, std::shared_ptr player); virtual bool TestUse(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param virtual void onRemove(Level *level, int x, int y, int z, int id, int data); virtual bool getSignal(LevelSource *level, int x, int y, int z, int dir); virtual bool getDirectSignal(Level *level, int x, int y, int z, int dir); diff --git a/Minecraft.World/Blocks/LiquidTile.cpp b/Minecraft.World/Blocks/LiquidTile.cpp index 4d85ea2f1..a168a8b4b 100644 --- a/Minecraft.World/Blocks/LiquidTile.cpp +++ b/Minecraft.World/Blocks/LiquidTile.cpp @@ -203,7 +203,7 @@ Vec3 *LiquidTile::getFlow(LevelSource *level, int x, int y, int z) return flow; } -void LiquidTile::handleEntityInside(Level *level, int x, int y, int z, shared_ptr e, Vec3 *current) +void LiquidTile::handleEntityInside(Level *level, int x, int y, int z, std::shared_ptr e, Vec3 *current) { Vec3 *flow = getFlow(level, x, y, z); current->x += flow->x; diff --git a/Minecraft.World/Blocks/LiquidTile.h b/Minecraft.World/Blocks/LiquidTile.h index 1c437f39e..53649acbc 100644 --- a/Minecraft.World/Blocks/LiquidTile.h +++ b/Minecraft.World/Blocks/LiquidTile.h @@ -42,7 +42,7 @@ public: private: virtual Vec3 *getFlow(LevelSource *level, int x, int y, int z); public: - virtual void handleEntityInside(Level *level, int x, int y, int z, shared_ptr e, Vec3 *current); + virtual void handleEntityInside(Level *level, int x, int y, int z, std::shared_ptr e, Vec3 *current); virtual int getTickDelay(); virtual int getLightColor(LevelSource *level, int x, int y, int z, int tileId=-1); // 4J - brought forward from 1.8.2 virtual float getBrightness(LevelSource *level, int x, int y, int z); diff --git a/Minecraft.World/Blocks/MobSpawner.cpp b/Minecraft.World/Blocks/MobSpawner.cpp index 635ceb1e3..fd199aafe 100644 --- a/Minecraft.World/Blocks/MobSpawner.cpp +++ b/Minecraft.World/Blocks/MobSpawner.cpp @@ -105,7 +105,7 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie AUTO_VAR(itEnd, level->players.end()); for (AUTO_VAR(it, level->players.begin()); it != itEnd; it++) { - shared_ptr player = *it; //level->players.at(i); + std::shared_ptr player = *it; //level->players.at(i); int xx = Mth::floor(player->x / 16); int zz = Mth::floor(player->z / 16); @@ -125,7 +125,7 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie int *zz = new int[playerCount]; for (int i = 0; i < playerCount; i++) { - shared_ptr player = level->players[i]; + std::shared_ptr player = level->players[i]; xx[i] = Mth::floor(player->x / 16); zz[i] = Mth::floor(player->z / 16); #ifdef __PSVITA__ @@ -288,7 +288,7 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie } } - shared_ptr mob; + std::shared_ptr mob; // 4J - removed try/catch // try // { @@ -423,11 +423,11 @@ bool MobSpawner::isSpawnPositionOk(MobCategory *category, Level *level, int x, i } -void MobSpawner::finalizeMobSettings(shared_ptr mob, Level *level, float xx, float yy, float zz) +void MobSpawner::finalizeMobSettings(std::shared_ptr mob, Level *level, float xx, float yy, float zz) { if (dynamic_pointer_cast( mob ) != NULL && level->random->nextInt(100) == 0) { - shared_ptr skeleton = shared_ptr( new Skeleton(level) ); + std::shared_ptr skeleton = std::shared_ptr( new Skeleton(level) ); skeleton->moveTo(xx, yy, zz, mob->yRot, 0); level->addEntity(skeleton); skeleton->ride(mob); @@ -442,7 +442,7 @@ void MobSpawner::finalizeMobSettings(shared_ptr mob, Level *level, float xx { for (int kitten = 0; kitten < 2; kitten++) { - shared_ptr ozelot = shared_ptr(new Ozelot(level)); + std::shared_ptr ozelot = std::shared_ptr(new Ozelot(level)); ozelot->moveTo(xx, yy, zz, mob->yRot, 0); ozelot->setAge(-20 * 60 * 20); level->addEntity(ozelot); @@ -459,7 +459,7 @@ eINSTANCEOF MobSpawner::bedEnemies[bedEnemyCount] = { }; -bool MobSpawner::attackSleepingPlayers(Level *level, vector > *players) +bool MobSpawner::attackSleepingPlayers(Level *level, vector > *players) { bool somebodyWokeUp = false; @@ -469,7 +469,7 @@ bool MobSpawner::attackSleepingPlayers(Level *level, vector > AUTO_VAR(itEnd, players->end()); for (AUTO_VAR(it, players->begin()); it != itEnd; it++) { - shared_ptr player = (*it); + std::shared_ptr player = (*it); bool nextPlayer = false; @@ -514,7 +514,7 @@ bool MobSpawner::attackSleepingPlayers(Level *level, vector > float yy = (float) y; float zz = z + 0.5f; - shared_ptr mob; + std::shared_ptr mob; // 4J - removed try/catch // try // { @@ -619,7 +619,7 @@ void MobSpawner::postProcessSpawnMobs(Level *level, Biome *biome, int xo, int zo float yy = (float)y; float zz = z + 0.5f; - shared_ptr mob; + std::shared_ptr mob; //try { mob = dynamic_pointer_cast( EntityIO::newByEnumType(type->mobClass, level ) ); //} catch (Exception e) { diff --git a/Minecraft.World/Blocks/MobSpawner.h b/Minecraft.World/Blocks/MobSpawner.h index 2a3a8a70b..173e03852 100644 --- a/Minecraft.World/Blocks/MobSpawner.h +++ b/Minecraft.World/Blocks/MobSpawner.h @@ -30,7 +30,7 @@ public: static bool isSpawnPositionOk(MobCategory *category, Level *level, int x, int y, int z); private: - static void finalizeMobSettings(shared_ptr mob, Level *level, float xx, float yy, float zz); + static void finalizeMobSettings(std::shared_ptr mob, Level *level, float xx, float yy, float zz); protected: // 4J Stu TODO This was an array of Class type. I haven't made a base Class type yet, but don't need to @@ -40,7 +40,7 @@ protected: public: - static bool attackSleepingPlayers(Level *level, vector > *players); + static bool attackSleepingPlayers(Level *level, vector > *players); static void postProcessSpawnMobs(Level *level, Biome *biome, int xo, int zo, int cellWidth, int cellHeight, Random *random); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/MobSpawnerTile.cpp b/Minecraft.World/Blocks/MobSpawnerTile.cpp index 8989206ba..3f61ef790 100644 --- a/Minecraft.World/Blocks/MobSpawnerTile.cpp +++ b/Minecraft.World/Blocks/MobSpawnerTile.cpp @@ -7,9 +7,9 @@ MobSpawnerTile::MobSpawnerTile(int id) : EntityTile(id, Material::stone, isSolid { } -shared_ptr MobSpawnerTile::newTileEntity(Level *level) +std::shared_ptr MobSpawnerTile::newTileEntity(Level *level) { - return shared_ptr( new MobSpawnerTileEntity() ); + return std::shared_ptr( new MobSpawnerTileEntity() ); } int MobSpawnerTile::getResource(int data, Random *random, int playerBonusLevel) diff --git a/Minecraft.World/Blocks/MobSpawnerTile.h b/Minecraft.World/Blocks/MobSpawnerTile.h index aa21c16b5..df41f8b4c 100644 --- a/Minecraft.World/Blocks/MobSpawnerTile.h +++ b/Minecraft.World/Blocks/MobSpawnerTile.h @@ -9,7 +9,7 @@ class MobSpawnerTile : public EntityTile protected: MobSpawnerTile(int id); public: - virtual shared_ptr newTileEntity(Level *level); + virtual std::shared_ptr newTileEntity(Level *level); virtual int getResource(int data, Random *random, int playerBonusLevel); virtual int getResourceCount(Random *random); virtual bool isSolidRender(bool isServerLevel = false); diff --git a/Minecraft.World/Blocks/MusicTile.cpp b/Minecraft.World/Blocks/MusicTile.cpp index cc25422d5..6b51047f4 100644 --- a/Minecraft.World/Blocks/MusicTile.cpp +++ b/Minecraft.World/Blocks/MusicTile.cpp @@ -12,7 +12,7 @@ void MusicTile::neighborChanged(Level *level, int x, int y, int z, int type) { app.DebugPrintf("-------- Neighbour changed type %d\n", type); bool signal = level->hasNeighborSignal(x, y, z); - shared_ptr mte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); + std::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) { @@ -30,11 +30,11 @@ bool MusicTile::TestUse() return true; } -bool MusicTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool MusicTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if (soundOnly) return false; if (level->isClientSide) return true; - shared_ptr mte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); + std::shared_ptr mte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); if (mte != NULL ) { mte->tune(); @@ -43,16 +43,16 @@ bool MusicTile::use(Level *level, int x, int y, int z, shared_ptr player return true; } -void MusicTile::attack(Level *level, int x, int y, int z, shared_ptr player) +void MusicTile::attack(Level *level, int x, int y, int z, std::shared_ptr player) { if (level->isClientSide) return; - shared_ptr mte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); + std::shared_ptr mte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); if( mte != NULL ) mte->playNote(level, x, y, z); } -shared_ptr MusicTile::newTileEntity(Level *level) +std::shared_ptr MusicTile::newTileEntity(Level *level) { - return shared_ptr( new MusicTileEntity() ); + return std::shared_ptr( new MusicTileEntity() ); } void MusicTile::triggerEvent(Level *level, int x, int y, int z, int i, int note) diff --git a/Minecraft.World/Blocks/MusicTile.h b/Minecraft.World/Blocks/MusicTile.h index 8de9f35c3..63836dcb3 100644 --- a/Minecraft.World/Blocks/MusicTile.h +++ b/Minecraft.World/Blocks/MusicTile.h @@ -9,8 +9,8 @@ public: MusicTile(int id); virtual void neighborChanged(Level *level, int x, int y, int z, int type); virtual bool TestUse(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param - virtual void attack(Level *level, int x, int y, int z, shared_ptr player); - virtual shared_ptr newTileEntity(Level *level); + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual void attack(Level *level, int x, int y, int z, std::shared_ptr player); + virtual std::shared_ptr newTileEntity(Level *level); virtual void triggerEvent(Level *level, int x, int y, int z, int i, int note); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/NetherStalkTile.cpp b/Minecraft.World/Blocks/NetherStalkTile.cpp index 23d2027c2..689967831 100644 --- a/Minecraft.World/Blocks/NetherStalkTile.cpp +++ b/Minecraft.World/Blocks/NetherStalkTile.cpp @@ -92,7 +92,7 @@ void NetherStalkTile::spawnResources(Level *level, int x, int y, int z, int data } for (int i = 0; i < count; i++) { - popResource(level, x, y, z, shared_ptr(new ItemInstance(Item::netherStalkSeeds))); + popResource(level, x, y, z, std::shared_ptr(new ItemInstance(Item::netherStalkSeeds))); } } diff --git a/Minecraft.World/Blocks/PistonBaseTile.cpp b/Minecraft.World/Blocks/PistonBaseTile.cpp index eff61ae27..d61a6d58b 100644 --- a/Minecraft.World/Blocks/PistonBaseTile.cpp +++ b/Minecraft.World/Blocks/PistonBaseTile.cpp @@ -119,12 +119,12 @@ bool PistonBaseTile::isSolidRender(bool isServerLevel) return false; } -bool PistonBaseTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool PistonBaseTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { return false; } -void PistonBaseTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void PistonBaseTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int targetData = getNewFacing(level, x, y, z, dynamic_pointer_cast(by) ); level->setData(x, y, z, targetData); @@ -249,7 +249,7 @@ void PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, else if (param1 == TRIGGER_CONTRACT) { 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]); + std::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) { dynamic_pointer_cast(prevTileEntity)->finalTick(); @@ -280,10 +280,10 @@ void 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); + std::shared_ptr tileEntity = level->getTileEntity(twoX, twoY, twoZ); if (tileEntity != NULL && dynamic_pointer_cast(tileEntity) != NULL ) { - shared_ptr ppe = dynamic_pointer_cast(tileEntity); + std::shared_ptr ppe = dynamic_pointer_cast(tileEntity); if (ppe->getFacing() == facing && ppe->isExtending()) { @@ -337,7 +337,7 @@ void PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, ignoreUpdate(false); } -void PistonBaseTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void PistonBaseTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { int data = (forceData == -1 ) ? level->getData(x, y, z) : forceData; @@ -377,7 +377,7 @@ void PistonBaseTile::updateDefaultShape() setShape(0, 0, 0, 1, 1, 1); } -void PistonBaseTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void PistonBaseTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source) { setShape(0, 0, 0, 1, 1, 1); Tile::addAABBs(level, x, y, z, box, boxes, source); @@ -404,7 +404,7 @@ bool PistonBaseTile::isExtended(int data) return (data & EXTENDED_BIT) != 0; } -int PistonBaseTile::getNewFacing(Level *level, int x, int y, int z, shared_ptr player) +int PistonBaseTile::getNewFacing(Level *level, int x, int y, int z, std::shared_ptr player) { if (Mth::abs((float) player->x - x) < 2 && Mth::abs((float) player->z - z) < 2) { diff --git a/Minecraft.World/Blocks/PistonBaseTile.h b/Minecraft.World/Blocks/PistonBaseTile.h index 0fda1391a..c5127e8c2 100644 --- a/Minecraft.World/Blocks/PistonBaseTile.h +++ b/Minecraft.World/Blocks/PistonBaseTile.h @@ -42,8 +42,8 @@ public: virtual int getRenderShape(); virtual bool isSolidRender(bool isServerLevel = false); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param - virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); virtual void neighborChanged(Level *level, int x, int y, int z, int type); virtual void onPlace(Level *level, int x, int y, int z); @@ -53,15 +53,15 @@ private: public: virtual void triggerEvent(Level *level, int x, int y, int z, int param1, int facing); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual void updateDefaultShape(); - virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source); + virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source); virtual AABB *getAABB(Level *level, int x, int y, int z); virtual bool isCubeShaped(); static int getFacing(int data); static bool isExtended(int data); - static int getNewFacing(Level *level, int x, int y, int z, shared_ptr player); + static int getNewFacing(Level *level, int x, int y, int z, std::shared_ptr player); private: static bool isPushable(int block, Level *level, int cx, int cy, int cz, bool allowDestroyable); static bool canPush(Level *level, int sx, int sy, int sz, int facing); diff --git a/Minecraft.World/Blocks/PistonExtensionTile.cpp b/Minecraft.World/Blocks/PistonExtensionTile.cpp index 7a494c6e0..1f5dd1b21 100644 --- a/Minecraft.World/Blocks/PistonExtensionTile.cpp +++ b/Minecraft.World/Blocks/PistonExtensionTile.cpp @@ -103,7 +103,7 @@ int PistonExtensionTile::getResourceCount(Random *random) return 0; } -void PistonExtensionTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void PistonExtensionTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source) { int data = level->getData(x, y, z); @@ -156,7 +156,7 @@ void PistonExtensionTile::addAABBs(Level *level, int x, int y, int z, AABB *box, } -void PistonExtensionTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void PistonExtensionTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { int data = (forceData == -1 ) ? level->getData(x, y, z) : forceData; diff --git a/Minecraft.World/Blocks/PistonExtensionTile.h b/Minecraft.World/Blocks/PistonExtensionTile.h index a0b087293..8ebb9bd1e 100644 --- a/Minecraft.World/Blocks/PistonExtensionTile.h +++ b/Minecraft.World/Blocks/PistonExtensionTile.h @@ -23,8 +23,8 @@ public: virtual bool mayPlace(Level *level, int x, int y, int z); virtual bool mayPlace(Level *level, int x, int y, int z, int face); virtual int getResourceCount(Random *random); - virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source); + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual void neighborChanged(Level *level, int x, int y, int z, int type); static int getFacing(int data); virtual int cloneTileId(Level *level, int x, int y, int z); diff --git a/Minecraft.World/Blocks/PistonMovingTileEntity.cpp b/Minecraft.World/Blocks/PistonMovingTileEntity.cpp index 220a3bd1a..9fcd065c5 100644 --- a/Minecraft.World/Blocks/PistonMovingTileEntity.cpp +++ b/Minecraft.World/Blocks/PistonMovingTileEntity.cpp @@ -11,7 +11,7 @@ PistonMovingPiece::PistonMovingPiece(int id) : EntityTile(id, Material::piston, setDestroyTime(INDESTRUCTIBLE_DESTROY_TIME); } -shared_ptr PistonMovingPiece::newTileEntity(Level *level) +std::shared_ptr PistonMovingPiece::newTileEntity(Level *level) { return nullptr; } @@ -22,7 +22,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); + std::shared_ptr tileEntity = level->getTileEntity(x, y, z); if (tileEntity != NULL && dynamic_pointer_cast(tileEntity) != NULL) { dynamic_pointer_cast(tileEntity)->finalTick(); @@ -58,7 +58,7 @@ bool PistonMovingPiece::isCubeShaped() return false; } -bool PistonMovingPiece::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool PistonMovingPiece::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if( soundOnly) return false; // this is a special case in order to help removing invisible, unbreakable, blocks in the world @@ -80,7 +80,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); + std::shared_ptr entity = getEntity(level, x, y, z); if (entity == NULL) { return; @@ -96,14 +96,14 @@ void PistonMovingPiece::neighborChanged(Level *level, int x, int y, int z, int t } } -shared_ptr PistonMovingPiece::newMovingPieceEntity(int block, int data, int facing, bool extending, bool isSourcePiston) +std::shared_ptr PistonMovingPiece::newMovingPieceEntity(int block, int data, int facing, bool extending, bool isSourcePiston) { - return shared_ptr(new PistonPieceEntity(block, data, facing, extending, isSourcePiston)); + return std::shared_ptr(new PistonPieceEntity(block, data, facing, extending, isSourcePiston)); } AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z) { - shared_ptr entity = getEntity(level, x, y, z); + std::shared_ptr entity = getEntity(level, x, y, z); if (entity == NULL) { return NULL; @@ -118,9 +118,9 @@ AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z) return getAABB(level, x, y, z, entity->getId(), progress, entity->getFacing()); } -void PistonMovingPiece::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void PistonMovingPiece::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { - shared_ptr entity = dynamic_pointer_cast(forceEntity); + std::shared_ptr entity = dynamic_pointer_cast(forceEntity); if( entity == NULL ) entity = getEntity(level, x, y, z); if (entity != NULL) { @@ -188,9 +188,9 @@ AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z, int tile, fl return aabb; } -shared_ptr PistonMovingPiece::getEntity(LevelSource *level, int x, int y, int z) +std::shared_ptr PistonMovingPiece::getEntity(LevelSource *level, int x, int y, int z) { - shared_ptr tileEntity = level->getTileEntity(x, y, z); + std::shared_ptr tileEntity = level->getTileEntity(x, y, z); if (tileEntity != NULL && dynamic_pointer_cast(tileEntity) != NULL) { return dynamic_pointer_cast(tileEntity); diff --git a/Minecraft.World/Blocks/PistonMovingTileEntity.h b/Minecraft.World/Blocks/PistonMovingTileEntity.h index 9b19417ee..42426ffca 100644 --- a/Minecraft.World/Blocks/PistonMovingTileEntity.h +++ b/Minecraft.World/Blocks/PistonMovingTileEntity.h @@ -9,7 +9,7 @@ public: PistonMovingPiece(int id); protected: - virtual shared_ptr newTileEntity(Level *level); + virtual std::shared_ptr newTileEntity(Level *level); public: virtual void onPlace(Level *level, int x, int y, int z); @@ -19,18 +19,18 @@ public: virtual int getRenderShape(); virtual bool isSolidRender(bool isServerLevel = false); virtual bool isCubeShaped(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param; + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param; virtual int getResource(int data, Random *random, int playerBonusLevel); virtual void spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonus); virtual void neighborChanged(Level *level, int x, int y, int z, int type); - static shared_ptr newMovingPieceEntity(int block, int data, int facing, bool extending, bool isSourcePiston); + static std::shared_ptr newMovingPieceEntity(int block, int data, int facing, bool extending, bool isSourcePiston); virtual AABB *getAABB(Level *level, int x, int y, int z); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param AABB *getAABB(Level *level, int x, int y, int z, int tile, float progress, int facing); private: - shared_ptr getEntity(LevelSource *level, int x, int y, int z); + std::shared_ptr getEntity(LevelSource *level, int x, int y, int z); public: virtual int cloneTileId(Level *level, int x, int y, int z); diff --git a/Minecraft.World/Blocks/PortalTile.cpp b/Minecraft.World/Blocks/PortalTile.cpp index 487a715b3..5043a0925 100644 --- a/Minecraft.World/Blocks/PortalTile.cpp +++ b/Minecraft.World/Blocks/PortalTile.cpp @@ -37,7 +37,7 @@ AABB *PortalTile::getAABB(Level *level, int x, int y, int z) return NULL; } -void PortalTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void PortalTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { if (level->getTile(x - 1, y, z) == id || level->getTile(x + 1, y, z) == id) { @@ -195,7 +195,7 @@ int PortalTile::getRenderLayer() return 1; } -void PortalTile::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +void PortalTile::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) { if (entity->riding == NULL && entity->rider.lock() == NULL) entity->handleInsidePortal(); } diff --git a/Minecraft.World/Blocks/PortalTile.h b/Minecraft.World/Blocks/PortalTile.h index 387195e1c..e727d0389 100644 --- a/Minecraft.World/Blocks/PortalTile.h +++ b/Minecraft.World/Blocks/PortalTile.h @@ -10,7 +10,7 @@ public: PortalTile(int id); virtual void tick(Level *level, int x, int y, int z, Random *random); virtual AABB *getAABB(Level *level, int x, int y, int z); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual bool isSolidRender(bool isServerLevel = false); virtual bool isCubeShaped(); virtual bool trySpawnPortal(Level *level, int x, int y, int z, bool actuallySpawn); @@ -18,7 +18,7 @@ public: virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face); virtual int getResourceCount(Random *random); virtual int getRenderLayer(); - virtual void entityInside(Level *level, int x, int y, int z, shared_ptr entity); + virtual void entityInside(Level *level, int x, int y, int z, std::shared_ptr entity); virtual void animateTick(Level *level, int xt, int yt, int zt, Random *random); virtual int cloneTileId(Level *level, int x, int y, int z); virtual bool mayPick(); // 4J Added override diff --git a/Minecraft.World/Blocks/PotatoTile.cpp b/Minecraft.World/Blocks/PotatoTile.cpp index d4557482d..efe4b3e70 100644 --- a/Minecraft.World/Blocks/PotatoTile.cpp +++ b/Minecraft.World/Blocks/PotatoTile.cpp @@ -46,7 +46,7 @@ void PotatoTile::spawnResources(Level *level, int x, int y, int z, int data, flo { if (level->random->nextInt(50) == 0) { - popResource(level, x, y, z, shared_ptr(new ItemInstance(Item::potatoPoisonous))); + popResource(level, x, y, z, std::shared_ptr(new ItemInstance(Item::potatoPoisonous))); } } } diff --git a/Minecraft.World/Blocks/PressurePlateTile.cpp b/Minecraft.World/Blocks/PressurePlateTile.cpp index d9789325f..5262d17a9 100644 --- a/Minecraft.World/Blocks/PressurePlateTile.cpp +++ b/Minecraft.World/Blocks/PressurePlateTile.cpp @@ -76,7 +76,7 @@ void PressurePlateTile::tick(Level *level, int x, int y, int z, Random *random) checkPressed(level, x, y, z); } -void PressurePlateTile::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +void PressurePlateTile::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) { if (level->isClientSide) return; @@ -94,7 +94,7 @@ void PressurePlateTile::checkPressed(Level *level, int x, int y, int z) bool shouldBePressed = false; float b = 2 / 16.0f; - vector > *entities = NULL; + vector > *entities = NULL; bool entitiesToBeFreed = false; if (sensitivity == PressurePlateTile::everything) entities = level->getEntities(nullptr, AABB::newTemp(x + b, y, z + b, x + 1 - b, y + 0.25, z + 1 - b)); @@ -155,7 +155,7 @@ void PressurePlateTile::onRemove(Level *level, int x, int y, int z, int id, int Tile::onRemove(level, x, y, z, id, data); } -void PressurePlateTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void PressurePlateTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { bool pressed = level->getData(x, y, z) == 1; diff --git a/Minecraft.World/Blocks/PressurePlateTile.h b/Minecraft.World/Blocks/PressurePlateTile.h index 03b3235fd..49780acbe 100644 --- a/Minecraft.World/Blocks/PressurePlateTile.h +++ b/Minecraft.World/Blocks/PressurePlateTile.h @@ -31,12 +31,12 @@ public: virtual bool mayPlace(Level *level, int x, int y, int z); virtual void neighborChanged(Level *level, int x, int y, int z, int type); virtual void tick(Level *level, int x, int y, int z, Random *random); - virtual void entityInside(Level *level, int x, int y, int z, shared_ptr entity); + virtual void entityInside(Level *level, int x, int y, int z, std::shared_ptr entity); private: virtual void checkPressed(Level *level, int x, int y, int z); public: virtual void onRemove(Level *level, int x, int y, int z, int id, int data); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual bool getSignal(LevelSource *level, int x, int y, int z, int dir); virtual bool getDirectSignal(Level *level, int x, int y, int z, int dir); virtual bool isSignalSource(); diff --git a/Minecraft.World/Blocks/PumpkinTile.cpp b/Minecraft.World/Blocks/PumpkinTile.cpp index cfb39e3d5..41c5c3485 100644 --- a/Minecraft.World/Blocks/PumpkinTile.cpp +++ b/Minecraft.World/Blocks/PumpkinTile.cpp @@ -45,7 +45,7 @@ void PumpkinTile::onPlace(Level *level, int x, int y, int z) level->setTileNoUpdate(x, y, z, 0); level->setTileNoUpdate(x, y - 1, z, 0); level->setTileNoUpdate(x, y - 2, z, 0); - shared_ptr snowMan = shared_ptr(new SnowMan(level)); + std::shared_ptr snowMan = std::shared_ptr(new SnowMan(level)); snowMan->moveTo(x + 0.5, y - 1.95, z + 0.5, 0, 0); level->addEntity(snowMan); @@ -94,7 +94,7 @@ void PumpkinTile::onPlace(Level *level, int x, int y, int z) level->setTileNoUpdate(x, y - 1, z + 1, 0); } - shared_ptr villagerGolem = shared_ptr(new VillagerGolem(level)); + std::shared_ptr villagerGolem = std::shared_ptr(new VillagerGolem(level)); villagerGolem->setPlayerCreated(true); villagerGolem->moveTo(x + 0.5, y - 1.95, z + 0.5, 0, 0); level->addEntity(villagerGolem); @@ -155,7 +155,7 @@ bool PumpkinTile::mayPlace(Level *level, int x, int y, int z) } -void PumpkinTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void PumpkinTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int dir = Mth::floor(by->yRot * 4 / (360) + 2.5) & 3; level->setData(x, y, z, dir); diff --git a/Minecraft.World/Blocks/PumpkinTile.h b/Minecraft.World/Blocks/PumpkinTile.h index 1c808b545..03e555695 100644 --- a/Minecraft.World/Blocks/PumpkinTile.h +++ b/Minecraft.World/Blocks/PumpkinTile.h @@ -26,6 +26,6 @@ public: virtual Icon *getTexture(int face, int data); virtual void onPlace(Level *level, int x, int y, int z); virtual bool mayPlace(Level *level, int x, int y, int z); - virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); + virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); void registerIcons(IconRegister *iconRegister); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/QuartzBlockTile.cpp b/Minecraft.World/Blocks/QuartzBlockTile.cpp index 03d5845f4..553d97943 100644 --- a/Minecraft.World/Blocks/QuartzBlockTile.cpp +++ b/Minecraft.World/Blocks/QuartzBlockTile.cpp @@ -89,9 +89,9 @@ int QuartzBlockTile::getSpawnResourcesAuxValue(int data) return data; } -shared_ptr QuartzBlockTile::getSilkTouchItemInstance(int data) +std::shared_ptr QuartzBlockTile::getSilkTouchItemInstance(int data) { - if (data == TYPE_LINES_X || data == TYPE_LINES_Z) return shared_ptr(new ItemInstance(id, 1, TYPE_LINES_Y)); + if (data == TYPE_LINES_X || data == TYPE_LINES_Z) return std::shared_ptr(new ItemInstance(id, 1, TYPE_LINES_Y)); return Tile::getSilkTouchItemInstance(data); } diff --git a/Minecraft.World/Blocks/QuartzBlockTile.h b/Minecraft.World/Blocks/QuartzBlockTile.h index bdb5af8be..d812e8a18 100644 --- a/Minecraft.World/Blocks/QuartzBlockTile.h +++ b/Minecraft.World/Blocks/QuartzBlockTile.h @@ -39,7 +39,7 @@ public: int getSpawnResourcesAuxValue(int data); protected: - shared_ptr getSilkTouchItemInstance(int data); + std::shared_ptr getSilkTouchItemInstance(int data); public: int getRenderShape(); diff --git a/Minecraft.World/Blocks/RailTile.cpp b/Minecraft.World/Blocks/RailTile.cpp index ede65960e..05f810a85 100644 --- a/Minecraft.World/Blocks/RailTile.cpp +++ b/Minecraft.World/Blocks/RailTile.cpp @@ -397,7 +397,7 @@ HitResult *RailTile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b return Tile::clip(level, xt, yt, zt, a, b); } -void RailTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void RailTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { int data = level->getData(x, y, z); if (data >= 2 && data <= 5) diff --git a/Minecraft.World/Blocks/RailTile.h b/Minecraft.World/Blocks/RailTile.h index 1a266a258..4a02cc3a0 100644 --- a/Minecraft.World/Blocks/RailTile.h +++ b/Minecraft.World/Blocks/RailTile.h @@ -66,7 +66,7 @@ public: virtual bool blocksLight(); virtual bool isSolidRender(bool isServerLevel = false); virtual HitResult *clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual Icon *getTexture(int face, int data); virtual bool isCubeShaped(); virtual int getRenderShape(); diff --git a/Minecraft.World/Blocks/RecordPlayerTile.cpp b/Minecraft.World/Blocks/RecordPlayerTile.cpp index 5072ed3c7..274d541ed 100644 --- a/Minecraft.World/Blocks/RecordPlayerTile.cpp +++ b/Minecraft.World/Blocks/RecordPlayerTile.cpp @@ -23,14 +23,14 @@ Icon *RecordPlayerTile::getTexture(int face, int data) } // 4J-PB - Adding a TestUse for tooltip display -bool RecordPlayerTile::TestUse(Level *level, int x, int y, int z, shared_ptr player) +bool RecordPlayerTile::TestUse(Level *level, int x, int y, int z, std::shared_ptr player) { // if the jukebox is empty, return true if (level->getData(x, y, z) == 0) return false; return true; } -bool RecordPlayerTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool RecordPlayerTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if (soundOnly) return false; if (level->getData(x, y, z) == 0) return false; @@ -42,7 +42,7 @@ void RecordPlayerTile::setRecord(Level *level, int x, int y, int z, int record) { if (level->isClientSide) return; - shared_ptr rte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); + std::shared_ptr rte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); rte->record = record; rte->setChanged(); @@ -53,7 +53,7 @@ void RecordPlayerTile::dropRecording(Level *level, int x, int y, int z) { if (level->isClientSide) return; - shared_ptr rte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); + std::shared_ptr rte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); if( rte == NULL ) return; int oldRecord = rte->record; @@ -71,7 +71,7 @@ void RecordPlayerTile::dropRecording(Level *level, int x, int y, int z) double xo = level->random->nextFloat() * s + (1 - s) * 0.5; double yo = level->random->nextFloat() * s + (1 - s) * 0.2 + 0.6; double zo = level->random->nextFloat() * s + (1 - s) * 0.5; - shared_ptr item = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr( new ItemInstance(oldRecord, 1, 0) ) ) ); + std::shared_ptr item = std::shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, std::shared_ptr( new ItemInstance(oldRecord, 1, 0) ) ) ); item->throwTime = 10; level->addEntity(item); } @@ -88,9 +88,9 @@ void RecordPlayerTile::spawnResources(Level *level, int x, int y, int z, int dat Tile::spawnResources(level, x, y, z, data, odds, 0); } -shared_ptr RecordPlayerTile::newTileEntity(Level *level) +std::shared_ptr RecordPlayerTile::newTileEntity(Level *level) { - return shared_ptr( new RecordPlayerTile::Entity() ); + return std::shared_ptr( new RecordPlayerTile::Entity() ); } void RecordPlayerTile::registerIcons(IconRegister *iconRegister) diff --git a/Minecraft.World/Blocks/RecordPlayerTile.h b/Minecraft.World/Blocks/RecordPlayerTile.h index cb350d08b..a12874f88 100644 --- a/Minecraft.World/Blocks/RecordPlayerTile.h +++ b/Minecraft.World/Blocks/RecordPlayerTile.h @@ -37,9 +37,9 @@ public: } // 4J Added - shared_ptr clone() + std::shared_ptr clone() { - shared_ptr result = shared_ptr( new RecordPlayerTile::Entity() ); + std::shared_ptr result = std::shared_ptr( new RecordPlayerTile::Entity() ); TileEntity::clone(result); result->record = record; @@ -56,13 +56,13 @@ protected: public: virtual Icon *getTexture(int face, int data); - virtual bool TestUse(Level *level, int x, int y, int z, shared_ptr player); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual bool TestUse(Level *level, int x, int y, int z, std::shared_ptr player); + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param void setRecord(Level *level, int x, int y, int z, int record); void dropRecording(Level *level, int x, int y, int z); virtual void onRemove(Level *level, int x, int y, int z, int id, int data); virtual void spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonus); - virtual shared_ptr newTileEntity(Level *level); + virtual std::shared_ptr newTileEntity(Level *level); void registerIcons(IconRegister *iconRegister); }; diff --git a/Minecraft.World/Blocks/RedStoneOreTile.cpp b/Minecraft.World/Blocks/RedStoneOreTile.cpp index fe005c4cf..fd2d72519 100644 --- a/Minecraft.World/Blocks/RedStoneOreTile.cpp +++ b/Minecraft.World/Blocks/RedStoneOreTile.cpp @@ -17,13 +17,13 @@ int RedStoneOreTile::getTickDelay() return 30; } -void RedStoneOreTile::attack(Level *level, int x, int y, int z, shared_ptr player) +void RedStoneOreTile::attack(Level *level, int x, int y, int z, std::shared_ptr player) { interact(level, x, y, z); Tile::attack(level, x, y, z, player); } -void RedStoneOreTile::stepOn(Level *level, int x, int y, int z, shared_ptr entity) +void RedStoneOreTile::stepOn(Level *level, int x, int y, int z, std::shared_ptr entity) { interact(level, x, y, z); Tile::stepOn(level, x, y, z, entity); @@ -35,7 +35,7 @@ bool RedStoneOreTile::TestUse() return true; } -bool RedStoneOreTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool RedStoneOreTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if (soundOnly) return false; interact(level, x, y, z); @@ -122,7 +122,7 @@ bool RedStoneOreTile::shouldTileTick(Level *level, int x,int y,int z) return id == Tile::redStoneOre_lit_Id; } -shared_ptr RedStoneOreTile::getSilkTouchItemInstance(int data) +std::shared_ptr RedStoneOreTile::getSilkTouchItemInstance(int data) { - return shared_ptr(new ItemInstance(Tile::redStoneOre)); + return std::shared_ptr(new ItemInstance(Tile::redStoneOre)); } \ No newline at end of file diff --git a/Minecraft.World/Blocks/RedStoneOreTile.h b/Minecraft.World/Blocks/RedStoneOreTile.h index bc1d48d76..22639a10f 100644 --- a/Minecraft.World/Blocks/RedStoneOreTile.h +++ b/Minecraft.World/Blocks/RedStoneOreTile.h @@ -11,10 +11,10 @@ private: public: RedStoneOreTile(int id, bool lit); virtual int getTickDelay(); - virtual void attack(Level *level, int x, int y, int z, shared_ptr player); - virtual void stepOn(Level *level, int x, int y, int z, shared_ptr entity); + virtual void attack(Level *level, int x, int y, int z, std::shared_ptr player); + virtual void stepOn(Level *level, int x, int y, int z, std::shared_ptr entity); virtual bool TestUse(); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param private: virtual void interact(Level *level, int x, int y, int z); public: @@ -30,5 +30,5 @@ public: private: void poofParticles(Level *level, int x, int y, int z); protected: - virtual shared_ptr getSilkTouchItemInstance(int data); + virtual std::shared_ptr getSilkTouchItemInstance(int data); }; diff --git a/Minecraft.World/Blocks/SignTile.cpp b/Minecraft.World/Blocks/SignTile.cpp index cf54c14b1..47d68eed1 100644 --- a/Minecraft.World/Blocks/SignTile.cpp +++ b/Minecraft.World/Blocks/SignTile.cpp @@ -35,7 +35,7 @@ AABB *SignTile::getTileAABB(Level *level, int x, int y, int z) return EntityTile::getTileAABB(level, x, y, z); } -void SignTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void SignTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { if (onGround) return; @@ -75,11 +75,11 @@ bool SignTile::isSolidRender(bool isServerLevel) return false; } -shared_ptr SignTile::newTileEntity(Level *level) +std::shared_ptr SignTile::newTileEntity(Level *level) { //try { // 4J Stu - For some reason the newInstance wasn't working right, but doing it like the other TileEntities is fine - return shared_ptr( new SignTileEntity() ); + return std::shared_ptr( new SignTileEntity() ); //return dynamic_pointer_cast( clas->newInstance() ); //} catch (Exception e) { // TODO 4J Stu - Exception handling diff --git a/Minecraft.World/Blocks/SignTile.h b/Minecraft.World/Blocks/SignTile.h index 960da4a71..929974617 100644 --- a/Minecraft.World/Blocks/SignTile.h +++ b/Minecraft.World/Blocks/SignTile.h @@ -21,14 +21,14 @@ public: virtual void updateDefaultShape(); AABB *getAABB(Level *level, int x, int y, int z); AABB *getTileAABB(Level *level, int x, int y, int z); - void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param int getRenderShape(); bool isCubeShaped(); virtual bool isPathfindable(LevelSource *level, int x, int y, int z); bool isSolidRender(bool isServerLevel = false); protected: - shared_ptr newTileEntity(Level *level); + std::shared_ptr newTileEntity(Level *level); public: int getResource(int data, Random *random, int playerBonusLevel); diff --git a/Minecraft.World/Blocks/SkullTile.cpp b/Minecraft.World/Blocks/SkullTile.cpp index 47733b59c..59c6f9c0f 100644 --- a/Minecraft.World/Blocks/SkullTile.cpp +++ b/Minecraft.World/Blocks/SkullTile.cpp @@ -25,7 +25,7 @@ bool SkullTile::isCubeShaped() return false; } -void SkullTile::updateShape(LevelSource *level, int x, int y, int z, int forceData , shared_ptr forceEntity) +void SkullTile::updateShape(LevelSource *level, int x, int y, int z, int forceData , std::shared_ptr forceEntity) { int data = level->getData(x, y, z) & PLACEMENT_MASK; @@ -56,15 +56,15 @@ AABB *SkullTile::getAABB(Level *level, int x, int y, int z) return EntityTile::getAABB(level, x, y, z); } -void SkullTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void SkullTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int dir = Mth::floor(by->yRot * 4 / (360) + 2.5) & 3; level->setData(x, y, z, dir); } -shared_ptr SkullTile::newTileEntity(Level *level) +std::shared_ptr SkullTile::newTileEntity(Level *level) { - return shared_ptr(new SkullTileEntity()); + return std::shared_ptr(new SkullTileEntity()); } int SkullTile::cloneTileId(Level *level, int x, int y, int z) @@ -74,8 +74,8 @@ int SkullTile::cloneTileId(Level *level, int x, int y, int z) 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); + std::shared_ptr tileEntity = level->getTileEntity(x, y, z); + std::shared_ptr skull = dynamic_pointer_cast(tileEntity); if (skull != NULL) { return skull->getSkullType(); @@ -96,7 +96,7 @@ void SkullTile::spawnResources(Level *level, int x, int y, int z, int data, floa // ... because the tile entity is removed prior to spawnResources } -void SkullTile::playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr player) +void SkullTile::playerWillDestroy(Level *level, int x, int y, int z, int data, std::shared_ptr player) { // 4J Stu - Not implemented #if 0 @@ -116,8 +116,8 @@ void SkullTile::onRemove(Level *level, int x, int y, int z)//, int id, int data) int data = level->getData(x, y, z); if ((data & NO_DROP_BIT) == 0) { - shared_ptr item = shared_ptr(new ItemInstance(Item::skull_Id, 1, cloneTileData(level, x, y, z))); - shared_ptr entity = dynamic_pointer_cast(level->getTileEntity(x, y, z)); + std::shared_ptr item = std::shared_ptr(new ItemInstance(Item::skull_Id, 1, cloneTileData(level, x, y, z))); + std::shared_ptr entity = dynamic_pointer_cast(level->getTileEntity(x, y, z)); if (entity->getSkullType() == SkullTileEntity::TYPE_CHAR && !entity->getExtraType().empty()) { @@ -135,7 +135,7 @@ int SkullTile::getResource(int data, Random *random, int playerBonusLevel) return Item::skull_Id; } -void SkullTile::checkMobSpawn(Level *level, int x, int y, int z, shared_ptr placedSkull) +void SkullTile::checkMobSpawn(Level *level, int x, int y, int z, std::shared_ptr placedSkull) { // 4J Stu - Don't have Withers yet, so don't need this #if 0 @@ -244,8 +244,8 @@ bool SkullTile::isSkullAt(Level *level, int x, int y, int z, int skullType) { return false; } - shared_ptr te = level->getTileEntity(x, y, z); - shared_ptr skull = dynamic_pointer_cast(te); + std::shared_ptr te = level->getTileEntity(x, y, z); + std::shared_ptr skull = dynamic_pointer_cast(te); if (skull == NULL) { return false; diff --git a/Minecraft.World/Blocks/SkullTile.h b/Minecraft.World/Blocks/SkullTile.h index 08f430fab..eef309a0c 100644 --- a/Minecraft.World/Blocks/SkullTile.h +++ b/Minecraft.World/Blocks/SkullTile.h @@ -21,18 +21,18 @@ public: int getRenderShape(); bool isSolidRender(bool isServerLevel = false); bool isCubeShaped(); - void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); + void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); AABB *getAABB(Level *level, int x, int y, int z); - void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); - shared_ptr newTileEntity(Level *level); + void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); + std::shared_ptr newTileEntity(Level *level); int cloneTileId(Level *level, int x, int y, int z); int cloneTileData(Level *level, int x, int y, int z); int getSpawnResourcesAuxValue(int data); void spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel); - void playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr player); + void playerWillDestroy(Level *level, int x, int y, int z, int data, std::shared_ptr player); void onRemove(Level *level, int x, int y, int z); //, int id, int data); int getResource(int data, Random *random, int playerBonusLevel); - void checkMobSpawn(Level *level, int x, int y, int z, shared_ptr placedSkull); + void checkMobSpawn(Level *level, int x, int y, int z, std::shared_ptr placedSkull); private: bool isSkullAt(Level *level, int x, int y, int z, int skullType); diff --git a/Minecraft.World/Blocks/StairTile.cpp b/Minecraft.World/Blocks/StairTile.cpp index 36f16f1d6..7fadb36d2 100644 --- a/Minecraft.World/Blocks/StairTile.cpp +++ b/Minecraft.World/Blocks/StairTile.cpp @@ -22,7 +22,7 @@ StairTile::StairTile(int id, Tile *base,int basedata) : Tile(id, base->material, setLightBlock(255); } -void StairTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void StairTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { if (isClipping) { @@ -309,7 +309,7 @@ bool StairTile::setInnerPieceShape(LevelSource *level, int x, int y, int z) return hasInnerPiece; } -void StairTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void StairTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source) { setBaseShape(level, x, y, z); Tile::addAABBs(level, x, y, z, box, boxes, source); @@ -380,7 +380,7 @@ void StairTile::animateTick(Level *level, int x, int y, int z, Random *random) base->animateTick(level, x, y, z, random); } -void StairTile::attack(Level *level, int x, int y, int z, shared_ptr player) +void StairTile::attack(Level *level, int x, int y, int z, std::shared_ptr player) { base->attack(level, x, y, z, player); } @@ -401,7 +401,7 @@ float StairTile::getBrightness(LevelSource *level, int x, int y, int z) return base->getBrightness(level, x, y, z); } -float StairTile::getExplosionResistance(shared_ptr source) +float StairTile::getExplosionResistance(std::shared_ptr source) { return base->getExplosionResistance(source); } @@ -426,7 +426,7 @@ AABB *StairTile::getTileAABB(Level *level, int x, int y, int z) return base->getTileAABB(level, x, y, z); } -void StairTile::handleEntityInside(Level *level, int x, int y, int z, shared_ptr e, Vec3 *current) +void StairTile::handleEntityInside(Level *level, int x, int y, int z, std::shared_ptr e, Vec3 *current) { base->handleEntityInside(level, x, y, z, e, current); } @@ -462,7 +462,7 @@ void StairTile::prepareRender(Level *level, int x, int y, int z) base->prepareRender(level, x, y, z); } -void StairTile::stepOn(Level *level, int x, int y, int z, shared_ptr entity) +void StairTile::stepOn(Level *level, int x, int y, int z, std::shared_ptr entity) { base->stepOn(level, x, y, z, entity); } @@ -479,7 +479,7 @@ void StairTile::tick(Level *level, int x, int y, int z, Random *random) // return true; //} -bool StairTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool StairTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if (soundOnly) return false; return base->use(level, x, y, z, player, 0, 0, 0, 0); @@ -490,7 +490,7 @@ void StairTile::wasExploded(Level *level, int x, int y, int z) base->wasExploded(level, x, y, z); } -void StairTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void StairTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int dir = ( Mth::floor(by->yRot * 4 / (360) + 0.5) ) & 3; int usd = level->getData(x, y, z) & UPSIDEDOWN_BIT; diff --git a/Minecraft.World/Blocks/StairTile.h b/Minecraft.World/Blocks/StairTile.h index d4797f04c..33c5a30ed 100644 --- a/Minecraft.World/Blocks/StairTile.h +++ b/Minecraft.World/Blocks/StairTile.h @@ -32,7 +32,7 @@ protected: StairTile(int id, Tile *base, int basedata); public: - void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param bool isSolidRender(bool isServerLevel = false); bool isCubeShaped(); @@ -49,7 +49,7 @@ public: bool setStepShape(LevelSource *level, int x, int y, int z); bool setInnerPieceShape(LevelSource *level, int x, int y, int z); - void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source); + void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source); /** DELEGATES: **/ @@ -58,14 +58,14 @@ public: void animateTick(Level *level, int x, int y, int z, Random *random); - void attack(Level *level, int x, int y, int z, shared_ptr player); + void attack(Level *level, int x, int y, int z, std::shared_ptr player); void destroy(Level *level, int x, int y, int z, int data); int getLightColor(LevelSource *level, int x, int y, int z, int tileId = -1); float getBrightness(LevelSource *level, int x, int y, int z); - float getExplosionResistance(shared_ptr source); + float getExplosionResistance(std::shared_ptr source); int getRenderLayer(); @@ -75,7 +75,7 @@ public: AABB *getTileAABB(Level *level, int x, int y, int z); - void handleEntityInside(Level *level, int x, int y, int z, shared_ptr e, Vec3 *current); + void handleEntityInside(Level *level, int x, int y, int z, std::shared_ptr e, Vec3 *current); bool mayPick(); @@ -89,15 +89,15 @@ public: void prepareRender(Level *level, int x, int y, int z); - void stepOn(Level *level, int x, int y, int z, shared_ptr entity); + void stepOn(Level *level, int x, int y, int z, std::shared_ptr entity); void tick(Level *level, int x, int y, int z, Random *random); - bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param void wasExploded(Level *level, int x, int y, int z); - void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); + void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); int getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, int itemValue); HitResult *clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b); diff --git a/Minecraft.World/Blocks/StemTile.cpp b/Minecraft.World/Blocks/StemTile.cpp index 27ef25384..9d3544e82 100644 --- a/Minecraft.World/Blocks/StemTile.cpp +++ b/Minecraft.World/Blocks/StemTile.cpp @@ -145,7 +145,7 @@ void StemTile::updateDefaultShape() this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, 0.25f, 0.5f + ss); } -void StemTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void StemTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); tls->yy1 = (level->getData(x, y, z) * 2 + 2) / 16.0f; @@ -192,7 +192,7 @@ void StemTile::spawnResources(Level *level, int x, int y, int z, int data, float float xo = level->random->nextFloat() * s + (1 - s) * 0.5f; float yo = level->random->nextFloat() * s + (1 - s) * 0.5f; float zo = level->random->nextFloat() * s + (1 - s) * 0.5f; - shared_ptr item = shared_ptr(new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr(new ItemInstance(seed)))); + std::shared_ptr item = std::shared_ptr(new ItemEntity(level, x + xo, y + yo, z + zo, std::shared_ptr(new ItemInstance(seed)))); item->throwTime = 10; level->addEntity(item); } diff --git a/Minecraft.World/Blocks/StemTile.h b/Minecraft.World/Blocks/StemTile.h index 1e5ad7819..c4b4f87a4 100644 --- a/Minecraft.World/Blocks/StemTile.h +++ b/Minecraft.World/Blocks/StemTile.h @@ -29,7 +29,7 @@ public: virtual int getColor(LevelSource *level, int x, int y, int z); virtual void updateDefaultShape(); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual int getRenderShape(); int getConnectDir(LevelSource *level, int x, int y, int z); diff --git a/Minecraft.World/Blocks/StoneMonsterTile.cpp b/Minecraft.World/Blocks/StoneMonsterTile.cpp index 6ec6a5f2a..232886e22 100644 --- a/Minecraft.World/Blocks/StoneMonsterTile.cpp +++ b/Minecraft.World/Blocks/StoneMonsterTile.cpp @@ -41,7 +41,7 @@ void StoneMonsterTile::destroy(Level *level, int x, int y, int z, int data) // Also limit the amount of silverfish specifically if(level->countInstanceOf( eTYPE_SILVERFISH, true) < 15 ) { - shared_ptr silverfish = shared_ptr(new Silverfish(level)); + std::shared_ptr silverfish = std::shared_ptr(new Silverfish(level)); silverfish->moveTo(x + .5, y, z + .5, 0, 0); level->addEntity(silverfish); @@ -88,7 +88,7 @@ Tile *StoneMonsterTile::getHostBlockForData(int data) } } -shared_ptr StoneMonsterTile::getSilkTouchItemInstance(int data) +std::shared_ptr StoneMonsterTile::getSilkTouchItemInstance(int data) { Tile *tile = Tile::rock; if (data == HOST_COBBLE) @@ -99,7 +99,7 @@ shared_ptr StoneMonsterTile::getSilkTouchItemInstance(int data) { tile = Tile::stoneBrickSmooth; } - return shared_ptr(new ItemInstance(tile)); + return std::shared_ptr(new ItemInstance(tile)); } int StoneMonsterTile::cloneTileData(Level *level, int x, int y, int z) diff --git a/Minecraft.World/Blocks/StoneMonsterTile.h b/Minecraft.World/Blocks/StoneMonsterTile.h index 9c0b58fd0..96063a140 100644 --- a/Minecraft.World/Blocks/StoneMonsterTile.h +++ b/Minecraft.World/Blocks/StoneMonsterTile.h @@ -31,7 +31,7 @@ public: virtual unsigned int getDescriptionId(int iData = -1); protected: - virtual shared_ptr getSilkTouchItemInstance(int data); + virtual std::shared_ptr getSilkTouchItemInstance(int data); public: int cloneTileData(Level *level, int x, int y, int z); diff --git a/Minecraft.World/Blocks/StoneSlabTile.cpp b/Minecraft.World/Blocks/StoneSlabTile.cpp index 72a64ec84..526c207fe 100644 --- a/Minecraft.World/Blocks/StoneSlabTile.cpp +++ b/Minecraft.World/Blocks/StoneSlabTile.cpp @@ -78,7 +78,7 @@ int StoneSlabTile::getAuxName(int auxValue) return SLAB_NAMES[auxValue];//super.getDescriptionId() + "." + SLAB_NAMES[auxValue]; } -shared_ptr StoneSlabTile::getSilkTouchItemInstance(int data) +std::shared_ptr StoneSlabTile::getSilkTouchItemInstance(int data) { - return shared_ptr(new ItemInstance(Tile::stoneSlabHalf_Id, 2, data & TYPE_MASK)); + return std::shared_ptr(new ItemInstance(Tile::stoneSlabHalf_Id, 2, data & TYPE_MASK)); } diff --git a/Minecraft.World/Blocks/StoneSlabTile.h b/Minecraft.World/Blocks/StoneSlabTile.h index 4380b04c5..42972c402 100644 --- a/Minecraft.World/Blocks/StoneSlabTile.h +++ b/Minecraft.World/Blocks/StoneSlabTile.h @@ -35,5 +35,5 @@ public: virtual unsigned int getDescriptionId(int iData = -1); virtual int getAuxName(int auxValue); protected: - virtual shared_ptr getSilkTouchItemInstance(int data); + virtual std::shared_ptr getSilkTouchItemInstance(int data); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TallGrassPlantTile.cpp b/Minecraft.World/Blocks/TallGrassPlantTile.cpp index 8a0a9ab2d..daf5efac6 100644 --- a/Minecraft.World/Blocks/TallGrassPlantTile.cpp +++ b/Minecraft.World/Blocks/TallGrassPlantTile.cpp @@ -79,7 +79,7 @@ int TallGrass::getResourceCountForLootBonus(int bonusLevel, Random *random) return 1 + random->nextInt(bonusLevel * 2 + 1); } -void TallGrass::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) +void TallGrass::playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data) { if (!level->isClientSide && player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears->id) { @@ -89,7 +89,7 @@ void TallGrass::playerDestroy(Level *level, shared_ptr player, int x, in ); // drop leaf block instead of sapling - popResource(level, x, y, z, shared_ptr(new ItemInstance(Tile::tallgrass, 1, data))); + popResource(level, x, y, z, std::shared_ptr(new ItemInstance(Tile::tallgrass, 1, data))); } else { diff --git a/Minecraft.World/Blocks/TallGrassPlantTile.h b/Minecraft.World/Blocks/TallGrassPlantTile.h index a7a05463a..3af76cabc 100644 --- a/Minecraft.World/Blocks/TallGrassPlantTile.h +++ b/Minecraft.World/Blocks/TallGrassPlantTile.h @@ -35,7 +35,7 @@ public: virtual int getResource(int data, Random *random, int playerBonusLevel); virtual int getResourceCountForLootBonus(int bonusLevel, Random *random); - virtual void playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data); + virtual void playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data); virtual int cloneTileData(Level *level, int x, int y, int z); virtual unsigned int getDescriptionId(int iData = -1); diff --git a/Minecraft.World/Blocks/TheEndPortalFrameTile.cpp b/Minecraft.World/Blocks/TheEndPortalFrameTile.cpp index 0c92e347f..5a266f11f 100644 --- a/Minecraft.World/Blocks/TheEndPortalFrameTile.cpp +++ b/Minecraft.World/Blocks/TheEndPortalFrameTile.cpp @@ -52,7 +52,7 @@ void TheEndPortalFrameTile::updateDefaultShape() setShape(0, 0, 0, 1, 13.0f / 16.0f, 1); } -void TheEndPortalFrameTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void TheEndPortalFrameTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source) { setShape(0, 0, 0, 1, 13.0f / 16.0f, 1); Tile::addAABBs(level, x, y, z, box, boxes, source); @@ -76,7 +76,7 @@ int TheEndPortalFrameTile::getResource(int data, Random *random, int playerBonus return 0; } -void TheEndPortalFrameTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void TheEndPortalFrameTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int dir = (((Mth::floor(by->yRot * 4 / (360) + 0.5)) & 3) + 2) % 4; level->setData(x, y, z, dir); diff --git a/Minecraft.World/Blocks/TheEndPortalFrameTile.h b/Minecraft.World/Blocks/TheEndPortalFrameTile.h index b48d3c096..bedad14d5 100644 --- a/Minecraft.World/Blocks/TheEndPortalFrameTile.h +++ b/Minecraft.World/Blocks/TheEndPortalFrameTile.h @@ -19,8 +19,8 @@ public: virtual bool isSolidRender(bool isServerLevel = false); virtual int getRenderShape(); virtual void updateDefaultShape(); - virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source); + virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source); static bool hasEye(int data); virtual int getResource(int data, Random *random, int playerBonusLevel); - virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); + virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TheEndPortalTile.cpp b/Minecraft.World/Blocks/TheEndPortalTile.cpp index aef1e85f1..d1c3cf8d8 100644 --- a/Minecraft.World/Blocks/TheEndPortalTile.cpp +++ b/Minecraft.World/Blocks/TheEndPortalTile.cpp @@ -26,12 +26,12 @@ TheEndPortal::TheEndPortal(int id, Material *material) : EntityTile(id, material this->setLightEmission(1.0f); } -shared_ptr TheEndPortal::newTileEntity(Level *level) +std::shared_ptr TheEndPortal::newTileEntity(Level *level) { - return shared_ptr(new TheEndPortalTileEntity()); + return std::shared_ptr(new TheEndPortalTileEntity()); } -void TheEndPortal::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void TheEndPortal::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { float r = 1 / 16.0f; this->setShape(0, 0, 0, 1, r, 1); @@ -43,7 +43,7 @@ bool TheEndPortal::shouldRenderFace(LevelSource *level, int x, int y, int z, int return EntityTile::shouldRenderFace(level, x, y, z, face); } -void TheEndPortal::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void TheEndPortal::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source) { } @@ -62,7 +62,7 @@ int TheEndPortal::getResourceCount(Random *random) return 0; } -void TheEndPortal::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +void TheEndPortal::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) { if (entity->riding == NULL && entity->rider.lock() == NULL) { diff --git a/Minecraft.World/Blocks/TheEndPortalTile.h b/Minecraft.World/Blocks/TheEndPortalTile.h index 1aa92fab6..b344ce796 100644 --- a/Minecraft.World/Blocks/TheEndPortalTile.h +++ b/Minecraft.World/Blocks/TheEndPortalTile.h @@ -11,14 +11,14 @@ public: TheEndPortal(int id, Material *material); - virtual shared_ptr newTileEntity(Level *level); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual std::shared_ptr newTileEntity(Level *level); + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face); - virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source); + virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source); virtual bool isSolidRender(bool isServerLevel = false); virtual bool isCubeShaped(); virtual int getResourceCount(Random *random); - virtual void entityInside(Level *level, int x, int y, int z, shared_ptr entity); + virtual void entityInside(Level *level, int x, int y, int z, std::shared_ptr entity); virtual void animateTick(Level *level, int xt, int yt, int zt, Random *random); virtual int getRenderShape(); virtual void onPlace(Level *level, int x, int y, int z); diff --git a/Minecraft.World/Blocks/ThinFenceTile.cpp b/Minecraft.World/Blocks/ThinFenceTile.cpp index 3d17a8d68..697338e2d 100644 --- a/Minecraft.World/Blocks/ThinFenceTile.cpp +++ b/Minecraft.World/Blocks/ThinFenceTile.cpp @@ -42,7 +42,7 @@ bool ThinFenceTile::shouldRenderFace(LevelSource *level, int x, int y, int z, in return Tile::shouldRenderFace(level, x, y, z, face); } -void ThinFenceTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void ThinFenceTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source) { bool n = attachsTo(level->getTile(x, y, z - 1)); bool s = attachsTo(level->getTile(x, y, z + 1)); @@ -86,7 +86,7 @@ void ThinFenceTile::updateDefaultShape() setShape(0, 0, 0, 1, 1, 1); } -void ThinFenceTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void ThinFenceTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { float minX = 7.0f / 16.0f; float maxX = 9.0f / 16.0f; @@ -142,9 +142,9 @@ bool ThinFenceTile::isSilkTouchable() return true; } -shared_ptr ThinFenceTile::getSilkTouchItemInstance(int data) +std::shared_ptr ThinFenceTile::getSilkTouchItemInstance(int data) { - return shared_ptr(new ItemInstance(id, 1, data)); + return std::shared_ptr(new ItemInstance(id, 1, data)); } void ThinFenceTile::registerIcons(IconRegister *iconRegister) diff --git a/Minecraft.World/Blocks/ThinFenceTile.h b/Minecraft.World/Blocks/ThinFenceTile.h index d6e3e5ceb..0f1c3bfa1 100644 --- a/Minecraft.World/Blocks/ThinFenceTile.h +++ b/Minecraft.World/Blocks/ThinFenceTile.h @@ -17,15 +17,15 @@ public: virtual bool isCubeShaped(); virtual int getRenderShape(); virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face); - virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source); + virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source); virtual void updateDefaultShape(); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual Icon *getEdgeTexture(); bool attachsTo(int tile); protected: bool isSilkTouchable(); - shared_ptr getSilkTouchItemInstance(int data); + std::shared_ptr getSilkTouchItemInstance(int data); public: void registerIcons(IconRegister *iconRegister); diff --git a/Minecraft.World/Blocks/Tile.cpp b/Minecraft.World/Blocks/Tile.cpp index daf716a3d..e80d0637c 100644 --- a/Minecraft.World/Blocks/Tile.cpp +++ b/Minecraft.World/Blocks/Tile.cpp @@ -798,7 +798,7 @@ AABB *Tile::getTileAABB(Level *level, int x, int y, int z) return AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1); } -void Tile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void Tile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source) { AABB *aabb = getAABB(level, x, y, z); if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb); @@ -870,7 +870,7 @@ int Tile::getResource(int data, Random *random, int playerBonusLevel) return id; } -float Tile::getDestroyProgress(shared_ptr player, Level *level, int x, int y, int z) +float Tile::getDestroyProgress(std::shared_ptr player, Level *level, int x, int y, int z) { float destroySpeed = getDestroySpeed(level, x, y, z); if (destroySpeed < 0) return 0; @@ -893,11 +893,11 @@ void Tile::spawnResources(Level *level, int x, int y, int z, int data, float odd int type = getResource(data, level->random, playerBonusLevel); if (type <= 0) continue; - popResource(level, x, y, z, shared_ptr( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data) ) ) ); + popResource(level, x, y, z, std::shared_ptr( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data) ) ) ); } } -void Tile::popResource(Level *level, int x, int y, int z, shared_ptr itemInstance) +void Tile::popResource(Level *level, int x, int y, int z, std::shared_ptr itemInstance) { if( level->isClientSide ) return; @@ -905,7 +905,7 @@ void Tile::popResource(Level *level, int x, int y, int z, shared_ptrrandom->nextFloat() * s + (1 - s) * 0.5; double yo = level->random->nextFloat() * s + (1 - s) * 0.5; double zo = level->random->nextFloat() * s + (1 - s) * 0.5; - shared_ptr item = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, itemInstance ) ); + std::shared_ptr item = std::shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, itemInstance ) ); item->throwTime = 10; level->addEntity(item); } @@ -919,7 +919,7 @@ void Tile::popExperience(Level *level, int x, int y, int z, int amount) { int newCount = ExperienceOrb::getExperienceValue(amount); amount -= newCount; - level->addEntity(shared_ptr( new ExperienceOrb(level, x + .5, y + .5, z + .5, newCount))); + level->addEntity(std::shared_ptr( new ExperienceOrb(level, x + .5, y + .5, z + .5, newCount))); } } } @@ -929,7 +929,7 @@ int Tile::getSpawnResourcesAuxValue(int data) return 0; } -float Tile::getExplosionResistance(shared_ptr source) +float Tile::getExplosionResistance(std::shared_ptr source) { return explosionResistance / 5.0f; } @@ -1030,17 +1030,17 @@ bool Tile::TestUse() return false; } -bool Tile::TestUse(Level *level, int x, int y, int z, shared_ptr player) +bool Tile::TestUse(Level *level, int x, int y, int z, std::shared_ptr player) { return false; } -bool Tile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool Tile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { return false; } -void Tile::stepOn(Level *level, int x, int y, int z, shared_ptr entity) +void Tile::stepOn(Level *level, int x, int y, int z, std::shared_ptr entity) { } @@ -1053,15 +1053,15 @@ void Tile::prepareRender(Level *level, int x, int y, int z) { } -void Tile::attack(Level *level, int x, int y, int z, shared_ptr player) +void Tile::attack(Level *level, int x, int y, int z, std::shared_ptr player) { } -void Tile::handleEntityInside(Level *level, int x, int y, int z, shared_ptr e, Vec3 *current) +void Tile::handleEntityInside(Level *level, int x, int y, int z, std::shared_ptr e, Vec3 *current) { } -void Tile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void Tile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile @@ -1151,7 +1151,7 @@ bool Tile::isSignalSource() return false; } -void Tile::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +void Tile::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) { } @@ -1165,7 +1165,7 @@ void Tile::updateDefaultShape() setShape(0,0,0,1,1,1); } -void Tile::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) +void Tile::playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data) { // 4J Stu - Special case - only record a crop destroy if is fully grown if( id==Tile::crops_Id ) @@ -1208,7 +1208,7 @@ void Tile::playerDestroy(Level *level, shared_ptr player, int x, int y, if (isSilkTouchable() && EnchantmentHelper::hasSilkTouch(player->inventory)) { - shared_ptr item = getSilkTouchItemInstance(data); + std::shared_ptr item = getSilkTouchItemInstance(data); if (item != NULL) { popResource(level, x, y, z, item); @@ -1226,14 +1226,14 @@ bool Tile::isSilkTouchable() return isCubeShaped() && !_isEntityTile; } -shared_ptr Tile::getSilkTouchItemInstance(int data) +std::shared_ptr Tile::getSilkTouchItemInstance(int data) { int popData = 0; if (id >= 0 && id < Item::items.length && Item::items[id]->isStackedByData()) { popData = data; } - return shared_ptr(new ItemInstance(id, 1, popData)); + return std::shared_ptr(new ItemInstance(id, 1, popData)); } int Tile::getResourceCountForLootBonus(int bonusLevel, Random *random) @@ -1246,7 +1246,7 @@ bool Tile::canSurvive(Level *level, int x, int y, int z) return true; } -void Tile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void Tile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { } @@ -1307,7 +1307,7 @@ float Tile::getShadeBrightness(LevelSource *level, int x, int y, int z) return level->isSolidBlockingTile(x, y, z) ? 0.2f : 1.0f; } -void Tile::fallOn(Level *level, int x, int y, int z, shared_ptr entity, float fallDistance) +void Tile::fallOn(Level *level, int x, int y, int z, std::shared_ptr entity, float fallDistance) { } @@ -1321,7 +1321,7 @@ int Tile::cloneTileData(Level *level, int x, int y, int z) return getSpawnResourcesAuxValue(level->getData(x, y, z)); } -void Tile::playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr player) +void Tile::playerWillDestroy(Level *level, int x, int y, int z, int data, std::shared_ptr player) { } diff --git a/Minecraft.World/Blocks/Tile.h b/Minecraft.World/Blocks/Tile.h index c95dde200..7d93d6bbb 100644 --- a/Minecraft.World/Blocks/Tile.h +++ b/Minecraft.World/Blocks/Tile.h @@ -545,7 +545,7 @@ public: virtual Icon *getTexture(int face, int data); virtual Icon *getTexture(int face); virtual AABB *getTileAABB(Level *level, int x, int y, int z); - virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source); + virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source); virtual AABB *getAABB(Level *level, int x, int y, int z); virtual bool isSolidRender(bool isServerLevel = false); // 4J - Added isServerLevel param virtual bool mayPick(int data, bool liquid); @@ -560,16 +560,16 @@ public: virtual void onRemove(Level *level, int x, int y, int z, int id, int data); virtual int getResourceCount(Random *random); virtual int getResource(int data, Random *random, int playerBonusLevel); - virtual float getDestroyProgress(shared_ptr player, Level *level = nullptr, int x = 0, int y = 0, int z = 0); + virtual float getDestroyProgress(std::shared_ptr player, Level *level = nullptr, int x = 0, int y = 0, int z = 0); virtual void spawnResources(Level *level, int x, int y, int z, int data, int playerBonusLevel); virtual void spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel); protected: - virtual void popResource(Level *level, int x, int y, int z, shared_ptr itemInstance); + virtual void popResource(Level *level, int x, int y, int z, std::shared_ptr itemInstance); virtual void popExperience(Level *level, int x, int y, int z, int amount); public: virtual int getSpawnResourcesAuxValue(int data); - virtual float getExplosionResistance(shared_ptr source); + virtual float getExplosionResistance(std::shared_ptr source); virtual HitResult *clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b); private: virtual bool containsX(Vec3 *v); @@ -581,14 +581,14 @@ public: virtual bool mayPlace(Level *level, int x, int y, int z, int face); virtual bool mayPlace(Level *level, int x, int y, int z); virtual bool TestUse(); - virtual bool TestUse(Level *level, int x, int y, int z, shared_ptr player); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace = 0, float clickX = 0.0f, float clickY = 0.0f, float clickZ = 0.0f, bool soundOnly = false); // 4J added soundOnly param - virtual void stepOn(Level *level, int x, int y, int z, shared_ptr entity); + virtual bool TestUse(Level *level, int x, int y, int z, std::shared_ptr player); + virtual bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace = 0, float clickX = 0.0f, float clickY = 0.0f, float clickZ = 0.0f, bool soundOnly = false); // 4J added soundOnly param + virtual void stepOn(Level *level, int x, int y, int z, std::shared_ptr entity); virtual int getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, int itemValue); virtual void prepareRender(Level *level, int x, int y, int z); - virtual void attack(Level *level, int x, int y, int z, shared_ptr player); - virtual void handleEntityInside(Level *level, int x, int y, int z, shared_ptr e, Vec3 *current); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void attack(Level *level, int x, int y, int z, std::shared_ptr player); + virtual void handleEntityInside(Level *level, int x, int y, int z, std::shared_ptr e, Vec3 *current); + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual double getShapeX0(); virtual double getShapeX1(); virtual double getShapeY0(); @@ -602,17 +602,17 @@ public: virtual bool getSignal(LevelSource *level, int x, int y, int z); virtual bool getSignal(LevelSource *level, int x, int y, int z, int dir); virtual bool isSignalSource(); - virtual void entityInside(Level *level, int x, int y, int z, shared_ptr entity); + virtual void entityInside(Level *level, int x, int y, int z, std::shared_ptr entity); virtual bool getDirectSignal(Level *level, int x, int y, int z, int dir); virtual void updateDefaultShape(); - virtual void playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data); + virtual void playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data); virtual bool canSurvive(Level *level, int x, int y, int z); protected: virtual bool isSilkTouchable(); - virtual shared_ptr getSilkTouchItemInstance(int data); + virtual std::shared_ptr getSilkTouchItemInstance(int data); public: virtual int getResourceCountForLootBonus(int bonusLevel, Random *random); - virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); + virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); virtual void finalizePlacement(Level *level, int x, int y, int z, int data); virtual Tile *setDescriptionId(unsigned int id); virtual wstring getName(); @@ -630,10 +630,10 @@ protected: public: virtual int getPistonPushReaction(); virtual float getShadeBrightness(LevelSource *level, int x, int y, int z); // 4J - brought forward from 1.8.2 - virtual void fallOn(Level *level, int x, int y, int z, shared_ptr entity, float fallDistance); + virtual void fallOn(Level *level, int x, int y, int z, std::shared_ptr entity, float fallDistance); virtual int cloneTileId(Level *level, int x, int y, int z); virtual int cloneTileData(Level *level, int x, int y, int z); - virtual void playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr player); + virtual void playerWillDestroy(Level *level, int x, int y, int z, int data, std::shared_ptr player); virtual void onRemoving(Level *level, int x, int y, int z, int data); virtual void handleRain(Level *level, int x, int y, int z); virtual void levelTimeChanged(Level *level, __int64 delta, __int64 newTime); diff --git a/Minecraft.World/Blocks/TileEntities/BrewingStandTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/BrewingStandTileEntity.cpp index 60ce155cd..d7d59d8cd 100644 --- a/Minecraft.World/Blocks/TileEntities/BrewingStandTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/BrewingStandTileEntity.cpp @@ -79,7 +79,7 @@ bool BrewingStandTileEntity::isBrewable() { return false; } - shared_ptr ingredient = items[INGREDIENT_SLOT]; + std::shared_ptr ingredient = items[INGREDIENT_SLOT]; if (PotionBrewing::SIMPLIFIED_BREWING) { if (!Item::items[ingredient->id]->hasPotionBrewingFormula()) @@ -172,7 +172,7 @@ void BrewingStandTileEntity::doBrew() return; } - shared_ptr ingredient = items[INGREDIENT_SLOT]; + std::shared_ptr ingredient = items[INGREDIENT_SLOT]; if (PotionBrewing::SIMPLIFIED_BREWING) { @@ -233,14 +233,14 @@ void BrewingStandTileEntity::doBrew() } else if (isWater && items[dest] != NULL && items[dest]->id == Item::glassBottle_Id) { - items[dest] = shared_ptr(new ItemInstance(Item::potion)); + items[dest] = std::shared_ptr(new ItemInstance(Item::potion)); } } } if (Item::items[ingredient->id]->hasCraftingRemainingItem()) { - items[INGREDIENT_SLOT] = shared_ptr(new ItemInstance(Item::items[ingredient->id]->getCraftingRemainingItem())); + items[INGREDIENT_SLOT] = std::shared_ptr(new ItemInstance(Item::items[ingredient->id]->getCraftingRemainingItem())); } else { @@ -252,7 +252,7 @@ void BrewingStandTileEntity::doBrew() } } -int BrewingStandTileEntity::applyIngredient(int currentBrew, shared_ptr ingredient) +int BrewingStandTileEntity::applyIngredient(int currentBrew, std::shared_ptr ingredient) { if (ingredient == NULL) { @@ -316,7 +316,7 @@ void BrewingStandTileEntity::save(CompoundTag *base) base->put(L"Items", listTag); } -shared_ptr BrewingStandTileEntity::getItem(unsigned int slot) +std::shared_ptr BrewingStandTileEntity::getItem(unsigned int slot) { if (slot >= 0 && slot < items.length) { @@ -325,7 +325,7 @@ shared_ptr BrewingStandTileEntity::getItem(unsigned int slot) return nullptr; } -shared_ptr BrewingStandTileEntity::removeItem(unsigned int slot, int count) +std::shared_ptr BrewingStandTileEntity::removeItem(unsigned int slot, int count) { // 4J Stu - Changed the implementation of this function to be the same as ChestTileEntity to enable the "Pickup Half" // option on the ingredients slot @@ -335,7 +335,7 @@ shared_ptr BrewingStandTileEntity::removeItem(unsigned int slot, i { if (items[slot]->count <= count) { - shared_ptr item = items[slot]; + std::shared_ptr item = items[slot]; items[slot] = nullptr; this->setChanged(); // 4J Stu - Fix for duplication glitch @@ -344,7 +344,7 @@ shared_ptr BrewingStandTileEntity::removeItem(unsigned int slot, i } else { - shared_ptr i = items[slot]->remove(count); + std::shared_ptr i = items[slot]->remove(count); if (items[slot]->count == 0) items[slot] = nullptr; this->setChanged(); // 4J Stu - Fix for duplication glitch @@ -355,18 +355,18 @@ shared_ptr BrewingStandTileEntity::removeItem(unsigned int slot, i return nullptr; } -shared_ptr BrewingStandTileEntity::removeItemNoUpdate(int slot) +std::shared_ptr BrewingStandTileEntity::removeItemNoUpdate(int slot) { if (slot >= 0 && slot < items.length) { - shared_ptr item = items[slot]; + std::shared_ptr item = items[slot]; items[slot] = nullptr; return item; } return nullptr; } -void BrewingStandTileEntity::setItem(unsigned int slot, shared_ptr item) +void BrewingStandTileEntity::setItem(unsigned int slot, std::shared_ptr item) { if (slot >= 0 && slot < items.length) { @@ -379,7 +379,7 @@ int BrewingStandTileEntity::getMaxStackSize() return 1; } -bool BrewingStandTileEntity::stillValid(shared_ptr player) +bool BrewingStandTileEntity::stillValid(std::shared_ptr player) { if (level->getTileEntity(x, y, z) != shared_from_this()) return false; if (player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 8 * 8) return false; @@ -413,9 +413,9 @@ int BrewingStandTileEntity::getPotionBits() } // 4J Added -shared_ptr BrewingStandTileEntity::clone() +std::shared_ptr BrewingStandTileEntity::clone() { - shared_ptr result = shared_ptr( new BrewingStandTileEntity() ); + std::shared_ptr result = std::shared_ptr( new BrewingStandTileEntity() ); TileEntity::clone(result); result->brewTime = brewTime; diff --git a/Minecraft.World/Blocks/TileEntities/BrewingStandTileEntity.h b/Minecraft.World/Blocks/TileEntities/BrewingStandTileEntity.h index 1c8c38cda..df8d6b3a0 100644 --- a/Minecraft.World/Blocks/TileEntities/BrewingStandTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/BrewingStandTileEntity.h @@ -29,17 +29,17 @@ private: bool isBrewable(); void doBrew(); - int applyIngredient(int currentBrew, shared_ptr ingredient); + int applyIngredient(int currentBrew, std::shared_ptr ingredient); public: virtual void load(CompoundTag *base); virtual void save(CompoundTag *base); - virtual shared_ptr getItem(unsigned int slot); - virtual shared_ptr removeItem(unsigned int slot, int i); - virtual shared_ptr removeItemNoUpdate(int slot); - virtual void setItem(unsigned int slot, shared_ptr item); + virtual std::shared_ptr getItem(unsigned int slot); + virtual std::shared_ptr removeItem(unsigned int slot, int i); + virtual std::shared_ptr removeItemNoUpdate(int slot); + virtual void setItem(unsigned int slot, std::shared_ptr item); virtual int getMaxStackSize(); - virtual bool stillValid(shared_ptr player); + virtual bool stillValid(std::shared_ptr player); virtual void startOpen(); virtual void stopOpen(); virtual void setBrewTime(int value); @@ -47,5 +47,5 @@ public: int getPotionBits(); // 4J Added - virtual shared_ptr clone(); + virtual std::shared_ptr clone(); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp index 6c60a0f6e..9bd14b10e 100644 --- a/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp @@ -37,18 +37,18 @@ unsigned int ChestTileEntity::getContainerSize() return 9 * 3; } -shared_ptr ChestTileEntity::getItem(unsigned int slot) +std::shared_ptr ChestTileEntity::getItem(unsigned int slot) { return items->data[slot]; } -shared_ptr ChestTileEntity::removeItem(unsigned int slot, int count) +std::shared_ptr ChestTileEntity::removeItem(unsigned int slot, int count) { if (items->data[slot] != NULL) { if (items->data[slot]->count <= count) { - shared_ptr item = items->data[slot]; + std::shared_ptr item = items->data[slot]; items->data[slot] = nullptr; this->setChanged(); // 4J Stu - Fix for duplication glitch @@ -57,7 +57,7 @@ shared_ptr ChestTileEntity::removeItem(unsigned int slot, int coun } else { - shared_ptr i = items->data[slot]->remove(count); + std::shared_ptr i = items->data[slot]->remove(count); if (items->data[slot]->count == 0) items->data[slot] = nullptr; this->setChanged(); // 4J Stu - Fix for duplication glitch @@ -68,18 +68,18 @@ shared_ptr ChestTileEntity::removeItem(unsigned int slot, int coun return nullptr; } -shared_ptr ChestTileEntity::removeItemNoUpdate(int slot) +std::shared_ptr ChestTileEntity::removeItemNoUpdate(int slot) { if (items->data[slot] != NULL) { - shared_ptr item = items->data[slot]; + std::shared_ptr item = items->data[slot]; items->data[slot] = nullptr; return item; } return nullptr; } -void ChestTileEntity::setItem(unsigned int slot, shared_ptr item) +void ChestTileEntity::setItem(unsigned int slot, std::shared_ptr item) { items->data[slot] = item; if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); @@ -135,7 +135,7 @@ int ChestTileEntity::getMaxStackSize() return Container::LARGE_MAX_STACK_SIZE; } -bool ChestTileEntity::stillValid(shared_ptr player) +bool ChestTileEntity::stillValid(std::shared_ptr player) { if (level->getTileEntity(x, y, z) != shared_from_this() ) return false; if (player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 8 * 8) return false; @@ -273,9 +273,9 @@ void ChestTileEntity::setRemoved() } // 4J Added -shared_ptr ChestTileEntity::clone() +std::shared_ptr ChestTileEntity::clone() { - shared_ptr result = shared_ptr( new ChestTileEntity() ); + std::shared_ptr result = std::shared_ptr( new ChestTileEntity() ); TileEntity::clone(result); for (unsigned int i = 0; i < items->length; i++) diff --git a/Minecraft.World/Blocks/TileEntities/ChestTileEntity.h b/Minecraft.World/Blocks/TileEntities/ChestTileEntity.h index 647f13606..2198f1e32 100644 --- a/Minecraft.World/Blocks/TileEntities/ChestTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/ChestTileEntity.h @@ -40,15 +40,15 @@ private: public: virtual unsigned int getContainerSize(); - virtual shared_ptr getItem(unsigned int slot); - virtual shared_ptr removeItem(unsigned int slot, int count); - virtual shared_ptr removeItemNoUpdate(int slot); - virtual void setItem(unsigned int slot, shared_ptr item); + virtual std::shared_ptr getItem(unsigned int slot); + virtual std::shared_ptr removeItem(unsigned int slot, int count); + virtual std::shared_ptr removeItemNoUpdate(int slot); + virtual void setItem(unsigned int slot, std::shared_ptr item); virtual int getName(); virtual void load(CompoundTag *base); virtual void save(CompoundTag *base); virtual int getMaxStackSize(); - virtual bool stillValid(shared_ptr player); + virtual bool stillValid(std::shared_ptr player); virtual void setChanged(); virtual void clearCache(); virtual void checkNeighbors(); @@ -59,5 +59,5 @@ public: virtual void setRemoved(); // 4J Added - virtual shared_ptr clone(); + virtual std::shared_ptr clone(); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TileEntities/DispenserTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/DispenserTileEntity.cpp index 7fce8839b..3012212e2 100644 --- a/Minecraft.World/Blocks/TileEntities/DispenserTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/DispenserTileEntity.cpp @@ -30,18 +30,18 @@ unsigned int DispenserTileEntity::getContainerSize() return 9; } -shared_ptr DispenserTileEntity::getItem(unsigned int slot) +std::shared_ptr DispenserTileEntity::getItem(unsigned int slot) { return items->data[slot]; } -shared_ptr DispenserTileEntity::removeItem(unsigned int slot, int count) +std::shared_ptr DispenserTileEntity::removeItem(unsigned int slot, int count) { if (items->data[slot] != NULL) { if (items->data[slot]->count <= count) { - shared_ptr item = items->data[slot]; + std::shared_ptr item = items->data[slot]; items->data[slot] = nullptr; this->setChanged(); // 4J Stu - Fix for duplication glitch @@ -50,7 +50,7 @@ shared_ptr DispenserTileEntity::removeItem(unsigned int slot, int } else { - shared_ptr i = items->data[slot]->remove(count); + std::shared_ptr i = items->data[slot]->remove(count); if (items->data[slot]->count == 0) items->data[slot] = nullptr; this->setChanged(); // 4J Stu - Fix for duplication glitch @@ -61,11 +61,11 @@ shared_ptr DispenserTileEntity::removeItem(unsigned int slot, int return nullptr; } -shared_ptr DispenserTileEntity::removeItemNoUpdate(int slot) +std::shared_ptr DispenserTileEntity::removeItemNoUpdate(int slot) { if (items->data[slot] != NULL) { - shared_ptr item = items->data[slot]; + std::shared_ptr item = items->data[slot]; items->data[slot] = nullptr; return item; } @@ -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) +void DispenserTileEntity::AddItemBack(std::shared_ptritem, unsigned int slot) { if (items->data[slot] != NULL) { @@ -103,7 +103,7 @@ bool DispenserTileEntity::removeProjectile(int itemId) { if (items->data[i] != NULL && items->data[i]->id == itemId) { - shared_ptr removedItem = removeItem(i, 1); + std::shared_ptr removedItem = removeItem(i, 1); return removedItem != NULL; } } @@ -125,14 +125,14 @@ int DispenserTileEntity::getRandomSlot() return replaceSlot; } -void DispenserTileEntity::setItem(unsigned int slot, shared_ptr item) +void DispenserTileEntity::setItem(unsigned int slot, std::shared_ptr item) { items->data[slot] = item; if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); this->setChanged(); } -int DispenserTileEntity::addItem(shared_ptr item) +int DispenserTileEntity::addItem(std::shared_ptr item) { for (int i = 0; i < items->length; i++) { @@ -187,7 +187,7 @@ int DispenserTileEntity::getMaxStackSize() return Container::LARGE_MAX_STACK_SIZE; } -bool DispenserTileEntity::stillValid(shared_ptr player) +bool DispenserTileEntity::stillValid(std::shared_ptr player) { if (level->getTileEntity(x, y, z) != shared_from_this() ) return false; if (player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 8 * 8) return false; @@ -208,9 +208,9 @@ void DispenserTileEntity::stopOpen() } // 4J Added -shared_ptr DispenserTileEntity::clone() +std::shared_ptr DispenserTileEntity::clone() { - shared_ptr result = shared_ptr( new DispenserTileEntity() ); + std::shared_ptr result = std::shared_ptr( new DispenserTileEntity() ); TileEntity::clone(result); for (unsigned int i = 0; i < items->length; i++) diff --git a/Minecraft.World/Blocks/TileEntities/DispenserTileEntity.h b/Minecraft.World/Blocks/TileEntities/DispenserTileEntity.h index 309df2c54..077090a6a 100644 --- a/Minecraft.World/Blocks/TileEntities/DispenserTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/DispenserTileEntity.h @@ -29,24 +29,24 @@ public: virtual ~DispenserTileEntity(); virtual unsigned int getContainerSize(); - virtual shared_ptr getItem(unsigned int slot); - virtual shared_ptr removeItem(unsigned int slot, int count); - shared_ptr removeItemNoUpdate(int slot); + virtual std::shared_ptr getItem(unsigned int slot); + virtual std::shared_ptr removeItem(unsigned int slot, int count); + std::shared_ptr removeItemNoUpdate(int slot); bool removeProjectile(int itemId); int getRandomSlot(); - virtual void setItem(unsigned int slot, shared_ptr item); - virtual int addItem(shared_ptr item); + virtual void setItem(unsigned int slot, std::shared_ptr item); + virtual int addItem(std::shared_ptr item); virtual int getName(); virtual void load(CompoundTag *base); virtual void save(CompoundTag *base); virtual int getMaxStackSize(); - virtual bool stillValid(shared_ptr player); + virtual bool stillValid(std::shared_ptr player); virtual void setChanged(); void startOpen(); void stopOpen(); // 4J Added - virtual shared_ptr clone(); - void AddItemBack(shared_ptritem, unsigned int slot); + virtual std::shared_ptr clone(); + void AddItemBack(std::shared_ptritem, unsigned int slot); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TileEntities/EnchantmentTableTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/EnchantmentTableTileEntity.cpp index 254a994fc..f146da7a2 100644 --- a/Minecraft.World/Blocks/TileEntities/EnchantmentTableTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/EnchantmentTableTileEntity.cpp @@ -32,7 +32,7 @@ void EnchantmentTableEntity::tick() oOpen = open; oRot = rot; - shared_ptr player = level->getNearestPlayer(x + 0.5f, y + 0.5f, z + 0.5f, 3); + std::shared_ptr player = level->getNearestPlayer(x + 0.5f, y + 0.5f, z + 0.5f, 3); if (player != NULL) { double xd = player->x - (x + 0.5f); @@ -89,9 +89,9 @@ void EnchantmentTableEntity::tick() flip = flip + flipA; } -shared_ptr EnchantmentTableEntity::clone() +std::shared_ptr EnchantmentTableEntity::clone() { - shared_ptr result = shared_ptr( new EnchantmentTableEntity() ); + std::shared_ptr result = std::shared_ptr( new EnchantmentTableEntity() ); TileEntity::clone(result); result->time = time; diff --git a/Minecraft.World/Blocks/TileEntities/EnchantmentTableTileEntity.h b/Minecraft.World/Blocks/TileEntities/EnchantmentTableTileEntity.h index aa54c812f..c7cef9f74 100644 --- a/Minecraft.World/Blocks/TileEntities/EnchantmentTableTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/EnchantmentTableTileEntity.h @@ -21,5 +21,5 @@ public: virtual void tick(); // 4J Added - virtual shared_ptr clone(); + virtual std::shared_ptr clone(); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TileEntities/EnderChestTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/EnderChestTileEntity.cpp index 1bdfaddf9..0abe9fba0 100644 --- a/Minecraft.World/Blocks/TileEntities/EnderChestTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/EnderChestTileEntity.cpp @@ -81,7 +81,7 @@ void EnderChestTileEntity::stopOpen() level->tileEvent(x, y, z, Tile::enderChest_Id, ChestTile::EVENT_SET_OPEN_COUNT, openCount); } -bool EnderChestTileEntity::stillValid(shared_ptr player) +bool EnderChestTileEntity::stillValid(std::shared_ptr player) { if (level->getTileEntity(x, y, z) != shared_from_this()) return false; if (player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 8 * 8) return false; @@ -90,9 +90,9 @@ bool EnderChestTileEntity::stillValid(shared_ptr player) } // 4J Added -shared_ptr EnderChestTileEntity::clone() +std::shared_ptr EnderChestTileEntity::clone() { - shared_ptr result = shared_ptr( new EnderChestTileEntity() ); + std::shared_ptr result = std::shared_ptr( new EnderChestTileEntity() ); TileEntity::clone(result); return result; diff --git a/Minecraft.World/Blocks/TileEntities/EnderChestTileEntity.h b/Minecraft.World/Blocks/TileEntities/EnderChestTileEntity.h index f68829800..e67b6bcc6 100644 --- a/Minecraft.World/Blocks/TileEntities/EnderChestTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/EnderChestTileEntity.h @@ -23,8 +23,8 @@ public: void setRemoved(); void startOpen(); void stopOpen(); - bool stillValid(shared_ptr player); + bool stillValid(std::shared_ptr player); // 4J Added - virtual shared_ptr clone(); + virtual std::shared_ptr clone(); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TileEntities/EntityTile.cpp b/Minecraft.World/Blocks/TileEntities/EntityTile.cpp index 8fed31321..0e26c4824 100644 --- a/Minecraft.World/Blocks/TileEntities/EntityTile.cpp +++ b/Minecraft.World/Blocks/TileEntities/EntityTile.cpp @@ -24,7 +24,7 @@ void EntityTile::onRemove(Level *level, int x, int y, int z, int id, int data) void EntityTile::triggerEvent(Level *level, int x, int y, int z, int b0, int b1) { Tile::triggerEvent(level, x, y, z, b0, b1); - shared_ptr te = level->getTileEntity(x, y, z); + std::shared_ptr te = level->getTileEntity(x, y, z); if (te != NULL) { te->triggerEvent(b0, b1); diff --git a/Minecraft.World/Blocks/TileEntities/EntityTile.h b/Minecraft.World/Blocks/TileEntities/EntityTile.h index 56e6d646f..a913f59ff 100644 --- a/Minecraft.World/Blocks/TileEntities/EntityTile.h +++ b/Minecraft.World/Blocks/TileEntities/EntityTile.h @@ -10,6 +10,6 @@ protected: public: virtual void onPlace(Level *level, int x, int y, int z); virtual void onRemove(Level *level, int x, int y, int z, int id, int data); - virtual shared_ptr newTileEntity(Level *level) = 0; + virtual std::shared_ptr newTileEntity(Level *level) = 0; virtual void triggerEvent(Level *level, int x, int y, int z, int b0, int b1); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.cpp index b9be394d4..6aa7df569 100644 --- a/Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.cpp @@ -39,13 +39,13 @@ unsigned int FurnaceTileEntity::getContainerSize() } -shared_ptr FurnaceTileEntity::getItem(unsigned int slot) +std::shared_ptr FurnaceTileEntity::getItem(unsigned int slot) { return (*items)[slot]; } -shared_ptr FurnaceTileEntity::removeItem(unsigned int slot, int count) +std::shared_ptr FurnaceTileEntity::removeItem(unsigned int slot, int count) { m_charcoalUsed = false; @@ -53,7 +53,7 @@ shared_ptr FurnaceTileEntity::removeItem(unsigned int slot, int co { if ((*items)[slot]->count <= count) { - shared_ptr item = (*items)[slot]; + std::shared_ptr item = (*items)[slot]; (*items)[slot] = nullptr; // 4J Stu - Fix for duplication glitch if(item->count <= 0) return nullptr; @@ -61,7 +61,7 @@ shared_ptr FurnaceTileEntity::removeItem(unsigned int slot, int co } else { - shared_ptr i = (*items)[slot]->remove(count); + std::shared_ptr i = (*items)[slot]->remove(count); if ((*items)[slot]->count == 0) (*items)[slot] = nullptr; // 4J Stu - Fix for duplication glitch if(i->count <= 0) return nullptr; @@ -71,13 +71,13 @@ shared_ptr FurnaceTileEntity::removeItem(unsigned int slot, int co return nullptr; } -shared_ptr FurnaceTileEntity::removeItemNoUpdate(int slot) +std::shared_ptr FurnaceTileEntity::removeItemNoUpdate(int slot) { m_charcoalUsed = false; if (items->data[slot] != NULL) { - shared_ptr item = items->data[slot]; + std::shared_ptr item = items->data[slot]; items->data[slot] = nullptr; return item; } @@ -85,7 +85,7 @@ shared_ptr FurnaceTileEntity::removeItemNoUpdate(int slot) } -void FurnaceTileEntity::setItem(unsigned int slot, shared_ptr item) +void FurnaceTileEntity::setItem(unsigned int slot, std::shared_ptr item) { (*items)[slot] = item; if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); @@ -195,7 +195,7 @@ void FurnaceTileEntity::tick() if ((*items)[FUEL_SLOT]->count == 0) { Item *remaining = (*items)[FUEL_SLOT]->getItem()->getCraftingRemainingItem(); - (*items)[FUEL_SLOT] = remaining != NULL ? shared_ptr(new ItemInstance(remaining)) : nullptr; + (*items)[FUEL_SLOT] = remaining != NULL ? std::shared_ptr(new ItemInstance(remaining)) : nullptr; } } } @@ -253,7 +253,7 @@ void FurnaceTileEntity::burn() } -int FurnaceTileEntity::getBurnDuration(shared_ptr itemInstance) +int FurnaceTileEntity::getBurnDuration(std::shared_ptr itemInstance) { if (itemInstance == NULL) return 0; int id = itemInstance->getItem()->id; @@ -304,12 +304,12 @@ int FurnaceTileEntity::getBurnDuration(shared_ptr itemInstance) return 0; } -bool FurnaceTileEntity::isFuel(shared_ptr item) +bool FurnaceTileEntity::isFuel(std::shared_ptr item) { return getBurnDuration(item) > 0; } -bool FurnaceTileEntity::stillValid(shared_ptr player) +bool FurnaceTileEntity::stillValid(std::shared_ptr player) { if (level->getTileEntity(x, y, z) != shared_from_this() ) return false; if (player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 8 * 8) return false; @@ -330,9 +330,9 @@ void FurnaceTileEntity::stopOpen() } // 4J Added -shared_ptr FurnaceTileEntity::clone() +std::shared_ptr FurnaceTileEntity::clone() { - shared_ptr result = shared_ptr( new FurnaceTileEntity() ); + std::shared_ptr result = std::shared_ptr( new FurnaceTileEntity() ); TileEntity::clone(result); result->litTime = litTime; diff --git a/Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.h b/Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.h index b8ba73446..2bfdbe318 100644 --- a/Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.h @@ -41,10 +41,10 @@ public: virtual ~FurnaceTileEntity(); virtual unsigned int getContainerSize(); - virtual shared_ptr getItem(unsigned int slot); - virtual shared_ptr removeItem(unsigned int slot, int count); - virtual shared_ptr removeItemNoUpdate(int slot); - virtual void setItem(unsigned int slot, shared_ptr item); + virtual std::shared_ptr getItem(unsigned int slot); + virtual std::shared_ptr removeItem(unsigned int slot, int count); + virtual std::shared_ptr removeItemNoUpdate(int slot); + virtual void setItem(unsigned int slot, std::shared_ptr item); virtual int getName(); virtual void load(CompoundTag *base); virtual void save(CompoundTag *base); @@ -60,18 +60,18 @@ private: public: void burn(); - static int getBurnDuration(shared_ptr itemInstance); - static bool isFuel(shared_ptr item); + static int getBurnDuration(std::shared_ptr itemInstance); + static bool isFuel(std::shared_ptr item); public: - virtual bool stillValid(shared_ptr player); + virtual bool stillValid(std::shared_ptr player); virtual void setChanged(); void startOpen(); void stopOpen(); // 4J Added - virtual shared_ptr clone(); + virtual std::shared_ptr clone(); // 4J-JEV: Added for 'Renewable Energy' achievement. bool wasCharcoalUsed() { return m_charcoalUsed; } diff --git a/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.cpp index 5b28db000..9142bebf8 100644 --- a/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.cpp @@ -89,10 +89,10 @@ void MobSpawnerTileEntity::tick() for (int c = 0; c < spawnCount; c++) { - shared_ptr entity = dynamic_pointer_cast (EntityIO::newEntity(entityId, level)); + std::shared_ptr entity = dynamic_pointer_cast (EntityIO::newEntity(entityId, level)); if (entity == NULL) return; - vector > *vecNearby = level->getEntitiesOfClass(typeid(*entity), AABB::newTemp(x, y, z, x + 1, y + 1, z + 1)->grow(8, 4, 8)); + vector > *vecNearby = level->getEntitiesOfClass(typeid(*entity), AABB::newTemp(x, y, z, x + 1, y + 1, z + 1)->grow(8, 4, 8)); int nearBy = (int)vecNearby->size(); //4J - IB, TODO, Mob contains no getClass delete vecNearby; @@ -115,7 +115,7 @@ void MobSpawnerTileEntity::tick() double xp = x + (level->random->nextDouble() - level->random->nextDouble()) * 4; double yp = y + level->random->nextInt(3) - 1; double zp = z + (level->random->nextDouble() - level->random->nextDouble()) * 4; - shared_ptr mob = dynamic_pointer_cast( entity ); + std::shared_ptr mob = dynamic_pointer_cast( entity ); entity->moveTo(xp, yp, zp, level->random->nextFloat() * 360, 0); @@ -137,7 +137,7 @@ void MobSpawnerTileEntity::tick() TileEntity::tick(); } -void MobSpawnerTileEntity::fillExtraData(shared_ptr entity) +void MobSpawnerTileEntity::fillExtraData(std::shared_ptr entity) { if (spawnData != NULL) { @@ -201,11 +201,11 @@ void MobSpawnerTileEntity::save(CompoundTag *tag) } } -shared_ptr MobSpawnerTileEntity::getDisplayEntity() +std::shared_ptr MobSpawnerTileEntity::getDisplayEntity() { if (displayEntity == NULL || m_bEntityIdUpdated) { - shared_ptr e = EntityIO::newEntity(getEntityId(), NULL); + std::shared_ptr e = EntityIO::newEntity(getEntityId(), NULL); fillExtraData(e); displayEntity = e; m_bEntityIdUpdated = false; @@ -214,17 +214,17 @@ shared_ptr MobSpawnerTileEntity::getDisplayEntity() return displayEntity; } -shared_ptr MobSpawnerTileEntity::getUpdatePacket() +std::shared_ptr MobSpawnerTileEntity::getUpdatePacket() { CompoundTag *tag = new CompoundTag(); save(tag); - return shared_ptr( new TileEntityDataPacket(x, y, z, TileEntityDataPacket::TYPE_MOB_SPAWNER, tag) ); + return std::shared_ptr( new TileEntityDataPacket(x, y, z, TileEntityDataPacket::TYPE_MOB_SPAWNER, tag) ); } // 4J Added -shared_ptr MobSpawnerTileEntity::clone() +std::shared_ptr MobSpawnerTileEntity::clone() { - shared_ptr result = shared_ptr( new MobSpawnerTileEntity() ); + std::shared_ptr result = std::shared_ptr( new MobSpawnerTileEntity() ); TileEntity::clone(result); result->entityId = entityId; diff --git a/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.h b/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.h index 9cfb9f2fd..61c69d3ef 100644 --- a/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.h @@ -33,7 +33,7 @@ private: int minSpawnDelay; int maxSpawnDelay; int spawnCount; - shared_ptr displayEntity; + std::shared_ptr displayEntity; public: MobSpawnerTileEntity(); @@ -42,7 +42,7 @@ public: void setEntityId(const wstring& entityId); bool isNearPlayer(); virtual void tick(); - void fillExtraData(shared_ptr entity); + void fillExtraData(std::shared_ptr entity); private: void delay(); @@ -51,9 +51,9 @@ public: virtual void load(CompoundTag *tag); virtual void save(CompoundTag *tag); - shared_ptr getDisplayEntity(); - virtual shared_ptr getUpdatePacket(); + std::shared_ptr getDisplayEntity(); + virtual std::shared_ptr getUpdatePacket(); // 4J Added - virtual shared_ptr clone(); + virtual std::shared_ptr clone(); }; diff --git a/Minecraft.World/Blocks/TileEntities/MusicTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/MusicTileEntity.cpp index dcd67f1ae..bbe7063fa 100644 --- a/Minecraft.World/Blocks/TileEntities/MusicTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/MusicTileEntity.cpp @@ -53,9 +53,9 @@ void MusicTileEntity::playNote(Level *level, int x, int y, int z) } // 4J Added -shared_ptr MusicTileEntity::clone() +std::shared_ptr MusicTileEntity::clone() { - shared_ptr result = shared_ptr( new MusicTileEntity() ); + std::shared_ptr result = std::shared_ptr( new MusicTileEntity() ); TileEntity::clone(result); result->note = note; diff --git a/Minecraft.World/Blocks/TileEntities/MusicTileEntity.h b/Minecraft.World/Blocks/TileEntities/MusicTileEntity.h index b5a23be6c..a83731c5a 100644 --- a/Minecraft.World/Blocks/TileEntities/MusicTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/MusicTileEntity.h @@ -22,5 +22,5 @@ public: void playNote(Level *level, int x, int y, int z); // 4J Added - virtual shared_ptr clone(); + virtual std::shared_ptr clone(); }; diff --git a/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.cpp index be64e5254..49544d08f 100644 --- a/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.cpp @@ -119,10 +119,10 @@ void PistonPieceEntity::moveCollidedEntities(float progress, float amount) AABB *aabb = Tile::pistonMovingPiece->getAABB(level, x, y, z, id, progress, facing); if (aabb != NULL) { - vector > *entities = level->getEntities(nullptr, aabb); + vector > *entities = level->getEntities(nullptr, aabb); if (!entities->empty()) { - vector< shared_ptr > collisionHolder; + vector< std::shared_ptr > collisionHolder; for( AUTO_VAR(it, entities->begin()); it != entities->end(); it++ ) { collisionHolder.push_back(*it); @@ -199,9 +199,9 @@ void PistonPieceEntity::save(CompoundTag *tag) } // 4J Added -shared_ptr PistonPieceEntity::clone() +std::shared_ptr PistonPieceEntity::clone() { - shared_ptr result = shared_ptr( new PistonPieceEntity() ); + std::shared_ptr result = std::shared_ptr( new PistonPieceEntity() ); TileEntity::clone(result); result->id = id; diff --git a/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.h b/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.h index cf37d67a8..6eb6654f3 100644 --- a/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.h @@ -37,5 +37,5 @@ public: virtual void save(CompoundTag *tag); // 4J Added - shared_ptr clone(); + std::shared_ptr clone(); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp index 2f03b38c8..f8ae04c9a 100644 --- a/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp @@ -84,14 +84,14 @@ void SignTileEntity::load(CompoundTag *tag) setChanged(); } -shared_ptr SignTileEntity::getUpdatePacket() +std::shared_ptr SignTileEntity::getUpdatePacket() { wstring copy[MAX_SIGN_LINES]; for (int i = 0; i < MAX_SIGN_LINES; i++) { copy[i] = m_wsmessages[i]; } - return shared_ptr( new SignUpdatePacket(x, y, z, m_bVerified, m_bCensored, copy) ); + return std::shared_ptr( new SignUpdatePacket(x, y, z, m_bVerified, m_bCensored, copy) ); } bool SignTileEntity::isEditable() @@ -183,9 +183,9 @@ int SignTileEntity::StringVerifyCallback(LPVOID lpParam,STRING_VERIFY_RESPONSE * } // 4J Added -shared_ptr SignTileEntity::clone() +std::shared_ptr SignTileEntity::clone() { - shared_ptr result = shared_ptr( new SignTileEntity() ); + std::shared_ptr result = std::shared_ptr( new SignTileEntity() ); TileEntity::clone(result); result->m_wsmessages[0] = m_wsmessages[0]; diff --git a/Minecraft.World/Blocks/TileEntities/SignTileEntity.h b/Minecraft.World/Blocks/TileEntities/SignTileEntity.h index b963f12fc..8713c6272 100644 --- a/Minecraft.World/Blocks/TileEntities/SignTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/SignTileEntity.h @@ -38,12 +38,12 @@ private: public: virtual void save(CompoundTag *tag); virtual void load(CompoundTag *tag); - virtual shared_ptr getUpdatePacket(); + virtual std::shared_ptr getUpdatePacket(); bool isEditable(); void setEditable(bool isEditable); virtual void setChanged(); static int StringVerifyCallback(LPVOID lpParam,STRING_VERIFY_RESPONSE *pResults); // 4J Added - virtual shared_ptr clone(); + virtual std::shared_ptr clone(); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp index 2f756bb12..7c7550a84 100644 --- a/Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp @@ -26,11 +26,11 @@ void SkullTileEntity::load(CompoundTag *tag) if (tag->contains(L"ExtraType")) extraType = tag->getString(L"ExtraType"); } -shared_ptr SkullTileEntity::getUpdatePacket() +std::shared_ptr SkullTileEntity::getUpdatePacket() { CompoundTag *tag = new CompoundTag(); save(tag); - return shared_ptr(new TileEntityDataPacket(x, y, z, TileEntityDataPacket::TYPE_SKULL, tag)); + return std::shared_ptr(new TileEntityDataPacket(x, y, z, TileEntityDataPacket::TYPE_SKULL, tag)); } void SkullTileEntity::setSkullType(int skullType, const wstring &extra) @@ -60,9 +60,9 @@ wstring SkullTileEntity::getExtraType() } // 4J Added -shared_ptr SkullTileEntity::clone() +std::shared_ptr SkullTileEntity::clone() { - shared_ptr result = shared_ptr( new SkullTileEntity() ); + std::shared_ptr result = std::shared_ptr( new SkullTileEntity() ); TileEntity::clone(result); result->skullType = skullType; diff --git a/Minecraft.World/Blocks/TileEntities/SkullTileEntity.h b/Minecraft.World/Blocks/TileEntities/SkullTileEntity.h index 4b24457bc..db1580fa0 100644 --- a/Minecraft.World/Blocks/TileEntities/SkullTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/SkullTileEntity.h @@ -24,7 +24,7 @@ public: void save(CompoundTag *tag); void load(CompoundTag *tag); - shared_ptr getUpdatePacket(); + std::shared_ptr getUpdatePacket(); void setSkullType(int skullType, const wstring &extra); int getSkullType(); int getRotation(); @@ -32,5 +32,5 @@ public: wstring getExtraType(); // 4J Added - virtual shared_ptr clone(); + virtual std::shared_ptr clone(); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TileEntities/TheEndPortalTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/TheEndPortalTileEntity.cpp index 8ba7bbb1e..72b22a464 100644 --- a/Minecraft.World/Blocks/TileEntities/TheEndPortalTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/TheEndPortalTileEntity.cpp @@ -2,9 +2,9 @@ #include "TheEndPortalTileEntity.h" // 4J Added -shared_ptr TheEndPortalTileEntity::clone() +std::shared_ptr TheEndPortalTileEntity::clone() { - shared_ptr result = shared_ptr( new TheEndPortalTileEntity() ); + std::shared_ptr result = std::shared_ptr( new TheEndPortalTileEntity() ); TileEntity::clone(result); return result; } \ No newline at end of file diff --git a/Minecraft.World/Blocks/TileEntities/TheEndPortalTileEntity.h b/Minecraft.World/Blocks/TileEntities/TheEndPortalTileEntity.h index 29752d440..0bc0b46c0 100644 --- a/Minecraft.World/Blocks/TileEntities/TheEndPortalTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/TheEndPortalTileEntity.h @@ -8,5 +8,5 @@ public: static TileEntity *create() { return new TheEndPortalTileEntity(); } // 4J Added - shared_ptr clone(); + std::shared_ptr clone(); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TileEntities/TileEntity.cpp b/Minecraft.World/Blocks/TileEntities/TileEntity.cpp index 718754581..1fd4a81ce 100644 --- a/Minecraft.World/Blocks/TileEntities/TileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/TileEntity.cpp @@ -89,14 +89,14 @@ void TileEntity::tick() { } -shared_ptr TileEntity::loadStatic(CompoundTag *tag) +std::shared_ptr TileEntity::loadStatic(CompoundTag *tag) { - shared_ptr entity = nullptr; + std::shared_ptr entity = nullptr; //try //{ AUTO_VAR(it, idCreateMap.find(tag->getString(L"id"))); - if (it != idCreateMap.end() ) entity = shared_ptr(it->second()); + if (it != idCreateMap.end() ) entity = std::shared_ptr(it->second()); //} //catch (Exception e) //{ @@ -152,7 +152,7 @@ Tile *TileEntity::getTile() return tile; } -shared_ptr TileEntity::getUpdatePacket() +std::shared_ptr TileEntity::getUpdatePacket() { return nullptr; } @@ -200,7 +200,7 @@ void TileEntity::upgradeRenderRemoveStage() } // 4J Added -void TileEntity::clone(shared_ptr tileEntity) +void TileEntity::clone(std::shared_ptr tileEntity) { tileEntity->level = this->level; tileEntity->x = this->x; diff --git a/Minecraft.World/Blocks/TileEntities/TileEntity.h b/Minecraft.World/Blocks/TileEntities/TileEntity.h index 31a636081..6106b3f92 100644 --- a/Minecraft.World/Blocks/TileEntities/TileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/TileEntity.h @@ -54,13 +54,13 @@ public: virtual void load(CompoundTag *tag); virtual void save(CompoundTag *tag); virtual void tick(); - static shared_ptr loadStatic(CompoundTag *tag); + static std::shared_ptr loadStatic(CompoundTag *tag); int getData(); void setData(int data); void setChanged(); double distanceToSqr(double xPlayer, double yPlayer, double zPlayer); Tile *getTile(); - virtual shared_ptr getUpdatePacket(); + virtual std::shared_ptr getUpdatePacket(); virtual bool isRemoved(); virtual void setRemoved(); virtual void clearRemoved(); @@ -68,7 +68,7 @@ public: virtual void clearCache(); // 4J Added - virtual shared_ptr clone() = 0; + virtual std::shared_ptr clone() = 0; protected: - void clone(shared_ptr tileEntity); + void clone(std::shared_ptr tileEntity); }; diff --git a/Minecraft.World/Blocks/TntTile.cpp b/Minecraft.World/Blocks/TntTile.cpp index a4be64e8a..cf6f107a0 100644 --- a/Minecraft.World/Blocks/TntTile.cpp +++ b/Minecraft.World/Blocks/TntTile.cpp @@ -59,7 +59,7 @@ void TntTile::wasExploded(Level *level, int x, int y, int z) // 4J-JEV: Fix for #90934 - Customer Encountered: TU11: Content: Gameplay: TNT blocks are triggered by explosions even though "TNT explodes" option is unchecked. if( level->newPrimedTntAllowed() && app.GetGameHostOption(eGameHostOption_TNT) ) { - shared_ptr primed = shared_ptr( new PrimedTnt(level, x + 0.5f, y + 0.5f, z + 0.5f) ); + std::shared_ptr primed = std::shared_ptr( new PrimedTnt(level, x + 0.5f, y + 0.5f, z + 0.5f) ); primed->life = level->random->nextInt(primed->life / 4) + primed->life / 8; level->addEntity(primed); } @@ -74,14 +74,14 @@ void TntTile::destroy(Level *level, int x, int y, int z, int data) // 4J - added condition to have finite limit of these if( level->newPrimedTntAllowed() && app.GetGameHostOption(eGameHostOption_TNT) ) { - shared_ptr tnt = shared_ptr( new PrimedTnt(level, x + 0.5f, y + 0.5f, z + 0.5f) ); + std::shared_ptr tnt = std::shared_ptr( new PrimedTnt(level, x + 0.5f, y + 0.5f, z + 0.5f) ); level->addEntity(tnt); level->playSound(tnt, eSoundType_RANDOM_FUSE, 1, 1.0f); } } } -bool TntTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool TntTile::use(Level *level, int x, int y, int z, std::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) @@ -93,12 +93,12 @@ bool TntTile::use(Level *level, int x, int y, int z, shared_ptr player, return Tile::use(level, x, y, z, player, clickedFace, clickX, clickY, clickZ); } -void TntTile::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +void TntTile::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) { if (entity->GetType() == eTYPE_ARROW && !level->isClientSide) { // 4J Stu - Don't need to cast this - //shared_ptr arrow = dynamic_pointer_cast(entity); + //std::shared_ptr arrow = dynamic_pointer_cast(entity); if (entity->isOnFire()) { destroy(level, x, y, z, EXPLODE_BIT); @@ -107,7 +107,7 @@ void TntTile::entityInside(Level *level, int x, int y, int z, shared_ptr } } -shared_ptr TntTile::getSilkTouchItemInstance(int data) +std::shared_ptr TntTile::getSilkTouchItemInstance(int data) { return nullptr; } diff --git a/Minecraft.World/Blocks/TntTile.h b/Minecraft.World/Blocks/TntTile.h index 27b788c60..b628e01c4 100644 --- a/Minecraft.World/Blocks/TntTile.h +++ b/Minecraft.World/Blocks/TntTile.h @@ -23,9 +23,9 @@ public: void destroy(Level *level, int x, int y, int z, int data); - bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param - void entityInside(Level *level, int x, int y, int z, shared_ptr entity); - virtual shared_ptr getSilkTouchItemInstance(int data); + void entityInside(Level *level, int x, int y, int z, std::shared_ptr entity); + virtual std::shared_ptr getSilkTouchItemInstance(int data); void registerIcons(IconRegister *iconRegister); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TopSnowTile.cpp b/Minecraft.World/Blocks/TopSnowTile.cpp index 66091bbf8..f33dfe1ea 100644 --- a/Minecraft.World/Blocks/TopSnowTile.cpp +++ b/Minecraft.World/Blocks/TopSnowTile.cpp @@ -64,7 +64,7 @@ void TopSnowTile::updateDefaultShape() updateShape(0); } -void TopSnowTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void TopSnowTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { updateShape(level->getData(x, y, z)); } @@ -104,14 +104,14 @@ bool TopSnowTile::checkCanSurvive(Level *level, int x, int y, int z) } -void TopSnowTile::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) +void TopSnowTile::playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data) { int type = Item::snowBall->id; float s = 0.7f; double xo = level->random->nextFloat() * s + (1 - s) * 0.5; double yo = level->random->nextFloat() * s + (1 - s) * 0.5; double zo = level->random->nextFloat() * s + (1 - s) * 0.5; - shared_ptr item = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr( new ItemInstance(type, 1, 0) ) ) ); + std::shared_ptr item = std::shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, std::shared_ptr( new ItemInstance(type, 1, 0) ) ) ); item->throwTime = 10; level->addEntity(item); level->setTile(x, y, z, 0); diff --git a/Minecraft.World/Blocks/TopSnowTile.h b/Minecraft.World/Blocks/TopSnowTile.h index 059f0f423..208fcc2ae 100644 --- a/Minecraft.World/Blocks/TopSnowTile.h +++ b/Minecraft.World/Blocks/TopSnowTile.h @@ -32,7 +32,7 @@ public: public: void updateDefaultShape(); - void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param protected: void updateShape(int data); @@ -47,7 +47,7 @@ private: bool checkCanSurvive(Level *level, int x, int y, int z); public: - void playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data); + void playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data); public: int getResource(int data, Random *random, int playerBonusLevel); diff --git a/Minecraft.World/Blocks/TorchTile.cpp b/Minecraft.World/Blocks/TorchTile.cpp index 33d85bdc2..49db9163c 100644 --- a/Minecraft.World/Blocks/TorchTile.cpp +++ b/Minecraft.World/Blocks/TorchTile.cpp @@ -20,7 +20,7 @@ AABB *TorchTile::getTileAABB(Level *level, int x, int y, int z) return Tile::getTileAABB(level, x, y, z); } -void TorchTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void TorchTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { setShape(level->getData(x, y, z)); } diff --git a/Minecraft.World/Blocks/TorchTile.h b/Minecraft.World/Blocks/TorchTile.h index f3355a5ed..16f7d6067 100644 --- a/Minecraft.World/Blocks/TorchTile.h +++ b/Minecraft.World/Blocks/TorchTile.h @@ -13,7 +13,7 @@ protected: public: virtual AABB *getAABB(Level *level, int x, int y, int z); virtual AABB *getTileAABB(Level *level, int x, int y, int z); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param using Tile::setShape; virtual void setShape(int data); virtual bool isSolidRender(bool isServerLevel = false); diff --git a/Minecraft.World/Blocks/TrapDoorTile.cpp b/Minecraft.World/Blocks/TrapDoorTile.cpp index 3b80e2ef6..5c896f8c5 100644 --- a/Minecraft.World/Blocks/TrapDoorTile.cpp +++ b/Minecraft.World/Blocks/TrapDoorTile.cpp @@ -55,7 +55,7 @@ AABB *TrapDoorTile::getAABB(Level *level, int x, int y, int z) } -void TrapDoorTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void TrapDoorTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { setShape(level->getData(x, y, z)); } @@ -83,7 +83,7 @@ void TrapDoorTile::setShape(int data) } -void TrapDoorTile::attack(Level *level, int x, int y, int z, shared_ptr player) +void TrapDoorTile::attack(Level *level, int x, int y, int z, std::shared_ptr player) { use(level, x, y, z, player, 0, 0, 0, 0); } @@ -94,7 +94,7 @@ bool TrapDoorTile::TestUse() return true; } -bool TrapDoorTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool TrapDoorTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if (material == Material::metal) return true; diff --git a/Minecraft.World/Blocks/TrapDoorTile.h b/Minecraft.World/Blocks/TrapDoorTile.h index 19cec1505..5f6a52e7d 100644 --- a/Minecraft.World/Blocks/TrapDoorTile.h +++ b/Minecraft.World/Blocks/TrapDoorTile.h @@ -43,7 +43,7 @@ public: AABB *getAABB(Level *level, int x, int y, int z); public: - void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param public: void updateDefaultShape(); @@ -53,11 +53,11 @@ public: void setShape(int data); public: - void attack(Level *level, int x, int y, int z, shared_ptr player); + void attack(Level *level, int x, int y, int z, std::shared_ptr player); public: virtual bool TestUse(); - bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param public: void setOpen(Level *level, int x, int y, int z, bool shouldOpen); diff --git a/Minecraft.World/Blocks/TreeTile.cpp b/Minecraft.World/Blocks/TreeTile.cpp index 804039797..935520686 100644 --- a/Minecraft.World/Blocks/TreeTile.cpp +++ b/Minecraft.World/Blocks/TreeTile.cpp @@ -60,7 +60,7 @@ void TreeTile::onRemove(Level *level, int x, int y, int z, int id, int data) } } -void TreeTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void TreeTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int type = level->getData(x, y, z) & MASK_TYPE; int dir = PistonBaseTile::getNewFacing(level, x, y, z, dynamic_pointer_cast(by)); @@ -123,10 +123,10 @@ int TreeTile::getWoodType(int data) return data & MASK_TYPE; } -shared_ptr TreeTile::getSilkTouchItemInstance(int data) +std::shared_ptr TreeTile::getSilkTouchItemInstance(int data) { // fix to avoid getting silktouched sideways logs - return shared_ptr(new ItemInstance(id, 1, getWoodType(data))); + return std::shared_ptr(new ItemInstance(id, 1, getWoodType(data))); } void TreeTile::registerIcons(IconRegister *iconRegister) diff --git a/Minecraft.World/Blocks/TreeTile.h b/Minecraft.World/Blocks/TreeTile.h index b7e0d56d1..a245064f1 100644 --- a/Minecraft.World/Blocks/TreeTile.h +++ b/Minecraft.World/Blocks/TreeTile.h @@ -39,7 +39,7 @@ public: virtual int getResourceCount(Random *random); virtual int getResource(int data, Random *random, int playerBonusLevel); virtual void onRemove(Level *level, int x, int y, int z, int id, int data); - virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr by); + virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); virtual Icon *getTexture(int face, int data); virtual unsigned int getDescriptionId(int iData = -1); @@ -51,5 +51,5 @@ public: void registerIcons(IconRegister *iconRegister); protected: - virtual shared_ptr getSilkTouchItemInstance(int data); + virtual std::shared_ptr getSilkTouchItemInstance(int data); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TripWireSourceTile.cpp b/Minecraft.World/Blocks/TripWireSourceTile.cpp index 8c1bf8802..c6202031b 100644 --- a/Minecraft.World/Blocks/TripWireSourceTile.cpp +++ b/Minecraft.World/Blocks/TripWireSourceTile.cpp @@ -273,7 +273,7 @@ bool TripWireSourceTile::checkCanSurvive(Level *level, int x, int y, int z) return true; } -void TripWireSourceTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) +void TripWireSourceTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) { int dir = level->getData(x, y, z) & MASK_DIR; float r = 3 / 16.0f; diff --git a/Minecraft.World/Blocks/TripWireSourceTile.h b/Minecraft.World/Blocks/TripWireSourceTile.h index c86e781d3..a5a26ad1e 100644 --- a/Minecraft.World/Blocks/TripWireSourceTile.h +++ b/Minecraft.World/Blocks/TripWireSourceTile.h @@ -35,7 +35,7 @@ private: bool checkCanSurvive(Level *level, int x, int y, int z); public: - void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); + void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); void onRemove(Level *level, int x, int y, int z, int id, int data); virtual bool getSignal(LevelSource *level, int x, int y, int z, int dir); virtual bool getDirectSignal(Level *level, int x, int y, int z, int dir); diff --git a/Minecraft.World/Blocks/TripWireTile.cpp b/Minecraft.World/Blocks/TripWireTile.cpp index 5803db610..9fc35daa7 100644 --- a/Minecraft.World/Blocks/TripWireTile.cpp +++ b/Minecraft.World/Blocks/TripWireTile.cpp @@ -70,7 +70,7 @@ void TripWireTile::neighborChanged(Level *level, int x, int y, int z, int type) } } -void TripWireTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) +void TripWireTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) { int data = level->getData(x, y, z); bool attached = (data & MASK_ATTACHED) == MASK_ATTACHED; @@ -102,7 +102,7 @@ void TripWireTile::onRemove(Level *level, int x, int y, int z, int id, int data) updateSource(level, x, y, z, data | MASK_POWERED); } -void TripWireTile::playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr player) +void TripWireTile::playerWillDestroy(Level *level, int x, int y, int z, int data, std::shared_ptr player) { if (level->isClientSide) return; @@ -141,7 +141,7 @@ void TripWireTile::updateSource(Level *level, int x, int y, int z, int data) } } -void TripWireTile::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +void TripWireTile::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) { if (level->isClientSide) return; @@ -166,7 +166,7 @@ void TripWireTile::checkPressed(Level *level, int x, int y, int z) bool shouldBePressed = false; ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); - vector > *entities = level->getEntities(nullptr, AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1)); + vector > *entities = level->getEntities(nullptr, AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1)); if (!entities->empty()) { shouldBePressed = true; diff --git a/Minecraft.World/Blocks/TripWireTile.h b/Minecraft.World/Blocks/TripWireTile.h index 7880e6643..664541c53 100644 --- a/Minecraft.World/Blocks/TripWireTile.h +++ b/Minecraft.World/Blocks/TripWireTile.h @@ -23,16 +23,16 @@ public: int getResource(int data, Random *random, int playerBonusLevel); int cloneTileId(Level *level, int x, int y, int z); void neighborChanged(Level *level, int x, int y, int z, int type); - void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); + void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); void onPlace(Level *level, int x, int y, int z); void onRemove(Level *level, int x, int y, int z, int id, int data); - void playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr player); + void playerWillDestroy(Level *level, int x, int y, int z, int data, std::shared_ptr player); private: void updateSource(Level *level, int x, int y, int z, int data); public: - void entityInside(Level *level, int x, int y, int z, shared_ptr entity); + void entityInside(Level *level, int x, int y, int z, std::shared_ptr entity); void tick(Level *level, int x, int y, int z, Random *random); private: diff --git a/Minecraft.World/Blocks/VineTile.cpp b/Minecraft.World/Blocks/VineTile.cpp index 26a9c23af..d4631cb0d 100644 --- a/Minecraft.World/Blocks/VineTile.cpp +++ b/Minecraft.World/Blocks/VineTile.cpp @@ -33,7 +33,7 @@ bool VineTile::isCubeShaped() return false; } -void VineTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void VineTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { const float thickness = 1.0f / 16.0f; @@ -368,7 +368,7 @@ int VineTile::getResourceCount(Random *random) return 0; } -void VineTile::playerDestroy(Level *level, shared_ptrplayer, int x, int y, int z, int data) +void VineTile::playerDestroy(Level *level, std::shared_ptrplayer, int x, int y, int z, int data) { if (!level->isClientSide && player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears->id) { @@ -378,7 +378,7 @@ void VineTile::playerDestroy(Level *level, shared_ptrplayer, int x, int ); // drop leaf block instead of sapling - popResource(level, x, y, z, shared_ptr(new ItemInstance(Tile::vine, 1, 0))); + popResource(level, x, y, z, std::shared_ptr(new ItemInstance(Tile::vine, 1, 0))); } else { diff --git a/Minecraft.World/Blocks/VineTile.h b/Minecraft.World/Blocks/VineTile.h index fbc890588..8499581ee 100644 --- a/Minecraft.World/Blocks/VineTile.h +++ b/Minecraft.World/Blocks/VineTile.h @@ -18,7 +18,7 @@ public: virtual int getRenderShape(); virtual bool isSolidRender(bool isServerLevel = false); virtual bool isCubeShaped(); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual AABB *getAABB(Level *level, int x, int y, int z); virtual bool mayPlace(Level *level, int x, int y, int z, int face); private: @@ -34,5 +34,5 @@ public: virtual int getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, int itemValue); virtual int getResource(int data, Random *random, int playerBonusLevel); virtual int getResourceCount(Random *random); - virtual void playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data); + virtual void playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/WallTile.cpp b/Minecraft.World/Blocks/WallTile.cpp index 5280faab5..bdba416ba 100644 --- a/Minecraft.World/Blocks/WallTile.cpp +++ b/Minecraft.World/Blocks/WallTile.cpp @@ -51,7 +51,7 @@ bool WallTile::isSolidRender(bool isServerLevel) return false; } -void WallTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) +void WallTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) { bool n = connectsTo(level, x, y, z - 1); bool s = connectsTo(level, x, y, z + 1); diff --git a/Minecraft.World/Blocks/WallTile.h b/Minecraft.World/Blocks/WallTile.h index a9a383d16..e693f9a42 100644 --- a/Minecraft.World/Blocks/WallTile.h +++ b/Minecraft.World/Blocks/WallTile.h @@ -22,7 +22,7 @@ public: bool isCubeShaped(); bool isPathfindable(LevelSource *level, int x, int y, int z); bool isSolidRender(bool isServerLevel = false); - void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); + void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); AABB *getAABB(Level *level, int x, int y, int z); bool connectsTo(LevelSource *level, int x, int y, int z); int getSpawnResourcesAuxValue(int data); diff --git a/Minecraft.World/Blocks/WaterLilyTile.cpp b/Minecraft.World/Blocks/WaterLilyTile.cpp index 317f985d7..32497630f 100644 --- a/Minecraft.World/Blocks/WaterLilyTile.cpp +++ b/Minecraft.World/Blocks/WaterLilyTile.cpp @@ -23,7 +23,7 @@ int WaterlilyTile::getRenderShape() return Tile::SHAPE_LILYPAD; } -void WaterlilyTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void WaterlilyTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source) { if (source == NULL || !(dynamic_pointer_cast(source))) { diff --git a/Minecraft.World/Blocks/WaterLilyTile.h b/Minecraft.World/Blocks/WaterLilyTile.h index a6d9b732a..e621d46b5 100644 --- a/Minecraft.World/Blocks/WaterLilyTile.h +++ b/Minecraft.World/Blocks/WaterLilyTile.h @@ -11,7 +11,7 @@ public: virtual void updateDefaultShape(); // 4J Added override virtual int getRenderShape(); - virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source); + virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source); virtual AABB *getAABB(Level *level, int x, int y, int z); virtual int getColor() const; virtual int getColor(int auxData); diff --git a/Minecraft.World/Blocks/WebTile.cpp b/Minecraft.World/Blocks/WebTile.cpp index d905ebe87..b471a7e5b 100644 --- a/Minecraft.World/Blocks/WebTile.cpp +++ b/Minecraft.World/Blocks/WebTile.cpp @@ -8,7 +8,7 @@ WebTile::WebTile(int id) : Tile(id, Material::web) } -void WebTile::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +void WebTile::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) { entity->makeStuckInWeb(); } diff --git a/Minecraft.World/Blocks/WebTile.h b/Minecraft.World/Blocks/WebTile.h index ca1f4dae0..546617179 100644 --- a/Minecraft.World/Blocks/WebTile.h +++ b/Minecraft.World/Blocks/WebTile.h @@ -10,7 +10,7 @@ public: public: - void entityInside(Level *level, int x, int y, int z, shared_ptr entity); + void entityInside(Level *level, int x, int y, int z, std::shared_ptr entity); public: diff --git a/Minecraft.World/Blocks/WoodSlabTile.cpp b/Minecraft.World/Blocks/WoodSlabTile.cpp index 80eab2be1..3e44cb912 100644 --- a/Minecraft.World/Blocks/WoodSlabTile.cpp +++ b/Minecraft.World/Blocks/WoodSlabTile.cpp @@ -31,9 +31,9 @@ int WoodSlabTile::getResource(int data, Random *random, int playerBonusLevel) return Tile::woodSlabHalf_Id; } -shared_ptr WoodSlabTile::getSilkTouchItemInstance(int data) +std::shared_ptr WoodSlabTile::getSilkTouchItemInstance(int data) { - return shared_ptr(new ItemInstance(Tile::woodSlabHalf, 2, data & TYPE_MASK)); + return std::shared_ptr(new ItemInstance(Tile::woodSlabHalf, 2, data & TYPE_MASK)); } int WoodSlabTile::getAuxName(int auxValue) diff --git a/Minecraft.World/Blocks/WoodSlabTile.h b/Minecraft.World/Blocks/WoodSlabTile.h index b91f7136d..c683f87b9 100644 --- a/Minecraft.World/Blocks/WoodSlabTile.h +++ b/Minecraft.World/Blocks/WoodSlabTile.h @@ -20,7 +20,7 @@ public: virtual int getResource(int data, Random *random, int playerBonusLevel); virtual int getAuxName(int auxValue); - virtual shared_ptr getSilkTouchItemInstance(int data); + virtual std::shared_ptr getSilkTouchItemInstance(int data); void registerIcons(IconRegister *iconRegister); // 4J added diff --git a/Minecraft.World/Blocks/WoolCarpetTile.cpp b/Minecraft.World/Blocks/WoolCarpetTile.cpp index 00dbf5083..1759d2ecd 100644 --- a/Minecraft.World/Blocks/WoolCarpetTile.cpp +++ b/Minecraft.World/Blocks/WoolCarpetTile.cpp @@ -46,7 +46,7 @@ void WoolCarpetTile::updateDefaultShape() updateShape(0); } -void WoolCarpetTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) +void WoolCarpetTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) { updateShape(level->getData(x, y, z)); } diff --git a/Minecraft.World/Blocks/WoolCarpetTile.h b/Minecraft.World/Blocks/WoolCarpetTile.h index af0cd28a8..ef84514cb 100644 --- a/Minecraft.World/Blocks/WoolCarpetTile.h +++ b/Minecraft.World/Blocks/WoolCarpetTile.h @@ -15,7 +15,7 @@ public: bool isSolidRender(bool isServerLevel = false); bool isCubeShaped(); void updateDefaultShape(); - void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); + void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); protected: void updateShape(int data); diff --git a/Minecraft.World/Blocks/WorkbenchTile.cpp b/Minecraft.World/Blocks/WorkbenchTile.cpp index f06749c11..a0f455ea4 100644 --- a/Minecraft.World/Blocks/WorkbenchTile.cpp +++ b/Minecraft.World/Blocks/WorkbenchTile.cpp @@ -32,7 +32,7 @@ bool WorkbenchTile::TestUse() return true; } -bool WorkbenchTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool WorkbenchTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if( soundOnly ) return false; if (level->isClientSide) diff --git a/Minecraft.World/Blocks/WorkbenchTile.h b/Minecraft.World/Blocks/WorkbenchTile.h index 1e7fd4ec7..bbbdcb85e 100644 --- a/Minecraft.World/Blocks/WorkbenchTile.h +++ b/Minecraft.World/Blocks/WorkbenchTile.h @@ -22,5 +22,5 @@ public: public: virtual bool TestUse(); - bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + bool use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param }; \ No newline at end of file diff --git a/Minecraft.World/Commands/AdminLogCommand.h b/Minecraft.World/Commands/AdminLogCommand.h index cfd311a50..0c80e1b0f 100644 --- a/Minecraft.World/Commands/AdminLogCommand.h +++ b/Minecraft.World/Commands/AdminLogCommand.h @@ -9,5 +9,5 @@ class AdminLogCommand public: static const int LOGTYPE_DONT_SHOW_TO_SELF = 1; - virtual void logAdminCommand(shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L"") = 0; + virtual void logAdminCommand(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L"") = 0; }; \ No newline at end of file diff --git a/Minecraft.World/Commands/Command.cpp b/Minecraft.World/Commands/Command.cpp index 332220473..e96b07cc3 100644 --- a/Minecraft.World/Commands/Command.cpp +++ b/Minecraft.World/Commands/Command.cpp @@ -7,17 +7,17 @@ AdminLogCommand *Command::logger; -bool Command::canExecute(shared_ptr source) +bool Command::canExecute(std::shared_ptr source) { return source->hasPermission(getId()); } -void Command::logAdminAction(shared_ptr source, ChatPacket::EChatPacketMessage messageType, const wstring& message, int customData, const wstring& additionalMessage) +void Command::logAdminAction(std::shared_ptr source, ChatPacket::EChatPacketMessage messageType, const wstring& message, int customData, const wstring& additionalMessage) { logAdminAction(source, 0, messageType, message, customData, additionalMessage); } -void Command::logAdminAction(shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message, int customData, const wstring& additionalMessage) +void Command::logAdminAction(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message, int customData, const wstring& additionalMessage) { if (logger != NULL) { @@ -30,9 +30,9 @@ void Command::setLogger(AdminLogCommand *logger) Command::logger = logger; } -shared_ptr Command::getPlayer(PlayerUID playerId) +std::shared_ptr Command::getPlayer(PlayerUID playerId) { - shared_ptr player = MinecraftServer::getInstance()->getPlayers()->getPlayer(playerId); + std::shared_ptr player = MinecraftServer::getInstance()->getPlayers()->getPlayer(playerId); if (player == NULL) { diff --git a/Minecraft.World/Commands/Command.h b/Minecraft.World/Commands/Command.h index ba2e1b625..580a98412 100644 --- a/Minecraft.World/Commands/Command.h +++ b/Minecraft.World/Commands/Command.h @@ -16,13 +16,13 @@ private: public: virtual EGameCommand getId() = 0; - virtual void execute(shared_ptr source, byteArray commandData) = 0; - virtual bool canExecute(shared_ptr source); + virtual void execute(std::shared_ptr source, byteArray commandData) = 0; + virtual bool canExecute(std::shared_ptr source); - static void logAdminAction(shared_ptr source, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L""); - static void logAdminAction(shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L""); + static void logAdminAction(std::shared_ptr source, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L""); + static void logAdminAction(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L""); static void setLogger(AdminLogCommand *logger); protected: - shared_ptr getPlayer(PlayerUID playerId); + std::shared_ptr getPlayer(PlayerUID playerId); }; \ No newline at end of file diff --git a/Minecraft.World/Commands/CommandDispatcher.cpp b/Minecraft.World/Commands/CommandDispatcher.cpp index 3bb5bce89..b95d40804 100644 --- a/Minecraft.World/Commands/CommandDispatcher.cpp +++ b/Minecraft.World/Commands/CommandDispatcher.cpp @@ -2,7 +2,7 @@ #include "../Headers/net.minecraft.commands.h" #include "CommandDispatcher.h" -void CommandDispatcher::performCommand(shared_ptr sender, EGameCommand command, byteArray commandData) +void CommandDispatcher::performCommand(std::shared_ptr sender, EGameCommand command, byteArray commandData) { AUTO_VAR(it, commandsById.find(command)); diff --git a/Minecraft.World/Commands/CommandDispatcher.h b/Minecraft.World/Commands/CommandDispatcher.h index 600f1db11..cfc4486a1 100644 --- a/Minecraft.World/Commands/CommandDispatcher.h +++ b/Minecraft.World/Commands/CommandDispatcher.h @@ -14,6 +14,6 @@ private: unordered_set commands; public: - void performCommand(shared_ptr sender, EGameCommand command, byteArray commandData); + void performCommand(std::shared_ptr sender, EGameCommand command, byteArray commandData); Command *addCommand(Command *command); }; \ No newline at end of file diff --git a/Minecraft.World/Commands/DefaultGameModeCommand.cpp b/Minecraft.World/Commands/DefaultGameModeCommand.cpp index 98abe4b94..54a3bdc55 100644 --- a/Minecraft.World/Commands/DefaultGameModeCommand.cpp +++ b/Minecraft.World/Commands/DefaultGameModeCommand.cpp @@ -7,7 +7,7 @@ EGameCommand DefaultGameModeCommand::getId() return eGameCommand_DefaultGameMode; } -void DefaultGameModeCommand::execute(shared_ptr source, byteArray commandData) +void DefaultGameModeCommand::execute(std::shared_ptr source, byteArray commandData) { //if (args.length > 0) //{ diff --git a/Minecraft.World/Commands/DefaultGameModeCommand.h b/Minecraft.World/Commands/DefaultGameModeCommand.h index 99d45a437..01a41331c 100644 --- a/Minecraft.World/Commands/DefaultGameModeCommand.h +++ b/Minecraft.World/Commands/DefaultGameModeCommand.h @@ -8,7 +8,7 @@ class DefaultGameModeCommand : public GameModeCommand { public: virtual EGameCommand getId(); - virtual void execute(shared_ptr source, byteArray commandData); + virtual void execute(std::shared_ptr source, byteArray commandData); protected: void doSetGameType(GameType *newGameType); diff --git a/Minecraft.World/Commands/EnchantItemCommand.cpp b/Minecraft.World/Commands/EnchantItemCommand.cpp index df463a8f0..1344930ed 100644 --- a/Minecraft.World/Commands/EnchantItemCommand.cpp +++ b/Minecraft.World/Commands/EnchantItemCommand.cpp @@ -15,7 +15,7 @@ int EnchantItemCommand::getPermissionLevel() return 0; //aLEVEL_GAMEMASTERS; } -void EnchantItemCommand::execute(shared_ptr source, byteArray commandData) +void EnchantItemCommand::execute(std::shared_ptr source, byteArray commandData) { ByteArrayInputStream bais(commandData); DataInputStream dis(&bais); @@ -26,11 +26,11 @@ void EnchantItemCommand::execute(shared_ptr source, byteArray com bais.reset(); - shared_ptr player = getPlayer(uid); + std::shared_ptr player = getPlayer(uid); if(player == NULL) return; - shared_ptr selectedItem = player->getSelectedItem(); + std::shared_ptr selectedItem = player->getSelectedItem(); if(selectedItem == NULL) return; @@ -70,7 +70,7 @@ void EnchantItemCommand::execute(shared_ptr source, byteArray com logAdminAction(source, ChatPacket::e_ChatCustom, L"commands.enchant.success"); } -shared_ptr EnchantItemCommand::preparePacket(shared_ptr player, int enchantmentId, int enchantmentLevel) +std::shared_ptr EnchantItemCommand::preparePacket(std::shared_ptr player, int enchantmentId, int enchantmentLevel) { if(player == NULL) return nullptr; @@ -81,5 +81,5 @@ shared_ptr EnchantItemCommand::preparePacket(shared_ptr( new GameCommandPacket(eGameCommand_EnchantItem, baos.toByteArray() )); + return std::shared_ptr( new GameCommandPacket(eGameCommand_EnchantItem, baos.toByteArray() )); } diff --git a/Minecraft.World/Commands/EnchantItemCommand.h b/Minecraft.World/Commands/EnchantItemCommand.h index 5fc6c6488..6792da537 100644 --- a/Minecraft.World/Commands/EnchantItemCommand.h +++ b/Minecraft.World/Commands/EnchantItemCommand.h @@ -9,7 +9,7 @@ class EnchantItemCommand : public Command public: virtual EGameCommand getId(); int getPermissionLevel(); - virtual void execute(shared_ptr source, byteArray commandData); + virtual void execute(std::shared_ptr source, byteArray commandData); - static shared_ptr preparePacket(shared_ptr player, int enchantmentId, int enchantmentLevel = 1); + static std::shared_ptr preparePacket(std::shared_ptr player, int enchantmentId, int enchantmentLevel = 1); }; \ No newline at end of file diff --git a/Minecraft.World/Commands/ExperienceCommand.cpp b/Minecraft.World/Commands/ExperienceCommand.cpp index c72183ba3..a9a2abe8a 100644 --- a/Minecraft.World/Commands/ExperienceCommand.cpp +++ b/Minecraft.World/Commands/ExperienceCommand.cpp @@ -9,7 +9,7 @@ EGameCommand ExperienceCommand::getId() return eGameCommand_Experience; } -void ExperienceCommand::execute(shared_ptr source, byteArray commandData) +void ExperienceCommand::execute(std::shared_ptr source, byteArray commandData) { //if (args.length > 0) //{ @@ -27,10 +27,10 @@ void ExperienceCommand::execute(shared_ptr source, byteArray comm //} } -shared_ptr ExperienceCommand::getPlayer(PlayerUID playerId) +std::shared_ptr ExperienceCommand::getPlayer(PlayerUID playerId) { return nullptr; - //shared_ptr player = MinecraftServer::getInstance()->getPlayers()->getPlayer(playerId); + //std::shared_ptr player = MinecraftServer::getInstance()->getPlayers()->getPlayer(playerId); //if (player == null) //{ diff --git a/Minecraft.World/Commands/ExperienceCommand.h b/Minecraft.World/Commands/ExperienceCommand.h index b1dd2cbe8..5165428fe 100644 --- a/Minecraft.World/Commands/ExperienceCommand.h +++ b/Minecraft.World/Commands/ExperienceCommand.h @@ -8,8 +8,8 @@ class ExperienceCommand : public Command { public: virtual EGameCommand getId(); - virtual void execute(shared_ptr source, byteArray commandData); + virtual void execute(std::shared_ptr source, byteArray commandData); protected: - shared_ptr getPlayer(PlayerUID playerId); + std::shared_ptr getPlayer(PlayerUID playerId); }; \ No newline at end of file diff --git a/Minecraft.World/Commands/GameModeCommand.cpp b/Minecraft.World/Commands/GameModeCommand.cpp index 3b82f6f32..6c50a0fda 100644 --- a/Minecraft.World/Commands/GameModeCommand.cpp +++ b/Minecraft.World/Commands/GameModeCommand.cpp @@ -7,7 +7,7 @@ EGameCommand GameModeCommand::getId() return eGameCommand_GameMode; } -void GameModeCommand::execute(shared_ptr source, byteArray commandData) +void GameModeCommand::execute(std::shared_ptr source, byteArray commandData) { //if (args.length > 0) //{ @@ -26,7 +26,7 @@ void GameModeCommand::execute(shared_ptr source, byteArray comman //} } -GameType *GameModeCommand::getModeForString(shared_ptr source, const wstring &name) +GameType *GameModeCommand::getModeForString(std::shared_ptr source, const wstring &name) { return NULL; //if (name.equalsIgnoreCase(GameType.SURVIVAL.getName()) || name.equalsIgnoreCase("s")) { @@ -40,7 +40,7 @@ GameType *GameModeCommand::getModeForString(shared_ptr source, co //} } -shared_ptr GameModeCommand::getPlayer(PlayerUID playerId) +std::shared_ptr GameModeCommand::getPlayer(PlayerUID playerId) { return nullptr; //Player player = MinecraftServer.getInstance().getPlayers().getPlayer(name); diff --git a/Minecraft.World/Commands/GameModeCommand.h b/Minecraft.World/Commands/GameModeCommand.h index 664015872..7c08caabe 100644 --- a/Minecraft.World/Commands/GameModeCommand.h +++ b/Minecraft.World/Commands/GameModeCommand.h @@ -8,9 +8,9 @@ class GameModeCommand : public Command { public: virtual EGameCommand getId(); - virtual void execute(shared_ptr source, byteArray commandData); + virtual void execute(std::shared_ptr source, byteArray commandData); protected: - GameType *getModeForString(shared_ptr source, const wstring &name); - shared_ptr getPlayer(PlayerUID playerId); + GameType *getModeForString(std::shared_ptr source, const wstring &name); + std::shared_ptr getPlayer(PlayerUID playerId); }; \ No newline at end of file diff --git a/Minecraft.World/Commands/GiveItemCommand.cpp b/Minecraft.World/Commands/GiveItemCommand.cpp index d57a950f2..0463e7103 100644 --- a/Minecraft.World/Commands/GiveItemCommand.cpp +++ b/Minecraft.World/Commands/GiveItemCommand.cpp @@ -10,7 +10,7 @@ EGameCommand GiveItemCommand::getId() return eGameCommand_Give; } -void GiveItemCommand::execute(shared_ptr source, byteArray commandData) +void GiveItemCommand::execute(std::shared_ptr source, byteArray commandData) { ByteArrayInputStream bais(commandData); DataInputStream dis(&bais); @@ -23,17 +23,17 @@ void GiveItemCommand::execute(shared_ptr source, byteArray comman bais.reset(); - shared_ptr player = getPlayer(uid); + std::shared_ptr player = getPlayer(uid); if(player != NULL && item > 0 && Item::items[item] != NULL) { - shared_ptr itemInstance = shared_ptr(new ItemInstance(item, amount, aux)); + std::shared_ptr itemInstance = std::shared_ptr(new ItemInstance(item, amount, aux)); player->drop(itemInstance); //logAdminAction(source, L"commands.give.success", ChatPacket::e_ChatCustom, Item::items[item]->getName(itemInstance), item, amount, player->getAName()); logAdminAction(source, ChatPacket::e_ChatCustom, L"commands.give.success", item, player->getAName()); } } -shared_ptr GiveItemCommand::preparePacket(shared_ptr player, int item, int amount, int aux, const wstring &tag) +std::shared_ptr GiveItemCommand::preparePacket(std::shared_ptr player, int item, int amount, int aux, const wstring &tag) { if(player == NULL) return nullptr; @@ -46,5 +46,5 @@ shared_ptr GiveItemCommand::preparePacket(shared_ptr dos.writeInt(aux); dos.writeUTF(tag); - return shared_ptr( new GameCommandPacket(eGameCommand_Give, baos.toByteArray() )); + return std::shared_ptr( new GameCommandPacket(eGameCommand_Give, baos.toByteArray() )); } diff --git a/Minecraft.World/Commands/GiveItemCommand.h b/Minecraft.World/Commands/GiveItemCommand.h index 532070a62..0881d9f64 100644 --- a/Minecraft.World/Commands/GiveItemCommand.h +++ b/Minecraft.World/Commands/GiveItemCommand.h @@ -8,8 +8,8 @@ class GiveItemCommand : public Command { public: virtual EGameCommand getId(); - virtual void execute(shared_ptr source, byteArray commandData); + virtual void execute(std::shared_ptr source, byteArray commandData); public: - static shared_ptr preparePacket(shared_ptr player, int item, int amount = 1, int aux = 0, const wstring &tag = L""); + static std::shared_ptr preparePacket(std::shared_ptr player, int item, int amount = 1, int aux = 0, const wstring &tag = L""); }; \ No newline at end of file diff --git a/Minecraft.World/Commands/KillCommand.cpp b/Minecraft.World/Commands/KillCommand.cpp index 58edf3e23..e41bb6df6 100644 --- a/Minecraft.World/Commands/KillCommand.cpp +++ b/Minecraft.World/Commands/KillCommand.cpp @@ -9,9 +9,9 @@ EGameCommand KillCommand::getId() return eGameCommand_Kill; } -void KillCommand::execute(shared_ptr source, byteArray commandData) +void KillCommand::execute(std::shared_ptr source, byteArray commandData) { - shared_ptr player = dynamic_pointer_cast(source); + std::shared_ptr player = dynamic_pointer_cast(source); player->hurt(DamageSource::outOfWorld, 1000); diff --git a/Minecraft.World/Commands/KillCommand.h b/Minecraft.World/Commands/KillCommand.h index a88b20694..21155b6ff 100644 --- a/Minecraft.World/Commands/KillCommand.h +++ b/Minecraft.World/Commands/KillCommand.h @@ -6,5 +6,5 @@ class KillCommand : public Command { public: virtual EGameCommand getId(); - virtual void execute(shared_ptr source, byteArray commandData); + virtual void execute(std::shared_ptr source, byteArray commandData); }; \ No newline at end of file diff --git a/Minecraft.World/Commands/TimeCommand.cpp b/Minecraft.World/Commands/TimeCommand.cpp index 8e79d9699..186cf78ac 100644 --- a/Minecraft.World/Commands/TimeCommand.cpp +++ b/Minecraft.World/Commands/TimeCommand.cpp @@ -10,7 +10,7 @@ EGameCommand TimeCommand::getId() return eGameCommand_Time; } -void TimeCommand::execute(shared_ptr source, byteArray commandData) +void TimeCommand::execute(std::shared_ptr source, byteArray commandData) { ByteArrayInputStream bais(commandData); DataInputStream dis(&bais); @@ -52,7 +52,7 @@ void TimeCommand::execute(shared_ptr source, byteArray commandDat //throw new UsageException("commands.time.usage"); } -void TimeCommand::doSetTime(shared_ptr source, int value) +void TimeCommand::doSetTime(std::shared_ptr source, int value) { for (int i = 0; i < MinecraftServer::getInstance()->levels.length; i++) { @@ -60,7 +60,7 @@ void TimeCommand::doSetTime(shared_ptr source, int value) } } -void TimeCommand::doAddTime(shared_ptr source, int value) +void TimeCommand::doAddTime(std::shared_ptr source, int value) { for (int i = 0; i < MinecraftServer::getInstance()->levels.length; i++) { @@ -69,12 +69,12 @@ void TimeCommand::doAddTime(shared_ptr source, int value) } } -shared_ptr TimeCommand::preparePacket(bool night) +std::shared_ptr TimeCommand::preparePacket(bool night) { ByteArrayOutputStream baos; DataOutputStream dos(&baos); dos.writeBoolean(night); - return shared_ptr( new GameCommandPacket(eGameCommand_Time, baos.toByteArray() )); + return std::shared_ptr( new GameCommandPacket(eGameCommand_Time, baos.toByteArray() )); } diff --git a/Minecraft.World/Commands/TimeCommand.h b/Minecraft.World/Commands/TimeCommand.h index f87fb27c4..da7008b2a 100644 --- a/Minecraft.World/Commands/TimeCommand.h +++ b/Minecraft.World/Commands/TimeCommand.h @@ -6,12 +6,12 @@ class TimeCommand : public Command { public: virtual EGameCommand getId(); - virtual void execute(shared_ptr source, byteArray commandData); + virtual void execute(std::shared_ptr source, byteArray commandData); protected: - void doSetTime(shared_ptr source, int value); - void doAddTime(shared_ptr source, int value); + void doSetTime(std::shared_ptr source, int value); + void doAddTime(std::shared_ptr source, int value); public: - static shared_ptr preparePacket(bool night); + static std::shared_ptr preparePacket(bool night); }; \ No newline at end of file diff --git a/Minecraft.World/Commands/ToggleDownfallCommand.cpp b/Minecraft.World/Commands/ToggleDownfallCommand.cpp index 860ca7b43..8bd123df0 100644 --- a/Minecraft.World/Commands/ToggleDownfallCommand.cpp +++ b/Minecraft.World/Commands/ToggleDownfallCommand.cpp @@ -12,7 +12,7 @@ EGameCommand ToggleDownfallCommand::getId() return eGameCommand_ToggleDownfall; } -void ToggleDownfallCommand::execute(shared_ptr source, byteArray commandData) +void ToggleDownfallCommand::execute(std::shared_ptr source, byteArray commandData) { doToggleDownfall(); logAdminAction(source, ChatPacket::e_ChatCustom, L"commands.downfall.success"); @@ -24,7 +24,7 @@ void ToggleDownfallCommand::doToggleDownfall() MinecraftServer::getInstance()->levels[0]->getLevelData()->setThundering(true); } -shared_ptr ToggleDownfallCommand::preparePacket() +std::shared_ptr ToggleDownfallCommand::preparePacket() { - return shared_ptr( new GameCommandPacket(eGameCommand_ToggleDownfall, byteArray() )); + return std::shared_ptr( new GameCommandPacket(eGameCommand_ToggleDownfall, byteArray() )); } diff --git a/Minecraft.World/Commands/ToggleDownfallCommand.h b/Minecraft.World/Commands/ToggleDownfallCommand.h index 2954962b5..a19b72519 100644 --- a/Minecraft.World/Commands/ToggleDownfallCommand.h +++ b/Minecraft.World/Commands/ToggleDownfallCommand.h @@ -7,11 +7,11 @@ class ToggleDownfallCommand : public Command { public: virtual EGameCommand getId(); - virtual void execute(shared_ptr source, byteArray commandData); + virtual void execute(std::shared_ptr source, byteArray commandData); protected: void doToggleDownfall(); public: - static shared_ptr preparePacket(); + static std::shared_ptr preparePacket(); }; \ No newline at end of file diff --git a/Minecraft.World/Containers/AbstractContainerMenu.cpp b/Minecraft.World/Containers/AbstractContainerMenu.cpp index 938467b38..615f2f859 100644 --- a/Minecraft.World/Containers/AbstractContainerMenu.cpp +++ b/Minecraft.World/Containers/AbstractContainerMenu.cpp @@ -8,7 +8,7 @@ // TODO Make sure all derived classes also call this AbstractContainerMenu::AbstractContainerMenu() { - lastSlots = new vector >(); + lastSlots = new vector >(); slots = new vector(); containerId = 0; @@ -49,15 +49,15 @@ void AbstractContainerMenu::addSlotListener(ContainerListener *listener) containerListeners->push_back(listener); - vector > *items = getItems(); + vector > *items = getItems(); listener->refreshContainer(this, items); delete items; broadcastChanges(); } -vector > *AbstractContainerMenu::getItems() +vector > *AbstractContainerMenu::getItems() { - vector > *items = new vector >(); + vector > *items = new vector >(); AUTO_VAR(itEnd, slots->end()); for (AUTO_VAR(it, slots->begin()); it != itEnd; it++) { @@ -79,8 +79,8 @@ void AbstractContainerMenu::broadcastChanges() { for (unsigned int i = 0; i < slots->size(); i++) { - shared_ptr current = slots->at(i)->getItem(); - shared_ptr expected = lastSlots->at(i); + std::shared_ptr current = slots->at(i)->getItem(); + std::shared_ptr expected = lastSlots->at(i); if (!ItemInstance::matches(expected, current)) { expected = current == NULL ? nullptr : current->copy(); @@ -103,8 +103,8 @@ bool AbstractContainerMenu::needsRendered() for (unsigned int i = 0; i < slots->size(); i++) { - shared_ptr current = slots->at(i)->getItem(); - shared_ptr expected = lastSlots->at(i); + std::shared_ptr current = slots->at(i)->getItem(); + std::shared_ptr expected = lastSlots->at(i); if (!ItemInstance::matches(expected, current)) { expected = current == NULL ? nullptr : current->copy(); @@ -116,12 +116,12 @@ bool AbstractContainerMenu::needsRendered() return needsRendered; } -bool AbstractContainerMenu::clickMenuButton(shared_ptr player, int buttonId) +bool AbstractContainerMenu::clickMenuButton(std::shared_ptr player, int buttonId) { return false; } -Slot *AbstractContainerMenu::getSlotFor(shared_ptr c, int index) +Slot *AbstractContainerMenu::getSlotFor(std::shared_ptr c, int index) { AUTO_VAR(itEnd, slots->end()); for (AUTO_VAR(it, slots->begin()); it != itEnd; it++) @@ -140,7 +140,7 @@ Slot *AbstractContainerMenu::getSlot(int index) return slots->at(index); } -shared_ptr AbstractContainerMenu::quickMoveStack(shared_ptr player, int slotIndex) +std::shared_ptr AbstractContainerMenu::quickMoveStack(std::shared_ptr player, int slotIndex) { Slot *slot = slots->at(slotIndex); if (slot != NULL) @@ -150,10 +150,10 @@ shared_ptr AbstractContainerMenu::quickMoveStack(shared_ptr AbstractContainerMenu::clicked(int slotIndex, int buttonNum, int clickType, shared_ptr player) +std::shared_ptr AbstractContainerMenu::clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr player) { - shared_ptr clickedEntity = nullptr; - shared_ptr inventory = player->inventory; + std::shared_ptr clickedEntity = nullptr; + std::shared_ptr inventory = player->inventory; if ((clickType == CLICK_PICKUP || clickType == CLICK_QUICK_MOVE) && (buttonNum == 0 || buttonNum == 1)) { @@ -182,7 +182,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto Slot *slot = slots->at(slotIndex); if(slot != NULL && slot->mayPickup(player)) { - shared_ptr piiClicked = quickMoveStack(player, slotIndex); + std::shared_ptr piiClicked = quickMoveStack(player, slotIndex); if (piiClicked != NULL) { //int oldSize = piiClicked->count; // 4J - Commented 1.8.2 and replaced with below @@ -208,8 +208,8 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto Slot *slot = slots->at(slotIndex); if (slot != NULL) { - shared_ptr clicked = slot->getItem(); - shared_ptr carried = inventory->getCarried(); + std::shared_ptr clicked = slot->getItem(); + std::shared_ptr carried = inventory->getCarried(); if (clicked != NULL) { @@ -235,7 +235,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto // 4J Added for dyable armour and combinining damaged items else if (buttonNum == 1 && mayCombine(slot, carried)) { - shared_ptr combined = slot->combine(carried); + std::shared_ptr combined = slot->combine(carried); if(combined != NULL) { slot->set(combined); @@ -252,7 +252,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto { // pick up to empty hand int c = buttonNum == 0 ? clicked->count : (clicked->count + 1) / 2; - shared_ptr removed = slot->remove(c); + std::shared_ptr removed = slot->remove(c); inventory->setCarried(removed); if (clicked->count == 0) @@ -321,7 +321,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto Slot *slot = slots->at(slotIndex); if (slot->mayPickup(player)) { - shared_ptr current = inventory->getItem(buttonNum); + std::shared_ptr current = inventory->getItem(buttonNum); bool canMove = current == NULL || (slot->container == inventory && slot->mayPlace(current)); int freeSlot = -1; @@ -333,7 +333,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto if (slot->hasItem() && canMove) { - shared_ptr taking = slot->getItem(); + std::shared_ptr taking = slot->getItem(); inventory->setItem(buttonNum, taking); if ((slot->container == inventory && slot->mayPlace(current)) || current == NULL) @@ -362,7 +362,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto Slot *slot = slots->at(slotIndex); if (slot != NULL && slot->hasItem()) { - shared_ptr copy = slot->getItem()->copy(); + std::shared_ptr copy = slot->getItem()->copy(); copy->count = copy->getMaxStackSize(); inventory->setCarried(copy); } @@ -371,19 +371,19 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto } // 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) +void AbstractContainerMenu::loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, std::shared_ptr player) { clicked(slotIndex, buttonNum, CLICK_QUICK_MOVE, player); } -bool AbstractContainerMenu::mayCombine(Slot *slot, shared_ptr item) +bool AbstractContainerMenu::mayCombine(Slot *slot, std::shared_ptr item) { return false; } -void AbstractContainerMenu::removed(shared_ptr player) +void AbstractContainerMenu::removed(std::shared_ptr player) { - shared_ptr inventory = player->inventory; + std::shared_ptr inventory = player->inventory; if (inventory->getCarried() != NULL) { player->drop(inventory->getCarried()); @@ -391,7 +391,7 @@ void AbstractContainerMenu::removed(shared_ptr player) } } -void AbstractContainerMenu::slotsChanged()// 4J used to take a shared_ptr but wasn't using it, so removed to simplify things +void AbstractContainerMenu::slotsChanged()// 4J used to take a std::shared_ptr but wasn't using it, so removed to simplify things { broadcastChanges(); } @@ -401,7 +401,7 @@ bool AbstractContainerMenu::isPauseScreen() return false; } -void AbstractContainerMenu::setItem(unsigned int slot, shared_ptr item) +void AbstractContainerMenu::setItem(unsigned int slot, std::shared_ptr item) { getSlot(slot)->set(item); } @@ -418,18 +418,18 @@ void AbstractContainerMenu::setData(int id, int value) { } -short AbstractContainerMenu::backup(shared_ptr inventory) +short AbstractContainerMenu::backup(std::shared_ptr inventory) { changeUid++; return changeUid; } -bool AbstractContainerMenu::isSynched(shared_ptr player) +bool AbstractContainerMenu::isSynched(std::shared_ptr player) { return !(unSynchedPlayers.find(player) != unSynchedPlayers.end()); } -void AbstractContainerMenu::setSynched(shared_ptr player, bool synched) +void AbstractContainerMenu::setSynched(std::shared_ptr player, bool synched) { if (synched) { @@ -444,7 +444,7 @@ void AbstractContainerMenu::setSynched(shared_ptr player, bool synched) } // 4J Stu - Brought a few changes in this function forward from 1.2 to make it return a bool -bool AbstractContainerMenu::moveItemStackTo(shared_ptr itemStack, int startSlot, int endSlot, bool backwards) +bool AbstractContainerMenu::moveItemStackTo(std::shared_ptr itemStack, int startSlot, int endSlot, bool backwards) { bool anythingChanged = false; @@ -461,7 +461,7 @@ bool AbstractContainerMenu::moveItemStackTo(shared_ptr itemStack, { Slot *slot = slots->at(destSlot); - shared_ptr target = slot->getItem(); + std::shared_ptr target = slot->getItem(); if (target != NULL && target->id == itemStack->id && (!itemStack->isStackedByData() || itemStack->getAuxValue() == target->getAuxValue()) && ItemInstance::tagMatches(itemStack, target) ) { @@ -507,7 +507,7 @@ bool AbstractContainerMenu::moveItemStackTo(shared_ptr itemStack, while ((!backwards && destSlot < endSlot) || (backwards && destSlot >= startSlot)) { Slot *slot = slots->at(destSlot); - shared_ptr target = slot->getItem(); + std::shared_ptr target = slot->getItem(); if (target == NULL) { diff --git a/Minecraft.World/Containers/AbstractContainerMenu.h b/Minecraft.World/Containers/AbstractContainerMenu.h index 8567485fa..31eec7aa3 100644 --- a/Minecraft.World/Containers/AbstractContainerMenu.h +++ b/Minecraft.World/Containers/AbstractContainerMenu.h @@ -26,7 +26,7 @@ public: static const int CONTAINER_ID_INVENTORY = 0; static const int CONTAINER_ID_CREATIVE = -2; - vector > *lastSlots; + vector > *lastSlots; vector *slots; int containerId; @@ -46,34 +46,34 @@ protected: public: virtual ~AbstractContainerMenu(); virtual void addSlotListener(ContainerListener *listener); - vector > *getItems(); + vector > *getItems(); void sendData(int id, int value); virtual void broadcastChanges(); virtual bool needsRendered(); - virtual bool clickMenuButton(shared_ptr player, int buttonId); - Slot *getSlotFor(shared_ptr c, int index); + virtual bool clickMenuButton(std::shared_ptr player, int buttonId); + Slot *getSlotFor(std::shared_ptr c, int index); Slot *getSlot(int index); - virtual shared_ptr quickMoveStack(shared_ptr player, int slotIndex); - virtual shared_ptr clicked(int slotIndex, int buttonNum, int clickType, shared_ptr player); - virtual bool mayCombine(Slot *slot, shared_ptr item); + virtual std::shared_ptr quickMoveStack(std::shared_ptr player, int slotIndex); + virtual std::shared_ptr clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr player); + virtual bool mayCombine(Slot *slot, std::shared_ptr item); protected: - virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, shared_ptr player); + virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, std::shared_ptr player); public: - virtual void removed(shared_ptr player); - virtual void slotsChanged();// 4J used to take a shared_ptr container but wasn't using it, so removed to simplify things + virtual void removed(std::shared_ptr player); + virtual void slotsChanged();// 4J used to take a std::shared_ptr container but wasn't using it, so removed to simplify things bool isPauseScreen(); - void setItem(unsigned int slot, shared_ptr item); + void setItem(unsigned int slot, std::shared_ptr item); void setAll(ItemInstanceArray *items); virtual void setData(int id, int value); - short backup(shared_ptr inventory); + short backup(std::shared_ptr inventory); private: - unordered_set , PlayerKeyHash, PlayerKeyEq> unSynchedPlayers; + unordered_set , PlayerKeyHash, PlayerKeyEq> unSynchedPlayers; public: - bool isSynched(shared_ptr player); - void setSynched(shared_ptr player, bool synched); - virtual bool stillValid(shared_ptr player) = 0; + bool isSynched(std::shared_ptr player); + void setSynched(std::shared_ptr player, bool synched); + virtual bool stillValid(std::shared_ptr player) = 0; // 4J Stu Added for UI unsigned int getSize() { return (unsigned int)slots->size(); } @@ -81,7 +81,7 @@ public: protected: // 4J Stu - Changes to return bool brought forward from 1.2 - bool moveItemStackTo(shared_ptr itemStack, int startSlot, int endSlot, bool backwards); + bool moveItemStackTo(std::shared_ptr itemStack, int startSlot, int endSlot, bool backwards); public: virtual bool isOverrideResultClick(int slotNum, int buttonNum); diff --git a/Minecraft.World/Containers/ArmorSlot.cpp b/Minecraft.World/Containers/ArmorSlot.cpp index 7826999c0..c84b95cf9 100644 --- a/Minecraft.World/Containers/ArmorSlot.cpp +++ b/Minecraft.World/Containers/ArmorSlot.cpp @@ -6,7 +6,7 @@ #include "../Headers/net.minecraft.world.item.crafting.h" #include "ArmorSlot.h" -ArmorSlot::ArmorSlot(int slotNum, shared_ptr container, int id, int x, int y) +ArmorSlot::ArmorSlot(int slotNum, std::shared_ptr container, int id, int x, int y) : Slot( container, id, x, y ), slotNum( slotNum ) { @@ -17,7 +17,7 @@ int ArmorSlot::getMaxStackSize() return 1; } -bool ArmorSlot::mayPlace(shared_ptr item) +bool ArmorSlot::mayPlace(std::shared_ptr item) { if ( dynamic_cast( item->getItem() ) != NULL) { @@ -36,9 +36,9 @@ Icon *ArmorSlot::getNoItemIcon() } // -//bool ArmorSlot::mayCombine(shared_ptr item) +//bool ArmorSlot::mayCombine(std::shared_ptr item) //{ -// shared_ptr thisItemI = getItem(); +// std::shared_ptr thisItemI = getItem(); // if(thisItemI == NULL || item == NULL) return false; // // ArmorItem *thisItem = (ArmorItem *)thisItemI->getItem(); @@ -47,12 +47,12 @@ Icon *ArmorSlot::getNoItemIcon() // return thisIsDyableArmor && itemIsDye; //} // -//shared_ptr ArmorSlot::combine(shared_ptr item) +//std::shared_ptr ArmorSlot::combine(std::shared_ptr item) //{ -// shared_ptr craftSlots = shared_ptr( new CraftingContainer(NULL, 2, 2) ); +// std::shared_ptr craftSlots = std::shared_ptr( new CraftingContainer(NULL, 2, 2) ); // craftSlots->setItem(0, item); // craftSlots->setItem(1, getItem()); // Armour item needs to go second -// shared_ptr result = ArmorDyeRecipe::assembleDyedArmor(craftSlots); +// std::shared_ptr result = ArmorDyeRecipe::assembleDyedArmor(craftSlots); // craftSlots->setItem(0, nullptr); // craftSlots->setItem(1, nullptr); // return result; diff --git a/Minecraft.World/Containers/ArmorSlot.h b/Minecraft.World/Containers/ArmorSlot.h index a9797be2d..2bf02067c 100644 --- a/Minecraft.World/Containers/ArmorSlot.h +++ b/Minecraft.World/Containers/ArmorSlot.h @@ -13,12 +13,12 @@ private: const int slotNum; public: - ArmorSlot(int slotNum, shared_ptr container, int id, int x, int y); + ArmorSlot(int slotNum, std::shared_ptr container, int id, int x, int y); virtual ~ArmorSlot() {} virtual int getMaxStackSize(); - virtual bool mayPlace(shared_ptr item); + virtual bool mayPlace(std::shared_ptr item); Icon *getNoItemIcon(); - //virtual bool mayCombine(shared_ptr item); // 4J Added - //virtual shared_ptr combine(shared_ptr item); // 4J Added + //virtual bool mayCombine(std::shared_ptr item); // 4J Added + //virtual std::shared_ptr combine(std::shared_ptr item); // 4J Added }; \ No newline at end of file diff --git a/Minecraft.World/Containers/BrewingStandMenu.cpp b/Minecraft.World/Containers/BrewingStandMenu.cpp index f4a185637..ee40737b2 100644 --- a/Minecraft.World/Containers/BrewingStandMenu.cpp +++ b/Minecraft.World/Containers/BrewingStandMenu.cpp @@ -6,7 +6,7 @@ #include "../Headers/net.minecraft.stats.h" #include "BrewingStandMenu.h" -BrewingStandMenu::BrewingStandMenu(shared_ptr inventory, shared_ptr brewingStand) +BrewingStandMenu::BrewingStandMenu(std::shared_ptr inventory, std::shared_ptr brewingStand) { tc = 0; @@ -57,14 +57,14 @@ void BrewingStandMenu::setData(int id, int value) if (id == 0) brewingStand->setBrewTime(value); } -bool BrewingStandMenu::stillValid(shared_ptr player) +bool BrewingStandMenu::stillValid(std::shared_ptr player) { return brewingStand->stillValid(player); } -shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr player, int slotIndex) +std::shared_ptr BrewingStandMenu::quickMoveStack(std::shared_ptr player, int slotIndex) { - shared_ptr clicked = nullptr; + std::shared_ptr clicked = nullptr; Slot *slot = slots->at(slotIndex); Slot *IngredientSlot = slots->at(INGREDIENT_SLOT); Slot *PotionSlot1 = slots->at(BOTTLE_SLOT_START); @@ -73,7 +73,7 @@ shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr pla if (slot != NULL && slot->hasItem()) { - shared_ptr stack = slot->getItem(); + std::shared_ptr stack = slot->getItem(); clicked = stack->copy(); if ((slotIndex >= BOTTLE_SLOT_START && slotIndex <= BOTTLE_SLOT_END) || (slotIndex == INGREDIENT_SLOT)) @@ -173,12 +173,12 @@ shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr pla return clicked; } -BrewingStandMenu::PotionSlot::PotionSlot(shared_ptr player, shared_ptr container, int slot, int x, int y) : Slot(container, slot, x, y) +BrewingStandMenu::PotionSlot::PotionSlot(std::shared_ptr player, std::shared_ptr container, int slot, int x, int y) : Slot(container, slot, x, y) { this->player = player; } -bool BrewingStandMenu::PotionSlot::mayPlace(shared_ptr item) +bool BrewingStandMenu::PotionSlot::mayPlace(std::shared_ptr item) { return mayPlaceItem(item); } @@ -188,7 +188,7 @@ int BrewingStandMenu::PotionSlot::getMaxStackSize() return 1; } -void BrewingStandMenu::PotionSlot::onTake(shared_ptr player, shared_ptr carried) +void BrewingStandMenu::PotionSlot::onTake(std::shared_ptr player, std::shared_ptr carried) { carried->onCraftedBy(this->player->level, dynamic_pointer_cast( this->player->shared_from_this() ), 1); if (carried->id == Item::potion_Id && carried->getAuxValue() > 0) @@ -196,23 +196,23 @@ void BrewingStandMenu::PotionSlot::onTake(shared_ptr player, shared_ptr< Slot::onTake(player, carried); } -bool BrewingStandMenu::PotionSlot::mayCombine(shared_ptr second) +bool BrewingStandMenu::PotionSlot::mayCombine(std::shared_ptr second) { return false; } -bool BrewingStandMenu::PotionSlot::mayPlaceItem(shared_ptr item) +bool BrewingStandMenu::PotionSlot::mayPlaceItem(std::shared_ptr item) { return item != NULL && (item->id == Item::potion_Id || item->id == Item::glassBottle_Id); } -BrewingStandMenu::IngredientsSlot::IngredientsSlot(shared_ptr container, int slot, int x, int y) : Slot(container, slot, x ,y) +BrewingStandMenu::IngredientsSlot::IngredientsSlot(std::shared_ptr container, int slot, int x, int y) : Slot(container, slot, x ,y) { } -bool BrewingStandMenu::IngredientsSlot::mayPlace(shared_ptr item) +bool BrewingStandMenu::IngredientsSlot::mayPlace(std::shared_ptr item) { if (item != NULL) { @@ -228,7 +228,7 @@ bool BrewingStandMenu::IngredientsSlot::mayPlace(shared_ptr item) return false; } -bool BrewingStandMenu::IngredientsSlot::mayCombine(shared_ptr second) +bool BrewingStandMenu::IngredientsSlot::mayCombine(std::shared_ptr second) { return false; } diff --git a/Minecraft.World/Containers/BrewingStandMenu.h b/Minecraft.World/Containers/BrewingStandMenu.h index 1f8d705d9..7a981acbc 100644 --- a/Minecraft.World/Containers/BrewingStandMenu.h +++ b/Minecraft.World/Containers/BrewingStandMenu.h @@ -21,11 +21,11 @@ public: static const int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9; private: - shared_ptr brewingStand; + std::shared_ptr brewingStand; Slot *ingredientSlot; public: - BrewingStandMenu(shared_ptr inventory, shared_ptr brewingStand); + BrewingStandMenu(std::shared_ptr inventory, std::shared_ptr brewingStand); private: int tc; @@ -34,32 +34,32 @@ public: virtual void addSlotListener(ContainerListener *listener); virtual void broadcastChanges(); virtual void setData(int id, int value); - virtual bool stillValid(shared_ptr player); - virtual shared_ptr quickMoveStack(shared_ptr player, int slotIndex); + virtual bool stillValid(std::shared_ptr player); + virtual std::shared_ptr quickMoveStack(std::shared_ptr player, int slotIndex); private: class PotionSlot : public Slot { private: - shared_ptr player; + std::shared_ptr player; public: - PotionSlot(shared_ptr player, shared_ptr container, int slot, int x, int y); + PotionSlot(std::shared_ptr player, std::shared_ptr container, int slot, int x, int y); - virtual bool mayPlace(shared_ptr item); + virtual bool mayPlace(std::shared_ptr item); virtual int getMaxStackSize(); - virtual void onTake(shared_ptr player, shared_ptr carried); - static bool mayPlaceItem(shared_ptr item); - virtual bool mayCombine(shared_ptr item); // 4J Added + virtual void onTake(std::shared_ptr player, std::shared_ptr carried); + static bool mayPlaceItem(std::shared_ptr item); + virtual bool mayCombine(std::shared_ptr item); // 4J Added }; class IngredientsSlot : public Slot { public: - IngredientsSlot(shared_ptr container, int slot, int x, int y); + IngredientsSlot(std::shared_ptr container, int slot, int x, int y); - virtual bool mayPlace(shared_ptr item); + virtual bool mayPlace(std::shared_ptr item); virtual int getMaxStackSize(); - virtual bool mayCombine(shared_ptr item); // 4J Added + virtual bool mayCombine(std::shared_ptr item); // 4J Added }; }; \ No newline at end of file diff --git a/Minecraft.World/Containers/ClientSideMerchant.cpp b/Minecraft.World/Containers/ClientSideMerchant.cpp index 4cc68e4ec..82e24f4e7 100644 --- a/Minecraft.World/Containers/ClientSideMerchant.cpp +++ b/Minecraft.World/Containers/ClientSideMerchant.cpp @@ -3,10 +3,10 @@ #include "../Headers/net.minecraft.world.inventory.h" #include "ClientSideMerchant.h" -ClientSideMerchant::ClientSideMerchant(shared_ptr source, int name) +ClientSideMerchant::ClientSideMerchant(std::shared_ptr source, int name) { this->source = source; - // 4J Stu - Need to do this after creating as a shared_ptr + // 4J Stu - Need to do this after creating as a std::shared_ptr container = NULL; //new MerchantContainer(source, this); currentOffers = NULL; m_name = name; @@ -28,17 +28,17 @@ Container *ClientSideMerchant::getContainer() return container; } -shared_ptr ClientSideMerchant::getTradingPlayer() +std::shared_ptr ClientSideMerchant::getTradingPlayer() { return source; } -void ClientSideMerchant::setTradingPlayer(shared_ptr player) +void ClientSideMerchant::setTradingPlayer(std::shared_ptr player) { } -MerchantRecipeList *ClientSideMerchant::getOffers(shared_ptr forPlayer) +MerchantRecipeList *ClientSideMerchant::getOffers(std::shared_ptr forPlayer) { return currentOffers; } @@ -54,7 +54,7 @@ void ClientSideMerchant::notifyTrade(MerchantRecipe *activeRecipe) activeRecipe->increaseUses(); } -void ClientSideMerchant::notifyTradeUpdated(shared_ptr item) +void ClientSideMerchant::notifyTradeUpdated(std::shared_ptr item) { } diff --git a/Minecraft.World/Containers/ClientSideMerchant.h b/Minecraft.World/Containers/ClientSideMerchant.h index 33f0c0b18..fa02c4867 100644 --- a/Minecraft.World/Containers/ClientSideMerchant.h +++ b/Minecraft.World/Containers/ClientSideMerchant.h @@ -10,21 +10,21 @@ class ClientSideMerchant : public Merchant, public enable_shared_from_this source; + std::shared_ptr source; MerchantRecipeList *currentOffers; int m_name; public: - ClientSideMerchant(shared_ptr source, int name); + ClientSideMerchant(std::shared_ptr source, int name); ~ClientSideMerchant(); void createContainer(); // 4J Added Container *getContainer(); - shared_ptr getTradingPlayer(); - void setTradingPlayer(shared_ptr player); - MerchantRecipeList *getOffers(shared_ptr forPlayer); + std::shared_ptr getTradingPlayer(); + void setTradingPlayer(std::shared_ptr player); + MerchantRecipeList *getOffers(std::shared_ptr forPlayer); void overrideOffers(MerchantRecipeList *recipeList); void notifyTrade(MerchantRecipe *activeRecipe); - void notifyTradeUpdated(shared_ptr item); + void notifyTradeUpdated(std::shared_ptr item); int getDisplayName(); }; \ No newline at end of file diff --git a/Minecraft.World/Containers/CompoundContainer.cpp b/Minecraft.World/Containers/CompoundContainer.cpp index ecc4b8698..4e28aaf44 100644 --- a/Minecraft.World/Containers/CompoundContainer.cpp +++ b/Minecraft.World/Containers/CompoundContainer.cpp @@ -3,7 +3,7 @@ #include "CompoundContainer.h" -CompoundContainer::CompoundContainer(int name, shared_ptr c1, shared_ptr c2) +CompoundContainer::CompoundContainer(int name, std::shared_ptr c1, std::shared_ptr c2) { this->name = name; if (c1 == NULL) c1 = c2; @@ -22,25 +22,25 @@ int CompoundContainer::getName() return name; } -shared_ptr CompoundContainer::getItem(unsigned int slot) +std::shared_ptr CompoundContainer::getItem(unsigned int slot) { if (slot >= c1->getContainerSize()) return c2->getItem(slot - c1->getContainerSize()); else return c1->getItem(slot); } -shared_ptr CompoundContainer::removeItem(unsigned int slot, int i) +std::shared_ptr CompoundContainer::removeItem(unsigned int slot, int i) { if (slot >= c1->getContainerSize()) return c2->removeItem(slot - c1->getContainerSize(), i); else return c1->removeItem(slot, i); } -shared_ptr CompoundContainer::removeItemNoUpdate(int slot) +std::shared_ptr CompoundContainer::removeItemNoUpdate(int slot) { if (slot >= c1->getContainerSize()) return c2->removeItemNoUpdate(slot - c1->getContainerSize()); else return c1->removeItemNoUpdate(slot); } -void CompoundContainer::setItem(unsigned int slot, shared_ptr item) +void CompoundContainer::setItem(unsigned int slot, std::shared_ptr item) { if (slot >= c1->getContainerSize()) c2->setItem(slot - c1->getContainerSize(), item); else c1->setItem(slot, item); @@ -57,7 +57,7 @@ void CompoundContainer::setChanged() c2->setChanged(); } -bool CompoundContainer::stillValid(shared_ptr player) +bool CompoundContainer::stillValid(std::shared_ptr player) { return c1->stillValid(player) && c2->stillValid(player); } diff --git a/Minecraft.World/Containers/CompoundContainer.h b/Minecraft.World/Containers/CompoundContainer.h index b0b8b9341..1103f0008 100644 --- a/Minecraft.World/Containers/CompoundContainer.h +++ b/Minecraft.World/Containers/CompoundContainer.h @@ -9,27 +9,27 @@ class CompoundContainer : public Container { private: int name; - shared_ptr c1, c2; + std::shared_ptr c1, c2; public: - CompoundContainer(int name, shared_ptr c1, shared_ptr c2); + CompoundContainer(int name, std::shared_ptr c1, std::shared_ptr c2); unsigned int getContainerSize(); int getName(); - shared_ptr getItem(unsigned int slot); + std::shared_ptr getItem(unsigned int slot); - shared_ptr removeItem(unsigned int slot, int i); - shared_ptr removeItemNoUpdate(int slot); + std::shared_ptr removeItem(unsigned int slot, int i); + std::shared_ptr removeItemNoUpdate(int slot); - void setItem(unsigned int slot, shared_ptr item); + void setItem(unsigned int slot, std::shared_ptr item); int getMaxStackSize(); void setChanged(); - bool stillValid(shared_ptr player); + bool stillValid(std::shared_ptr player); virtual void startOpen(); virtual void stopOpen(); diff --git a/Minecraft.World/Containers/Container.h b/Minecraft.World/Containers/Container.h index 7aa63728d..8939cd01d 100644 --- a/Minecraft.World/Containers/Container.h +++ b/Minecraft.World/Containers/Container.h @@ -10,14 +10,14 @@ public: static const int LARGE_MAX_STACK_SIZE = 64; virtual unsigned int getContainerSize() = 0; - virtual shared_ptr getItem(unsigned int slot) = 0; - virtual shared_ptr removeItem(unsigned int slot, int count) = 0; - virtual shared_ptr removeItemNoUpdate(int slot) = 0; - virtual void setItem(unsigned int slot, shared_ptr item) = 0; + virtual std::shared_ptr getItem(unsigned int slot) = 0; + virtual std::shared_ptr removeItem(unsigned int slot, int count) = 0; + virtual std::shared_ptr removeItemNoUpdate(int slot) = 0; + virtual void setItem(unsigned int slot, std::shared_ptr item) = 0; virtual int getName() = 0; virtual int getMaxStackSize() = 0; virtual void setChanged() = 0; - virtual bool stillValid(shared_ptr player) = 0; + virtual bool stillValid(std::shared_ptr player) = 0; virtual void startOpen() = 0; virtual void stopOpen() = 0; }; \ No newline at end of file diff --git a/Minecraft.World/Containers/ContainerMenu.cpp b/Minecraft.World/Containers/ContainerMenu.cpp index 9f05f6789..a07046ce9 100644 --- a/Minecraft.World/Containers/ContainerMenu.cpp +++ b/Minecraft.World/Containers/ContainerMenu.cpp @@ -8,7 +8,7 @@ #include "../../Minecraft.Client/Player/LocalPlayer.h" #include "ContainerMenu.h" -ContainerMenu::ContainerMenu(shared_ptr inventory, shared_ptr container) : AbstractContainerMenu() +ContainerMenu::ContainerMenu(std::shared_ptr inventory, std::shared_ptr container) : AbstractContainerMenu() { this->container = container; this->containerRows = container->getContainerSize() / 9; @@ -37,18 +37,18 @@ ContainerMenu::ContainerMenu(shared_ptr inventory, shared_ptr player) +bool ContainerMenu::stillValid(std::shared_ptr player) { return container->stillValid(player); } -shared_ptr ContainerMenu::quickMoveStack(shared_ptr player, int slotIndex) +std::shared_ptr ContainerMenu::quickMoveStack(std::shared_ptr player, int slotIndex) { - shared_ptr clicked = nullptr; + std::shared_ptr clicked = nullptr; Slot *slot = slots->at(slotIndex); if (slot != NULL && slot->hasItem()) { - shared_ptr stack = slot->getItem(); + std::shared_ptr stack = slot->getItem(); clicked = stack->copy(); if (slotIndex < containerRows * 9) @@ -79,25 +79,25 @@ shared_ptr ContainerMenu::quickMoveStack(shared_ptr player return clicked; } -void ContainerMenu::removed(shared_ptr player) +void ContainerMenu::removed(std::shared_ptr player) { AbstractContainerMenu::removed(player); container->stopOpen(); } -shared_ptr ContainerMenu::clicked(int slotIndex, int buttonNum, int clickType, shared_ptr player) +std::shared_ptr ContainerMenu::clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr player) { - shared_ptr out = AbstractContainerMenu::clicked(slotIndex, buttonNum, clickType, player); + std::shared_ptr out = AbstractContainerMenu::clicked(slotIndex, buttonNum, clickType, player); #ifdef _EXTENDED_ACHIEVEMENTS - shared_ptr localPlayer = dynamic_pointer_cast(player); + std::shared_ptr localPlayer = dynamic_pointer_cast(player); if (localPlayer != NULL) // 4J-JEV: For "Chestful o'Cobblestone" achievement. { int cobblecount = 0; for (int i = 0; i < container->getContainerSize(); i++) { - shared_ptr item = container->getItem(i); + std::shared_ptr item = container->getItem(i); if ( (item != nullptr) && (item->id == Tile::stoneBrick_Id) ) { cobblecount += item->GetCount(); diff --git a/Minecraft.World/Containers/ContainerMenu.h b/Minecraft.World/Containers/ContainerMenu.h index e6da0782d..a738cdc35 100644 --- a/Minecraft.World/Containers/ContainerMenu.h +++ b/Minecraft.World/Containers/ContainerMenu.h @@ -7,16 +7,16 @@ class Container; class ContainerMenu : public AbstractContainerMenu { private: - shared_ptr container; + std::shared_ptr container; int containerRows; public: - ContainerMenu(shared_ptr inventory, shared_ptr container); + ContainerMenu(std::shared_ptr inventory, std::shared_ptr container); - virtual bool stillValid(shared_ptr player); - virtual shared_ptr quickMoveStack(shared_ptr player, int slotIndex); - void removed(shared_ptr player); + virtual bool stillValid(std::shared_ptr player); + virtual std::shared_ptr quickMoveStack(std::shared_ptr player, int slotIndex); + void removed(std::shared_ptr player); // 4J ADDED, - virtual shared_ptr clicked(int slotIndex, int buttonNum, int clickType, shared_ptr player); + virtual std::shared_ptr clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr player); }; diff --git a/Minecraft.World/Containers/CraftingContainer.cpp b/Minecraft.World/Containers/CraftingContainer.cpp index 69fb640a4..abc4a2cc5 100644 --- a/Minecraft.World/Containers/CraftingContainer.cpp +++ b/Minecraft.World/Containers/CraftingContainer.cpp @@ -22,7 +22,7 @@ unsigned int CraftingContainer::getContainerSize() return items->length; } -shared_ptr CraftingContainer::getItem(unsigned int slot) +std::shared_ptr CraftingContainer::getItem(unsigned int slot) { if (slot >= getContainerSize()) { @@ -31,7 +31,7 @@ shared_ptr CraftingContainer::getItem(unsigned int slot) return (*items)[slot]; } -shared_ptr CraftingContainer::getItem(unsigned int x, unsigned int y) +std::shared_ptr CraftingContainer::getItem(unsigned int x, unsigned int y) { if (x < 0 || x >= width) { @@ -46,31 +46,31 @@ int CraftingContainer::getName() return 0; } -shared_ptr CraftingContainer::removeItemNoUpdate(int slot) +std::shared_ptr CraftingContainer::removeItemNoUpdate(int slot) { if ((*items)[slot] != NULL) { - shared_ptr item = (*items)[slot]; + std::shared_ptr item = (*items)[slot]; (*items)[slot] = nullptr; return item; } return nullptr; } -shared_ptr CraftingContainer::removeItem(unsigned int slot, int count) +std::shared_ptr CraftingContainer::removeItem(unsigned int slot, int count) { if ((*items)[slot] != NULL) { if ((*items)[slot]->count <= count) { - shared_ptr item = (*items)[slot]; + std::shared_ptr item = (*items)[slot]; (*items)[slot] = nullptr; menu->slotsChanged(); // 4J - used to take pointer to this, but wasn't using it so removed return item; } else { - shared_ptr i = (*items)[slot]->remove(count); + std::shared_ptr i = (*items)[slot]->remove(count); if ((*items)[slot]->count == 0) (*items)[slot] = nullptr; menu->slotsChanged(); // 4J - used to take pointer to this, but wasn't using it so removed return i; @@ -79,7 +79,7 @@ shared_ptr CraftingContainer::removeItem(unsigned int slot, int co return nullptr; } -void CraftingContainer::setItem(unsigned int slot, shared_ptr item) +void CraftingContainer::setItem(unsigned int slot, std::shared_ptr item) { (*items)[slot] = item; if(menu) menu->slotsChanged(); @@ -94,7 +94,7 @@ void CraftingContainer::setChanged() { } -bool CraftingContainer::stillValid(shared_ptr player) +bool CraftingContainer::stillValid(std::shared_ptr player) { return true; } \ No newline at end of file diff --git a/Minecraft.World/Containers/CraftingContainer.h b/Minecraft.World/Containers/CraftingContainer.h index 863249a27..d09d460ad 100644 --- a/Minecraft.World/Containers/CraftingContainer.h +++ b/Minecraft.World/Containers/CraftingContainer.h @@ -16,15 +16,15 @@ public: ~CraftingContainer(); virtual unsigned int getContainerSize(); - virtual shared_ptr getItem(unsigned int slot); - shared_ptr getItem(unsigned int x, unsigned int y); + virtual std::shared_ptr getItem(unsigned int slot); + std::shared_ptr getItem(unsigned int x, unsigned int y); virtual int getName(); - virtual shared_ptr removeItemNoUpdate(int slot); - virtual shared_ptr removeItem(unsigned int slot, int count); - virtual void setItem(unsigned int slot, shared_ptr item); + virtual std::shared_ptr removeItemNoUpdate(int slot); + virtual std::shared_ptr removeItem(unsigned int slot, int count); + virtual void setItem(unsigned int slot, std::shared_ptr item); virtual int getMaxStackSize(); virtual void setChanged(); - bool stillValid(shared_ptr player); + bool stillValid(std::shared_ptr player); void startOpen() { } // TODO Auto-generated method stub void stopOpen() { } // TODO Auto-generated method stub diff --git a/Minecraft.World/Containers/CraftingMenu.cpp b/Minecraft.World/Containers/CraftingMenu.cpp index 43bc03732..2cb2c72d2 100644 --- a/Minecraft.World/Containers/CraftingMenu.cpp +++ b/Minecraft.World/Containers/CraftingMenu.cpp @@ -17,10 +17,10 @@ const int CraftingMenu::INV_SLOT_END = CraftingMenu::INV_SLOT_START + 9 * 3; const int CraftingMenu::USE_ROW_SLOT_START = CraftingMenu::INV_SLOT_END; const int CraftingMenu::USE_ROW_SLOT_END = CraftingMenu::USE_ROW_SLOT_START + 9; -CraftingMenu::CraftingMenu(shared_ptr inventory, Level *level, int xt, int yt, int zt) : AbstractContainerMenu() +CraftingMenu::CraftingMenu(std::shared_ptr inventory, Level *level, int xt, int yt, int zt) : AbstractContainerMenu() { - craftSlots = shared_ptr( new CraftingContainer(this, 3, 3) ); - resultSlots = shared_ptr( new ResultContainer() ); + craftSlots = std::shared_ptr( new CraftingContainer(this, 3, 3) ); + resultSlots = std::shared_ptr( new ResultContainer() ); this->level = level; this->x = xt; @@ -51,19 +51,19 @@ CraftingMenu::CraftingMenu(shared_ptr inventory, Level *level, int xt slotsChanged(); // 4J - removed craftSlots parameter, see comment below } -void CraftingMenu::slotsChanged() // 4J used to take a shared_ptr but wasn't using it, so removed to simplify things +void CraftingMenu::slotsChanged() // 4J used to take a std::shared_ptr but wasn't using it, so removed to simplify things { resultSlots->setItem(0, Recipes::getInstance()->getItemFor(craftSlots, level)); } -void CraftingMenu::removed(shared_ptr player) +void CraftingMenu::removed(std::shared_ptr player) { AbstractContainerMenu::removed(player); if (level->isClientSide) return; for (int i = 0; i < 9; i++) { - shared_ptr item = craftSlots->removeItemNoUpdate(i); + std::shared_ptr item = craftSlots->removeItemNoUpdate(i); if (item != NULL) { player->drop(item); @@ -71,20 +71,20 @@ void CraftingMenu::removed(shared_ptr player) } } -bool CraftingMenu::stillValid(shared_ptr player) +bool CraftingMenu::stillValid(std::shared_ptr player) { if (level->getTile(x, y, z) != Tile::workBench_Id) return false; if (player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 8 * 8) return false; return true; } -shared_ptr CraftingMenu::quickMoveStack(shared_ptr player, int slotIndex) +std::shared_ptr CraftingMenu::quickMoveStack(std::shared_ptr player, int slotIndex) { - shared_ptr clicked = nullptr; + std::shared_ptr clicked = nullptr; Slot *slot = slots->at(slotIndex); if (slot != NULL && slot->hasItem()) { - shared_ptr stack = slot->getItem(); + std::shared_ptr stack = slot->getItem(); clicked = stack->copy(); if (slotIndex == RESULT_SLOT) diff --git a/Minecraft.World/Containers/CraftingMenu.h b/Minecraft.World/Containers/CraftingMenu.h index 0452eccc2..7ebba894a 100644 --- a/Minecraft.World/Containers/CraftingMenu.h +++ b/Minecraft.World/Containers/CraftingMenu.h @@ -18,18 +18,18 @@ public: static const int USE_ROW_SLOT_END; public: - shared_ptr craftSlots; - shared_ptr resultSlots; + std::shared_ptr craftSlots; + std::shared_ptr resultSlots; private: Level *level; int x, y, z; public: - CraftingMenu(shared_ptr inventory, Level *level, int xt, int yt, int zt); + CraftingMenu(std::shared_ptr inventory, Level *level, int xt, int yt, int zt); - virtual void slotsChanged();// 4J used to take a shared_ptr but wasn't using it, so removed to simplify things - virtual void removed(shared_ptr player); - virtual bool stillValid(shared_ptr player); - virtual shared_ptr quickMoveStack(shared_ptr player, int slotIndex); + virtual void slotsChanged();// 4J used to take a std::shared_ptr but wasn't using it, so removed to simplify things + virtual void removed(std::shared_ptr player); + virtual bool stillValid(std::shared_ptr player); + virtual std::shared_ptr quickMoveStack(std::shared_ptr player, int slotIndex); }; \ No newline at end of file diff --git a/Minecraft.World/Containers/EnchantmentMenu.cpp b/Minecraft.World/Containers/EnchantmentMenu.cpp index 091a0ea46..523dd3a54 100644 --- a/Minecraft.World/Containers/EnchantmentMenu.cpp +++ b/Minecraft.World/Containers/EnchantmentMenu.cpp @@ -7,9 +7,9 @@ #include "../Headers/net.minecraft.world.item.enchantment.h" #include "EnchantmentMenu.h" -EnchantmentMenu::EnchantmentMenu(shared_ptr inventory, Level *level, int xt, int yt, int zt) +EnchantmentMenu::EnchantmentMenu(std::shared_ptr inventory, Level *level, int xt, int yt, int zt) { - enchantSlots = shared_ptr( new EnchantmentContainer(this) ); + enchantSlots = std::shared_ptr( new EnchantmentContainer(this) ); for(int i = 0; i < 3; ++i) { @@ -77,9 +77,9 @@ void EnchantmentMenu::setData(int id, int value) } } -void EnchantmentMenu::slotsChanged() // 4J used to take a shared_ptr container but wasn't using it, so removed to simplify things +void EnchantmentMenu::slotsChanged() // 4J used to take a std::shared_ptr container but wasn't using it, so removed to simplify things { - shared_ptr item = enchantSlots->getItem(0); + std::shared_ptr item = enchantSlots->getItem(0); if (item == NULL || !item->isEnchantable()) { @@ -150,9 +150,9 @@ void EnchantmentMenu::slotsChanged() // 4J used to take a shared_ptr } } -bool EnchantmentMenu::clickMenuButton(shared_ptr player, int i) +bool EnchantmentMenu::clickMenuButton(std::shared_ptr player, int i) { - shared_ptr item = enchantSlots->getItem(0); + std::shared_ptr item = enchantSlots->getItem(0); if (costs[i] > 0 && item != NULL && (player->experienceLevel >= costs[i] || player->abilities.instabuild) ) { if (!level->isClientSide) @@ -194,34 +194,34 @@ bool EnchantmentMenu::clickMenuButton(shared_ptr player, int i) } -void EnchantmentMenu::removed(shared_ptr player) +void EnchantmentMenu::removed(std::shared_ptr player) { AbstractContainerMenu::removed(player); if (level->isClientSide) return; - shared_ptr item = enchantSlots->removeItemNoUpdate(0); + std::shared_ptr item = enchantSlots->removeItemNoUpdate(0); if (item != NULL) { player->drop(item); } } -bool EnchantmentMenu::stillValid(shared_ptr player) +bool EnchantmentMenu::stillValid(std::shared_ptr player) { if (level->getTile(x, y, z) != Tile::enchantTable_Id) return false; if (player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 8 * 8) return false; return true; } -shared_ptr EnchantmentMenu::quickMoveStack(shared_ptr player, int slotIndex) +std::shared_ptr EnchantmentMenu::quickMoveStack(std::shared_ptr player, int slotIndex) { - shared_ptr clicked = nullptr; + std::shared_ptr clicked = nullptr; Slot *slot = slots->at(slotIndex); Slot *IngredientSlot = slots->at(INGREDIENT_SLOT); if (slot != NULL && slot->hasItem()) { - shared_ptr stack = slot->getItem(); + std::shared_ptr stack = slot->getItem(); clicked = stack->copy(); if (slotIndex == INGREDIENT_SLOT) diff --git a/Minecraft.World/Containers/EnchantmentMenu.h b/Minecraft.World/Containers/EnchantmentMenu.h index bc1388166..7c4fd4138 100644 --- a/Minecraft.World/Containers/EnchantmentMenu.h +++ b/Minecraft.World/Containers/EnchantmentMenu.h @@ -13,7 +13,7 @@ public: static const int USE_ROW_SLOT_END = EnchantmentMenu::USE_ROW_SLOT_START + 9; public: - shared_ptr enchantSlots; + std::shared_ptr enchantSlots; private: Level *level; @@ -28,14 +28,14 @@ public: public: int costs[3]; - EnchantmentMenu(shared_ptr inventory, Level *level, int xt, int yt, int zt); + EnchantmentMenu(std::shared_ptr inventory, Level *level, int xt, int yt, int zt); virtual void addSlotListener(ContainerListener *listener); virtual void broadcastChanges(); virtual void setData(int id, int value); - virtual void slotsChanged();// 4J used to take a shared_ptr container but wasn't using it, so removed to simplify things - virtual bool clickMenuButton(shared_ptr player, int i); - void removed(shared_ptr player); - virtual bool stillValid(shared_ptr player); - virtual shared_ptr quickMoveStack(shared_ptr player, int slotIndex); + virtual void slotsChanged();// 4J used to take a std::shared_ptr container but wasn't using it, so removed to simplify things + virtual bool clickMenuButton(std::shared_ptr player, int i); + void removed(std::shared_ptr player); + virtual bool stillValid(std::shared_ptr player); + virtual std::shared_ptr quickMoveStack(std::shared_ptr player, int slotIndex); }; \ No newline at end of file diff --git a/Minecraft.World/Containers/EnchantmentSlot.h b/Minecraft.World/Containers/EnchantmentSlot.h index 590d9e31e..c86152887 100644 --- a/Minecraft.World/Containers/EnchantmentSlot.h +++ b/Minecraft.World/Containers/EnchantmentSlot.h @@ -10,7 +10,7 @@ class Container; class EnchantmentSlot : public Slot { public: - EnchantmentSlot(shared_ptr container, int id, int x, int y) : Slot(container,id, x, y) {} - virtual bool mayPlace(shared_ptr item) {return true;} - virtual bool mayCombine(shared_ptr item) {return false;} // 4J Added + EnchantmentSlot(std::shared_ptr container, int id, int x, int y) : Slot(container,id, x, y) {} + virtual bool mayPlace(std::shared_ptr item) {return true;} + virtual bool mayCombine(std::shared_ptr item) {return false;} // 4J Added }; \ No newline at end of file diff --git a/Minecraft.World/Containers/FurnaceMenu.cpp b/Minecraft.World/Containers/FurnaceMenu.cpp index 79e8bd8b5..e70e32721 100644 --- a/Minecraft.World/Containers/FurnaceMenu.cpp +++ b/Minecraft.World/Containers/FurnaceMenu.cpp @@ -8,7 +8,7 @@ #include "FurnaceMenu.h" #include "../Recipes/FurnaceRecipes.h" -FurnaceMenu::FurnaceMenu(shared_ptr inventory, shared_ptr furnace) : AbstractContainerMenu() +FurnaceMenu::FurnaceMenu(std::shared_ptr inventory, std::shared_ptr furnace) : AbstractContainerMenu() { tc = 0; lt = 0; @@ -75,14 +75,14 @@ void FurnaceMenu::setData(int id, int value) if (id == 2) furnace->litDuration = value; } -bool FurnaceMenu::stillValid(shared_ptr player) +bool FurnaceMenu::stillValid(std::shared_ptr player) { return furnace->stillValid(player); } -shared_ptr FurnaceMenu::quickMoveStack(shared_ptr player, int slotIndex) +std::shared_ptr FurnaceMenu::quickMoveStack(std::shared_ptr player, int slotIndex) { - shared_ptr clicked = nullptr; + std::shared_ptr clicked = nullptr; Slot *slot = slots->at(slotIndex); //Slot *IngredientSlot = slots->at(INGREDIENT_SLOT); @@ -90,7 +90,7 @@ shared_ptr FurnaceMenu::quickMoveStack(shared_ptr player, if (slot != NULL && slot->hasItem()) { - shared_ptr stack = slot->getItem(); + std::shared_ptr stack = slot->getItem(); clicked = stack->copy(); if (slotIndex == RESULT_SLOT) @@ -160,11 +160,11 @@ shared_ptr FurnaceMenu::quickMoveStack(shared_ptr player, return clicked; } -shared_ptr FurnaceMenu::clicked(int slotIndex, int buttonNum, int clickType, shared_ptr player) +std::shared_ptr FurnaceMenu::clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr player) { bool charcoalUsed = furnace->wasCharcoalUsed(); - shared_ptr out = AbstractContainerMenu::clicked(slotIndex, buttonNum, clickType, player); + std::shared_ptr out = AbstractContainerMenu::clicked(slotIndex, buttonNum, clickType, player); #ifdef _EXTENDED_ACHIEVEMENTS if ( charcoalUsed && (out!=nullptr) && (buttonNum==0 || buttonNum==1) && clickType==CLICK_PICKUP diff --git a/Minecraft.World/Containers/FurnaceMenu.h b/Minecraft.World/Containers/FurnaceMenu.h index 72b264d37..576a0fa20 100644 --- a/Minecraft.World/Containers/FurnaceMenu.h +++ b/Minecraft.World/Containers/FurnaceMenu.h @@ -17,10 +17,10 @@ public: static const int USE_ROW_SLOT_END = FurnaceMenu::USE_ROW_SLOT_START + 9; private: - shared_ptr furnace; + std::shared_ptr furnace; public: - FurnaceMenu(shared_ptr inventory, shared_ptr furnace); + FurnaceMenu(std::shared_ptr inventory, std::shared_ptr furnace); private: int tc; @@ -31,8 +31,8 @@ public: virtual void addSlotListener(ContainerListener *listener); virtual void broadcastChanges(); virtual void setData(int id, int value); - virtual bool stillValid(shared_ptr player); - virtual shared_ptr quickMoveStack(shared_ptr player, int slotIndex); + virtual bool stillValid(std::shared_ptr player); + virtual std::shared_ptr quickMoveStack(std::shared_ptr player, int slotIndex); - virtual shared_ptr clicked(int slotIndex, int buttonNum, int clickType, shared_ptr player); + virtual std::shared_ptr clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr player); }; diff --git a/Minecraft.World/Containers/FurnaceResultSlot.cpp b/Minecraft.World/Containers/FurnaceResultSlot.cpp index b7230012d..5a7bbe3ae 100644 --- a/Minecraft.World/Containers/FurnaceResultSlot.cpp +++ b/Minecraft.World/Containers/FurnaceResultSlot.cpp @@ -9,18 +9,18 @@ #include "FurnaceResultSlot.h" -FurnaceResultSlot::FurnaceResultSlot(shared_ptr player, shared_ptr container, int slot, int x, int y) : Slot( container, slot, x, y ) +FurnaceResultSlot::FurnaceResultSlot(std::shared_ptr player, std::shared_ptr container, int slot, int x, int y) : Slot( container, slot, x, y ) { this->player = player; removeCount = 0; } -bool FurnaceResultSlot::mayPlace(shared_ptr item) +bool FurnaceResultSlot::mayPlace(std::shared_ptr item) { return false; } -shared_ptr FurnaceResultSlot::remove(int c) +std::shared_ptr FurnaceResultSlot::remove(int c) { if (hasItem()) { @@ -29,24 +29,24 @@ shared_ptr FurnaceResultSlot::remove(int c) return Slot::remove(c); } -void FurnaceResultSlot::onTake(shared_ptr player, shared_ptr carried) +void FurnaceResultSlot::onTake(std::shared_ptr player, std::shared_ptr carried) { checkTakeAchievements(carried); Slot::onTake(player, carried); } -void FurnaceResultSlot::onQuickCraft(shared_ptr picked, int count) +void FurnaceResultSlot::onQuickCraft(std::shared_ptr picked, int count) { removeCount += count; checkTakeAchievements(picked); } -bool FurnaceResultSlot::mayCombine(shared_ptr second) +bool FurnaceResultSlot::mayCombine(std::shared_ptr second) { return false; } -void FurnaceResultSlot::checkTakeAchievements(shared_ptr carried) +void FurnaceResultSlot::checkTakeAchievements(std::shared_ptr carried) { carried->onCraftedBy(player->level, player, removeCount); // spawn xp right on top of the player @@ -73,7 +73,7 @@ void FurnaceResultSlot::checkTakeAchievements(shared_ptr carried) { int newCount = ExperienceOrb::getExperienceValue(amount); amount -= newCount; - player->level->addEntity(shared_ptr( new ExperienceOrb(player->level, player->x, player->y + .5, player->z + .5, newCount) )); + player->level->addEntity(std::shared_ptr( new ExperienceOrb(player->level, player->x, player->y + .5, player->z + .5, newCount) )); } } diff --git a/Minecraft.World/Containers/FurnaceResultSlot.h b/Minecraft.World/Containers/FurnaceResultSlot.h index bc770fab7..00967f318 100644 --- a/Minecraft.World/Containers/FurnaceResultSlot.h +++ b/Minecraft.World/Containers/FurnaceResultSlot.h @@ -5,19 +5,19 @@ class FurnaceResultSlot : public Slot { private: - shared_ptr player; + std::shared_ptr player; int removeCount; public: - FurnaceResultSlot(shared_ptr player, shared_ptr container, int slot, int x, int y); + FurnaceResultSlot(std::shared_ptr player, std::shared_ptr container, int slot, int x, int y); virtual ~FurnaceResultSlot() {} - virtual bool mayPlace(shared_ptr item); - virtual shared_ptr remove(int c); - virtual void onTake(shared_ptr player, shared_ptr carried); - virtual bool mayCombine(shared_ptr item); // 4J Added + virtual bool mayPlace(std::shared_ptr item); + virtual std::shared_ptr remove(int c); + virtual void onTake(std::shared_ptr player, std::shared_ptr carried); + virtual bool mayCombine(std::shared_ptr item); // 4J Added protected: - virtual void onQuickCraft(shared_ptr picked, int count); - virtual void checkTakeAchievements(shared_ptr carried); + virtual void onQuickCraft(std::shared_ptr picked, int count); + virtual void checkTakeAchievements(std::shared_ptr carried); }; \ No newline at end of file diff --git a/Minecraft.World/Containers/Inventory.cpp b/Minecraft.World/Containers/Inventory.cpp index 4b4b9afe5..ef8243963 100644 --- a/Minecraft.World/Containers/Inventory.cpp +++ b/Minecraft.World/Containers/Inventory.cpp @@ -13,8 +13,8 @@ const int Inventory::MAX_INVENTORY_STACK_SIZE = 64; const int Inventory::INVENTORY_SIZE = 4 * 9; const int Inventory::SELECTION_SIZE = 9; -// 4J Stu - The Pllayer is managed by shared_ptrs elsewhere, but it owns us so we don't want to also -// keep a shared_ptr of it. If we pass it on we should use shared_from_this() though +// 4J Stu - The Pllayer is managed by std::shared_ptrs elsewhere, but it owns us so we don't want to also +// keep a std::shared_ptr of it. If we pass it on we should use shared_from_this() though Inventory::Inventory(Player *player) { items = ItemInstanceArray( INVENTORY_SIZE ); @@ -35,7 +35,7 @@ Inventory::~Inventory() delete [] armor.data; } -shared_ptr Inventory::getSelected() +std::shared_ptr Inventory::getSelected() { // sanity checking to prevent exploits if (selected < SELECTION_SIZE && selected >= 0) @@ -83,7 +83,7 @@ int Inventory::getSlot(int tileId, int data) return -1; } -int Inventory::getSlotWithRemainingSpace(shared_ptr item) +int Inventory::getSlotWithRemainingSpace(std::shared_ptr item) { for (unsigned int i = 0; i < items.length; i++) { @@ -182,12 +182,12 @@ void Inventory::replaceSlot(Item *item, int data) { return; } - items[selected] = shared_ptr(new ItemInstance(Item::items[item->id], 1, data)); + items[selected] = std::shared_ptr(new ItemInstance(Item::items[item->id], 1, data)); } } -int Inventory::addResource(shared_ptr itemInstance) +int Inventory::addResource(std::shared_ptr itemInstance) { int type = itemInstance->id; @@ -211,7 +211,7 @@ int Inventory::addResource(shared_ptr itemInstance) if (slot < 0) return count; if (items[slot] == NULL) { - items[slot] = shared_ptr( new ItemInstance(type, 0, itemInstance->getAuxValue()) ); + items[slot] = std::shared_ptr( new ItemInstance(type, 0, itemInstance->getAuxValue()) ); // 4J Stu - Brought forward from 1.2 if (itemInstance->hasTag()) { @@ -269,7 +269,7 @@ bool Inventory::removeResource(int type,int iAuxVal) return true; } -void Inventory::removeResources(shared_ptr item) +void Inventory::removeResources(std::shared_ptr item) { if(item == NULL) return; @@ -293,14 +293,14 @@ void Inventory::removeResources(shared_ptr item) } } -shared_ptr Inventory::getResourceItem(int type) +std::shared_ptr Inventory::getResourceItem(int type) { int slot = getSlot(type); if (slot < 0) return nullptr; return getItem( slot ); } -shared_ptr Inventory::getResourceItem(int type,int iAuxVal) +std::shared_ptr Inventory::getResourceItem(int type,int iAuxVal) { int slot = getSlot(type,iAuxVal); if (slot < 0) return nullptr; @@ -317,12 +317,12 @@ bool Inventory::hasResource(int type) void Inventory::swapSlots(int from, int to) { - shared_ptr tmp = items[to]; + std::shared_ptr tmp = items[to]; items[to] = items[from]; items[from] = tmp; } -bool Inventory::add(shared_ptr item) +bool Inventory::add(std::shared_ptr item) { // 4J Stu - Fix for duplication glitch if(item->count <= 0) return true; @@ -377,7 +377,7 @@ bool Inventory::add(shared_ptr item) return false; } -shared_ptr Inventory::removeItem(unsigned int slot, int count) +std::shared_ptr Inventory::removeItem(unsigned int slot, int count) { ItemInstanceArray pile = items; @@ -391,13 +391,13 @@ shared_ptr Inventory::removeItem(unsigned int slot, int count) { if (pile[slot]->count <= count) { - shared_ptr item = pile[slot]; + std::shared_ptr item = pile[slot]; pile[slot] = nullptr; return item; } else { - shared_ptr i = pile[slot]->remove(count); + std::shared_ptr i = pile[slot]->remove(count); if (pile[slot]->count == 0) pile[slot] = nullptr; return i; } @@ -405,7 +405,7 @@ shared_ptr Inventory::removeItem(unsigned int slot, int count) return nullptr; } -shared_ptr Inventory::removeItemNoUpdate(int slot) +std::shared_ptr Inventory::removeItemNoUpdate(int slot) { ItemInstanceArray pile = items; if (slot >= items.length) @@ -416,14 +416,14 @@ shared_ptr Inventory::removeItemNoUpdate(int slot) if (pile[slot] != NULL) { - shared_ptr item = pile[slot]; + std::shared_ptr item = pile[slot]; pile[slot] = nullptr; return item; } return nullptr; } -void Inventory::setItem(unsigned int slot, shared_ptr item) +void Inventory::setItem(unsigned int slot, std::shared_ptr item) { #ifdef _DEBUG if(item!=NULL) @@ -512,7 +512,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) ); + std::shared_ptr item = std::shared_ptr( ItemInstance::fromTag(tag) ); if (item != NULL) { if (slot >= 0 && slot < items.length) items[slot] = item; @@ -526,7 +526,7 @@ unsigned int Inventory::getContainerSize() return items.length + 4; } -shared_ptr Inventory::getItem(unsigned int slot) +std::shared_ptr Inventory::getItem(unsigned int slot) { // 4J Stu - Changed this a little from the Java so it's less funny if( slot >= items.length ) @@ -559,9 +559,9 @@ int Inventory::getMaxStackSize() return MAX_INVENTORY_STACK_SIZE; } -int Inventory::getAttackDamage(shared_ptr entity) +int Inventory::getAttackDamage(std::shared_ptr entity) { - shared_ptr item = getItem(selected); + std::shared_ptr item = getItem(selected); if (item != NULL) return item->getAttackDamage(entity); return 1; } @@ -570,12 +570,12 @@ bool Inventory::canDestroy(Tile *tile) { if (tile->material->isAlwaysDestroyable()) return true; - shared_ptr item = getItem(selected); + std::shared_ptr item = getItem(selected); if (item != NULL) return item->canDestroySpecial(tile); return false; } -shared_ptr Inventory::getArmor(int layer) +std::shared_ptr Inventory::getArmor(int layer) { return armor[layer]; } @@ -640,7 +640,7 @@ void Inventory::setChanged() changed = true; } -bool Inventory::isSame(shared_ptr copy) +bool Inventory::isSame(std::shared_ptr copy) { for (unsigned int i = 0; i < items.length; i++) { @@ -654,7 +654,7 @@ bool Inventory::isSame(shared_ptr copy) } -bool Inventory::isSame(shared_ptr a, shared_ptr b) +bool Inventory::isSame(std::shared_ptr a, std::shared_ptr b) { if (a == NULL && b == NULL) return true; if (a == NULL || b == NULL) return false; @@ -663,9 +663,9 @@ bool Inventory::isSame(shared_ptr a, shared_ptr b) } -shared_ptr Inventory::copy() +std::shared_ptr Inventory::copy() { - shared_ptr copy = shared_ptr( new Inventory(NULL) ); + std::shared_ptr copy = std::shared_ptr( new Inventory(NULL) ); for (unsigned int i = 0; i < items.length; i++) { copy->items[i] = items[i] != NULL ? items[i]->copy() : nullptr; @@ -677,25 +677,25 @@ shared_ptr Inventory::copy() return copy; } -void Inventory::setCarried(shared_ptr carried) +void Inventory::setCarried(std::shared_ptr carried) { this->carried = carried; player->handleCollectItem(carried); } -shared_ptr Inventory::getCarried() +std::shared_ptr Inventory::getCarried() { return carried; } -bool Inventory::stillValid(shared_ptr player) +bool Inventory::stillValid(std::shared_ptr player) { if (this->player->removed) return false; if (player->distanceToSqr(this->player->shared_from_this()) > 8 * 8) return false; return true; } -bool Inventory::contains(shared_ptr itemInstance) +bool Inventory::contains(std::shared_ptr itemInstance) { for (unsigned int i = 0; i < armor.length; i++) { @@ -718,7 +718,7 @@ void Inventory::stopOpen() // TODO Auto-generated method stub } -void Inventory::replaceWith(shared_ptr other) +void Inventory::replaceWith(std::shared_ptr other) { for (int i = 0; i < items.length; i++) { @@ -730,7 +730,7 @@ void Inventory::replaceWith(shared_ptr other) } } -int Inventory::countMatches(shared_ptr itemInstance) +int Inventory::countMatches(std::shared_ptr itemInstance) { if(itemInstance == NULL) return 0; int count = 0; diff --git a/Minecraft.World/Containers/Inventory.h b/Minecraft.World/Containers/Inventory.h index c66d8e691..2460ff249 100644 --- a/Minecraft.World/Containers/Inventory.h +++ b/Minecraft.World/Containers/Inventory.h @@ -22,11 +22,11 @@ public: ItemInstanceArray armor; int selected; - Player *player; // This is owned by shared_ptrs, but we are owned by it + Player *player; // This is owned by std::shared_ptrs, but we are owned by it private: - shared_ptr heldItem; - shared_ptr carried; + std::shared_ptr heldItem; + std::shared_ptr carried; public: bool changed; @@ -34,7 +34,7 @@ public: Inventory(Player *player); ~Inventory(); - shared_ptr getSelected(); + std::shared_ptr getSelected(); // 4J-PB - Added for the in-game tooltips bool IsHeldItem(); @@ -44,7 +44,7 @@ private: int getSlot(int tileId); int getSlot(int tileId, int data); - int getSlotWithRemainingSpace(shared_ptr item); + int getSlotWithRemainingSpace(std::shared_ptr item); public: int getFreeSlot(); @@ -58,7 +58,7 @@ public: void replaceSlot(Item *item, int data); private: - int addResource(shared_ptr itemInstance); + int addResource(std::shared_ptr itemInstance); public: void tick(); @@ -67,22 +67,22 @@ public: // 4J-PB added to get the right resource from the inventory for removal bool removeResource(int type,int iAuxVal); - void removeResources(shared_ptr item); // 4J Added for trading + void removeResources(std::shared_ptr item); // 4J Added for trading // 4J-Stu added to the get the item that would be affected by the removeResource functions - shared_ptr getResourceItem(int type); - shared_ptr getResourceItem(int type,int iAuxVal); + std::shared_ptr getResourceItem(int type); + std::shared_ptr getResourceItem(int type,int iAuxVal); bool hasResource(int type); void swapSlots(int from, int to); - bool add(shared_ptr item); + bool add(std::shared_ptr item); - shared_ptr removeItem(unsigned int slot, int count); - virtual shared_ptr removeItemNoUpdate(int slot); + std::shared_ptr removeItem(unsigned int slot, int count); + virtual std::shared_ptr removeItemNoUpdate(int slot); - void setItem(unsigned int slot, shared_ptr item); + void setItem(unsigned int slot, std::shared_ptr item); float getDestroySpeed(Tile *tile); @@ -92,17 +92,17 @@ public: unsigned int getContainerSize(); - shared_ptr getItem(unsigned int slot); + std::shared_ptr getItem(unsigned int slot); int getName(); int getMaxStackSize(); - int getAttackDamage(shared_ptr entity); + int getAttackDamage(std::shared_ptr entity); bool canDestroy(Tile *tile); - shared_ptr getArmor(int layer); + std::shared_ptr getArmor(int layer); int getArmorValue(); @@ -112,25 +112,25 @@ public: void setChanged(); - bool isSame(shared_ptr copy); + bool isSame(std::shared_ptr copy); private: - bool isSame(shared_ptr a, shared_ptr b); + bool isSame(std::shared_ptr a, std::shared_ptr b); public: - shared_ptr copy(); + std::shared_ptr copy(); - void setCarried(shared_ptr carried); + void setCarried(std::shared_ptr carried); - shared_ptr getCarried(); + std::shared_ptr getCarried(); - bool stillValid(shared_ptr player); + bool stillValid(std::shared_ptr player); - bool contains(shared_ptr itemInstance); + bool contains(std::shared_ptr itemInstance); virtual void startOpen(); virtual void stopOpen(); - void replaceWith(shared_ptr other); + void replaceWith(std::shared_ptr other); - int countMatches(shared_ptr itemInstance); // 4J Added + int countMatches(std::shared_ptr itemInstance); // 4J Added }; \ No newline at end of file diff --git a/Minecraft.World/Containers/InventoryMenu.cpp b/Minecraft.World/Containers/InventoryMenu.cpp index c9cbfc58e..953d5f1bf 100644 --- a/Minecraft.World/Containers/InventoryMenu.cpp +++ b/Minecraft.World/Containers/InventoryMenu.cpp @@ -20,16 +20,16 @@ const int InventoryMenu::INV_SLOT_END = InventoryMenu::INV_SLOT_START + 9 * 3; const int InventoryMenu::USE_ROW_SLOT_START = InventoryMenu::INV_SLOT_END; const int InventoryMenu::USE_ROW_SLOT_END = InventoryMenu::USE_ROW_SLOT_START + 9; -InventoryMenu::InventoryMenu(shared_ptr inventory, bool active, Player *player) : AbstractContainerMenu() +InventoryMenu::InventoryMenu(std::shared_ptr inventory, bool active, Player *player) : AbstractContainerMenu() { owner = player; _init( inventory, active ); } -void InventoryMenu::_init(shared_ptr inventory, bool active) +void InventoryMenu::_init(std::shared_ptr inventory, bool active) { - craftSlots = shared_ptr( new CraftingContainer(this, 2, 2) ); - resultSlots = shared_ptr( new ResultContainer() ); + craftSlots = std::shared_ptr( new CraftingContainer(this, 2, 2) ); + resultSlots = std::shared_ptr( new ResultContainer() ); this->active = active; addSlot(new ResultSlot( inventory->player, craftSlots, resultSlots, 0, 144, 36)); @@ -64,19 +64,19 @@ void InventoryMenu::_init(shared_ptr inventory, bool active) slotsChanged(); // 4J removed craftSlots parameter, see comment below } -void InventoryMenu::slotsChanged() // 4J used to take a shared_ptr but wasn't using it, so removed to simplify things +void InventoryMenu::slotsChanged() // 4J used to take a std::shared_ptr but wasn't using it, so removed to simplify things { MemSect(23); resultSlots->setItem(0, Recipes::getInstance()->getItemFor(craftSlots, owner->level) ); MemSect(0); } -void InventoryMenu::removed(shared_ptr player) +void InventoryMenu::removed(std::shared_ptr player) { AbstractContainerMenu::removed(player); for (int i = 0; i < 4; i++) { - shared_ptr item = craftSlots->removeItemNoUpdate(i); + std::shared_ptr item = craftSlots->removeItemNoUpdate(i); if (item != NULL) { player->drop(item); @@ -86,14 +86,14 @@ void InventoryMenu::removed(shared_ptr player) resultSlots->setItem(0, nullptr); } -bool InventoryMenu::stillValid(shared_ptr player) +bool InventoryMenu::stillValid(std::shared_ptr player) { return true; } -shared_ptr InventoryMenu::quickMoveStack(shared_ptr player, int slotIndex) +std::shared_ptr InventoryMenu::quickMoveStack(std::shared_ptr player, int slotIndex) { - shared_ptr clicked = nullptr; + std::shared_ptr clicked = nullptr; Slot *slot = slots->at(slotIndex); Slot *HelmetSlot = slots->at(ARMOR_SLOT_START); @@ -104,7 +104,7 @@ shared_ptr InventoryMenu::quickMoveStack(shared_ptr player if (slot != NULL && slot->hasItem()) { - shared_ptr stack = slot->getItem(); + std::shared_ptr stack = slot->getItem(); clicked = stack->copy(); if (slotIndex == RESULT_SLOT) @@ -220,15 +220,15 @@ shared_ptr InventoryMenu::quickMoveStack(shared_ptr player return clicked; } -bool InventoryMenu::mayCombine(Slot *slot, shared_ptr item) +bool InventoryMenu::mayCombine(Slot *slot, std::shared_ptr item) { return slot->mayCombine(item); } // 4J-JEV: Added for achievement 'Iron Man'. -shared_ptr InventoryMenu::clicked(int slotIndex, int buttonNum, int clickType, shared_ptr player) +std::shared_ptr InventoryMenu::clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr player) { - shared_ptr out = AbstractContainerMenu::clicked(slotIndex, buttonNum, clickType, player); + std::shared_ptr out = AbstractContainerMenu::clicked(slotIndex, buttonNum, clickType, player); #ifdef _EXTENDED_ACHIEVEMENTS static int ironItems[4] = {Item::helmet_iron_Id,Item::chestplate_iron_Id,Item::leggings_iron_Id,Item::boots_iron_Id}; diff --git a/Minecraft.World/Containers/InventoryMenu.h b/Minecraft.World/Containers/InventoryMenu.h index b37a4be92..cd18f95f7 100644 --- a/Minecraft.World/Containers/InventoryMenu.h +++ b/Minecraft.World/Containers/InventoryMenu.h @@ -23,22 +23,22 @@ public: static const int USE_ROW_SLOT_END; public: - shared_ptr craftSlots; - shared_ptr resultSlots; + std::shared_ptr craftSlots; + std::shared_ptr resultSlots; bool active; - InventoryMenu(shared_ptr inventory, bool active, Player *player); + InventoryMenu(std::shared_ptr inventory, bool active, Player *player); private: - void _init(shared_ptr inventory, bool active); + void _init(std::shared_ptr inventory, bool active); public: - virtual void slotsChanged(); // 4J used to take a shared_ptr but wasn't using it, so removed to simplify things - virtual void removed(shared_ptr player); - virtual bool stillValid(shared_ptr player); - virtual shared_ptr quickMoveStack(shared_ptr player, int slotIndex); - virtual bool mayCombine(Slot *slot, shared_ptr item); + virtual void slotsChanged(); // 4J used to take a std::shared_ptr but wasn't using it, so removed to simplify things + virtual void removed(std::shared_ptr player); + virtual bool stillValid(std::shared_ptr player); + virtual std::shared_ptr quickMoveStack(std::shared_ptr player, int slotIndex); + virtual bool mayCombine(Slot *slot, std::shared_ptr item); // 4J ADDED, - virtual shared_ptr clicked(int slotIndex, int buttonNum, int clickType, shared_ptr player); + virtual std::shared_ptr clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr player); }; diff --git a/Minecraft.World/Containers/MenuBackup.cpp b/Minecraft.World/Containers/MenuBackup.cpp index 9d5da05f2..2655e0930 100644 --- a/Minecraft.World/Containers/MenuBackup.cpp +++ b/Minecraft.World/Containers/MenuBackup.cpp @@ -5,7 +5,7 @@ #include "Slot.h" #include "MenuBackup.h" -MenuBackup::MenuBackup(shared_ptr inventory, AbstractContainerMenu *menu) +MenuBackup::MenuBackup(std::shared_ptr inventory, AbstractContainerMenu *menu) { backups = new unordered_map(); diff --git a/Minecraft.World/Containers/MenuBackup.h b/Minecraft.World/Containers/MenuBackup.h index 2de750b11..27df45dad 100644 --- a/Minecraft.World/Containers/MenuBackup.h +++ b/Minecraft.World/Containers/MenuBackup.h @@ -7,11 +7,11 @@ class MenuBackup { private: unordered_map *backups; - shared_ptr inventory; + std::shared_ptr inventory; AbstractContainerMenu *menu; public: - MenuBackup(shared_ptr inventory, AbstractContainerMenu *menu); + MenuBackup(std::shared_ptr inventory, AbstractContainerMenu *menu); void save(short changeUid); diff --git a/Minecraft.World/Containers/Merchant.h b/Minecraft.World/Containers/Merchant.h index 8b4b7a698..ad7ab1fcb 100644 --- a/Minecraft.World/Containers/Merchant.h +++ b/Minecraft.World/Containers/Merchant.h @@ -7,11 +7,11 @@ class Player; class Merchant { public: - virtual void setTradingPlayer(shared_ptr player) = 0; - virtual shared_ptr getTradingPlayer() = 0; - virtual MerchantRecipeList *getOffers(shared_ptr forPlayer) = 0; + virtual void setTradingPlayer(std::shared_ptr player) = 0; + virtual std::shared_ptr getTradingPlayer() = 0; + virtual MerchantRecipeList *getOffers(std::shared_ptr forPlayer) = 0; virtual void overrideOffers(MerchantRecipeList *recipeList) = 0; virtual void notifyTrade(MerchantRecipe *activeRecipe) = 0; - virtual void notifyTradeUpdated(shared_ptr item) = 0; + virtual void notifyTradeUpdated(std::shared_ptr item) = 0; virtual int getDisplayName() = 0; }; \ No newline at end of file diff --git a/Minecraft.World/Containers/MerchantContainer.cpp b/Minecraft.World/Containers/MerchantContainer.cpp index 04a0230af..22fd4d802 100644 --- a/Minecraft.World/Containers/MerchantContainer.cpp +++ b/Minecraft.World/Containers/MerchantContainer.cpp @@ -3,7 +3,7 @@ #include "MerchantMenu.h" #include "MerchantContainer.h" -MerchantContainer::MerchantContainer(shared_ptr player, shared_ptr villager) +MerchantContainer::MerchantContainer(std::shared_ptr player, std::shared_ptr villager) { this->player = player; merchant = villager; @@ -25,24 +25,24 @@ unsigned int MerchantContainer::getContainerSize() return items.length; } -shared_ptr MerchantContainer::getItem(unsigned int slot) +std::shared_ptr MerchantContainer::getItem(unsigned int slot) { return items[slot]; } -shared_ptr MerchantContainer::removeItem(unsigned int slot, int count) +std::shared_ptr MerchantContainer::removeItem(unsigned int slot, int count) { if (items[slot] != NULL) { if (slot == MerchantMenu::RESULT_SLOT) { - shared_ptr item = items[slot]; + std::shared_ptr item = items[slot]; items[slot] = nullptr; return item; } if (items[slot]->count <= count) { - shared_ptr item = items[slot]; + std::shared_ptr item = items[slot]; items[slot] = nullptr; if (isPaymentSlot(slot)) { @@ -52,7 +52,7 @@ shared_ptr MerchantContainer::removeItem(unsigned int slot, int co } else { - shared_ptr i = items[slot]->remove(count); + std::shared_ptr i = items[slot]->remove(count); if (items[slot]->count == 0) items[slot] = nullptr; if (isPaymentSlot(slot)) { @@ -69,18 +69,18 @@ bool MerchantContainer::isPaymentSlot(int slot) return slot == MerchantMenu::PAYMENT1_SLOT || slot == MerchantMenu::PAYMENT2_SLOT; } -shared_ptr MerchantContainer::removeItemNoUpdate(int slot) +std::shared_ptr MerchantContainer::removeItemNoUpdate(int slot) { if (items[slot] != NULL) { - shared_ptr item = items[slot]; + std::shared_ptr item = items[slot]; items[slot] = nullptr; return item; } return nullptr; } -void MerchantContainer::setItem(unsigned int slot, shared_ptr item) +void MerchantContainer::setItem(unsigned int slot, std::shared_ptr item) { items[slot] = item; if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); @@ -100,7 +100,7 @@ int MerchantContainer::getMaxStackSize() return Container::LARGE_MAX_STACK_SIZE; } -bool MerchantContainer::stillValid(shared_ptr player) +bool MerchantContainer::stillValid(std::shared_ptr player) { return merchant->getTradingPlayer() == player; } @@ -122,8 +122,8 @@ void MerchantContainer::updateSellItem() { activeRecipe = NULL; - shared_ptr buyItem1 = items[MerchantMenu::PAYMENT1_SLOT]; - shared_ptr buyItem2 = items[MerchantMenu::PAYMENT2_SLOT]; + std::shared_ptr buyItem1 = items[MerchantMenu::PAYMENT1_SLOT]; + std::shared_ptr buyItem2 = items[MerchantMenu::PAYMENT2_SLOT]; if (buyItem1 == NULL) { diff --git a/Minecraft.World/Containers/MerchantContainer.h b/Minecraft.World/Containers/MerchantContainer.h index f923e7626..9fa80f3df 100644 --- a/Minecraft.World/Containers/MerchantContainer.h +++ b/Minecraft.World/Containers/MerchantContainer.h @@ -10,29 +10,29 @@ class MerchantRecipe; class MerchantContainer : public Container { private: - shared_ptr merchant; + std::shared_ptr merchant; ItemInstanceArray items; - shared_ptr player; + std::shared_ptr player; MerchantRecipe *activeRecipe; int selectionHint; public: - MerchantContainer(shared_ptr player, shared_ptr villager); + MerchantContainer(std::shared_ptr player, std::shared_ptr villager); ~MerchantContainer(); unsigned int getContainerSize(); - shared_ptr getItem(unsigned int slot); - shared_ptr removeItem(unsigned int slot, int count); + std::shared_ptr getItem(unsigned int slot); + std::shared_ptr removeItem(unsigned int slot, int count); private: bool isPaymentSlot(int slot); public: - shared_ptr removeItemNoUpdate(int slot); - void setItem(unsigned int slot, shared_ptr item); + std::shared_ptr removeItemNoUpdate(int slot); + void setItem(unsigned int slot, std::shared_ptr item); int getName(); int getMaxStackSize(); - bool stillValid(shared_ptr player); + bool stillValid(std::shared_ptr player); void startOpen(); void stopOpen(); void setChanged(); diff --git a/Minecraft.World/Containers/MerchantMenu.cpp b/Minecraft.World/Containers/MerchantMenu.cpp index 1721e621e..28f062bfc 100644 --- a/Minecraft.World/Containers/MerchantMenu.cpp +++ b/Minecraft.World/Containers/MerchantMenu.cpp @@ -5,12 +5,12 @@ #include "../Headers/net.minecraft.world.level.h" #include "MerchantMenu.h" -MerchantMenu::MerchantMenu(shared_ptr inventory, shared_ptr merchant, Level *level) +MerchantMenu::MerchantMenu(std::shared_ptr inventory, std::shared_ptr merchant, Level *level) { trader = merchant; this->level = level; - tradeContainer = shared_ptr( new MerchantContainer(dynamic_pointer_cast(inventory->player->shared_from_this()), merchant) ); + tradeContainer = std::shared_ptr( new MerchantContainer(dynamic_pointer_cast(inventory->player->shared_from_this()), merchant) ); addSlot(new Slot(tradeContainer, PAYMENT1_SLOT, SELLSLOT1_X, ROW2_Y)); addSlot(new Slot(tradeContainer, PAYMENT2_SLOT, SELLSLOT2_X, ROW2_Y)); addSlot(new MerchantResultSlot(inventory->player, merchant, tradeContainer, RESULT_SLOT, BUYSLOT_X, ROW2_Y)); @@ -28,7 +28,7 @@ MerchantMenu::MerchantMenu(shared_ptr inventory, shared_ptr } } -shared_ptr MerchantMenu::getTradeContainer() +std::shared_ptr MerchantMenu::getTradeContainer() { return tradeContainer; } @@ -43,7 +43,7 @@ void MerchantMenu::broadcastChanges() AbstractContainerMenu::broadcastChanges(); } -// 4J used to take a shared_ptr but wasn't using it, so removed to simplify things +// 4J used to take a std::shared_ptr but wasn't using it, so removed to simplify things void MerchantMenu::slotsChanged() { tradeContainer->updateSellItem(); @@ -59,20 +59,20 @@ void MerchantMenu::setData(int id, int value) { } -bool MerchantMenu::stillValid(shared_ptr player) +bool MerchantMenu::stillValid(std::shared_ptr player) { return trader->getTradingPlayer() == player; } -shared_ptr MerchantMenu::quickMoveStack(shared_ptr player, int slotIndex) +std::shared_ptr MerchantMenu::quickMoveStack(std::shared_ptr player, int slotIndex) { - shared_ptr clicked = nullptr; + std::shared_ptr clicked = nullptr; Slot *slot = NULL; if(slotIndex < slots->size()) slot = slots->at(slotIndex); if (slot != NULL && slot->hasItem()) { - shared_ptr stack = slot->getItem(); + std::shared_ptr stack = slot->getItem(); clicked = stack->copy(); if (slotIndex == RESULT_SLOT) @@ -124,7 +124,7 @@ shared_ptr MerchantMenu::quickMoveStack(shared_ptr player, return clicked; } -void MerchantMenu::removed(shared_ptr player) +void MerchantMenu::removed(std::shared_ptr player) { AbstractContainerMenu::removed(player); trader->setTradingPlayer(nullptr); @@ -132,7 +132,7 @@ void MerchantMenu::removed(shared_ptr player) AbstractContainerMenu::removed(player); if (level->isClientSide) return; - shared_ptr item = tradeContainer->removeItemNoUpdate(PAYMENT1_SLOT); + std::shared_ptr item = tradeContainer->removeItemNoUpdate(PAYMENT1_SLOT); if (item) { player->drop(item); @@ -144,7 +144,7 @@ void MerchantMenu::removed(shared_ptr player) } } -shared_ptr MerchantMenu::getMerchant() +std::shared_ptr MerchantMenu::getMerchant() { return trader; } \ No newline at end of file diff --git a/Minecraft.World/Containers/MerchantMenu.h b/Minecraft.World/Containers/MerchantMenu.h index 14a5fa1d1..23b639986 100644 --- a/Minecraft.World/Containers/MerchantMenu.h +++ b/Minecraft.World/Containers/MerchantMenu.h @@ -25,22 +25,22 @@ public: private: - shared_ptr trader; - shared_ptr tradeContainer; + std::shared_ptr trader; + std::shared_ptr tradeContainer; Level *level; public: - MerchantMenu(shared_ptr inventory, shared_ptr merchant, Level *level); + MerchantMenu(std::shared_ptr inventory, std::shared_ptr merchant, Level *level); - shared_ptr getTradeContainer(); + std::shared_ptr getTradeContainer(); void addSlotListener(ContainerListener *listener); void broadcastChanges(); - void slotsChanged(); // 4J used to take a shared_ptr but wasn't using it, so removed to simplify things + void slotsChanged(); // 4J used to take a std::shared_ptr but wasn't using it, so removed to simplify things void setSelectionHint(int hint); void setData(int id, int value); - bool stillValid(shared_ptr player); - shared_ptr quickMoveStack(shared_ptr player, int slotIndex); - void removed(shared_ptr player); + bool stillValid(std::shared_ptr player); + std::shared_ptr quickMoveStack(std::shared_ptr player, int slotIndex); + void removed(std::shared_ptr player); - shared_ptr getMerchant(); // 4J Added + std::shared_ptr getMerchant(); // 4J Added }; \ No newline at end of file diff --git a/Minecraft.World/Containers/MerchantRecipe.cpp b/Minecraft.World/Containers/MerchantRecipe.cpp index de3bd0528..74439d3c5 100644 --- a/Minecraft.World/Containers/MerchantRecipe.cpp +++ b/Minecraft.World/Containers/MerchantRecipe.cpp @@ -2,7 +2,7 @@ #include "MerchantRecipe.h" -void MerchantRecipe::_init(shared_ptr buyA, shared_ptr buyB, shared_ptr sell) +void MerchantRecipe::_init(std::shared_ptr buyA, std::shared_ptr buyB, std::shared_ptr sell) { this->buyA = buyA; this->buyB = buyB; @@ -20,34 +20,34 @@ MerchantRecipe::MerchantRecipe(CompoundTag *tag) load(tag); } -MerchantRecipe::MerchantRecipe(shared_ptr buyA, shared_ptr buyB, shared_ptr sell, int uses, int maxUses) +MerchantRecipe::MerchantRecipe(std::shared_ptr buyA, std::shared_ptr buyB, std::shared_ptr sell, int uses, int maxUses) { _init(buyA, buyB, sell); this->uses = uses; this->maxUses = maxUses; } -MerchantRecipe::MerchantRecipe(shared_ptr buy, shared_ptr sell) +MerchantRecipe::MerchantRecipe(std::shared_ptr buy, std::shared_ptr sell) { _init(buy, nullptr, sell); } -MerchantRecipe::MerchantRecipe(shared_ptr buy, Item *sell) +MerchantRecipe::MerchantRecipe(std::shared_ptr buy, Item *sell) { - _init(buy, nullptr, shared_ptr(new ItemInstance(sell))); + _init(buy, nullptr, std::shared_ptr(new ItemInstance(sell))); } -MerchantRecipe::MerchantRecipe(shared_ptr buy, Tile *sell) +MerchantRecipe::MerchantRecipe(std::shared_ptr buy, Tile *sell) { - _init(buy, nullptr, shared_ptr(new ItemInstance(sell))); + _init(buy, nullptr, std::shared_ptr(new ItemInstance(sell))); } -shared_ptr MerchantRecipe::getBuyAItem() +std::shared_ptr MerchantRecipe::getBuyAItem() { return buyA; } -shared_ptr MerchantRecipe::getBuyBItem() +std::shared_ptr MerchantRecipe::getBuyBItem() { return buyB; } @@ -57,7 +57,7 @@ bool MerchantRecipe::hasSecondaryBuyItem() return buyB != NULL; } -shared_ptr MerchantRecipe::getSellItem() +std::shared_ptr MerchantRecipe::getSellItem() { return sell; } diff --git a/Minecraft.World/Containers/MerchantRecipe.h b/Minecraft.World/Containers/MerchantRecipe.h index 0ed848984..dd684b6a4 100644 --- a/Minecraft.World/Containers/MerchantRecipe.h +++ b/Minecraft.World/Containers/MerchantRecipe.h @@ -3,25 +3,25 @@ class MerchantRecipe { private: - shared_ptr buyA; - shared_ptr buyB; - shared_ptr sell; + std::shared_ptr buyA; + std::shared_ptr buyB; + std::shared_ptr sell; int uses; int maxUses; - void _init(shared_ptr buyA, shared_ptr buyB, shared_ptr sell); + void _init(std::shared_ptr buyA, std::shared_ptr buyB, std::shared_ptr sell); public: MerchantRecipe(CompoundTag *tag); - MerchantRecipe(shared_ptr buyA, shared_ptr buyB, shared_ptr sell, int uses = 0, int maxUses = 7); - MerchantRecipe(shared_ptr buy, shared_ptr sell); - MerchantRecipe(shared_ptr buy, Item *sell); - MerchantRecipe(shared_ptr buy, Tile *sell); + MerchantRecipe(std::shared_ptr buyA, std::shared_ptr buyB, std::shared_ptr sell, int uses = 0, int maxUses = 7); + MerchantRecipe(std::shared_ptr buy, std::shared_ptr sell); + MerchantRecipe(std::shared_ptr buy, Item *sell); + MerchantRecipe(std::shared_ptr buy, Tile *sell); - shared_ptr getBuyAItem(); - shared_ptr getBuyBItem(); + std::shared_ptr getBuyAItem(); + std::shared_ptr getBuyBItem(); bool hasSecondaryBuyItem(); - shared_ptr getSellItem(); + std::shared_ptr getSellItem(); bool isSame(MerchantRecipe *other); bool isSameSameButBetter(MerchantRecipe *other); int getUses(); diff --git a/Minecraft.World/Containers/MerchantRecipeList.cpp b/Minecraft.World/Containers/MerchantRecipeList.cpp index f07427254..9c4e6e701 100644 --- a/Minecraft.World/Containers/MerchantRecipeList.cpp +++ b/Minecraft.World/Containers/MerchantRecipeList.cpp @@ -19,7 +19,7 @@ MerchantRecipeList::~MerchantRecipeList() } } -MerchantRecipe *MerchantRecipeList::getRecipeFor(shared_ptr buyA, shared_ptr buyB, int selectionHint) +MerchantRecipe *MerchantRecipeList::getRecipeFor(std::shared_ptr buyA, std::shared_ptr buyB, int selectionHint) { if (selectionHint > 0 && selectionHint < m_recipes.size()) { @@ -67,7 +67,7 @@ bool MerchantRecipeList::addIfNewOrBetter(MerchantRecipe *recipe) return true; } -MerchantRecipe *MerchantRecipeList::getMatchingRecipeFor(shared_ptr buy, shared_ptr buyB, shared_ptr sell) +MerchantRecipe *MerchantRecipeList::getMatchingRecipeFor(std::shared_ptr buy, std::shared_ptr buyB, std::shared_ptr sell) { for (int i = 0; i < m_recipes.size(); i++) { @@ -92,7 +92,7 @@ void MerchantRecipeList::writeToStream(DataOutputStream *stream) Packet::writeItem(r->getBuyAItem(), stream); Packet::writeItem(r->getSellItem(), stream); - shared_ptr buyBItem = r->getBuyBItem(); + std::shared_ptr buyBItem = r->getBuyBItem(); stream->writeBoolean(buyBItem != NULL); if (buyBItem != NULL) { @@ -111,10 +111,10 @@ MerchantRecipeList *MerchantRecipeList::createFromStream(DataInputStream *stream int count = (int) (stream->readByte() & 0xff); for (int i = 0; i < count; i++) { - shared_ptr buy = Packet::readItem(stream); - shared_ptr sell = Packet::readItem(stream); + std::shared_ptr buy = Packet::readItem(stream); + std::shared_ptr sell = Packet::readItem(stream); - shared_ptr buyB = nullptr; + std::shared_ptr buyB = nullptr; if (stream->readBoolean()) { buyB = Packet::readItem(stream); diff --git a/Minecraft.World/Containers/MerchantRecipeList.h b/Minecraft.World/Containers/MerchantRecipeList.h index 4a761d398..b3c0cd2b2 100644 --- a/Minecraft.World/Containers/MerchantRecipeList.h +++ b/Minecraft.World/Containers/MerchantRecipeList.h @@ -17,9 +17,9 @@ public: MerchantRecipeList(CompoundTag *tag); ~MerchantRecipeList(); - MerchantRecipe *getRecipeFor(shared_ptr buyA, shared_ptr buyB, int selectionHint); + MerchantRecipe *getRecipeFor(std::shared_ptr buyA, std::shared_ptr buyB, int selectionHint); bool addIfNewOrBetter(MerchantRecipe *recipe); // 4J Added bool return - MerchantRecipe *getMatchingRecipeFor(shared_ptr buy, shared_ptr buyB, shared_ptr sell); + MerchantRecipe *getMatchingRecipeFor(std::shared_ptr buy, std::shared_ptr buyB, std::shared_ptr sell); void writeToStream(DataOutputStream *stream); static MerchantRecipeList *createFromStream(DataInputStream *stream); void load(CompoundTag *tag); diff --git a/Minecraft.World/Containers/MerchantResultSlot.cpp b/Minecraft.World/Containers/MerchantResultSlot.cpp index f3af4e879..9b02fe459 100644 --- a/Minecraft.World/Containers/MerchantResultSlot.cpp +++ b/Minecraft.World/Containers/MerchantResultSlot.cpp @@ -3,7 +3,7 @@ #include "../Headers/net.minecraft.world.item.trading.h" #include "MerchantResultSlot.h" -MerchantResultSlot::MerchantResultSlot(Player *player, shared_ptr merchant, shared_ptr slots, int id, int x, int y) : Slot(slots, id, x, y) +MerchantResultSlot::MerchantResultSlot(Player *player, std::shared_ptr merchant, std::shared_ptr slots, int id, int x, int y) : Slot(slots, id, x, y) { this->player = player; this->merchant = merchant; @@ -11,12 +11,12 @@ MerchantResultSlot::MerchantResultSlot(Player *player, shared_ptr merc removeCount = 0; } -bool MerchantResultSlot::mayPlace(shared_ptr item) +bool MerchantResultSlot::mayPlace(std::shared_ptr item) { return false; } -shared_ptr MerchantResultSlot::remove(int c) +std::shared_ptr MerchantResultSlot::remove(int c) { if (hasItem()) { @@ -25,27 +25,27 @@ shared_ptr MerchantResultSlot::remove(int c) return Slot::remove(c); } -void MerchantResultSlot::onQuickCraft(shared_ptr picked, int count) +void MerchantResultSlot::onQuickCraft(std::shared_ptr picked, int count) { removeCount += count; checkTakeAchievements(picked); } -void MerchantResultSlot::checkTakeAchievements(shared_ptr carried) +void MerchantResultSlot::checkTakeAchievements(std::shared_ptr carried) { carried->onCraftedBy(player->level, dynamic_pointer_cast(player->shared_from_this()), removeCount); removeCount = 0; } -void MerchantResultSlot::onTake(shared_ptr player, shared_ptr carried) +void MerchantResultSlot::onTake(std::shared_ptr player, std::shared_ptr carried) { checkTakeAchievements(carried); MerchantRecipe *activeRecipe = slots->getActiveRecipe(); if (activeRecipe != NULL) { - shared_ptr item1 = slots->getItem(MerchantMenu::PAYMENT1_SLOT); - shared_ptr item2 = slots->getItem(MerchantMenu::PAYMENT2_SLOT); + std::shared_ptr item1 = slots->getItem(MerchantMenu::PAYMENT1_SLOT); + std::shared_ptr item2 = slots->getItem(MerchantMenu::PAYMENT2_SLOT); // remove payment items, but remember slots may have switched if (removePaymentItemsIfMatching(activeRecipe, item1, item2) || removePaymentItemsIfMatching(activeRecipe, item2, item1)) @@ -66,15 +66,15 @@ void MerchantResultSlot::onTake(shared_ptr player, shared_ptr second) +bool MerchantResultSlot::mayCombine(std::shared_ptr second) { return false; } -bool MerchantResultSlot::removePaymentItemsIfMatching(MerchantRecipe *activeRecipe, shared_ptr a, shared_ptr b) +bool MerchantResultSlot::removePaymentItemsIfMatching(MerchantRecipe *activeRecipe, std::shared_ptr a, std::shared_ptr b) { - shared_ptr buyA = activeRecipe->getBuyAItem(); - shared_ptr buyB = activeRecipe->getBuyBItem(); + std::shared_ptr buyA = activeRecipe->getBuyAItem(); + std::shared_ptr buyB = activeRecipe->getBuyBItem(); if (a != NULL && a->id == buyA->id) { diff --git a/Minecraft.World/Containers/MerchantResultSlot.h b/Minecraft.World/Containers/MerchantResultSlot.h index 7b8d97b6d..1b45082cb 100644 --- a/Minecraft.World/Containers/MerchantResultSlot.h +++ b/Minecraft.World/Containers/MerchantResultSlot.h @@ -9,25 +9,25 @@ class Merchant; class MerchantResultSlot : public Slot { private: - shared_ptr slots; + std::shared_ptr slots; Player *player; int removeCount; - shared_ptr merchant; + std::shared_ptr merchant; public: - MerchantResultSlot(Player *player, shared_ptr merchant, shared_ptr slots, int id, int x, int y); + MerchantResultSlot(Player *player, std::shared_ptr merchant, std::shared_ptr slots, int id, int x, int y); - bool mayPlace(shared_ptr item); - shared_ptr remove(int c); + bool mayPlace(std::shared_ptr item); + std::shared_ptr remove(int c); protected: - void onQuickCraft(shared_ptr picked, int count); - void checkTakeAchievements(shared_ptr carried); + void onQuickCraft(std::shared_ptr picked, int count); + void checkTakeAchievements(std::shared_ptr carried); public: - void onTake(shared_ptr player, shared_ptr carried); - virtual bool mayCombine(shared_ptr item); // 4J Added + void onTake(std::shared_ptr player, std::shared_ptr carried); + virtual bool mayCombine(std::shared_ptr item); // 4J Added private: - bool removePaymentItemsIfMatching(MerchantRecipe *activeRecipe, shared_ptr a, shared_ptr b); + bool removePaymentItemsIfMatching(MerchantRecipe *activeRecipe, std::shared_ptr a, std::shared_ptr b); }; \ No newline at end of file diff --git a/Minecraft.World/Containers/RepairMenu.cpp b/Minecraft.World/Containers/RepairMenu.cpp index 15e1c1985..3ef1b563e 100644 --- a/Minecraft.World/Containers/RepairMenu.cpp +++ b/Minecraft.World/Containers/RepairMenu.cpp @@ -6,10 +6,10 @@ #include "../Headers/net.minecraft.world.item.enchantment.h" #include "RepairMenu.h" -RepairMenu::RepairMenu(shared_ptr inventory, Level *level, int xt, int yt, int zt, shared_ptr player) +RepairMenu::RepairMenu(std::shared_ptr inventory, Level *level, int xt, int yt, int zt, std::shared_ptr player) { - resultSlots = shared_ptr( new ResultContainer() ); - repairSlots = shared_ptr( new RepairContainer(this,IDS_REPAIR_AND_NAME, 2) ); + resultSlots = std::shared_ptr( new ResultContainer() ); + repairSlots = std::shared_ptr( new RepairContainer(this,IDS_REPAIR_AND_NAME, 2) ); cost = 0; repairItemCountCost = 0; @@ -38,7 +38,7 @@ RepairMenu::RepairMenu(shared_ptr inventory, Level *level, int xt, in } } -void RepairMenu::slotsChanged(shared_ptr container) +void RepairMenu::slotsChanged(std::shared_ptr container) { AbstractContainerMenu::slotsChanged(); @@ -47,7 +47,7 @@ void RepairMenu::slotsChanged(shared_ptr container) void RepairMenu::createResult() { - shared_ptr input = repairSlots->getItem(INPUT_SLOT); + std::shared_ptr input = repairSlots->getItem(INPUT_SLOT); cost = 0; int price = 0; int tax = 0; @@ -63,8 +63,8 @@ void RepairMenu::createResult() } else { - shared_ptr result = input->copy(); - shared_ptr addition = repairSlots->getItem(ADDITIONAL_SLOT); + std::shared_ptr result = input->copy(); + std::shared_ptr addition = repairSlots->getItem(ADDITIONAL_SLOT); unordered_map *enchantments = EnchantmentHelper::getEnchantments(result); bool usingBook = false; @@ -319,14 +319,14 @@ void RepairMenu::setData(int id, int value) if (id == DATA_TOTAL_COST) cost = value; } -void RepairMenu::removed(shared_ptr player) +void RepairMenu::removed(std::shared_ptr player) { AbstractContainerMenu::removed(player); if (level->isClientSide) return; for (int i = 0; i < repairSlots->getContainerSize(); i++) { - shared_ptr item = repairSlots->removeItemNoUpdate(i); + std::shared_ptr item = repairSlots->removeItemNoUpdate(i); if (item != NULL) { player->drop(item); @@ -334,20 +334,20 @@ void RepairMenu::removed(shared_ptr player) } } -bool RepairMenu::stillValid(shared_ptr player) +bool RepairMenu::stillValid(std::shared_ptr player) { if (level->getTile(x, y, z) != Tile::anvil_Id) return false; if (player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 8 * 8) return false; return true; } -shared_ptr RepairMenu::quickMoveStack(shared_ptr player, int slotIndex) +std::shared_ptr RepairMenu::quickMoveStack(std::shared_ptr player, int slotIndex) { - shared_ptr clicked = nullptr; + std::shared_ptr clicked = nullptr; Slot *slot = slots->at(slotIndex); if (slot != NULL && slot->hasItem()) { - shared_ptr stack = slot->getItem(); + std::shared_ptr stack = slot->getItem(); clicked = stack->copy(); if (slotIndex == RESULT_SLOT) diff --git a/Minecraft.World/Containers/RepairMenu.h b/Minecraft.World/Containers/RepairMenu.h index e0c90267f..acd7dc37c 100644 --- a/Minecraft.World/Containers/RepairMenu.h +++ b/Minecraft.World/Containers/RepairMenu.h @@ -22,10 +22,10 @@ public: static const int DATA_TOTAL_COST = 0; private: - shared_ptr resultSlots; + std::shared_ptr resultSlots; // 4J Stu - anonymous class here now RepairContainer - shared_ptr repairSlots; + std::shared_ptr repairSlots; Level *level; int x, y, z; @@ -36,20 +36,20 @@ public: private: int repairItemCountCost; wstring itemName; - shared_ptr player; + std::shared_ptr player; public: using AbstractContainerMenu::slotsChanged; - RepairMenu(shared_ptr inventory, Level *level, int xt, int yt, int zt, shared_ptr player); + RepairMenu(std::shared_ptr inventory, Level *level, int xt, int yt, int zt, std::shared_ptr player); - void slotsChanged(shared_ptr container); + void slotsChanged(std::shared_ptr container); void createResult(); void sendData(int id, int value); void addSlotListener(ContainerListener *listener); void setData(int id, int value); - void removed(shared_ptr player); - bool stillValid(shared_ptr player); - shared_ptr quickMoveStack(shared_ptr player, int slotIndex); + void removed(std::shared_ptr player); + bool stillValid(std::shared_ptr player); + std::shared_ptr quickMoveStack(std::shared_ptr player, int slotIndex); void setItemName(const wstring &name); }; diff --git a/Minecraft.World/Containers/RepairResultSlot.cpp b/Minecraft.World/Containers/RepairResultSlot.cpp index 32eadba3a..214d15287 100644 --- a/Minecraft.World/Containers/RepairResultSlot.cpp +++ b/Minecraft.World/Containers/RepairResultSlot.cpp @@ -5,7 +5,7 @@ #include "../Headers/net.minecraft.world.entity.player.h" #include "RepairResultSlot.h" -RepairResultSlot::RepairResultSlot(RepairMenu *menu, int xt, int yt, int zt, shared_ptr container, int slot, int x, int y) : Slot(container, slot, x, y) +RepairResultSlot::RepairResultSlot(RepairMenu *menu, int xt, int yt, int zt, std::shared_ptr container, int slot, int x, int y) : Slot(container, slot, x, y) { m_menu = menu; this->xt = xt; @@ -13,23 +13,23 @@ RepairResultSlot::RepairResultSlot(RepairMenu *menu, int xt, int yt, int zt, sha this->zt = zt; } -bool RepairResultSlot::mayPlace(shared_ptr item) +bool RepairResultSlot::mayPlace(std::shared_ptr item) { return false; } -bool RepairResultSlot::mayPickup(shared_ptr player) +bool RepairResultSlot::mayPickup(std::shared_ptr player) { return (player->abilities.instabuild || player->experienceLevel >= m_menu->cost) && (m_menu->cost > 0 && hasItem()); } -void RepairResultSlot::onTake(shared_ptr player, shared_ptr carried) +void RepairResultSlot::onTake(std::shared_ptr player, std::shared_ptr carried) { if (!player->abilities.instabuild) player->withdrawExperienceLevels(m_menu->cost); m_menu->repairSlots->setItem(RepairMenu::INPUT_SLOT, nullptr); if (m_menu->repairItemCountCost > 0) { - shared_ptr addition = m_menu->repairSlots->getItem(RepairMenu::ADDITIONAL_SLOT); + std::shared_ptr addition = m_menu->repairSlots->getItem(RepairMenu::ADDITIONAL_SLOT); if (addition != NULL && addition->count > m_menu->repairItemCountCost) { addition->count -= m_menu->repairItemCountCost; @@ -69,7 +69,7 @@ void RepairResultSlot::onTake(shared_ptr player, shared_ptr second) +bool RepairResultSlot::mayCombine(std::shared_ptr second) { return false; } \ No newline at end of file diff --git a/Minecraft.World/Containers/RepairResultSlot.h b/Minecraft.World/Containers/RepairResultSlot.h index 1895ca30d..92af20feb 100644 --- a/Minecraft.World/Containers/RepairResultSlot.h +++ b/Minecraft.World/Containers/RepairResultSlot.h @@ -11,10 +11,10 @@ private: int xt, yt, zt; public: - RepairResultSlot(RepairMenu *menu, int xt, int yt, int zt, shared_ptr container, int slot, int x, int y); + RepairResultSlot(RepairMenu *menu, int xt, int yt, int zt, std::shared_ptr container, int slot, int x, int y); - bool mayPlace(shared_ptr item); - bool mayPickup(shared_ptr player); - void onTake(shared_ptr player, shared_ptr carried); - virtual bool mayCombine(shared_ptr item); // 4J Added + bool mayPlace(std::shared_ptr item); + bool mayPickup(std::shared_ptr player); + void onTake(std::shared_ptr player, std::shared_ptr carried); + virtual bool mayCombine(std::shared_ptr item); // 4J Added }; \ No newline at end of file diff --git a/Minecraft.World/Containers/ResultContainer.cpp b/Minecraft.World/Containers/ResultContainer.cpp index b07283d07..6da4006b2 100644 --- a/Minecraft.World/Containers/ResultContainer.cpp +++ b/Minecraft.World/Containers/ResultContainer.cpp @@ -12,7 +12,7 @@ unsigned int ResultContainer::getContainerSize() return 1; } -shared_ptr ResultContainer::getItem(unsigned int slot) +std::shared_ptr ResultContainer::getItem(unsigned int slot) { return (*items)[0]; } @@ -22,29 +22,29 @@ int ResultContainer::getName() return 0; } -shared_ptr ResultContainer::removeItem(unsigned int slot, int count) +std::shared_ptr ResultContainer::removeItem(unsigned int slot, int count) { if ((*items)[0] != NULL) { - shared_ptr item = (*items)[0]; + std::shared_ptr item = (*items)[0]; (*items)[0] = nullptr; return item; } return nullptr; } -shared_ptr ResultContainer::removeItemNoUpdate(int slot) +std::shared_ptr ResultContainer::removeItemNoUpdate(int slot) { if ((*items)[0] != NULL) { - shared_ptr item = (*items)[0]; + std::shared_ptr item = (*items)[0]; (*items)[0] = nullptr; return item; } return nullptr; } -void ResultContainer::setItem(unsigned int slot, shared_ptr item) +void ResultContainer::setItem(unsigned int slot, std::shared_ptr item) { (*items)[0] = item; } @@ -58,7 +58,7 @@ void ResultContainer::setChanged() { } -bool ResultContainer::stillValid(shared_ptr player) +bool ResultContainer::stillValid(std::shared_ptr player) { return true; } \ No newline at end of file diff --git a/Minecraft.World/Containers/ResultContainer.h b/Minecraft.World/Containers/ResultContainer.h index 62df65d8e..1b030d810 100644 --- a/Minecraft.World/Containers/ResultContainer.h +++ b/Minecraft.World/Containers/ResultContainer.h @@ -12,14 +12,14 @@ public: ResultContainer(); virtual unsigned int getContainerSize(); - virtual shared_ptr getItem(unsigned int slot); + virtual std::shared_ptr getItem(unsigned int slot); virtual int getName(); - virtual shared_ptr removeItem(unsigned int slot, int count); - virtual shared_ptr removeItemNoUpdate(int slot); - virtual void setItem(unsigned int slot, shared_ptr item); + virtual std::shared_ptr removeItem(unsigned int slot, int count); + virtual std::shared_ptr removeItemNoUpdate(int slot); + virtual void setItem(unsigned int slot, std::shared_ptr item); virtual int getMaxStackSize(); virtual void setChanged(); - virtual bool stillValid(shared_ptr player); + virtual bool stillValid(std::shared_ptr player); void startOpen() { } // TODO Auto-generated method stub void stopOpen() { } // TODO Auto-generated method stub diff --git a/Minecraft.World/Containers/ResultSlot.cpp b/Minecraft.World/Containers/ResultSlot.cpp index 14e6b39dc..a3d5e3104 100644 --- a/Minecraft.World/Containers/ResultSlot.cpp +++ b/Minecraft.World/Containers/ResultSlot.cpp @@ -6,19 +6,19 @@ #include "../Headers/net.minecraft.world.level.tile.h" #include "ResultSlot.h" -ResultSlot::ResultSlot(Player *player, shared_ptr craftSlots, shared_ptr container, int id, int x, int y) : Slot( container, id, x, y ) +ResultSlot::ResultSlot(Player *player, std::shared_ptr craftSlots, std::shared_ptr container, int id, int x, int y) : Slot( container, id, x, y ) { this->player = player; this->craftSlots = craftSlots; removeCount = 0; } -bool ResultSlot::mayPlace(shared_ptr item) +bool ResultSlot::mayPlace(std::shared_ptr item) { return false; } -shared_ptr ResultSlot::remove(int c) +std::shared_ptr ResultSlot::remove(int c) { if (hasItem()) { @@ -27,13 +27,13 @@ shared_ptr ResultSlot::remove(int c) return Slot::remove(c); } -void ResultSlot::onQuickCraft(shared_ptr picked, int count) +void ResultSlot::onQuickCraft(std::shared_ptr picked, int count) { removeCount += count; checkTakeAchievements(picked); } -void ResultSlot::checkTakeAchievements(shared_ptr carried) +void ResultSlot::checkTakeAchievements(std::shared_ptr carried) { carried->onCraftedBy(player->level, dynamic_pointer_cast( player->shared_from_this() ), removeCount); removeCount = 0; @@ -53,13 +53,13 @@ void ResultSlot::checkTakeAchievements(shared_ptr carried) else if (carried->id == Tile::dispenser_Id) player->awardStat(GenericStats::dispenseWithThis(), GenericStats::param_dispenseWithThis()); } -void ResultSlot::onTake(shared_ptr player, shared_ptr carried) +void ResultSlot::onTake(std::shared_ptr player, std::shared_ptr carried) { checkTakeAchievements(carried); for (unsigned int i = 0; i < craftSlots->getContainerSize(); i++) { - shared_ptr item = craftSlots->getItem(i); + std::shared_ptr item = craftSlots->getItem(i); if (item != NULL) { craftSlots->removeItem(i, 1); @@ -68,7 +68,7 @@ void ResultSlot::onTake(shared_ptr player, shared_ptr carr { // (TheApathetic) - shared_ptr craftResult = shared_ptr(new ItemInstance(item->getItem()->getCraftingRemainingItem())); + std::shared_ptr craftResult = std::shared_ptr(new ItemInstance(item->getItem()->getCraftingRemainingItem())); /* * Try to place this in the player's inventory (See we.java @@ -96,7 +96,7 @@ void ResultSlot::onTake(shared_ptr player, shared_ptr carr } } -bool ResultSlot::mayCombine(shared_ptr second) +bool ResultSlot::mayCombine(std::shared_ptr second) { return false; } diff --git a/Minecraft.World/Containers/ResultSlot.h b/Minecraft.World/Containers/ResultSlot.h index 28e464f03..b8308f663 100644 --- a/Minecraft.World/Containers/ResultSlot.h +++ b/Minecraft.World/Containers/ResultSlot.h @@ -5,22 +5,22 @@ class ResultSlot : public Slot { private: - shared_ptr craftSlots; - Player *player; // This can't be a shared_ptr, as we create a result slot in the inventorymenu in the Player ctor + std::shared_ptr craftSlots; + Player *player; // This can't be a std::shared_ptr, as we create a result slot in the inventorymenu in the Player ctor int removeCount; public: - ResultSlot(Player *player, shared_ptr craftSlots, shared_ptr container, int id, int x, int y); + ResultSlot(Player *player, std::shared_ptr craftSlots, std::shared_ptr container, int id, int x, int y); virtual ~ResultSlot() {} - virtual bool mayPlace(shared_ptr item); - virtual shared_ptr remove(int c); + virtual bool mayPlace(std::shared_ptr item); + virtual std::shared_ptr remove(int c); protected: - virtual void onQuickCraft(shared_ptr picked, int count); - virtual void checkTakeAchievements(shared_ptr carried); + virtual void onQuickCraft(std::shared_ptr picked, int count); + virtual void checkTakeAchievements(std::shared_ptr carried); public: - virtual void onTake(shared_ptr player, shared_ptr carried); - virtual bool mayCombine(shared_ptr item); // 4J Added + virtual void onTake(std::shared_ptr player, std::shared_ptr carried); + virtual bool mayCombine(std::shared_ptr item); // 4J Added }; \ No newline at end of file diff --git a/Minecraft.World/Containers/SimpleContainer.cpp b/Minecraft.World/Containers/SimpleContainer.cpp index 4e7331528..cf4c08b1c 100644 --- a/Minecraft.World/Containers/SimpleContainer.cpp +++ b/Minecraft.World/Containers/SimpleContainer.cpp @@ -34,24 +34,24 @@ void SimpleContainer::removeListener(net_minecraft_world::ContainerListener *lis listeners->erase( it ); } -shared_ptr SimpleContainer::getItem(unsigned int slot) +std::shared_ptr SimpleContainer::getItem(unsigned int slot) { return (*items)[slot]; } -shared_ptr SimpleContainer::removeItem(unsigned int slot, int count) +std::shared_ptr SimpleContainer::removeItem(unsigned int slot, int count) { if ((*items)[slot] != NULL) { if ((*items)[slot]->count <= count) { - shared_ptr item = (*items)[slot]; + std::shared_ptr item = (*items)[slot]; (*items)[slot] = nullptr; this->setChanged(); return item; } else { - shared_ptr i = (*items)[slot]->remove(count); + std::shared_ptr i = (*items)[slot]->remove(count); if ((*items)[slot]->count == 0) (*items)[slot] = nullptr; this->setChanged(); return i; @@ -60,18 +60,18 @@ shared_ptr SimpleContainer::removeItem(unsigned int slot, int coun return nullptr; } -shared_ptr SimpleContainer::removeItemNoUpdate(int slot) +std::shared_ptr SimpleContainer::removeItemNoUpdate(int slot) { if ((*items)[slot] != NULL) { - shared_ptr item = (*items)[slot]; + std::shared_ptr item = (*items)[slot]; (*items)[slot] = nullptr; return item; } return nullptr; } -void SimpleContainer::setItem(unsigned int slot, shared_ptr item) +void SimpleContainer::setItem(unsigned int slot, std::shared_ptr item) { (*items)[slot] = item; if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); @@ -104,7 +104,7 @@ void SimpleContainer::setChanged() #endif } -bool SimpleContainer::stillValid(shared_ptr player) +bool SimpleContainer::stillValid(std::shared_ptr player) { return true; } \ No newline at end of file diff --git a/Minecraft.World/Containers/SimpleContainer.h b/Minecraft.World/Containers/SimpleContainer.h index 9cc354337..8d2e4bf4f 100644 --- a/Minecraft.World/Containers/SimpleContainer.h +++ b/Minecraft.World/Containers/SimpleContainer.h @@ -19,12 +19,12 @@ public: void removeListener(net_minecraft_world::ContainerListener *listener); - shared_ptr getItem(unsigned int slot); + std::shared_ptr getItem(unsigned int slot); - shared_ptr removeItem(unsigned int slot, int count); - shared_ptr removeItemNoUpdate(int slot); + std::shared_ptr removeItem(unsigned int slot, int count); + std::shared_ptr removeItemNoUpdate(int slot); - void setItem(unsigned int slot, shared_ptr item); + void setItem(unsigned int slot, std::shared_ptr item); unsigned int getContainerSize(); @@ -34,7 +34,7 @@ public: void setChanged(); - bool stillValid(shared_ptr player); + bool stillValid(std::shared_ptr player); void startOpen() { } // TODO Auto-generated method stub void stopOpen() { } // TODO Auto-generated method stub diff --git a/Minecraft.World/Containers/Slot.cpp b/Minecraft.World/Containers/Slot.cpp index ce15666c7..5a7346a11 100644 --- a/Minecraft.World/Containers/Slot.cpp +++ b/Minecraft.World/Containers/Slot.cpp @@ -5,7 +5,7 @@ #include "../Headers/net.minecraft.world.item.crafting.h" #include "Slot.h" -Slot::Slot(shared_ptr container, int slot, int x, int y) : container( container ), slot( slot ) +Slot::Slot(std::shared_ptr container, int slot, int x, int y) : container( container ), slot( slot ) { this->x = x; this->y = y; @@ -13,7 +13,7 @@ Slot::Slot(shared_ptr container, int slot, int x, int y) : container( this->index = 0; } -void Slot::onQuickCraft(shared_ptr picked, shared_ptr original) +void Slot::onQuickCraft(std::shared_ptr picked, std::shared_ptr original) { if (picked == NULL || original == NULL) { @@ -31,18 +31,18 @@ void Slot::onQuickCraft(shared_ptr picked, shared_ptr picked, int count) +void Slot::onQuickCraft(std::shared_ptr picked, int count) { } -void Slot::checkTakeAchievements(shared_ptr picked) +void Slot::checkTakeAchievements(std::shared_ptr picked) { } void Slot::swap(Slot *other) { - shared_ptr item1 = container->getItem(slot); - shared_ptr item2 = other->container->getItem(other->slot); + std::shared_ptr item1 = container->getItem(slot); + std::shared_ptr item2 = other->container->getItem(other->slot); if (item1 != NULL && item1->count > other->getMaxStackSize()) { @@ -60,17 +60,17 @@ void Slot::swap(Slot *other) setChanged(); } -void Slot::onTake(shared_ptr player, shared_ptr carried) +void Slot::onTake(std::shared_ptr player, std::shared_ptr carried) { setChanged(); } -bool Slot::mayPlace(shared_ptr item) +bool Slot::mayPlace(std::shared_ptr item) { return true; } -shared_ptr Slot::getItem() +std::shared_ptr Slot::getItem() { return container->getItem(slot); } @@ -80,7 +80,7 @@ bool Slot::hasItem() return getItem() != NULL; } -void Slot::set(shared_ptr item) +void Slot::set(std::shared_ptr item) { container->setItem(slot, item); setChanged(); @@ -101,24 +101,24 @@ Icon *Slot::getNoItemIcon() return NULL; } -shared_ptr Slot::remove(int c) +std::shared_ptr Slot::remove(int c) { return container->removeItem(slot, c); } -bool Slot::isAt(shared_ptr c, int s) +bool Slot::isAt(std::shared_ptr c, int s) { return c == container && s == slot; } -bool Slot::mayPickup(shared_ptr player) +bool Slot::mayPickup(std::shared_ptr player) { return true; } -bool Slot::mayCombine(shared_ptr second) +bool Slot::mayCombine(std::shared_ptr second) { - shared_ptr first = getItem(); + std::shared_ptr first = getItem(); if(first == NULL || second == NULL) return false; @@ -138,12 +138,12 @@ bool Slot::mayCombine(shared_ptr second) return false; } -shared_ptr Slot::combine(shared_ptr item) +std::shared_ptr Slot::combine(std::shared_ptr item) { - shared_ptr result = nullptr; - shared_ptr first = getItem(); + std::shared_ptr result = nullptr; + std::shared_ptr first = getItem(); - shared_ptr craftSlots = shared_ptr( new CraftingContainer(NULL, 2, 2) ); + std::shared_ptr craftSlots = std::shared_ptr( new CraftingContainer(NULL, 2, 2) ); craftSlots->setItem(0, item); craftSlots->setItem(1, first); diff --git a/Minecraft.World/Containers/Slot.h b/Minecraft.World/Containers/Slot.h index 6289ec0e2..13827b5ad 100644 --- a/Minecraft.World/Containers/Slot.h +++ b/Minecraft.World/Containers/Slot.h @@ -8,34 +8,34 @@ private: int slot; public: - shared_ptr container; + std::shared_ptr container; public: int index; int x, y; - Slot(shared_ptr container, int slot, int x, int y); + Slot(std::shared_ptr container, int slot, int x, int y); virtual ~Slot() {} - void onQuickCraft(shared_ptr picked, shared_ptr original); + void onQuickCraft(std::shared_ptr picked, std::shared_ptr original); protected: - virtual void onQuickCraft(shared_ptr picked, int count); - virtual void checkTakeAchievements(shared_ptr picked); + virtual void onQuickCraft(std::shared_ptr picked, int count); + virtual void checkTakeAchievements(std::shared_ptr picked); public: void swap(Slot *other); - virtual void onTake(shared_ptr player, shared_ptr carried); - virtual bool mayPlace(shared_ptr item); - virtual shared_ptr getItem(); + virtual void onTake(std::shared_ptr player, std::shared_ptr carried); + virtual bool mayPlace(std::shared_ptr item); + virtual std::shared_ptr getItem(); virtual bool hasItem(); - virtual void set(shared_ptr item); + virtual void set(std::shared_ptr item); virtual void setChanged(); virtual int getMaxStackSize(); virtual Icon *getNoItemIcon(); - virtual shared_ptr remove(int c); - virtual bool isAt(shared_ptr c, int s); - virtual bool mayPickup(shared_ptr player); - virtual bool mayCombine(shared_ptr item); // 4J Added - virtual shared_ptr combine(shared_ptr item); // 4J Added + virtual std::shared_ptr remove(int c); + virtual bool isAt(std::shared_ptr c, int s); + virtual bool mayPickup(std::shared_ptr player); + virtual bool mayCombine(std::shared_ptr item); // 4J Added + virtual std::shared_ptr combine(std::shared_ptr item); // 4J Added }; \ No newline at end of file diff --git a/Minecraft.World/Containers/TrapMenu.cpp b/Minecraft.World/Containers/TrapMenu.cpp index 5a0b6769e..85c622c4f 100644 --- a/Minecraft.World/Containers/TrapMenu.cpp +++ b/Minecraft.World/Containers/TrapMenu.cpp @@ -5,7 +5,7 @@ #include "Slot.h" #include "TrapMenu.h" -TrapMenu::TrapMenu(shared_ptr inventory, shared_ptr trap) +TrapMenu::TrapMenu(std::shared_ptr inventory, std::shared_ptr trap) { this->trap = trap; @@ -30,19 +30,19 @@ TrapMenu::TrapMenu(shared_ptr inventory, shared_ptr player) +bool TrapMenu::stillValid(std::shared_ptr player) { return trap->stillValid(player); } // 4J Stu - Brought forward from 1.2 -shared_ptr TrapMenu::quickMoveStack(shared_ptr player, int slotIndex) +std::shared_ptr TrapMenu::quickMoveStack(std::shared_ptr player, int slotIndex) { - shared_ptr clicked = nullptr; + std::shared_ptr clicked = nullptr; Slot *slot = slots->at(slotIndex); if (slot != NULL && slot->hasItem()) { - shared_ptr stack = slot->getItem(); + std::shared_ptr stack = slot->getItem(); clicked = stack->copy(); if (slotIndex < INV_SLOT_START) diff --git a/Minecraft.World/Containers/TrapMenu.h b/Minecraft.World/Containers/TrapMenu.h index e3fb4965b..6e5cc5170 100644 --- a/Minecraft.World/Containers/TrapMenu.h +++ b/Minecraft.World/Containers/TrapMenu.h @@ -12,11 +12,11 @@ private: static const int USE_ROW_SLOT_START = INV_SLOT_END; static const int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9; private: - shared_ptr trap; + std::shared_ptr trap; public: - TrapMenu(shared_ptr inventory, shared_ptr trap); + TrapMenu(std::shared_ptr inventory, std::shared_ptr trap); - virtual bool stillValid(shared_ptr player); - virtual shared_ptr quickMoveStack(shared_ptr player, int slotIndex); + virtual bool stillValid(std::shared_ptr player); + virtual std::shared_ptr quickMoveStack(std::shared_ptr player, int slotIndex); }; \ No newline at end of file diff --git a/Minecraft.World/Enchantments/DamageEnchantment.cpp b/Minecraft.World/Enchantments/DamageEnchantment.cpp index 192965564..b0b07a009 100644 --- a/Minecraft.World/Enchantments/DamageEnchantment.cpp +++ b/Minecraft.World/Enchantments/DamageEnchantment.cpp @@ -27,7 +27,7 @@ int DamageEnchantment::getMaxLevel() return 5; } -int DamageEnchantment::getDamageBonus(int level, shared_ptr target) +int DamageEnchantment::getDamageBonus(int level, std::shared_ptr target) { if (type == ALL) { @@ -54,7 +54,7 @@ bool DamageEnchantment::isCompatibleWith(Enchantment *other) const return dynamic_cast(other) == NULL; } -bool DamageEnchantment::canEnchant(shared_ptr item) +bool DamageEnchantment::canEnchant(std::shared_ptr item) { HatchetItem *hatchet = dynamic_cast(item->getItem()); if (hatchet) return true; diff --git a/Minecraft.World/Enchantments/DamageEnchantment.h b/Minecraft.World/Enchantments/DamageEnchantment.h index 00f9b0479..7d7a3fd93 100644 --- a/Minecraft.World/Enchantments/DamageEnchantment.h +++ b/Minecraft.World/Enchantments/DamageEnchantment.h @@ -23,8 +23,8 @@ public: virtual int getMinCost(int level); virtual int getMaxCost(int level); virtual int getMaxLevel(); - virtual int getDamageBonus(int level, shared_ptr target); + virtual int getDamageBonus(int level, std::shared_ptr target); virtual int getDescriptionId(); virtual bool isCompatibleWith(Enchantment *other) const; - virtual bool canEnchant(shared_ptr item); + virtual bool canEnchant(std::shared_ptr item); }; \ No newline at end of file diff --git a/Minecraft.World/Enchantments/DigDurabilityEnchantment.cpp b/Minecraft.World/Enchantments/DigDurabilityEnchantment.cpp index 3ea5c186a..3a54c2146 100644 --- a/Minecraft.World/Enchantments/DigDurabilityEnchantment.cpp +++ b/Minecraft.World/Enchantments/DigDurabilityEnchantment.cpp @@ -22,13 +22,13 @@ int DigDurabilityEnchantment::getMaxLevel() return 3; } -bool DigDurabilityEnchantment::canEnchant(shared_ptr item) +bool DigDurabilityEnchantment::canEnchant(std::shared_ptr item) { if (item->isDamageableItem()) return true; return Enchantment::canEnchant(item); } -bool DigDurabilityEnchantment::shouldIgnoreDurabilityDrop(shared_ptr item, int level, Random *random) +bool DigDurabilityEnchantment::shouldIgnoreDurabilityDrop(std::shared_ptr item, int level, Random *random) { ArmorItem *armor = dynamic_cast(item->getItem()); if (armor && random->nextFloat() < 0.6f) return false; diff --git a/Minecraft.World/Enchantments/DigDurabilityEnchantment.h b/Minecraft.World/Enchantments/DigDurabilityEnchantment.h index 88f6447dc..4751f3fe0 100644 --- a/Minecraft.World/Enchantments/DigDurabilityEnchantment.h +++ b/Minecraft.World/Enchantments/DigDurabilityEnchantment.h @@ -10,6 +10,6 @@ public: virtual int getMinCost(int level); virtual int getMaxCost(int level); virtual int getMaxLevel(); - virtual bool canEnchant(shared_ptr item); - static bool shouldIgnoreDurabilityDrop(shared_ptr item, int level, Random *random); + virtual bool canEnchant(std::shared_ptr item); + static bool shouldIgnoreDurabilityDrop(std::shared_ptr item, int level, Random *random); }; \ No newline at end of file diff --git a/Minecraft.World/Enchantments/DiggingEnchantment.cpp b/Minecraft.World/Enchantments/DiggingEnchantment.cpp index 38e0a9703..e5dfb1f64 100644 --- a/Minecraft.World/Enchantments/DiggingEnchantment.cpp +++ b/Minecraft.World/Enchantments/DiggingEnchantment.cpp @@ -22,7 +22,7 @@ int DiggingEnchantment::getMaxLevel() return 5; } -bool DiggingEnchantment::canEnchant(shared_ptr item) +bool DiggingEnchantment::canEnchant(std::shared_ptr item) { if (item->getItem()->id == Item::shears_Id) return true; return Enchantment::canEnchant(item); diff --git a/Minecraft.World/Enchantments/DiggingEnchantment.h b/Minecraft.World/Enchantments/DiggingEnchantment.h index 324f5cdde..48b0fb0b5 100644 --- a/Minecraft.World/Enchantments/DiggingEnchantment.h +++ b/Minecraft.World/Enchantments/DiggingEnchantment.h @@ -10,5 +10,5 @@ public: virtual int getMinCost(int level); virtual int getMaxCost(int level); virtual int getMaxLevel(); - virtual bool canEnchant(shared_ptr item); + virtual bool canEnchant(std::shared_ptr item); }; \ No newline at end of file diff --git a/Minecraft.World/Enchantments/Enchantment.cpp b/Minecraft.World/Enchantments/Enchantment.cpp index c2682317a..4c8c0383d 100644 --- a/Minecraft.World/Enchantments/Enchantment.cpp +++ b/Minecraft.World/Enchantments/Enchantment.cpp @@ -129,7 +129,7 @@ int Enchantment::getDamageProtection(int level, DamageSource *source) return 0; } -int Enchantment::getDamageBonus(int level, shared_ptr target) +int Enchantment::getDamageBonus(int level, std::shared_ptr target) { return 0; } @@ -159,7 +159,7 @@ wstring Enchantment::getFullname(int level,wstring &unformatted) return formatted; } -bool Enchantment::canEnchant(shared_ptr item) +bool Enchantment::canEnchant(std::shared_ptr item) { return category->canEnchant(item->getItem()); } diff --git a/Minecraft.World/Enchantments/Enchantment.h b/Minecraft.World/Enchantments/Enchantment.h index 794edf853..08c1ab0a2 100644 --- a/Minecraft.World/Enchantments/Enchantment.h +++ b/Minecraft.World/Enchantments/Enchantment.h @@ -74,12 +74,12 @@ public: virtual int getMinCost(int level); virtual int getMaxCost(int level); virtual int getDamageProtection(int level, DamageSource *source); - virtual int getDamageBonus(int level, shared_ptr target); + virtual int getDamageBonus(int level, std::shared_ptr target); virtual bool isCompatibleWith(Enchantment *other) const; virtual Enchantment *setDescriptionId(int id); virtual int getDescriptionId(); virtual wstring getFullname(int level,wstring &unformatted); // 4J Stu added unformatted - virtual bool canEnchant(shared_ptr item); + virtual bool canEnchant(std::shared_ptr item); private: // 4J Added diff --git a/Minecraft.World/Enchantments/EnchantmentHelper.cpp b/Minecraft.World/Enchantments/EnchantmentHelper.cpp index 1b047fe00..f37cba337 100644 --- a/Minecraft.World/Enchantments/EnchantmentHelper.cpp +++ b/Minecraft.World/Enchantments/EnchantmentHelper.cpp @@ -9,7 +9,7 @@ Random EnchantmentHelper::random; -int EnchantmentHelper::getEnchantmentLevel(int enchantmentId, shared_ptr piece) +int EnchantmentHelper::getEnchantmentLevel(int enchantmentId, std::shared_ptr piece) { if (piece == NULL) { @@ -33,7 +33,7 @@ int EnchantmentHelper::getEnchantmentLevel(int enchantmentId, shared_ptr *EnchantmentHelper::getEnchantments(shared_ptr item) +unordered_map *EnchantmentHelper::getEnchantments(std::shared_ptr item) { unordered_map *result = new unordered_map(); ListTag *list = item->id == Item::enchantedBook_Id ? Item::enchantedBook->getEnchantments(item) : item->getEnchantmentTags(); @@ -52,7 +52,7 @@ unordered_map *EnchantmentHelper::getEnchantments(shared_ptr *enchantments, shared_ptr item) +void EnchantmentHelper::setEnchantments(unordered_map *enchantments, std::shared_ptr item) { ListTag *list = new ListTag(); @@ -101,7 +101,7 @@ int EnchantmentHelper::getEnchantmentLevel(int enchantmentId, ItemInstanceArray return bestLevel; } -void EnchantmentHelper::runIterationOnItem(EnchantmentIterationMethod &method, shared_ptr piece) +void EnchantmentHelper::runIterationOnItem(EnchantmentIterationMethod &method, std::shared_ptr piece) { if (piece == NULL) { @@ -147,7 +147,7 @@ EnchantmentHelper::GetDamageProtectionIteration EnchantmentHelper::getDamageProt * @param source * @return */ -int EnchantmentHelper::getDamageProtection(shared_ptr inventory, DamageSource *source) +int EnchantmentHelper::getDamageProtection(std::shared_ptr inventory, DamageSource *source) { getDamageProtectionIteration.sum = 0; getDamageProtectionIteration.source = source; @@ -177,7 +177,7 @@ EnchantmentHelper::GetDamageBonusIteration EnchantmentHelper::getDamageBonusIter * @param target * @return */ -int EnchantmentHelper::getDamageBonus(shared_ptr inventory, shared_ptr target) +int EnchantmentHelper::getDamageBonus(std::shared_ptr inventory, std::shared_ptr target) { getDamageBonusIteration.sum = 0; @@ -192,62 +192,62 @@ int EnchantmentHelper::getDamageBonus(shared_ptr inventory, shared_pt return 0; } -int EnchantmentHelper::getKnockbackBonus(shared_ptr inventory, shared_ptr target) +int EnchantmentHelper::getKnockbackBonus(std::shared_ptr inventory, std::shared_ptr target) { return getEnchantmentLevel(Enchantment::knockback->id, inventory->getSelected()); } -int EnchantmentHelper::getFireAspect(shared_ptr source) +int EnchantmentHelper::getFireAspect(std::shared_ptr source) { return getEnchantmentLevel(Enchantment::fireAspect->id, source->getCarriedItem()); } -int EnchantmentHelper::getOxygenBonus(shared_ptr inventory) +int EnchantmentHelper::getOxygenBonus(std::shared_ptr inventory) { return getEnchantmentLevel(Enchantment::drownProtection->id, inventory->armor); } -int EnchantmentHelper::getDiggingBonus(shared_ptr inventory) +int EnchantmentHelper::getDiggingBonus(std::shared_ptr inventory) { return getEnchantmentLevel(Enchantment::diggingBonus->id, inventory->getSelected()); } -int EnchantmentHelper::getDigDurability(shared_ptr inventory) +int EnchantmentHelper::getDigDurability(std::shared_ptr inventory) { return getEnchantmentLevel(Enchantment::digDurability->id, inventory->getSelected()); } -bool EnchantmentHelper::hasSilkTouch(shared_ptr inventory) +bool EnchantmentHelper::hasSilkTouch(std::shared_ptr inventory) { return getEnchantmentLevel(Enchantment::untouching->id, inventory->getSelected()) > 0; } -int EnchantmentHelper::getDiggingLootBonus(shared_ptr inventory) +int EnchantmentHelper::getDiggingLootBonus(std::shared_ptr inventory) { return getEnchantmentLevel(Enchantment::resourceBonus->id, inventory->getSelected()); } -int EnchantmentHelper::getKillingLootBonus(shared_ptr inventory) +int EnchantmentHelper::getKillingLootBonus(std::shared_ptr inventory) { return getEnchantmentLevel(Enchantment::lootBonus->id, inventory->getSelected()); } -bool EnchantmentHelper::hasWaterWorkerBonus(shared_ptr inventory) +bool EnchantmentHelper::hasWaterWorkerBonus(std::shared_ptr inventory) { return getEnchantmentLevel(Enchantment::waterWorker->id, inventory->armor) > 0; } -int EnchantmentHelper::getArmorThorns(shared_ptr source) +int EnchantmentHelper::getArmorThorns(std::shared_ptr source) { return getEnchantmentLevel(Enchantment::thorns->id, source->getEquipmentSlots()); } -shared_ptr EnchantmentHelper::getRandomItemWith(Enchantment *enchantment, shared_ptr source) +std::shared_ptr EnchantmentHelper::getRandomItemWith(Enchantment *enchantment, std::shared_ptr source) { ItemInstanceArray items = source->getEquipmentSlots(); for(unsigned int i = 0; i < items.length; ++i) { - shared_ptr item = items[i]; + std::shared_ptr item = items[i]; if (item != NULL && getEnchantmentLevel(enchantment->id, item) > 0) { return item; @@ -268,7 +268,7 @@ shared_ptr EnchantmentHelper::getRandomItemWith(Enchantment *encha * Which item that is being enchanted. * @return The enchantment cost, 0 means unchantable, 50 is max. */ -int EnchantmentHelper::getEnchantmentCost(Random *random, int slot, int bookcases, shared_ptr itemInstance) +int EnchantmentHelper::getEnchantmentCost(Random *random, int slot, int bookcases, std::shared_ptr itemInstance) { Item *item = itemInstance->getItem(); int itemValue = item->getEnchantmentValue(); @@ -297,7 +297,7 @@ int EnchantmentHelper::getEnchantmentCost(Random *random, int slot, int bookcase return selected; } -shared_ptr EnchantmentHelper::enchantItem(Random *random, shared_ptr itemInstance, int enchantmentCost) +std::shared_ptr EnchantmentHelper::enchantItem(Random *random, std::shared_ptr itemInstance, int enchantmentCost) { vector *newEnchantment = EnchantmentHelper::selectEnchantment(random, itemInstance, enchantmentCost); bool isBook = itemInstance->id == Item::book_Id; @@ -331,7 +331,7 @@ shared_ptr EnchantmentHelper::enchantItem(Random *random, shared_p * @param enchantmentCost * @return */ -vector *EnchantmentHelper::selectEnchantment(Random *random, shared_ptr itemInstance, int enchantmentCost) +vector *EnchantmentHelper::selectEnchantment(Random *random, std::shared_ptr itemInstance, int enchantmentCost) { // withdraw bonus from item Item *item = itemInstance->getItem(); @@ -433,7 +433,7 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand return results; } -unordered_map *EnchantmentHelper::getAvailableEnchantmentResults(int value, shared_ptr itemInstance) +unordered_map *EnchantmentHelper::getAvailableEnchantmentResults(int value, std::shared_ptr itemInstance) { Item *item = itemInstance->getItem(); unordered_map *results = NULL; diff --git a/Minecraft.World/Enchantments/EnchantmentHelper.h b/Minecraft.World/Enchantments/EnchantmentHelper.h index 9f7de5c53..382017bcb 100644 --- a/Minecraft.World/Enchantments/EnchantmentHelper.h +++ b/Minecraft.World/Enchantments/EnchantmentHelper.h @@ -12,9 +12,9 @@ private: static Random random; public: - static int getEnchantmentLevel(int enchantmentId, shared_ptr piece); - static unordered_map *getEnchantments(shared_ptr item); - static void setEnchantments(unordered_map *enchantments, shared_ptr item); + static int getEnchantmentLevel(int enchantmentId, std::shared_ptr piece); + static unordered_map *getEnchantments(std::shared_ptr item); + static void setEnchantments(unordered_map *enchantments, std::shared_ptr item); static int getEnchantmentLevel(int enchantmentId, ItemInstanceArray inventory); @@ -27,7 +27,7 @@ private: virtual void doEnchantment(Enchantment *enchantment, int level) = 0; }; - static void runIterationOnItem(EnchantmentIterationMethod &method, shared_ptr piece); + static void runIterationOnItem(EnchantmentIterationMethod &method, std::shared_ptr piece); static void runIterationOnInventory(EnchantmentIterationMethod &method, ItemInstanceArray inventory); class GetDamageProtectionIteration : public EnchantmentIterationMethod @@ -49,14 +49,14 @@ private: * @return */ public: - static int getDamageProtection(shared_ptr inventory, DamageSource *source); + static int getDamageProtection(std::shared_ptr inventory, DamageSource *source); private: class GetDamageBonusIteration : public EnchantmentIterationMethod { public: int sum; - shared_ptr target; + std::shared_ptr target; virtual void doEnchantment(Enchantment *enchantment, int level); }; @@ -70,18 +70,18 @@ private: * @return */ public: - static int getDamageBonus(shared_ptr inventory, shared_ptr target); - static int getKnockbackBonus(shared_ptr inventory, shared_ptr target); - static int getFireAspect(shared_ptr source); - static int getOxygenBonus(shared_ptr inventory); - static int getDiggingBonus(shared_ptr inventory); - static int getDigDurability(shared_ptr inventory); - static bool hasSilkTouch(shared_ptr inventory); - static int getDiggingLootBonus(shared_ptr inventory); - static int getKillingLootBonus(shared_ptr inventory); - static bool hasWaterWorkerBonus(shared_ptr inventory); - static int getArmorThorns(shared_ptr source); - static shared_ptr getRandomItemWith(Enchantment *enchantment, shared_ptr source); + static int getDamageBonus(std::shared_ptr inventory, std::shared_ptr target); + static int getKnockbackBonus(std::shared_ptr inventory, std::shared_ptr target); + static int getFireAspect(std::shared_ptr source); + static int getOxygenBonus(std::shared_ptr inventory); + static int getDiggingBonus(std::shared_ptr inventory); + static int getDigDurability(std::shared_ptr inventory); + static bool hasSilkTouch(std::shared_ptr inventory); + static int getDiggingLootBonus(std::shared_ptr inventory); + static int getKillingLootBonus(std::shared_ptr inventory); + static bool hasWaterWorkerBonus(std::shared_ptr inventory); + static int getArmorThorns(std::shared_ptr source); + static std::shared_ptr getRandomItemWith(Enchantment *enchantment, std::shared_ptr source); /** * @@ -94,9 +94,9 @@ public: * Which item that is being enchanted. * @return The enchantment cost, 0 means unchantable, 50 is max. */ - static int getEnchantmentCost(Random *random, int slot, int bookcases, shared_ptr itemInstance); + static int getEnchantmentCost(Random *random, int slot, int bookcases, std::shared_ptr itemInstance); - static shared_ptr enchantItem(Random *random, shared_ptr itemInstance, int enchantmentCost); + static std::shared_ptr enchantItem(Random *random, std::shared_ptr itemInstance, int enchantmentCost); /** * @@ -105,6 +105,6 @@ public: * @param enchantmentCost * @return */ - static vector *selectEnchantment(Random *random, shared_ptr itemInstance, int enchantmentCost); - static unordered_map *getAvailableEnchantmentResults(int value, shared_ptr itemInstance); + static vector *selectEnchantment(Random *random, std::shared_ptr itemInstance, int enchantmentCost); + static unordered_map *getAvailableEnchantmentResults(int value, std::shared_ptr itemInstance); }; \ No newline at end of file diff --git a/Minecraft.World/Enchantments/ProtectionEnchantment.cpp b/Minecraft.World/Enchantments/ProtectionEnchantment.cpp index 6aae070b5..d8f93c632 100644 --- a/Minecraft.World/Enchantments/ProtectionEnchantment.cpp +++ b/Minecraft.World/Enchantments/ProtectionEnchantment.cpp @@ -69,7 +69,7 @@ bool ProtectionEnchantment::isCompatibleWith(Enchantment *other) const return Enchantment::isCompatibleWith(other); } -int ProtectionEnchantment::getFireAfterDampener(shared_ptr entity, int time) +int ProtectionEnchantment::getFireAfterDampener(std::shared_ptr entity, int time) { int level = EnchantmentHelper::getEnchantmentLevel(Enchantment::fireProtection->id, entity->getEquipmentSlots()); @@ -81,7 +81,7 @@ int ProtectionEnchantment::getFireAfterDampener(shared_ptr entity, int t return time; } -double ProtectionEnchantment::getExplosionKnockbackAfterDampener(shared_ptr entity, double power) +double ProtectionEnchantment::getExplosionKnockbackAfterDampener(std::shared_ptr entity, double power) { int level = EnchantmentHelper::getEnchantmentLevel(Enchantment::explosionProtection->id, entity->getEquipmentSlots()); diff --git a/Minecraft.World/Enchantments/ProtectionEnchantment.h b/Minecraft.World/Enchantments/ProtectionEnchantment.h index 910e32dfb..e97272546 100644 --- a/Minecraft.World/Enchantments/ProtectionEnchantment.h +++ b/Minecraft.World/Enchantments/ProtectionEnchantment.h @@ -28,6 +28,6 @@ public: virtual int getDamageProtection(int level, DamageSource *source); virtual int getDescriptionId(); virtual bool isCompatibleWith(Enchantment *other) const; - static int getFireAfterDampener(shared_ptr entity, int time); - static double getExplosionKnockbackAfterDampener(shared_ptr entity, double power); + static int getFireAfterDampener(std::shared_ptr entity, int time); + static double getExplosionKnockbackAfterDampener(std::shared_ptr entity, double power); }; \ No newline at end of file diff --git a/Minecraft.World/Enchantments/ThornsEnchantment.cpp b/Minecraft.World/Enchantments/ThornsEnchantment.cpp index bf589bb70..3ad98a55d 100644 --- a/Minecraft.World/Enchantments/ThornsEnchantment.cpp +++ b/Minecraft.World/Enchantments/ThornsEnchantment.cpp @@ -27,7 +27,7 @@ int ThornsEnchantment::getMaxLevel() return 3; } -bool ThornsEnchantment::canEnchant(shared_ptr item) +bool ThornsEnchantment::canEnchant(std::shared_ptr item) { ArmorItem *armor = dynamic_cast(item->getItem()); if (armor) return true; @@ -52,10 +52,10 @@ int ThornsEnchantment::getDamage(int level, Random *random) } } -void ThornsEnchantment::doThornsAfterAttack(shared_ptr source, shared_ptr target, Random *random) +void ThornsEnchantment::doThornsAfterAttack(std::shared_ptr source, std::shared_ptr target, Random *random) { int level = EnchantmentHelper::getArmorThorns(target); - shared_ptr item = EnchantmentHelper::getRandomItemWith(Enchantment::thorns, target); + std::shared_ptr item = EnchantmentHelper::getRandomItemWith(Enchantment::thorns, target); if (shouldHit(level, random)) { diff --git a/Minecraft.World/Enchantments/ThornsEnchantment.h b/Minecraft.World/Enchantments/ThornsEnchantment.h index 42f4326bb..240888a06 100644 --- a/Minecraft.World/Enchantments/ThornsEnchantment.h +++ b/Minecraft.World/Enchantments/ThornsEnchantment.h @@ -13,8 +13,8 @@ public: virtual int getMinCost(int level); virtual int getMaxCost(int level); virtual int getMaxLevel(); - virtual bool canEnchant(shared_ptr item); + virtual bool canEnchant(std::shared_ptr item); static bool shouldHit(int level, Random *random); static int getDamage(int level, Random *random); - static void doThornsAfterAttack(shared_ptr source, shared_ptr target, Random *random); + static void doThornsAfterAttack(std::shared_ptr source, std::shared_ptr target, Random *random); }; \ No newline at end of file diff --git a/Minecraft.World/Enchantments/UntouchingEnchantment.cpp b/Minecraft.World/Enchantments/UntouchingEnchantment.cpp index 16c705069..5f85a4b58 100644 --- a/Minecraft.World/Enchantments/UntouchingEnchantment.cpp +++ b/Minecraft.World/Enchantments/UntouchingEnchantment.cpp @@ -27,7 +27,7 @@ bool UntouchingEnchantment::isCompatibleWith(Enchantment *other) const return Enchantment::isCompatibleWith(other) && other->id != resourceBonus->id; } -bool UntouchingEnchantment::canEnchant(shared_ptr item) +bool UntouchingEnchantment::canEnchant(std::shared_ptr item) { if (item->getItem()->id == Item::shears_Id) return true; return Enchantment::canEnchant(item); diff --git a/Minecraft.World/Enchantments/UntouchingEnchantment.h b/Minecraft.World/Enchantments/UntouchingEnchantment.h index db827c27a..14ce0b49e 100644 --- a/Minecraft.World/Enchantments/UntouchingEnchantment.h +++ b/Minecraft.World/Enchantments/UntouchingEnchantment.h @@ -11,5 +11,5 @@ public: virtual int getMaxCost(int level); virtual int getMaxLevel(); virtual bool isCompatibleWith(Enchantment *other) const; - virtual bool canEnchant(shared_ptr item); + virtual bool canEnchant(std::shared_ptr item); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/BossMobPart.cpp b/Minecraft.World/Entities/BossMobPart.cpp index 35e4bb215..3c3100a87 100644 --- a/Minecraft.World/Entities/BossMobPart.cpp +++ b/Minecraft.World/Entities/BossMobPart.cpp @@ -37,7 +37,7 @@ bool BossMobPart::hurt(DamageSource *source, int damage) return bossMob->hurt( dynamic_pointer_cast( shared_from_this() ), source, damage); } -bool BossMobPart::is(shared_ptr other) +bool BossMobPart::is(std::shared_ptr other) { return shared_from_this() == other || bossMob == other.get(); } \ No newline at end of file diff --git a/Minecraft.World/Entities/BossMobPart.h b/Minecraft.World/Entities/BossMobPart.h index 55af809f6..7b53126f2 100644 --- a/Minecraft.World/Entities/BossMobPart.h +++ b/Minecraft.World/Entities/BossMobPart.h @@ -23,5 +23,5 @@ protected: public: virtual bool isPickable(); virtual bool hurt(DamageSource *source, int damage); - virtual bool is(shared_ptr other); + virtual bool is(std::shared_ptr other); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/Entity.cpp b/Minecraft.World/Entities/Entity.cpp index cb8f59e81..f6710d8bf 100644 --- a/Minecraft.World/Entities/Entity.cpp +++ b/Minecraft.World/Entities/Entity.cpp @@ -314,7 +314,7 @@ void Entity::_init(bool useSmallId) fireImmune = false; // values that need to be sent to clients in SMP - entityData = shared_ptr(new SynchedEntityData()); + entityData = std::shared_ptr(new SynchedEntityData()); xRideRotA = yRideRotA = 0.0; inChunk = false; @@ -355,7 +355,7 @@ Entity::~Entity() delete bb; } -shared_ptr Entity::getEntityData() +std::shared_ptr Entity::getEntityData() { return entityData; } @@ -377,7 +377,7 @@ void Entity::resetPos() { if (level == NULL) return; - shared_ptr sharedThis = shared_from_this(); + std::shared_ptr sharedThis = shared_from_this(); while (true && y > 0) { setPos(x, y, z); @@ -1174,7 +1174,7 @@ void Entity::moveTo(double x, double y, double z, float yRot, float xRot) this->setPos(this->x, this->y, this->z); } -float Entity::distanceTo(shared_ptr e) +float Entity::distanceTo(std::shared_ptr e) { float xd = (float) (x - e->x); float yd = (float) (y - e->y); @@ -1198,7 +1198,7 @@ double Entity::distanceTo(double x2, double y2, double z2) return sqrt(xd * xd + yd * yd + zd * zd); } -double Entity::distanceToSqr(shared_ptr e) +double Entity::distanceToSqr(std::shared_ptr e) { double xd = x - e->x; double yd = y - e->y; @@ -1206,11 +1206,11 @@ double Entity::distanceToSqr(shared_ptr e) return xd * xd + yd * yd + zd * zd; } -void Entity::playerTouch(shared_ptr player) +void Entity::playerTouch(std::shared_ptr player) { } -void Entity::push(shared_ptr e) +void Entity::push(std::shared_ptr e) { if (e->rider.lock().get() == this || e->riding.get() == this) return; @@ -1282,7 +1282,7 @@ bool Entity::isShootable() return false; } -void Entity::awardKillScore(shared_ptr victim, int score) +void Entity::awardKillScore(std::shared_ptr victim, int score) { } @@ -1442,19 +1442,19 @@ float Entity::getShadowHeightOffs() return bbHeight / 2; } -shared_ptr Entity::spawnAtLocation(int resource, int count) +std::shared_ptr Entity::spawnAtLocation(int resource, int count) { return spawnAtLocation(resource, count, 0); } -shared_ptr Entity::spawnAtLocation(int resource, int count, float yOffs) +std::shared_ptr Entity::spawnAtLocation(int resource, int count, float yOffs) { - return spawnAtLocation(shared_ptr( new ItemInstance(resource, count, 0) ), yOffs); + return spawnAtLocation(std::shared_ptr( new ItemInstance(resource, count, 0) ), yOffs); } -shared_ptr Entity::spawnAtLocation(shared_ptr itemInstance, float yOffs) +std::shared_ptr Entity::spawnAtLocation(std::shared_ptr itemInstance, float yOffs) { - shared_ptr ie = shared_ptr( new ItemEntity(level, x, y + yOffs, z, itemInstance) ); + std::shared_ptr ie = std::shared_ptr( new ItemEntity(level, x, y + yOffs, z, itemInstance) ); ie->throwTime = 10; level->addEntity(ie); return ie; @@ -1483,12 +1483,12 @@ bool Entity::isInWall() return false; } -bool Entity::interact(shared_ptr player) +bool Entity::interact(std::shared_ptr player) { return false; } -AABB *Entity::getCollideAgainstBox(shared_ptr entity) +AABB *Entity::getCollideAgainstBox(std::shared_ptr entity) { return NULL; } @@ -1536,10 +1536,10 @@ void Entity::rideTick() void Entity::positionRider() { - shared_ptr lockedRider = rider.lock(); + std::shared_ptr lockedRider = rider.lock(); if( lockedRider ) { - shared_ptr player = dynamic_pointer_cast(lockedRider); + std::shared_ptr player = dynamic_pointer_cast(lockedRider); if (!(player && player->isLocalPlayer())) { lockedRider->xOld = xOld; @@ -1560,7 +1560,7 @@ double Entity::getRideHeight() return bbHeight * .75; } -void Entity::ride(shared_ptr e) +void Entity::ride(std::shared_ptr e) { xRideRotA = 0; yRideRotA = 0; @@ -1585,7 +1585,7 @@ void Entity::ride(shared_ptr e) } // 4J Stu - Brought forward from 12w36 to fix #46282 - TU5: Gameplay: Exiting the minecart in a tight corridor damages the player -void Entity::findStandUpPosition(shared_ptr vehicle) +void Entity::findStandUpPosition(std::shared_ptr vehicle) { AABB *boundingBox; double fallbackX = vehicle->x; @@ -1695,7 +1695,7 @@ ItemInstanceArray Entity::getEquipmentSlots() // ItemInstance[] } // 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 -void Entity::setEquippedSlot(int slot, shared_ptr item) +void Entity::setEquippedSlot(int slot, std::shared_ptr item) { } @@ -1744,7 +1744,7 @@ bool Entity::isInvisible() return getSharedFlag(FLAG_INVISIBLE); } -bool Entity::isInvisibleTo(shared_ptr plr) +bool Entity::isInvisibleTo(std::shared_ptr plr) { return isInvisible(); } @@ -1811,7 +1811,7 @@ void Entity::thunderHit(const LightningBolt *lightningBolt) if (onFire == 0) setOnFire(8); } -void Entity::killed(shared_ptr mob) +void Entity::killed(std::shared_ptr mob) { } @@ -1897,12 +1897,12 @@ wstring Entity::getAName() //return I18n.get("entity." + id + ".name"); } -vector > *Entity::getSubEntities() +vector > *Entity::getSubEntities() { return NULL; } -bool Entity::is(shared_ptr other) +bool Entity::is(std::shared_ptr other) { return shared_from_this() == other; } @@ -1926,7 +1926,7 @@ bool Entity::isInvulnerable() return false; } -void Entity::copyPosition(shared_ptr target) +void Entity::copyPosition(std::shared_ptr target) { moveTo(target->x, target->y, target->z, target->yRot, target->xRot); } diff --git a/Minecraft.World/Entities/Entity.h b/Minecraft.World/Entities/Entity.h index 941764760..6e96bd8a6 100644 --- a/Minecraft.World/Entities/Entity.h +++ b/Minecraft.World/Entities/Entity.h @@ -53,7 +53,7 @@ public: bool blocksBuilding; weak_ptr rider; // Changed to weak to avoid circular dependency between rider/riding entity - shared_ptr riding; + std::shared_ptr riding; Level *level; double xo, yo, zo; @@ -119,7 +119,7 @@ protected: bool fireImmune; // values that need to be sent to clients in SMP - shared_ptr entityData; + std::shared_ptr entityData; private: // shared flags that are sent to clients (max 8) @@ -160,7 +160,7 @@ protected: virtual void defineSynchedData() = 0; public: - shared_ptr getEntityData(); + std::shared_ptr getEntityData(); /* public bool equals(Object obj) { @@ -244,12 +244,12 @@ public: virtual void setLevel(Level *level); void absMoveTo(double x, double y, double z, float yRot, float xRot); void moveTo(double x, double y, double z, float yRot, float xRot); - float distanceTo(shared_ptr e); + float distanceTo(std::shared_ptr e); double distanceToSqr(double x2, double y2, double z2); double distanceTo(double x2, double y2, double z2); - double distanceToSqr(shared_ptr e); - virtual void playerTouch(shared_ptr player); - virtual void push(shared_ptr e); + double distanceToSqr(std::shared_ptr e); + virtual void playerTouch(std::shared_ptr player); + virtual void push(std::shared_ptr e); virtual void push(double xa, double ya, double za); protected: @@ -262,7 +262,7 @@ public: virtual bool isPickable(); virtual bool isPushable(); virtual bool isShootable(); - virtual void awardKillScore(shared_ptr victim, int score); + virtual void awardKillScore(std::shared_ptr victim, int score); virtual bool shouldRender(Vec3 *c); virtual bool shouldRenderAtSqrDistance(double distance); virtual int getTexture(); // 4J - changed from wstring to int @@ -284,20 +284,20 @@ protected: public: virtual float getShadowHeightOffs(); - shared_ptr spawnAtLocation(int resource, int count); - shared_ptr spawnAtLocation(int resource, int count, float yOffs); - shared_ptr spawnAtLocation(shared_ptr itemInstance, float yOffs); + std::shared_ptr spawnAtLocation(int resource, int count); + std::shared_ptr spawnAtLocation(int resource, int count, float yOffs); + std::shared_ptr spawnAtLocation(std::shared_ptr itemInstance, float yOffs); virtual bool isAlive(); virtual bool isInWall(); - virtual bool interact(shared_ptr player); - virtual AABB *getCollideAgainstBox(shared_ptr entity); + virtual bool interact(std::shared_ptr player); + virtual AABB *getCollideAgainstBox(std::shared_ptr entity); virtual void rideTick(); virtual void positionRider(); virtual double getRidingHeight(); virtual double getRideHeight(); - virtual void ride(shared_ptr e); - virtual void findStandUpPosition(shared_ptr vehicle); // 4J Stu - Brought forward from 12w36 to fix #46282 - TU5: Gameplay: Exiting the minecart in a tight corridor damages the player + virtual void ride(std::shared_ptr e); + virtual void findStandUpPosition(std::shared_ptr vehicle); // 4J Stu - Brought forward from 12w36 to fix #46282 - TU5: Gameplay: Exiting the minecart in a tight corridor damages the player virtual void lerpTo(double x, double y, double z, float yRot, float xRot, int steps); virtual float getPickRadius(); virtual Vec3 *getLookAngle(); @@ -307,7 +307,7 @@ public: virtual void animateHurt(); virtual void prepareCustomTextures(); virtual ItemInstanceArray getEquipmentSlots(); // ItemInstance[] - virtual void setEquippedSlot(int slot, shared_ptr item); // 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 + virtual void setEquippedSlot(int slot, std::shared_ptr item); // 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 virtual bool isOnFire(); virtual bool isRiding(); virtual bool isSneaking(); @@ -317,7 +317,7 @@ public: virtual bool isSprinting(); virtual void setSprinting(bool value); virtual bool isInvisible(); - virtual bool isInvisibleTo(shared_ptr plr); + virtual bool isInvisibleTo(std::shared_ptr plr); virtual void setInvisible(bool value); virtual bool isUsingItemFlag(); virtual void setUsingItemFlag(bool value); @@ -337,7 +337,7 @@ public: void setAirSupply(int supply); virtual void thunderHit(const LightningBolt *lightningBolt); - virtual void killed(shared_ptr mob); + virtual void killed(std::shared_ptr mob); protected: bool checkInTile(double x, double y, double z); @@ -348,7 +348,7 @@ public: virtual wstring getAName(); // TU9 - bool skipAttackInteraction(shared_ptr source) {return false;} + bool skipAttackInteraction(std::shared_ptr source) {return false;} // 4J - added to manage allocation of small ids private: @@ -380,13 +380,13 @@ public: bool isExtraWanderingEnabled(); int getWanderingQuadrant(); - virtual vector > *getSubEntities(); - virtual bool is(shared_ptr other); + virtual vector > *getSubEntities(); + virtual bool is(std::shared_ptr other); virtual float getYHeadRot(); virtual void setYHeadRot(float yHeadRot); virtual bool isAttackable(); virtual bool isInvulnerable(); - virtual void copyPosition(shared_ptr target); + virtual void copyPosition(std::shared_ptr target); private: unsigned int m_uiAnimOverrideBitmask; diff --git a/Minecraft.World/Entities/EntityDamageSource.cpp b/Minecraft.World/Entities/EntityDamageSource.cpp index a16b3249c..cea252f07 100644 --- a/Minecraft.World/Entities/EntityDamageSource.cpp +++ b/Minecraft.World/Entities/EntityDamageSource.cpp @@ -4,32 +4,32 @@ #include "../Headers/net.minecraft.world.damagesource.h" #include "../Headers/net.minecraft.network.packet.h" -//EntityDamageSource::EntityDamageSource(const wstring &msgId, shared_ptr entity) : DamageSource(msgId) -EntityDamageSource::EntityDamageSource(ChatPacket::EChatPacketMessage msgId, shared_ptr entity) : DamageSource(msgId) +//EntityDamageSource::EntityDamageSource(const wstring &msgId, std::shared_ptr entity) : DamageSource(msgId) +EntityDamageSource::EntityDamageSource(ChatPacket::EChatPacketMessage msgId, std::shared_ptr entity) : DamageSource(msgId) { this->entity = entity; } -shared_ptr EntityDamageSource::getEntity() +std::shared_ptr EntityDamageSource::getEntity() { return entity; } -//wstring EntityDamageSource::getLocalizedDeathMessage(shared_ptr player) +//wstring EntityDamageSource::getLocalizedDeathMessage(std::shared_ptr player) //{ // return L"death." + msgId + player->name + entity->getAName(); // //return I18n.get("death." + msgId, player.name, entity.getAName()); //} -shared_ptr EntityDamageSource::getDeathMessagePacket(shared_ptr player) +std::shared_ptr EntityDamageSource::getDeathMessagePacket(std::shared_ptr player) { wstring additional = L""; if(entity->GetType() == eTYPE_SERVERPLAYER) { - shared_ptr sourcePlayer = dynamic_pointer_cast(entity); + std::shared_ptr sourcePlayer = dynamic_pointer_cast(entity); if(sourcePlayer != NULL) additional = sourcePlayer->name; } - return shared_ptr( new ChatPacket(player->name, m_msgId, entity->GetType(), additional ) ); + return std::shared_ptr( new ChatPacket(player->name, m_msgId, entity->GetType(), additional ) ); } bool EntityDamageSource::scalesWithDifficulty() diff --git a/Minecraft.World/Entities/EntityDamageSource.h b/Minecraft.World/Entities/EntityDamageSource.h index 33a5e17cf..5c9fab190 100644 --- a/Minecraft.World/Entities/EntityDamageSource.h +++ b/Minecraft.World/Entities/EntityDamageSource.h @@ -9,18 +9,18 @@ class Player; class EntityDamageSource : public DamageSource { protected: - shared_ptr entity; + std::shared_ptr entity; public: - //EntityDamageSource(const wstring &msgId, shared_ptr entity); - EntityDamageSource(ChatPacket::EChatPacketMessage msgId, shared_ptr entity); + //EntityDamageSource(const wstring &msgId, std::shared_ptr entity); + EntityDamageSource(ChatPacket::EChatPacketMessage msgId, std::shared_ptr entity); virtual ~EntityDamageSource() { } - shared_ptr getEntity(); + std::shared_ptr getEntity(); // 4J Stu - Made return a packet - //virtual wstring getLocalizedDeathMessage(shared_ptr player); - virtual shared_ptr getDeathMessagePacket(shared_ptr player); + //virtual wstring getLocalizedDeathMessage(std::shared_ptr player); + virtual std::shared_ptr getDeathMessagePacket(std::shared_ptr player); virtual bool scalesWithDifficulty(); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/EntityPos.cpp b/Minecraft.World/Entities/EntityPos.cpp index 122869064..943c6ab73 100644 --- a/Minecraft.World/Entities/EntityPos.cpp +++ b/Minecraft.World/Entities/EntityPos.cpp @@ -34,7 +34,7 @@ EntityPos::EntityPos(float yRot, float xRot) move = false; } -EntityPos *EntityPos::lerp(shared_ptr e, float f) +EntityPos *EntityPos::lerp(std::shared_ptr e, float f) { double xd = e->x+(x-e->x)*f; double yd = e->y+(y-e->y)*f; diff --git a/Minecraft.World/Entities/EntityPos.h b/Minecraft.World/Entities/EntityPos.h index 5b0649012..6b82af01e 100644 --- a/Minecraft.World/Entities/EntityPos.h +++ b/Minecraft.World/Entities/EntityPos.h @@ -11,5 +11,5 @@ public: EntityPos(double x, double y, double z, float yRot, float xRot); EntityPos(double x, double y, double z); EntityPos(float yRot, float xRot); - EntityPos *lerp(shared_ptr e, float f); + EntityPos *lerp(std::shared_ptr e, float f); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/HangingEntity.cpp b/Minecraft.World/Entities/HangingEntity.cpp index ac1cd79f3..c7b2e666b 100644 --- a/Minecraft.World/Entities/HangingEntity.cpp +++ b/Minecraft.World/Entities/HangingEntity.cpp @@ -148,14 +148,14 @@ bool HangingEntity::survives() } } - vector > *entities = level->getEntities(shared_from_this(), bb); + vector > *entities = level->getEntities(shared_from_this(), bb); if (entities != NULL && entities->size() > 0) { AUTO_VAR(itEnd, entities->end()); for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { - shared_ptr e = (*it); + std::shared_ptr e = (*it); if(dynamic_pointer_cast(e) != NULL) { return false; @@ -172,7 +172,7 @@ bool HangingEntity::isPickable() return true; } -bool HangingEntity::skipAttackInteraction(shared_ptr source) +bool HangingEntity::skipAttackInteraction(std::shared_ptr source) { if(source->GetType()==eTYPE_PLAYER) { @@ -187,7 +187,7 @@ bool HangingEntity::hurt(DamageSource *source, int damage) { if (dynamic_cast(source) != NULL) { - shared_ptr sourceEntity = source->getDirectEntity(); + std::shared_ptr sourceEntity = source->getDirectEntity(); if (dynamic_pointer_cast(sourceEntity) != NULL && !dynamic_pointer_cast(sourceEntity)->isAllowedToHurtEntity(shared_from_this()) ) { @@ -198,8 +198,8 @@ bool HangingEntity::hurt(DamageSource *source, int damage) remove(); markHurt(); - shared_ptr player = nullptr; - shared_ptr e = source->getEntity(); + std::shared_ptr player = nullptr; + std::shared_ptr e = source->getEntity(); if (e!=NULL && ((e->GetType() & eTYPE_PLAYER)!=0) ) // check if it's serverplayer or player { player = dynamic_pointer_cast( e ); diff --git a/Minecraft.World/Entities/HangingEntity.h b/Minecraft.World/Entities/HangingEntity.h index b87915e49..e03bd6fe9 100644 --- a/Minecraft.World/Entities/HangingEntity.h +++ b/Minecraft.World/Entities/HangingEntity.h @@ -29,7 +29,7 @@ public: virtual void tick(); virtual bool isPickable(); - virtual bool skipAttackInteraction(shared_ptr source); + virtual bool skipAttackInteraction(std::shared_ptr source); virtual bool hurt(DamageSource *source, int damage); virtual void move(double xa, double ya, double za, bool noEntityCubes=false); // 4J - added noEntityCubes parameter virtual void push(double xa, double ya, double za); diff --git a/Minecraft.World/Entities/IndirectEntityDamageSource.cpp b/Minecraft.World/Entities/IndirectEntityDamageSource.cpp index 537479907..e5670c969 100644 --- a/Minecraft.World/Entities/IndirectEntityDamageSource.cpp +++ b/Minecraft.World/Entities/IndirectEntityDamageSource.cpp @@ -4,30 +4,30 @@ #include "../Headers/net.minecraft.world.damagesource.h" #include "../Headers/net.minecraft.network.packet.h" -//IndirectEntityDamageSource::IndirectEntityDamageSource(const wstring &msgId, shared_ptr entity, shared_ptr owner) : EntityDamageSource(msgId, entity) -IndirectEntityDamageSource::IndirectEntityDamageSource(ChatPacket::EChatPacketMessage msgId, shared_ptr entity, shared_ptr owner) : EntityDamageSource(msgId, entity) +//IndirectEntityDamageSource::IndirectEntityDamageSource(const wstring &msgId, std::shared_ptr entity, std::shared_ptr owner) : EntityDamageSource(msgId, entity) +IndirectEntityDamageSource::IndirectEntityDamageSource(ChatPacket::EChatPacketMessage msgId, std::shared_ptr entity, std::shared_ptr owner) : EntityDamageSource(msgId, entity) { this->owner = owner; } // 4J Stu - Brought forward from 1.2.3 to fix #46422 -shared_ptr IndirectEntityDamageSource::getDirectEntity() +std::shared_ptr IndirectEntityDamageSource::getDirectEntity() { return entity; } -shared_ptr IndirectEntityDamageSource::getEntity() +std::shared_ptr IndirectEntityDamageSource::getEntity() { return owner; } -//wstring IndirectEntityDamageSource::getLocalizedDeathMessage(shared_ptr player) +//wstring IndirectEntityDamageSource::getLocalizedDeathMessage(std::shared_ptr player) //{ // return L"death." + msgId + player->name + owner->getAName(); // //return I18n.get("death." + msgId, player.name, owner.getAName()); //} -shared_ptr IndirectEntityDamageSource::getDeathMessagePacket(shared_ptr player) +std::shared_ptr IndirectEntityDamageSource::getDeathMessagePacket(std::shared_ptr player) { wstring additional = L""; int type; @@ -36,7 +36,7 @@ shared_ptr IndirectEntityDamageSource::getDeathMessagePacket(shared_ type = owner->GetType(); if(type == eTYPE_SERVERPLAYER) { - shared_ptr sourcePlayer = dynamic_pointer_cast(owner); + std::shared_ptr sourcePlayer = dynamic_pointer_cast(owner); if(sourcePlayer != NULL) additional = sourcePlayer->name; } } @@ -44,5 +44,5 @@ shared_ptr IndirectEntityDamageSource::getDeathMessagePacket(shared_ { type = entity->GetType(); } - return shared_ptr( new ChatPacket(player->name, m_msgId, type, additional ) ); + return std::shared_ptr( new ChatPacket(player->name, m_msgId, type, additional ) ); } \ No newline at end of file diff --git a/Minecraft.World/Entities/IndirectEntityDamageSource.h b/Minecraft.World/Entities/IndirectEntityDamageSource.h index b7aec18cf..52848de1f 100644 --- a/Minecraft.World/Entities/IndirectEntityDamageSource.h +++ b/Minecraft.World/Entities/IndirectEntityDamageSource.h @@ -9,17 +9,17 @@ class Player; class IndirectEntityDamageSource : public EntityDamageSource { private: - shared_ptr owner; + std::shared_ptr owner; public: - //IndirectEntityDamageSource(const wstring &msgId, shared_ptr entity, shared_ptr owner); - IndirectEntityDamageSource(ChatPacket::EChatPacketMessage msgId, shared_ptr entity, shared_ptr owner); + //IndirectEntityDamageSource(const wstring &msgId, std::shared_ptr entity, std::shared_ptr owner); + IndirectEntityDamageSource(ChatPacket::EChatPacketMessage msgId, std::shared_ptr entity, std::shared_ptr owner); virtual ~IndirectEntityDamageSource() { } - virtual shared_ptr getDirectEntity(); // 4J Stu - Brought forward from 1.2.3 to fix #46422 - virtual shared_ptr getEntity(); + virtual std::shared_ptr getDirectEntity(); // 4J Stu - Brought forward from 1.2.3 to fix #46422 + virtual std::shared_ptr getEntity(); // 4J Stu - Made return a packet - //virtual wstring getLocalizedDeathMessage(shared_ptr player); - virtual shared_ptr getDeathMessagePacket(shared_ptr player); + //virtual wstring getLocalizedDeathMessage(std::shared_ptr player); + virtual std::shared_ptr getDeathMessagePacket(std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/ItemEntity.cpp b/Minecraft.World/Entities/ItemEntity.cpp index 1beaa260f..c3210f930 100644 --- a/Minecraft.World/Entities/ItemEntity.cpp +++ b/Minecraft.World/Entities/ItemEntity.cpp @@ -48,7 +48,7 @@ ItemEntity::ItemEntity(Level *level, double x, double y, double z) : Entity(leve _init(level,x,y,z); } -ItemEntity::ItemEntity(Level *level, double x, double y, double z, shared_ptr item) : Entity( level ) +ItemEntity::ItemEntity(Level *level, double x, double y, double z, std::shared_ptr item) : Entity( level ) { _init(level,x,y,z); setItem(item); @@ -134,21 +134,21 @@ void ItemEntity::tick() void ItemEntity::mergeWithNeighbours() { - vector > *neighbours = level->getEntitiesOfClass(typeid(*this), bb->grow(0.5, 0, 0.5)); + vector > *neighbours = level->getEntitiesOfClass(typeid(*this), bb->grow(0.5, 0, 0.5)); for(AUTO_VAR(it, neighbours->begin()); it != neighbours->end(); ++it) { - shared_ptr entity = dynamic_pointer_cast(*it); + std::shared_ptr entity = dynamic_pointer_cast(*it); merge(entity); } delete neighbours; } -bool ItemEntity::merge(shared_ptr target) +bool ItemEntity::merge(std::shared_ptr target) { if (target == shared_from_this()) return false; if (!target->isAlive() || !this->isAlive()) return false; - shared_ptr myItem = this->getItem(); - shared_ptr targetItem = target->getItem(); + std::shared_ptr myItem = this->getItem(); + std::shared_ptr targetItem = target->getItem(); if (targetItem->getItem() != myItem->getItem()) return false; if (targetItem->hasTag() ^ myItem->hasTag()) return false; @@ -216,11 +216,11 @@ void ItemEntity::readAdditionalSaveData(CompoundTag *tag) if (getItem() == NULL) remove(); } -void ItemEntity::playerTouch(shared_ptr player) +void ItemEntity::playerTouch(std::shared_ptr player) { if (level->isClientSide) return; - shared_ptr item = getItem(); + std::shared_ptr item = getItem(); // 4J Stu - Fix for duplication glitch if(item->count <= 0) @@ -243,7 +243,7 @@ void ItemEntity::playerTouch(shared_ptr player) #ifdef _EXTENDED_ACHIEVEMENTS if ( getItem()->getItem()->id ) { - shared_ptr pThrower = level->getPlayerByName(getThrower()); + std::shared_ptr pThrower = level->getPlayerByName(getThrower()); if ( (pThrower != nullptr) && (pThrower != player) ) { pThrower->awardStat(GenericStats::diamondsToYou(), GenericStats::param_diamondsToYou()); @@ -267,9 +267,9 @@ wstring ItemEntity::getAName() //return I18n.get("item." + item.getDescriptionId()); } -shared_ptr ItemEntity::getItem() +std::shared_ptr ItemEntity::getItem() { - shared_ptr result = getEntityData()->getItemInstance(DATA_ITEM); + std::shared_ptr result = getEntityData()->getItemInstance(DATA_ITEM); if (result == NULL) { @@ -278,13 +278,13 @@ shared_ptr ItemEntity::getItem() app.DebugPrintf("Item entity %d has no item?!\n", entityId); //level.getLogger().severe("Item entity " + entityId + " has no item?!"); } - return shared_ptr(new ItemInstance(Tile::rock)); + return std::shared_ptr(new ItemInstance(Tile::rock)); } return result; } -void ItemEntity::setItem(shared_ptr item) +void ItemEntity::setItem(std::shared_ptr item) { getEntityData()->set(DATA_ITEM, item); getEntityData()->markDirty(DATA_ITEM); diff --git a/Minecraft.World/Entities/ItemEntity.h b/Minecraft.World/Entities/ItemEntity.h index cb8ac3e74..6973497de 100644 --- a/Minecraft.World/Entities/ItemEntity.h +++ b/Minecraft.World/Entities/ItemEntity.h @@ -32,7 +32,7 @@ public: float bobOffs; ItemEntity(Level *level, double x, double y, double z); - ItemEntity(Level *level, double x, double y, double z, shared_ptr item); + ItemEntity(Level *level, double x, double y, double z, std::shared_ptr item); protected: virtual bool makeStepSound(); @@ -50,7 +50,7 @@ private: void mergeWithNeighbours(); public: - bool merge(shared_ptr target); + bool merge(std::shared_ptr target); void setShortLifeTime(); virtual bool updateInWaterState(); @@ -61,12 +61,12 @@ public: virtual bool hurt(DamageSource *source, int damage); virtual void addAdditonalSaveData(CompoundTag *entityTag); virtual void readAdditionalSaveData(CompoundTag *tag); - virtual void playerTouch(shared_ptr player); + virtual void playerTouch(std::shared_ptr player); virtual wstring getAName(); - shared_ptr getItem(); - void setItem(shared_ptr item); + std::shared_ptr getItem(); + void setItem(std::shared_ptr item); virtual bool isAttackable(); void setThrower(const wstring &thrower); diff --git a/Minecraft.World/Entities/Mob.cpp b/Minecraft.World/Entities/Mob.cpp index 4d16887cf..1d635cf9a 100644 --- a/Minecraft.World/Entities/Mob.cpp +++ b/Minecraft.World/Entities/Mob.cpp @@ -193,19 +193,19 @@ Random *Mob::getRandom() return random; } -shared_ptr Mob::getLastHurtByMob() +std::shared_ptr Mob::getLastHurtByMob() { return lastHurtByMob; } -shared_ptr Mob::getLastHurtMob() +std::shared_ptr Mob::getLastHurtMob() { return lastHurtMob; } -void Mob::setLastHurtMob(shared_ptr target) +void Mob::setLastHurtMob(std::shared_ptr target) { - shared_ptr mob = dynamic_pointer_cast(target); + std::shared_ptr mob = dynamic_pointer_cast(target); if (mob != NULL) lastHurtMob = mob; } @@ -235,18 +235,18 @@ void Mob::setSpeed(float speed) setYya(speed); } -bool Mob::doHurtTarget(shared_ptr target) +bool Mob::doHurtTarget(std::shared_ptr target) { setLastHurtMob(target); return false; } -shared_ptr Mob::getTarget() +std::shared_ptr Mob::getTarget() { return target; } -void Mob::setTarget(shared_ptr target) +void Mob::setTarget(std::shared_ptr target) { this->target = target; } @@ -299,7 +299,7 @@ bool Mob::hasRestriction() return restrictRadius != -1; } -void Mob::setLastHurtByMob(shared_ptr hurtBy) +void Mob::setLastHurtByMob(std::shared_ptr hurtBy) { lastHurtByMob = hurtBy; lastHurtByMobTime = lastHurtByMob != NULL ? PLAYER_HURT_EXPERIENCE_TIME : 0; @@ -310,7 +310,7 @@ void Mob::defineSynchedData() entityData->define(DATA_EFFECT_COLOR_ID, effectColor); } -bool Mob::canSee(shared_ptr target) +bool Mob::canSee(std::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); @@ -412,7 +412,7 @@ void Mob::baseTick() if (lastHurtByPlayerTime > 0) lastHurtByPlayerTime--; else { - // Note - this used to just set to nullptr, but that has to create a new shared_ptr and free an old one, when generally this won't be doing anything at all. This + // Note - this used to just set to nullptr, but that has to create a new std::shared_ptr and free an old one, when generally this won't be doing anything at all. This // is the lightweight but ugly alternative if( lastHurtByPlayer ) { @@ -454,7 +454,7 @@ void Mob::tickDeath() { int newCount = ExperienceOrb::getExperienceValue(xpCount); xpCount -= newCount; - level->addEntity(shared_ptr( new ExperienceOrb(level, x, y, z, newCount) ) ); + level->addEntity(std::shared_ptr( new ExperienceOrb(level, x, y, z, newCount) ) ); } } } @@ -475,7 +475,7 @@ int Mob::decreaseAirSupply(int currentSupply) return currentSupply - 1; } -int Mob::getExperienceReward(shared_ptr killedBy) +int Mob::getExperienceReward(std::shared_ptr killedBy) { return xpReward; } @@ -661,7 +661,7 @@ bool Mob::hurt(DamageSource *source, int dmg) if ( source->isFire() && hasEffect(MobEffect::fireResistance) ) { // 4J-JEV, for new achievement Stayin'Frosty, TODO merge with Java version. - shared_ptr plr = dynamic_pointer_cast(shared_from_this()); + std::shared_ptr plr = dynamic_pointer_cast(shared_from_this()); if ( plr != NULL && source == DamageSource::lava ) // Only award when in lava (not any fire). { plr->awardStat(GenericStats::stayinFrosty(),GenericStats::param_stayinFrosty()); @@ -690,7 +690,7 @@ bool Mob::hurt(DamageSource *source, int dmg) hurtDir = 0; - shared_ptr sourceEntity = source->getEntity(); + std::shared_ptr sourceEntity = source->getEntity(); if (sourceEntity != NULL) { if (dynamic_pointer_cast(sourceEntity) != NULL) { @@ -704,7 +704,7 @@ bool Mob::hurt(DamageSource *source, int dmg) } else if (dynamic_pointer_cast(sourceEntity)) { - shared_ptr w = dynamic_pointer_cast(sourceEntity); + std::shared_ptr w = dynamic_pointer_cast(sourceEntity); if (w->isTame()) { lastHurtByPlayerTime = PLAYER_HURT_EXPERIENCE_TIME; @@ -834,7 +834,7 @@ int Mob::getDeathSound() return eSoundType_DAMAGE_HURT; } -void Mob::knockback(shared_ptr source, int dmg, double xd, double zd) +void Mob::knockback(std::shared_ptr source, int dmg, double xd, double zd) { hasImpulse = true; float dd = (float) sqrt(xd * xd + zd * zd); @@ -853,7 +853,7 @@ void Mob::knockback(shared_ptr source, int dmg, double xd, double zd) void Mob::die(DamageSource *source) { - shared_ptr sourceEntity = source->getEntity(); + std::shared_ptr sourceEntity = source->getEntity(); if (deathScore >= 0 && sourceEntity != NULL) sourceEntity->awardKillScore(shared_from_this(), deathScore); if (sourceEntity != NULL) sourceEntity->killed( dynamic_pointer_cast( shared_from_this() ) ); @@ -863,7 +863,7 @@ void Mob::die(DamageSource *source) if (!level->isClientSide) { int playerBonus = 0; - shared_ptr player = dynamic_pointer_cast(sourceEntity); + std::shared_ptr player = dynamic_pointer_cast(sourceEntity); if (player != NULL) { playerBonus = EnchantmentHelper::getKillingLootBonus(player->inventory); @@ -960,7 +960,7 @@ void Mob::travel(float xa, float ya) thisPlayer = (Player*) this; } #else - shared_ptr thisPlayer = dynamic_pointer_cast(shared_from_this()); + std::shared_ptr thisPlayer = dynamic_pointer_cast(shared_from_this()); #endif if (isInWater() && !(thisPlayer && thisPlayer->abilities.flying) ) { @@ -1293,13 +1293,13 @@ void Mob::aiStep() if(!level->isClientSide) { - vector > *entities = level->getEntities(shared_from_this(), this->bb->grow(0.2f, 0, 0.2f)); + vector > *entities = level->getEntities(shared_from_this(), this->bb->grow(0.2f, 0, 0.2f)); if (entities != NULL && !entities->empty()) { AUTO_VAR(itEnd, entities->end()); for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { - shared_ptr e = *it; //entities->at(i); + std::shared_ptr e = *it; //entities->at(i); if (e->isPushable()) e->push(shared_from_this()); } } @@ -1350,7 +1350,7 @@ bool Mob::removeWhenFarAway() void Mob::checkDespawn() { - shared_ptr player = level->getNearestPlayer(shared_from_this(), -1); + std::shared_ptr player = level->getNearestPlayer(shared_from_this(), -1); if (player != NULL) { double xd = player->x - x; @@ -1409,7 +1409,7 @@ void Mob::serverAiStep() float lookDistance = 8; if (random->nextFloat() < 0.02f) { - shared_ptr player = level->getNearestPlayer(shared_from_this(), lookDistance); + std::shared_ptr player = level->getNearestPlayer(shared_from_this(), lookDistance); if (player != NULL) { lookingAt = player; @@ -1449,13 +1449,13 @@ int Mob::getMaxHeadXRot() return 40; } -void Mob::lookAt(shared_ptr e, float yMax, float xMax) +void Mob::lookAt(std::shared_ptr e, float yMax, float xMax) { double xd = e->x - x; double yd; double zd = e->z - z; - shared_ptr mob = dynamic_pointer_cast(e); + std::shared_ptr mob = dynamic_pointer_cast(e); if(mob != NULL) { yd = (y + getHeadHeight()) - (mob->y + mob->getHeadHeight()); @@ -1478,7 +1478,7 @@ bool Mob::isLookingAtAnEntity() return lookingAt != NULL; } -shared_ptr Mob::getLookingAt() +std::shared_ptr Mob::getLookingAt() { return lookingAt; } @@ -1579,12 +1579,12 @@ int Mob::getMaxSpawnClusterSize() return 4; } -shared_ptr Mob::getCarriedItem() +std::shared_ptr Mob::getCarriedItem() { return nullptr; } -shared_ptr Mob::getArmor(int pos) +std::shared_ptr Mob::getArmor(int pos) { // 4J Stu - Not implemented yet return nullptr; @@ -1635,7 +1635,7 @@ bool Mob::isSleeping() return false; } -Icon *Mob::getItemInHandIcon(shared_ptr item, int layer) +Icon *Mob::getItemInHandIcon(std::shared_ptr item, int layer) { return item->getIcon(); } @@ -1900,7 +1900,7 @@ MobType Mob::getMobType() return UNDEFINED; } -void Mob::breakItem(shared_ptr itemInstance) +void Mob::breakItem(std::shared_ptr itemInstance) { level->playSound(shared_from_this(), eSoundType_RANDOM_BREAK, 0.8f, 0.8f + level->random->nextFloat() * 0.4f); diff --git a/Minecraft.World/Entities/Mob.h b/Minecraft.World/Entities/Mob.h index 52a304d55..d98438165 100644 --- a/Minecraft.World/Entities/Mob.h +++ b/Minecraft.World/Entities/Mob.h @@ -99,13 +99,13 @@ public: float walkAnimPos; protected: - shared_ptr lastHurtByPlayer; + std::shared_ptr lastHurtByPlayer; int lastHurtByPlayerTime; private: - shared_ptr lastHurtByMob; + std::shared_ptr lastHurtByMob; int lastHurtByMobTime; - shared_ptr lastHurtMob; + std::shared_ptr lastHurtMob; public: int arrowCount; @@ -129,7 +129,7 @@ protected: GoalSelector targetSelector; private: - shared_ptr target; + std::shared_ptr target; Sensing *sensing; float speed; @@ -143,17 +143,17 @@ public: virtual PathNavigation *getNavigation(); virtual Sensing *getSensing(); virtual Random *getRandom(); - virtual shared_ptr getLastHurtByMob(); - virtual shared_ptr getLastHurtMob(); - void setLastHurtMob(shared_ptr target); + virtual std::shared_ptr getLastHurtByMob(); + virtual std::shared_ptr getLastHurtMob(); + void setLastHurtMob(std::shared_ptr target); virtual int getNoActionTime(); float getYHeadRot(); void setYHeadRot(float yHeadRot); float getSpeed(); void setSpeed(float speed); - virtual bool doHurtTarget(shared_ptr target); - shared_ptr getTarget(); - virtual void setTarget(shared_ptr target); + virtual bool doHurtTarget(std::shared_ptr target); + std::shared_ptr getTarget(); + virtual void setTarget(std::shared_ptr target); virtual bool canAttackType(eINSTANCEOF targetType); virtual void ate(); @@ -165,13 +165,13 @@ public: void clearRestriction(); bool hasRestriction(); - virtual void setLastHurtByMob(shared_ptr hurtBy); + virtual void setLastHurtByMob(std::shared_ptr hurtBy); protected: virtual void defineSynchedData(); public: - bool canSee(shared_ptr target); + bool canSee(std::shared_ptr target); virtual int getTexture(); // 4J - changed from wstring to int virtual bool isPickable() ; virtual bool isPushable(); @@ -183,7 +183,7 @@ public: protected: virtual void tickDeath(); virtual int decreaseAirSupply(int currentSupply); - virtual int getExperienceReward(shared_ptr killedBy); + virtual int getExperienceReward(std::shared_ptr killedBy); virtual bool isAlwaysExperienceDropper(); public: @@ -239,7 +239,7 @@ protected: virtual int getDeathSound(); public: - void knockback(shared_ptr source, int dmg, double xd, double zd); + void knockback(std::shared_ptr source, int dmg, double xd, double zd); virtual void die(DamageSource *source); protected: @@ -286,7 +286,7 @@ protected: virtual bool removeWhenFarAway(); private: - shared_ptr lookingAt; + std::shared_ptr lookingAt; protected: int lookTime; @@ -300,9 +300,9 @@ public: virtual int getMaxHeadXRot(); protected: - void lookAt(shared_ptr e, float yMax, float xMax); + void lookAt(std::shared_ptr e, float yMax, float xMax); bool isLookingAtAnEntity(); - shared_ptr getLookingAt(); + std::shared_ptr getLookingAt(); private: float rotlerp(float a, float b, float max); @@ -322,11 +322,11 @@ public: virtual float getHeadSizeScale(); HitResult *pick(double range, float a); virtual int getMaxSpawnClusterSize(); - virtual shared_ptr getCarriedItem(); - virtual shared_ptr getArmor(int pos); + virtual std::shared_ptr getCarriedItem(); + virtual std::shared_ptr getArmor(int pos); virtual void handleEntityEvent(uint8_t id); virtual bool isSleeping(); - virtual Icon *getItemInHandIcon(shared_ptr item, int layer); + virtual Icon *getItemInHandIcon(std::shared_ptr item, int layer); virtual bool shouldRender(Vec3 *c); protected: @@ -357,7 +357,7 @@ public: virtual void teleportTo(double x, double y, double z); virtual bool isBaby(); virtual MobType getMobType(); - virtual void breakItem(shared_ptr itemInstance); + virtual void breakItem(std::shared_ptr itemInstance); virtual bool isInvulnerable(); diff --git a/Minecraft.World/Entities/MobEffect.cpp b/Minecraft.World/Entities/MobEffect.cpp index 53cc4cd26..efb21889d 100644 --- a/Minecraft.World/Entities/MobEffect.cpp +++ b/Minecraft.World/Entities/MobEffect.cpp @@ -86,7 +86,7 @@ int MobEffect::getId() * @param mob * @param amplification */ -void MobEffect::applyEffectTick(shared_ptr mob, int amplification) +void MobEffect::applyEffectTick(std::shared_ptr mob, int amplification) { // Maybe move this to separate class implementations in the future? @@ -120,7 +120,7 @@ void MobEffect::applyEffectTick(shared_ptr mob, int amplification) } } -void MobEffect::applyInstantenousEffect(shared_ptr source, shared_ptr mob, int amplification, double scale) +void MobEffect::applyInstantenousEffect(std::shared_ptr source, std::shared_ptr mob, int amplification, double scale) { if ((id == heal->id && !mob->isInvertedHealAndHarm()) || (id == harm->id && mob->isInvertedHealAndHarm())) { diff --git a/Minecraft.World/Entities/MobEffect.h b/Minecraft.World/Entities/MobEffect.h index b0460bf13..94b9da8f1 100644 --- a/Minecraft.World/Entities/MobEffect.h +++ b/Minecraft.World/Entities/MobEffect.h @@ -86,8 +86,8 @@ protected: public: int getId(); - void applyEffectTick(shared_ptr mob, int amplification); - void applyInstantenousEffect(shared_ptr source, shared_ptr mob, int amplification, double scale); + void applyEffectTick(std::shared_ptr mob, int amplification); + void applyInstantenousEffect(std::shared_ptr source, std::shared_ptr mob, int amplification, double scale); virtual bool isInstantenous(); virtual bool isDurationEffectTick(int remainingDuration, int amplification); diff --git a/Minecraft.World/Entities/MobEffectInstance.cpp b/Minecraft.World/Entities/MobEffectInstance.cpp index 2f7ba644f..6a438eef2 100644 --- a/Minecraft.World/Entities/MobEffectInstance.cpp +++ b/Minecraft.World/Entities/MobEffectInstance.cpp @@ -68,7 +68,7 @@ int MobEffectInstance::getAmplifier() * @param target * @return True if the effect is still active. */ -bool MobEffectInstance::tick(shared_ptr target) +bool MobEffectInstance::tick(std::shared_ptr target) { if (duration > 0) { @@ -86,7 +86,7 @@ int MobEffectInstance::tickDownDuration() return --duration; } -void MobEffectInstance::applyEffect(shared_ptr mob) +void MobEffectInstance::applyEffect(std::shared_ptr mob) { if (duration > 0) { diff --git a/Minecraft.World/Entities/MobEffectInstance.h b/Minecraft.World/Entities/MobEffectInstance.h index d1c716e64..bfecc6125 100644 --- a/Minecraft.World/Entities/MobEffectInstance.h +++ b/Minecraft.World/Entities/MobEffectInstance.h @@ -24,13 +24,13 @@ public: int getId(); int getDuration(); int getAmplifier(); - bool tick(shared_ptr target); + bool tick(std::shared_ptr target); private: int tickDownDuration(); public: - void applyEffect(shared_ptr mob); + void applyEffect(std::shared_ptr mob); int getDescriptionId(); int getPostfixDescriptionId(); // 4J Added int hashCode(); diff --git a/Minecraft.World/Entities/Mobs/AgeableMob.cpp b/Minecraft.World/Entities/Mobs/AgeableMob.cpp index 4a1bbe8d7..af2cb19be 100644 --- a/Minecraft.World/Entities/Mobs/AgeableMob.cpp +++ b/Minecraft.World/Entities/Mobs/AgeableMob.cpp @@ -13,9 +13,9 @@ AgableMob::AgableMob(Level *level) : PathfinderMob(level) registeredBBHeight = 0; } -bool AgableMob::interact(shared_ptr player) +bool AgableMob::interact(std::shared_ptr player) { - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); if (item != NULL && item->id == Item::monsterPlacer_Id) { @@ -24,7 +24,7 @@ bool AgableMob::interact(shared_ptr player) eINSTANCEOF classToSpawn = EntityIO::getClass(item->getAuxValue()); if (classToSpawn != eTYPE_NOTSET && (classToSpawn & eTYPE_AGABLE_MOB) == eTYPE_AGABLE_MOB && classToSpawn == GetType() ) // 4J Added GetType() check to only spawn same type { - shared_ptr offspring = getBreedOffspring(dynamic_pointer_cast(shared_from_this())); + std::shared_ptr offspring = getBreedOffspring(dynamic_pointer_cast(shared_from_this())); if (offspring != NULL) { offspring->setAge(-20 * 60 * 20); diff --git a/Minecraft.World/Entities/Mobs/AgeableMob.h b/Minecraft.World/Entities/Mobs/AgeableMob.h index b693655d8..49b3a8dc2 100644 --- a/Minecraft.World/Entities/Mobs/AgeableMob.h +++ b/Minecraft.World/Entities/Mobs/AgeableMob.h @@ -13,13 +13,13 @@ private: public: AgableMob(Level *level); - virtual bool interact(shared_ptr player); + virtual bool interact(std::shared_ptr player); protected: virtual void defineSynchedData(); public: - virtual shared_ptr getBreedOffspring(shared_ptr target) = 0; + virtual std::shared_ptr getBreedOffspring(std::shared_ptr target) = 0; virtual int getAge(); virtual void setAge(int age); virtual void addAdditonalSaveData(CompoundTag *tag); diff --git a/Minecraft.World/Entities/Mobs/Animal.cpp b/Minecraft.World/Entities/Mobs/Animal.cpp index 9477be058..ea678c5d6 100644 --- a/Minecraft.World/Entities/Mobs/Animal.cpp +++ b/Minecraft.World/Entities/Mobs/Animal.cpp @@ -16,7 +16,7 @@ Animal::Animal(Level *level) : AgableMob( level ) { // inLove = 0; // 4J removed - now synched data loveTime = 0; - loveCause = shared_ptr(); + loveCause = std::shared_ptr(); setDespawnProtected(); } @@ -60,7 +60,7 @@ void Animal::aiStep() updateDespawnProtectedState(); // 4J added } -void Animal::checkHurtTarget(shared_ptr target, float d) +void Animal::checkHurtTarget(std::shared_ptr target, float d) { if (dynamic_pointer_cast(target) != NULL) { @@ -73,7 +73,7 @@ void Animal::checkHurtTarget(shared_ptr target, float d) holdGround = true; } - shared_ptr p = dynamic_pointer_cast(target); + std::shared_ptr p = dynamic_pointer_cast(target); if (p->getSelectedItem() != NULL && this->isFood(p->getSelectedItem())) { } @@ -85,7 +85,7 @@ void Animal::checkHurtTarget(shared_ptr target, float d) } else if (dynamic_pointer_cast(target) != NULL) { - shared_ptr a = dynamic_pointer_cast(target); + std::shared_ptr a = dynamic_pointer_cast(target); if (getAge() > 0 && a->getAge() < 0) { if (d < 2.5) @@ -121,9 +121,9 @@ void Animal::checkHurtTarget(shared_ptr target, float d) } -void Animal::breedWith(shared_ptr target) +void Animal::breedWith(std::shared_ptr target) { - shared_ptr offspring = getBreedOffspring(target); + std::shared_ptr offspring = getBreedOffspring(target); setInLoveValue(0); loveTime = 0; @@ -152,7 +152,7 @@ void Animal::breedWith(shared_ptr target) } level->addEntity(offspring); - level->addEntity( shared_ptr( new ExperienceOrb(level, x, y, z, random->nextInt(4) + 1) ) ); + level->addEntity( std::shared_ptr( new ExperienceOrb(level, x, y, z, random->nextInt(4) + 1) ) ); } setDespawnProtected(); @@ -168,7 +168,7 @@ bool Animal::hurt(DamageSource *dmgSource, int dmg) { if (dynamic_cast(dmgSource) != NULL) { - shared_ptr source = dmgSource->getDirectEntity(); + std::shared_ptr source = dmgSource->getDirectEntity(); if (dynamic_pointer_cast(source) != NULL && !dynamic_pointer_cast(source)->isAllowedToAttackAnimals() ) { @@ -177,7 +177,7 @@ bool Animal::hurt(DamageSource *dmgSource, int dmg) if (source != NULL && source->GetType() == eTYPE_ARROW) { - shared_ptr arrow = dynamic_pointer_cast(source); + std::shared_ptr arrow = dynamic_pointer_cast(source); if (dynamic_pointer_cast(arrow->owner) != NULL && ! dynamic_pointer_cast(arrow->owner)->isAllowedToAttackAnimals() ) { return false; @@ -205,18 +205,18 @@ void Animal::readAdditionalSaveData(CompoundTag *tag) setDespawnProtected(); } -shared_ptr Animal::findAttackTarget() +std::shared_ptr Animal::findAttackTarget() { if (fleeTime > 0) return nullptr; float r = 8; if (getInLoveValue() > 0) { - vector > *others = level->getEntitiesOfClass(typeid(*this), bb->grow(r, r, r)); + vector > *others = level->getEntitiesOfClass(typeid(*this), bb->grow(r, r, r)); //for (int i = 0; i < others->size(); i++) for(AUTO_VAR(it, others->begin()); it != others->end(); ++it) { - shared_ptr p = dynamic_pointer_cast(*it); + std::shared_ptr p = dynamic_pointer_cast(*it); if (p != shared_from_this() && p->getInLoveValue() > 0) { delete others; @@ -229,13 +229,13 @@ shared_ptr Animal::findAttackTarget() { if (getAge() == 0) { - vector > *players = level->getEntitiesOfClass(typeid(Player), bb->grow(r, r, r)); + vector > *players = level->getEntitiesOfClass(typeid(Player), bb->grow(r, r, r)); //for (int i = 0; i < players.size(); i++) for(AUTO_VAR(it, players->begin()); it != players->end(); ++it) { setDespawnProtected(); - shared_ptr p = dynamic_pointer_cast(*it); + std::shared_ptr p = dynamic_pointer_cast(*it); if (p->getSelectedItem() != NULL && this->isFood(p->getSelectedItem())) { delete players; @@ -246,11 +246,11 @@ shared_ptr Animal::findAttackTarget() } else if (getAge() > 0) { - vector > *others = level->getEntitiesOfClass(typeid(*this), bb->grow(r, r, r)); + vector > *others = level->getEntitiesOfClass(typeid(*this), bb->grow(r, r, r)); //for (int i = 0; i < others.size(); i++) for(AUTO_VAR(it, others->begin()); it != others->end(); ++it) { - shared_ptr p = dynamic_pointer_cast(*it); + std::shared_ptr p = dynamic_pointer_cast(*it); if (p != shared_from_this() && p->getAge() < 0) { delete others; @@ -281,19 +281,19 @@ bool Animal::removeWhenFarAway() return !isDespawnProtected(); // 4J changed - was false } -int Animal::getExperienceReward(shared_ptr killedBy) +int Animal::getExperienceReward(std::shared_ptr killedBy) { return 1 + level->random->nextInt(3); } -bool Animal::isFood(shared_ptr itemInstance) +bool Animal::isFood(std::shared_ptr itemInstance) { return itemInstance->id == Item::wheat_Id; } -bool Animal::interact(shared_ptr player) +bool Animal::interact(std::shared_ptr player) { - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); if (item != NULL && isFood(item) && getAge() == 0) { if (!player->abilities.instabuild) @@ -378,13 +378,13 @@ void Animal::setInLoveValue(int value) } // 4J added -void Animal::setInLove(shared_ptr player) +void Animal::setInLove(std::shared_ptr player) { loveCause = player; setInLoveValue(20*30); } -shared_ptr Animal::getLoveCause() +std::shared_ptr Animal::getLoveCause() { return loveCause.lock(); } @@ -398,7 +398,7 @@ void Animal::resetLove() { entityData->set(DATA_IN_LOVE, 0); } -bool Animal::canMate(shared_ptr partner) +bool Animal::canMate(std::shared_ptr partner) { if (partner == shared_from_this()) return false; if (typeid(*partner) != typeid(*this)) return false; diff --git a/Minecraft.World/Entities/Mobs/Animal.h b/Minecraft.World/Entities/Mobs/Animal.h index bed0975ae..32fa00229 100644 --- a/Minecraft.World/Entities/Mobs/Animal.h +++ b/Minecraft.World/Entities/Mobs/Animal.h @@ -26,10 +26,10 @@ public: virtual void aiStep(); protected: - virtual void checkHurtTarget(shared_ptr target, float d); + virtual void checkHurtTarget(std::shared_ptr target, float d); private: - virtual void breedWith(shared_ptr target); + virtual void breedWith(std::shared_ptr target); public: virtual float getWalkTargetValue(int x, int y, int z); @@ -40,7 +40,7 @@ public: virtual void readAdditionalSaveData(CompoundTag *tag); protected: - virtual shared_ptr findAttackTarget(); + virtual std::shared_ptr findAttackTarget(); public: virtual bool canSpawn(); @@ -48,22 +48,22 @@ public: protected: virtual bool removeWhenFarAway(); - virtual int getExperienceReward(shared_ptr killedBy); + virtual int getExperienceReward(std::shared_ptr killedBy); public: - virtual bool isFood(shared_ptr itemInstance); - virtual bool interact(shared_ptr player); + virtual bool isFood(std::shared_ptr itemInstance); + virtual bool interact(std::shared_ptr player); protected: int getInLoveValue(); // 4J added public: void setInLoveValue(int value); // 4J added - void setInLove(shared_ptr player); // 4J added, then modified to match latest Java for XboxOne achievements - shared_ptr getLoveCause(); + void setInLove(std::shared_ptr player); // 4J added, then modified to match latest Java for XboxOne achievements + std::shared_ptr getLoveCause(); bool isInLove(); void resetLove(); - virtual bool canMate(shared_ptr partner); + virtual bool canMate(std::shared_ptr partner); // 4J added for determining whether animals are enclosed or not private: diff --git a/Minecraft.World/Entities/Mobs/Arrow.cpp b/Minecraft.World/Entities/Mobs/Arrow.cpp index b4809a886..bb72417d2 100644 --- a/Minecraft.World/Entities/Mobs/Arrow.cpp +++ b/Minecraft.World/Entities/Mobs/Arrow.cpp @@ -52,7 +52,7 @@ Arrow::Arrow(Level *level) : Entity( level ) this->setSize(0.5f, 0.5f); } -Arrow::Arrow(Level *level, shared_ptr mob, shared_ptr target, float power, float uncertainty) : Entity( level ) +Arrow::Arrow(Level *level, std::shared_ptr mob, std::shared_ptr target, float power, float uncertainty) : Entity( level ) { _init(); @@ -89,7 +89,7 @@ Arrow::Arrow(Level *level, double x, double y, double z) : Entity( level ) this->heightOffset = 0; } -Arrow::Arrow(Level *level, shared_ptr mob, float power) : Entity( level ) +Arrow::Arrow(Level *level, std::shared_ptr mob, float power) : Entity( level ) { _init(); @@ -239,13 +239,13 @@ void Arrow::tick() { to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z); } - shared_ptr hitEntity = nullptr; - vector > *objects = level->getEntities(shared_from_this(), this->bb->expand(xd, yd, zd)->grow(1, 1, 1)); + std::shared_ptr hitEntity = nullptr; + vector > *objects = level->getEntities(shared_from_this(), this->bb->expand(xd, yd, zd)->grow(1, 1, 1)); double nearest = 0; AUTO_VAR(itEnd, objects->end()); for (AUTO_VAR(it, objects->begin()); it != itEnd; it++) { - shared_ptr e = *it; //objects->at(i); + std::shared_ptr e = *it; //objects->at(i); if (!e->isPickable() || (e == owner && flightTime < 5)) continue; float rr = 0.3f; @@ -299,7 +299,7 @@ void Arrow::tick() res->entity->setOnFire(5); } - shared_ptr mob = dynamic_pointer_cast(res->entity); + std::shared_ptr mob = dynamic_pointer_cast(res->entity); if (mob != NULL) { mob->arrowCount++; @@ -464,7 +464,7 @@ void Arrow::readAdditionalSaveData(CompoundTag *tag) } } -void Arrow::playerTouch(shared_ptr player) +void Arrow::playerTouch(std::shared_ptr player) { if (level->isClientSide || !inGround || shakeTime > 0) return; @@ -472,7 +472,7 @@ void Arrow::playerTouch(shared_ptr player) if (pickup == PICKUP_ALLOWED) { - if (!player->inventory->add( shared_ptr( new ItemInstance(Item::arrow, 1) ) )) + if (!player->inventory->add( std::shared_ptr( new ItemInstance(Item::arrow, 1) ) )) { bRemove = false; } diff --git a/Minecraft.World/Entities/Mobs/Arrow.h b/Minecraft.World/Entities/Mobs/Arrow.h index 442043715..dd29d67cf 100644 --- a/Minecraft.World/Entities/Mobs/Arrow.h +++ b/Minecraft.World/Entities/Mobs/Arrow.h @@ -36,7 +36,7 @@ private: public: int pickup; int shakeTime; - shared_ptr owner; + std::shared_ptr owner; private: double baseDamage; @@ -52,9 +52,9 @@ private: public: Arrow(Level *level); - Arrow(Level *level, shared_ptr mob, shared_ptr target, float power, float uncertainty); + Arrow(Level *level, std::shared_ptr mob, std::shared_ptr target, float power, float uncertainty); Arrow(Level *level, double x, double y, double z); - Arrow(Level *level, shared_ptr mob, float power); + Arrow(Level *level, std::shared_ptr mob, float power); protected: virtual void defineSynchedData(); @@ -66,7 +66,7 @@ public: virtual void tick(); virtual void addAdditonalSaveData(CompoundTag *tag); virtual void readAdditionalSaveData(CompoundTag *tag); - virtual void playerTouch(shared_ptr player); + virtual void playerTouch(std::shared_ptr player); virtual float getShadowHeightOffs(); void setBaseDamage(double baseDamage); diff --git a/Minecraft.World/Entities/Mobs/Blaze.cpp b/Minecraft.World/Entities/Mobs/Blaze.cpp index 84c9aa70c..20b1a164e 100644 --- a/Minecraft.World/Entities/Mobs/Blaze.cpp +++ b/Minecraft.World/Entities/Mobs/Blaze.cpp @@ -115,7 +115,7 @@ void Blaze::aiStep() Monster::aiStep(); } -void Blaze::checkHurtTarget(shared_ptr target, float d) +void Blaze::checkHurtTarget(std::shared_ptr target, float d) { if (attackTime <= 0 && d < 2.0f && target->bb->y1 > bb->y0 && target->bb->y0 < bb->y1) { @@ -154,7 +154,7 @@ void Blaze::checkHurtTarget(shared_ptr target, float d) level->levelEvent(nullptr, LevelEvent::SOUND_BLAZE_FIREBALL, (int) x, (int) y, (int) z, 0); // level.playSound(this, "mob.ghast.fireball", getSoundVolume(), (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f); for (int i = 0; i < 1; i++) { - shared_ptr ie = shared_ptr( new SmallFireball(level, dynamic_pointer_cast( shared_from_this() ), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd) ); + std::shared_ptr ie = std::shared_ptr( new SmallFireball(level, dynamic_pointer_cast( shared_from_this() ), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd) ); // Vec3 v = getViewVector(1); // ie.x = x + v.x * 1.5; ie->y = y + bbHeight / 2 + 0.5f; diff --git a/Minecraft.World/Entities/Mobs/Blaze.h b/Minecraft.World/Entities/Mobs/Blaze.h index dfb108709..2ac4b89b3 100644 --- a/Minecraft.World/Entities/Mobs/Blaze.h +++ b/Minecraft.World/Entities/Mobs/Blaze.h @@ -32,7 +32,7 @@ public: virtual void aiStep(); protected: - virtual void checkHurtTarget(shared_ptr target, float d); + virtual void checkHurtTarget(std::shared_ptr target, float d); virtual void causeFallDamage(float distance); virtual int getDeathLoot(); diff --git a/Minecraft.World/Entities/Mobs/Boat.cpp b/Minecraft.World/Entities/Mobs/Boat.cpp index af7cc60f4..b3480186b 100644 --- a/Minecraft.World/Entities/Mobs/Boat.cpp +++ b/Minecraft.World/Entities/Mobs/Boat.cpp @@ -56,7 +56,7 @@ void Boat::defineSynchedData() } -AABB *Boat::getCollideAgainstBox(shared_ptr entity) +AABB *Boat::getCollideAgainstBox(std::shared_ptr entity) { return entity->bb; } @@ -98,7 +98,7 @@ bool Boat::hurt(DamageSource *source, int hurtDamage) // Untrusted players shouldn't be able to damage minecarts or boats. if (dynamic_cast(source) != NULL) { - shared_ptr attacker = source->getDirectEntity(); + std::shared_ptr attacker = source->getDirectEntity(); if (dynamic_pointer_cast(attacker) != NULL && !dynamic_pointer_cast(attacker)->isAllowedToHurtEntity( shared_from_this() )) @@ -117,7 +117,7 @@ bool Boat::hurt(DamageSource *source, int hurtDamage) 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 - shared_ptr player = dynamic_pointer_cast(source->getEntity()); + std::shared_ptr player = dynamic_pointer_cast(source->getEntity()); if (player != NULL && player->abilities.instabuild) setDamage(100); if (getDamage() > 20 * 2) @@ -394,13 +394,13 @@ void Boat::tick() if(level->isClientSide) return; - vector > *entities = level->getEntities(shared_from_this(), this->bb->grow(0.2f, 0, 0.2f)); + vector > *entities = level->getEntities(shared_from_this(), this->bb->grow(0.2f, 0, 0.2f)); if (entities != NULL && !entities->empty()) { AUTO_VAR(itEnd, entities->end()); for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { - shared_ptr e = (*it); // entities->at(i); + std::shared_ptr e = (*it); // entities->at(i); if (e != rider.lock() && e->isPushable() && e->GetType() == eTYPE_BOAT) { e->push(shared_from_this()); @@ -467,7 +467,7 @@ wstring Boat::getName() return L"Boat"; } -bool Boat::interact(shared_ptr player) +bool Boat::interact(std::shared_ptr player) { if (rider.lock() != NULL && dynamic_pointer_cast(rider.lock())!=NULL && rider.lock() != player) return true; if (!level->isClientSide) diff --git a/Minecraft.World/Entities/Mobs/Boat.h b/Minecraft.World/Entities/Mobs/Boat.h index 85be1a867..eb5f5fc1f 100644 --- a/Minecraft.World/Entities/Mobs/Boat.h +++ b/Minecraft.World/Entities/Mobs/Boat.h @@ -40,7 +40,7 @@ protected: virtual void defineSynchedData(); public: - virtual AABB *getCollideAgainstBox(shared_ptr entity); + virtual AABB *getCollideAgainstBox(std::shared_ptr entity); virtual AABB *getCollideBox(); virtual bool isPushable(); @@ -69,7 +69,7 @@ protected: public: virtual float getShadowHeightOffs(); wstring getName(); - virtual bool interact(shared_ptr player); + virtual bool interact(std::shared_ptr player); virtual void setDamage(int damage); virtual int getDamage(); diff --git a/Minecraft.World/Entities/Mobs/BossMob.cpp b/Minecraft.World/Entities/Mobs/BossMob.cpp index c7e732e8a..bffd4a5eb 100644 --- a/Minecraft.World/Entities/Mobs/BossMob.cpp +++ b/Minecraft.World/Entities/Mobs/BossMob.cpp @@ -18,7 +18,7 @@ int BossMob::getMaxHealth() return maxHealth; } -bool BossMob::hurt(shared_ptr bossMobPart, DamageSource *source, int damage) +bool BossMob::hurt(std::shared_ptr bossMobPart, DamageSource *source, int damage) { return hurt(source, damage); } diff --git a/Minecraft.World/Entities/Mobs/BossMob.h b/Minecraft.World/Entities/Mobs/BossMob.h index fea81f672..2ed072f0f 100644 --- a/Minecraft.World/Entities/Mobs/BossMob.h +++ b/Minecraft.World/Entities/Mobs/BossMob.h @@ -14,7 +14,7 @@ public: BossMob(Level *level); virtual int getMaxHealth(); - virtual bool hurt(shared_ptr bossMobPart, DamageSource *source, int damage); + virtual bool hurt(std::shared_ptr bossMobPart, DamageSource *source, int damage); virtual bool hurt(DamageSource *source, int damage); protected: diff --git a/Minecraft.World/Entities/Mobs/CaveSpider.cpp b/Minecraft.World/Entities/Mobs/CaveSpider.cpp index 5ef5c243f..a0caaea26 100644 --- a/Minecraft.World/Entities/Mobs/CaveSpider.cpp +++ b/Minecraft.World/Entities/Mobs/CaveSpider.cpp @@ -28,7 +28,7 @@ float CaveSpider::getModelScale() } -bool CaveSpider::doHurtTarget(shared_ptr target) +bool CaveSpider::doHurtTarget(std::shared_ptr target) { if (Spider::doHurtTarget(target)) { diff --git a/Minecraft.World/Entities/Mobs/CaveSpider.h b/Minecraft.World/Entities/Mobs/CaveSpider.h index 26f07e5f9..de9cf370c 100644 --- a/Minecraft.World/Entities/Mobs/CaveSpider.h +++ b/Minecraft.World/Entities/Mobs/CaveSpider.h @@ -13,6 +13,6 @@ class CaveSpider : public Spider virtual int getMaxHealth(); virtual float getModelScale(); - virtual bool doHurtTarget(shared_ptr target); + virtual bool doHurtTarget(std::shared_ptr target); void finalizeMobSpawn(); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/Mobs/Chicken.cpp b/Minecraft.World/Entities/Mobs/Chicken.cpp index 257cb7c9e..b09897743 100644 --- a/Minecraft.World/Entities/Mobs/Chicken.cpp +++ b/Minecraft.World/Entities/Mobs/Chicken.cpp @@ -131,12 +131,12 @@ void Chicken::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) } } -shared_ptr Chicken::getBreedOffspring(shared_ptr target) +std::shared_ptr Chicken::getBreedOffspring(std::shared_ptr target) { // 4J - added limit to chickens that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - return shared_ptr(new Chicken(level)); + return std::shared_ptr(new Chicken(level)); } else { @@ -144,7 +144,7 @@ shared_ptr Chicken::getBreedOffspring(shared_ptr target) } } -bool Chicken::isFood(shared_ptr itemInstance) +bool Chicken::isFood(std::shared_ptr itemInstance) { return (itemInstance->id == Item::seeds_wheat_Id) || (itemInstance->id == Item::netherStalkSeeds_Id) || (itemInstance->id == Item::seeds_melon_Id) || (itemInstance->id == Item::seeds_pumpkin_Id); } diff --git a/Minecraft.World/Entities/Mobs/Chicken.h b/Minecraft.World/Entities/Mobs/Chicken.h index a162a5eb4..c0d18dbb5 100644 --- a/Minecraft.World/Entities/Mobs/Chicken.h +++ b/Minecraft.World/Entities/Mobs/Chicken.h @@ -36,7 +36,7 @@ protected: virtual void dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel); public: - virtual shared_ptr getBreedOffspring(shared_ptr target); - virtual bool isFood(shared_ptr itemInstance); + virtual std::shared_ptr getBreedOffspring(std::shared_ptr target); + virtual bool isFood(std::shared_ptr itemInstance); }; diff --git a/Minecraft.World/Entities/Mobs/Cow.cpp b/Minecraft.World/Entities/Mobs/Cow.cpp index 1c172db8f..d445768cc 100644 --- a/Minecraft.World/Entities/Mobs/Cow.cpp +++ b/Minecraft.World/Entities/Mobs/Cow.cpp @@ -95,20 +95,20 @@ void Cow::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) } } -bool Cow::interact(shared_ptr player) +bool Cow::interact(std::shared_ptr player) { - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); if (item != NULL && item->id == Item::bucket_empty->id) { player->awardStat(GenericStats::cowsMilked(),GenericStats::param_cowsMilked()); if (--item->count <= 0) { - player->inventory->setItem(player->inventory->selected, shared_ptr( new ItemInstance(Item::milk) ) ); + player->inventory->setItem(player->inventory->selected, std::shared_ptr( new ItemInstance(Item::milk) ) ); } - else if (!player->inventory->add(shared_ptr( new ItemInstance(Item::milk) ))) + else if (!player->inventory->add(std::shared_ptr( new ItemInstance(Item::milk) ))) { - player->drop(shared_ptr( new ItemInstance(Item::milk) )); + player->drop(std::shared_ptr( new ItemInstance(Item::milk) )); } return true; @@ -116,12 +116,12 @@ bool Cow::interact(shared_ptr player) return Animal::interact(player); } -shared_ptr Cow::getBreedOffspring(shared_ptr target) +std::shared_ptr Cow::getBreedOffspring(std::shared_ptr target) { // 4J - added limit to number of animals that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - return shared_ptr( new Cow(level) ); + return std::shared_ptr( new Cow(level) ); } else { diff --git a/Minecraft.World/Entities/Mobs/Cow.h b/Minecraft.World/Entities/Mobs/Cow.h index a1a91aba0..e721f8302 100644 --- a/Minecraft.World/Entities/Mobs/Cow.h +++ b/Minecraft.World/Entities/Mobs/Cow.h @@ -27,6 +27,6 @@ protected: virtual void dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel); public: - virtual bool interact(shared_ptr player); - virtual shared_ptr getBreedOffspring(shared_ptr target); + virtual bool interact(std::shared_ptr player); + virtual std::shared_ptr getBreedOffspring(std::shared_ptr target); }; diff --git a/Minecraft.World/Entities/Mobs/Creeper.cpp b/Minecraft.World/Entities/Mobs/Creeper.cpp index 899517ce5..0a9c948eb 100644 --- a/Minecraft.World/Entities/Mobs/Creeper.cpp +++ b/Minecraft.World/Entities/Mobs/Creeper.cpp @@ -125,14 +125,14 @@ void Creeper::die(DamageSource *source) spawnAtLocation(Item::record_01_Id + random->nextInt(12), 1); } - shared_ptr player = dynamic_pointer_cast(source->getEntity()); + std::shared_ptr player = dynamic_pointer_cast(source->getEntity()); if ( (dynamic_pointer_cast(source->getDirectEntity()) != NULL) && (player != NULL) ) { player->awardStat(GenericStats::archer(), GenericStats::param_archer()); } } -bool Creeper::doHurtTarget(shared_ptr target) +bool Creeper::doHurtTarget(std::shared_ptr target) { return true; } diff --git a/Minecraft.World/Entities/Mobs/Creeper.h b/Minecraft.World/Entities/Mobs/Creeper.h index 3bb516d2b..fe7028045 100644 --- a/Minecraft.World/Entities/Mobs/Creeper.h +++ b/Minecraft.World/Entities/Mobs/Creeper.h @@ -45,7 +45,7 @@ protected: public: virtual void die(DamageSource *source); - virtual bool doHurtTarget(shared_ptr target); + virtual bool doHurtTarget(std::shared_ptr target); virtual bool isPowered(); float getSwelling(float a); diff --git a/Minecraft.World/Entities/Mobs/DragonFireball.cpp b/Minecraft.World/Entities/Mobs/DragonFireball.cpp index a2827df39..9cf9522c0 100644 --- a/Minecraft.World/Entities/Mobs/DragonFireball.cpp +++ b/Minecraft.World/Entities/Mobs/DragonFireball.cpp @@ -17,7 +17,7 @@ DragonFireball::DragonFireball(Level *level) : Fireball(level) setSize(5 / 16.0f, 5 / 16.0f); } -DragonFireball::DragonFireball(Level *level, shared_ptr mob, double xa, double ya, double za) : Fireball(level, mob, xa, ya, za) +DragonFireball::DragonFireball(Level *level, std::shared_ptr mob, double xa, double ya, double za) : Fireball(level, mob, xa, ya, za) { setSize(5 / 16.0f, 5 / 16.0f); } @@ -32,15 +32,15 @@ void DragonFireball::onHit(HitResult *res) if (!level->isClientSide) { AABB *aoe = bb->grow(SPLASH_RANGE, SPLASH_RANGE / 2, SPLASH_RANGE); - vector > *entitiesOfClass = level->getEntitiesOfClass(typeid(Mob), aoe); + vector > *entitiesOfClass = level->getEntitiesOfClass(typeid(Mob), aoe); if (entitiesOfClass != NULL && !entitiesOfClass->empty()) { //for (Entity e : entitiesOfClass) for( AUTO_VAR(it, entitiesOfClass->begin()); it != entitiesOfClass->end(); ++it) { - //shared_ptr e = *it; - shared_ptr e = dynamic_pointer_cast( *it ); + //std::shared_ptr e = *it; + std::shared_ptr e = dynamic_pointer_cast( *it ); double dist = distanceToSqr(e); if (dist < SPLASH_RANGE_SQ) { diff --git a/Minecraft.World/Entities/Mobs/DragonFireball.h b/Minecraft.World/Entities/Mobs/DragonFireball.h index 9ce199ed2..96ab6d9f4 100644 --- a/Minecraft.World/Entities/Mobs/DragonFireball.h +++ b/Minecraft.World/Entities/Mobs/DragonFireball.h @@ -18,7 +18,7 @@ private: public: DragonFireball(Level *level); - DragonFireball(Level *level, shared_ptr mob, double xa, double ya, double za); + DragonFireball(Level *level, std::shared_ptr mob, double xa, double ya, double za); DragonFireball(Level *level, double x, double y, double z, double xa, double ya, double za); protected: diff --git a/Minecraft.World/Entities/Mobs/EnderCrystal.cpp b/Minecraft.World/Entities/Mobs/EnderCrystal.cpp index f4aedfa04..a73fc3384 100644 --- a/Minecraft.World/Entities/Mobs/EnderCrystal.cpp +++ b/Minecraft.World/Entities/Mobs/EnderCrystal.cpp @@ -91,7 +91,7 @@ bool EnderCrystal::isPickable() bool EnderCrystal::hurt(DamageSource *source, int damage) { // 4J-PB - if the owner of the source is the enderdragon, then ignore it (where the dragon's fireball hits an endercrystal) - shared_ptr sourceIsDragon = dynamic_pointer_cast(source->getEntity()); + std::shared_ptr sourceIsDragon = dynamic_pointer_cast(source->getEntity()); if(sourceIsDragon!=NULL) { @@ -108,12 +108,12 @@ bool EnderCrystal::hurt(DamageSource *source, int damage) { level->explode(nullptr, x, y, z, 6, true); - vector > entities = level->getAllEntities(); - shared_ptr dragon = nullptr; + vector > entities = level->getAllEntities(); + std::shared_ptr dragon = nullptr; AUTO_VAR(itEnd, entities.end()); for (AUTO_VAR(it, entities.begin()); it != itEnd; it++) { - shared_ptr e = *it; //entities->at(i); + std::shared_ptr e = *it; //entities->at(i); dragon = dynamic_pointer_cast(e); if(dragon != NULL) { diff --git a/Minecraft.World/Entities/Mobs/EnderDragon.cpp b/Minecraft.World/Entities/Mobs/EnderDragon.cpp index 058061c2b..15852f8a4 100644 --- a/Minecraft.World/Entities/Mobs/EnderDragon.cpp +++ b/Minecraft.World/Entities/Mobs/EnderDragon.cpp @@ -84,14 +84,14 @@ EnderDragon::EnderDragon(Level *level) : BossMob(level) { _init(); - head = shared_ptr( new BossMobPart(this, L"head", 6, 6) ); - neck = shared_ptr( new BossMobPart(this, L"neck", 6, 6) ); // 4J Added - body = shared_ptr( new BossMobPart(this, L"body", 8, 8) ); - tail1 = shared_ptr( new BossMobPart(this, L"tail", 4, 4) ); - tail2 = shared_ptr( new BossMobPart(this, L"tail", 4, 4) ); - tail3 = shared_ptr( new BossMobPart(this, L"tail", 4, 4) ); - wing1 = shared_ptr( new BossMobPart(this, L"wing", 4, 4) ); - wing2 = shared_ptr( new BossMobPart(this, L"wing", 4, 4) ); + head = std::shared_ptr( new BossMobPart(this, L"head", 6, 6) ); + neck = std::shared_ptr( new BossMobPart(this, L"neck", 6, 6) ); // 4J Added + body = std::shared_ptr( new BossMobPart(this, L"body", 8, 8) ); + tail1 = std::shared_ptr( new BossMobPart(this, L"tail", 4, 4) ); + tail2 = std::shared_ptr( new BossMobPart(this, L"tail", 4, 4) ); + tail3 = std::shared_ptr( new BossMobPart(this, L"tail", 4, 4) ); + wing1 = std::shared_ptr( new BossMobPart(this, L"wing", 4, 4) ); + wing2 = std::shared_ptr( new BossMobPart(this, L"wing", 4, 4) ); subEntities.push_back(head); subEntities.push_back(neck); // 4J Added @@ -440,11 +440,11 @@ void EnderDragon::aiStep() { if( m_actionTicks < (FLAME_TICKS - 10) ) { - vector > *targets = level->getEntities(shared_from_this(), m_acidArea); + vector > *targets = level->getEntities(shared_from_this(), m_acidArea); for( AUTO_VAR(it, targets->begin() ); it != targets->end(); ++it) { - shared_ptr e = dynamic_pointer_cast( *it ); + std::shared_ptr e = dynamic_pointer_cast( *it ); if (e != NULL) { //app.DebugPrintf("Attacking entity with acid\n"); @@ -685,7 +685,7 @@ void EnderDragon::aiStep() // Curls/straightens the tail for (int i = 0; i < 3; i++) { - shared_ptr part = nullptr; + std::shared_ptr part = nullptr; if (i == 0) part = tail1; if (i == 1) part = tail2; @@ -734,7 +734,7 @@ void EnderDragon::aiStep() double zdd = attackTarget->z - startingZ; level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_FIREBALL, (int) x, (int) y, (int) z, 0); - shared_ptr ie = shared_ptr( new DragonFireball(level, dynamic_pointer_cast( shared_from_this() ), xdd, ydd, zdd) ); + std::shared_ptr ie = std::shared_ptr( new DragonFireball(level, dynamic_pointer_cast( shared_from_this() ), xdd, ydd, zdd) ); ie->x = startingX; ie->y = startingY; ie->z = startingZ; @@ -793,14 +793,14 @@ void EnderDragon::checkCrystals() if (random->nextInt(10) == 0) { float maxDist = 32; - vector > *crystals = level->getEntitiesOfClass(typeid(EnderCrystal), bb->grow(maxDist, maxDist, maxDist)); + vector > *crystals = level->getEntitiesOfClass(typeid(EnderCrystal), bb->grow(maxDist, maxDist, maxDist)); - shared_ptr crystal = nullptr; + std::shared_ptr crystal = nullptr; double nearest = Double::MAX_VALUE; //for (Entity ec : crystals) for(AUTO_VAR(it, crystals->begin()); it != crystals->end(); ++it) { - shared_ptr ec = dynamic_pointer_cast( *it ); + std::shared_ptr ec = dynamic_pointer_cast( *it ); double dist = ec->distanceToSqr(shared_from_this() ); if (dist < nearest) { @@ -831,7 +831,7 @@ void EnderDragon::checkAttack() } } -void EnderDragon::knockBack(vector > *entities) +void EnderDragon::knockBack(vector > *entities) { double xm = (body->bb->x0 + body->bb->x1) / 2; // double ym = (body.bb.y0 + body.bb.y1) / 2; @@ -840,7 +840,7 @@ void EnderDragon::knockBack(vector > *entities) //for (Entity e : entities) for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { - shared_ptr e = dynamic_pointer_cast( *it ); + std::shared_ptr e = dynamic_pointer_cast( *it ); if (e != NULL)//(e instanceof Mob) { double xd = e->x - xm; @@ -851,12 +851,12 @@ void EnderDragon::knockBack(vector > *entities) } } -void EnderDragon::hurt(vector > *entities) +void EnderDragon::hurt(vector > *entities) { //for (int i = 0; i < entities->size(); i++) for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { - shared_ptr e = dynamic_pointer_cast( *it );//entities.get(i); + std::shared_ptr e = dynamic_pointer_cast( *it );//entities.get(i); if (e != NULL) //(e instanceof Mob) { DamageSource *damageSource = DamageSource::mobAttack( dynamic_pointer_cast( shared_from_this() )); @@ -868,7 +868,7 @@ void EnderDragon::hurt(vector > *entities) void EnderDragon::findNewTarget() { - shared_ptr playerNearestToEgg = nullptr; + std::shared_ptr playerNearestToEgg = nullptr; // Update current action switch(getSynchedAction()) @@ -1100,7 +1100,7 @@ bool EnderDragon::checkWalls(AABB *bb) return hitWall; } -bool EnderDragon::hurt(shared_ptr bossMobPart, DamageSource *source, int damage) +bool EnderDragon::hurt(std::shared_ptr bossMobPart, DamageSource *source, int damage) { if (bossMobPart != head) { @@ -1193,7 +1193,7 @@ void EnderDragon::tickDeath() { int newCount = ExperienceOrb::getExperienceValue(xpCount); xpCount -= newCount; - level->addEntity(shared_ptr( new ExperienceOrb(level, x, y, z, newCount) )); + level->addEntity(std::shared_ptr( new ExperienceOrb(level, x, y, z, newCount) )); } } if (dragonDeathTime == 1) @@ -1214,7 +1214,7 @@ void EnderDragon::tickDeath() { int newCount = ExperienceOrb::getExperienceValue(xpCount); xpCount -= newCount; - level->addEntity(shared_ptr( new ExperienceOrb(level, x, y, z, newCount))); + level->addEntity(std::shared_ptr( new ExperienceOrb(level, x, y, z, newCount))); } int xo = 5 + random->nextInt(2) * 2 - 1; int zo = 5 + random->nextInt(2) * 2 - 1; @@ -1312,7 +1312,7 @@ void EnderDragon::checkDespawn() { } -vector > *EnderDragon::getSubEntities() +vector > *EnderDragon::getSubEntities() { return &subEntities; } @@ -1435,7 +1435,7 @@ EnderDragon::EEnderdragonAction EnderDragon::getSynchedAction() void EnderDragon::handleCrystalDestroyed(DamageSource *source) { AABB *tempBB = AABB::newTemp(PODIUM_X_POS,84.0,PODIUM_Z_POS,PODIUM_X_POS+1.0,85.0,PODIUM_Z_POS+1.0); - vector > *crystals = level->getEntitiesOfClass(typeid(EnderCrystal), tempBB->grow(48, 40, 48)); + vector > *crystals = level->getEntitiesOfClass(typeid(EnderCrystal), tempBB->grow(48, 40, 48)); m_remainingCrystalsCount = (int)crystals->size() - 1; if(m_remainingCrystalsCount < 0) m_remainingCrystalsCount = 0; delete crystals; diff --git a/Minecraft.World/Entities/Mobs/EnderDragon.h b/Minecraft.World/Entities/Mobs/EnderDragon.h index 8a12c08c7..97a2fab17 100644 --- a/Minecraft.World/Entities/Mobs/EnderDragon.h +++ b/Minecraft.World/Entities/Mobs/EnderDragon.h @@ -28,15 +28,15 @@ public: int posPointer; //BossMobPart[] subEntities; - vector > subEntities; - shared_ptr head; - shared_ptr neck; // 4J Added - shared_ptr body; - shared_ptr tail1; - shared_ptr tail2; - shared_ptr tail3; - shared_ptr wing1; - shared_ptr wing2; + vector > subEntities; + std::shared_ptr head; + std::shared_ptr neck; // 4J Added + std::shared_ptr body; + std::shared_ptr tail1; + std::shared_ptr tail2; + std::shared_ptr tail3; + std::shared_ptr wing1; + std::shared_ptr wing2; float oFlapTime; float flapTime; @@ -99,13 +99,13 @@ private: static const int PODIUM_Z_POS = 0; private: - shared_ptr attackTarget; + std::shared_ptr attackTarget; public: int dragonDeathTime; public: - shared_ptr nearestCrystal; + std::shared_ptr nearestCrystal; private: void _init(); @@ -126,14 +126,14 @@ private: void checkCrystals(); void checkAttack(); - void knockBack(vector > *entities); - void hurt(vector > *entities); + void knockBack(vector > *entities); + void hurt(vector > *entities); void findNewTarget(); float rotWrap(double d); bool checkWalls(AABB *bb); public: - virtual bool hurt(shared_ptr bossMobPart, DamageSource *source, int damage); + virtual bool hurt(std::shared_ptr bossMobPart, DamageSource *source, int damage); protected: virtual void tickDeath(); @@ -145,7 +145,7 @@ protected: virtual void checkDespawn(); virtual int getHurtSound(); public: - virtual vector > *getSubEntities(); + virtual vector > *getSubEntities(); virtual bool isPickable(); virtual int getSynchedHealth(); diff --git a/Minecraft.World/Entities/Mobs/EnderMan.cpp b/Minecraft.World/Entities/Mobs/EnderMan.cpp index 1347a9b9d..da5ae5c69 100644 --- a/Minecraft.World/Entities/Mobs/EnderMan.cpp +++ b/Minecraft.World/Entities/Mobs/EnderMan.cpp @@ -82,16 +82,16 @@ void EnderMan::readAdditionalSaveData(CompoundTag *tag) setCarryingData(tag->getShort(L"carryingData")); } -shared_ptr EnderMan::findAttackTarget() +std::shared_ptr EnderMan::findAttackTarget() { #ifndef _FINAL_BUILD if(app.GetMobsDontAttackEnabled()) { - return shared_ptr(); + return std::shared_ptr(); } #endif - shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 64); + std::shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 64); if (player != NULL) { if (isLookingAtMe(player)) @@ -111,9 +111,9 @@ shared_ptr EnderMan::findAttackTarget() return nullptr; } -bool EnderMan::isLookingAtMe(shared_ptr player) +bool EnderMan::isLookingAtMe(std::shared_ptr player) { - shared_ptr helmet = player->inventory->armor[3]; + std::shared_ptr helmet = player->inventory->armor[3]; if (helmet != NULL && helmet->id == Tile::pumpkin_Id) return false; Vec3 *look = player->getViewVector(1)->normalize(); @@ -249,7 +249,7 @@ bool EnderMan::teleport() return teleport(xx, yy, zz); } -bool EnderMan::teleportTowards(shared_ptr e) +bool EnderMan::teleportTowards(std::shared_ptr e) { Vec3 *dir = Vec3::newTemp(x - e->x, bb->y0 + bbHeight / 2 - e->y + e->getHeadHeight(), z - e->z); dir = dir->normalize(); diff --git a/Minecraft.World/Entities/Mobs/EnderMan.h b/Minecraft.World/Entities/Mobs/EnderMan.h index e9c76fe07..a33077352 100644 --- a/Minecraft.World/Entities/Mobs/EnderMan.h +++ b/Minecraft.World/Entities/Mobs/EnderMan.h @@ -33,17 +33,17 @@ public: virtual void readAdditionalSaveData(CompoundTag *tag); protected: - virtual shared_ptr findAttackTarget(); + virtual std::shared_ptr findAttackTarget(); private: - bool isLookingAtMe(shared_ptr player); + bool isLookingAtMe(std::shared_ptr player); public: virtual void aiStep(); protected: bool teleport(); - bool teleportTowards(shared_ptr e); + bool teleportTowards(std::shared_ptr e); bool teleport(double xx, double yy, double zz); virtual int getAmbientSound(); diff --git a/Minecraft.World/Entities/Mobs/ExperienceOrb.cpp b/Minecraft.World/Entities/Mobs/ExperienceOrb.cpp index 5bceb80d4..078d57a45 100644 --- a/Minecraft.World/Entities/Mobs/ExperienceOrb.cpp +++ b/Minecraft.World/Entities/Mobs/ExperienceOrb.cpp @@ -187,7 +187,7 @@ void ExperienceOrb::readAdditionalSaveData(CompoundTag *tag) value = tag->getShort(L"Value"); } -void ExperienceOrb::playerTouch(shared_ptr player) +void ExperienceOrb::playerTouch(std::shared_ptr player) { if (level->isClientSide) return; diff --git a/Minecraft.World/Entities/Mobs/ExperienceOrb.h b/Minecraft.World/Entities/Mobs/ExperienceOrb.h index 4fad1b001..581dfdcb4 100644 --- a/Minecraft.World/Entities/Mobs/ExperienceOrb.h +++ b/Minecraft.World/Entities/Mobs/ExperienceOrb.h @@ -20,7 +20,7 @@ public: private: int health; int value; - shared_ptr followingPlayer; + std::shared_ptr followingPlayer; int followingTime; void _init(); @@ -49,7 +49,7 @@ public: virtual bool hurt(DamageSource *source, int damage); virtual void addAdditonalSaveData(CompoundTag *entityTag); virtual void readAdditionalSaveData(CompoundTag *tag); - virtual void playerTouch(shared_ptr player); + virtual void playerTouch(std::shared_ptr player); int getValue(); int getIcon(); diff --git a/Minecraft.World/Entities/Mobs/EyeOfEnderSignal.cpp b/Minecraft.World/Entities/Mobs/EyeOfEnderSignal.cpp index 604a9498b..8f216a7a0 100644 --- a/Minecraft.World/Entities/Mobs/EyeOfEnderSignal.cpp +++ b/Minecraft.World/Entities/Mobs/EyeOfEnderSignal.cpp @@ -167,7 +167,7 @@ void EyeOfEnderSignal::tick() remove(); if (surviveAfterDeath) { - level->addEntity(shared_ptr( new ItemEntity(level, x, y, z, shared_ptr(new ItemInstance(Item::eyeOfEnder))))); + level->addEntity(std::shared_ptr( new ItemEntity(level, x, y, z, std::shared_ptr(new ItemInstance(Item::eyeOfEnder))))); } else { diff --git a/Minecraft.World/Entities/Mobs/Fireball.cpp b/Minecraft.World/Entities/Mobs/Fireball.cpp index c85ce000f..fbb3ce85b 100644 --- a/Minecraft.World/Entities/Mobs/Fireball.cpp +++ b/Minecraft.World/Entities/Mobs/Fireball.cpp @@ -84,7 +84,7 @@ Fireball::Fireball(Level *level, double x, double y, double z, double xa, double } } -Fireball::Fireball(Level *level, shared_ptr mob, double xa, double ya, double za) : Entity ( level ) +Fireball::Fireball(Level *level, std::shared_ptr mob, double xa, double ya, double za) : Entity ( level ) { // 4J Stu - This function call had to be moved here from the Entity ctor to ensure that // the derived version of the function is called @@ -197,13 +197,13 @@ void Fireball::tick() { to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z); } - shared_ptr hitEntity = nullptr; - vector > *objects = level->getEntities(shared_from_this(), this->bb->expand(xd, yd, zd)->grow(1, 1, 1)); + std::shared_ptr hitEntity = nullptr; + vector > *objects = level->getEntities(shared_from_this(), this->bb->expand(xd, yd, zd)->grow(1, 1, 1)); double nearest = 0; AUTO_VAR(itEnd, objects->end()); for (AUTO_VAR(it, objects->begin()); it != itEnd; it++) { - shared_ptr e = *it; //objects->at(i); + std::shared_ptr e = *it; //objects->at(i); if (!e->isPickable() || (e->is(owner) )) continue; //4J Stu - Never collide with the owner (Enderdragon) // && flightTime < 25)) continue; float rr = 0.3f; @@ -374,7 +374,7 @@ bool Fireball::hurt(DamageSource *source, int damage) yPower = yd * 0.1; zPower = zd * 0.1; } - shared_ptr mob = dynamic_pointer_cast( source->getEntity() ); + std::shared_ptr mob = dynamic_pointer_cast( source->getEntity() ); if (mob != NULL) { owner = mob; diff --git a/Minecraft.World/Entities/Mobs/Fireball.h b/Minecraft.World/Entities/Mobs/Fireball.h index 8fe3d0292..32e55d7b3 100644 --- a/Minecraft.World/Entities/Mobs/Fireball.h +++ b/Minecraft.World/Entities/Mobs/Fireball.h @@ -22,7 +22,7 @@ private: bool inGround; public: - shared_ptr owner; + std::shared_ptr owner; private: int life; @@ -43,7 +43,7 @@ public: virtual bool shouldRenderAtSqrDistance(double distance); Fireball(Level *level, double x, double y, double z, double xa, double ya, double za); - Fireball(Level *level, shared_ptr mob, double xa, double ya, double za); + Fireball(Level *level, std::shared_ptr mob, double xa, double ya, double za); public: virtual void tick(); diff --git a/Minecraft.World/Entities/Mobs/FishingHook.cpp b/Minecraft.World/Entities/Mobs/FishingHook.cpp index c42f59d57..c3f6cb030 100644 --- a/Minecraft.World/Entities/Mobs/FishingHook.cpp +++ b/Minecraft.World/Entities/Mobs/FishingHook.cpp @@ -52,7 +52,7 @@ FishingHook::FishingHook(Level *level) : Entity( level ) _init(); } -FishingHook::FishingHook(Level *level, double x, double y, double z, shared_ptr owner) : Entity( level ) +FishingHook::FishingHook(Level *level, double x, double y, double z, std::shared_ptr owner) : Entity( level ) { _init(); @@ -63,7 +63,7 @@ FishingHook::FishingHook(Level *level, double x, double y, double z, shared_ptr< setPos(x, y, z); } -FishingHook::FishingHook(Level *level, shared_ptr mob) : Entity( level ) +FishingHook::FishingHook(Level *level, std::shared_ptr mob) : Entity( level ) { _init(); @@ -172,7 +172,7 @@ void FishingHook::tick() if (!level->isClientSide) { - shared_ptr selectedItem = owner->getSelectedItem(); + std::shared_ptr selectedItem = owner->getSelectedItem(); if (owner->removed || !owner->isAlive() || selectedItem == NULL || selectedItem->getItem() != Item::fishingRod || this->distanceToSqr(owner) > 32 * 32) { remove(); @@ -230,13 +230,13 @@ void FishingHook::tick() { to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z); } - shared_ptr hitEntity = nullptr; - vector > *objects = level->getEntities(shared_from_this(), this->bb->expand(xd, yd, zd)->grow(1, 1, 1)); + std::shared_ptr hitEntity = nullptr; + vector > *objects = level->getEntities(shared_from_this(), this->bb->expand(xd, yd, zd)->grow(1, 1, 1)); double nearest = 0; AUTO_VAR(itEnd, objects->end()); for (AUTO_VAR(it, objects->begin()); it != itEnd; it++) { - shared_ptr e = *it; // objects->at(i); + std::shared_ptr e = *it; // objects->at(i); if (!e->isPickable() || (e == owner && flightTime < 5)) continue; float rr = 0.3f; @@ -421,7 +421,7 @@ int FishingHook::retrieve() } else if (nibble > 0) { - shared_ptr ie = shared_ptr( new ItemEntity(this->Entity::level, x, y, z, shared_ptr( new ItemInstance(Item::fish_raw) ) ) ); + std::shared_ptr ie = std::shared_ptr( new ItemEntity(this->Entity::level, x, y, z, std::shared_ptr( new ItemInstance(Item::fish_raw) ) ) ); double xa = owner->x - x; double ya = owner->y - y; double za = owner->z - z; @@ -432,7 +432,7 @@ int FishingHook::retrieve() ie->Entity::yd = ya * speed + sqrt(dist) * 0.08; ie->Entity::zd = za * speed; level->addEntity(ie); - owner->level->addEntity( shared_ptr( new ExperienceOrb(owner->level, owner->x, owner->y + 0.5f, owner->z + 0.5f, random->nextInt(3) + 1) ) ); // 4J Stu brought forward from 1.4 + owner->level->addEntity( std::shared_ptr( new ExperienceOrb(owner->level, owner->x, owner->y + 0.5f, owner->z + 0.5f, random->nextInt(3) + 1) ) ); // 4J Stu brought forward from 1.4 dmg = 1; } if (inGround) dmg = 2; diff --git a/Minecraft.World/Entities/Mobs/FishingHook.h b/Minecraft.World/Entities/Mobs/FishingHook.h index 5215a830f..cb74cf8ed 100644 --- a/Minecraft.World/Entities/Mobs/FishingHook.h +++ b/Minecraft.World/Entities/Mobs/FishingHook.h @@ -19,7 +19,7 @@ private: public: int shakeTime; - shared_ptr owner; + std::shared_ptr owner; private: int life; @@ -27,15 +27,15 @@ private: int nibble; public: - shared_ptr hookedIn; + std::shared_ptr hookedIn; private: void _init(); public: FishingHook(Level *level); - FishingHook(Level *level, double x, double y, double z, shared_ptr owner); - FishingHook(Level *level, shared_ptr mob); + FishingHook(Level *level, double x, double y, double z, std::shared_ptr owner); + FishingHook(Level *level, std::shared_ptr mob); protected: virtual void defineSynchedData(); diff --git a/Minecraft.World/Entities/Mobs/Ghast.cpp b/Minecraft.World/Entities/Mobs/Ghast.cpp index 1bdc76fd4..ca4893ce5 100644 --- a/Minecraft.World/Entities/Mobs/Ghast.cpp +++ b/Minecraft.World/Entities/Mobs/Ghast.cpp @@ -49,7 +49,7 @@ bool Ghast::hurt(DamageSource *source, int dmg) { if (source->getMsgId() == ChatPacket::e_ChatDeathFireball) { - shared_ptr player = dynamic_pointer_cast( source->getEntity() ); + std::shared_ptr player = dynamic_pointer_cast( source->getEntity() ); if (player != NULL) { // reflected fireball, kill the ghast @@ -151,7 +151,7 @@ void Ghast::serverAiStep() { // 4J - change brought forward from 1.2.3 level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_FIREBALL, (int) x, (int) y, (int) z, 0); - shared_ptr ie = shared_ptr( new Fireball(level, dynamic_pointer_cast( shared_from_this() ), xdd, ydd, zdd) ); + std::shared_ptr ie = std::shared_ptr( new Fireball(level, dynamic_pointer_cast( shared_from_this() ), xdd, ydd, zdd) ); double d = 4; Vec3 *v = getViewVector(1); ie->x = x + v->x * d; diff --git a/Minecraft.World/Entities/Mobs/Ghast.h b/Minecraft.World/Entities/Mobs/Ghast.h index 325362592..9602e7272 100644 --- a/Minecraft.World/Entities/Mobs/Ghast.h +++ b/Minecraft.World/Entities/Mobs/Ghast.h @@ -21,7 +21,7 @@ public: double xTarget, yTarget, zTarget; private: - shared_ptr target; + std::shared_ptr target; int retargetTime; public: diff --git a/Minecraft.World/Entities/Mobs/ItemFrame.cpp b/Minecraft.World/Entities/Mobs/ItemFrame.cpp index 73361dc15..13bf5f37b 100644 --- a/Minecraft.World/Entities/Mobs/ItemFrame.cpp +++ b/Minecraft.World/Entities/Mobs/ItemFrame.cpp @@ -41,25 +41,25 @@ void ItemFrame::defineSynchedData() void ItemFrame::dropItem() { - spawnAtLocation(shared_ptr(new ItemInstance(Item::frame)), 0.0f); - shared_ptr item = getItem(); + spawnAtLocation(std::shared_ptr(new ItemInstance(Item::frame)), 0.0f); + std::shared_ptr item = getItem(); if (item != NULL) { - shared_ptr data = Item::map->getSavedData(item, level); + std::shared_ptr data = Item::map->getSavedData(item, level); data->removeItemFrameDecoration(item); - shared_ptr itemToDrop = item->copy(); + std::shared_ptr itemToDrop = item->copy(); itemToDrop->setFramed(nullptr); spawnAtLocation(itemToDrop, 0.0f); } } -shared_ptr ItemFrame::getItem() +std::shared_ptr ItemFrame::getItem() { return getEntityData()->getItemInstance(DATA_ITEM); } -void ItemFrame::setItem(shared_ptr item) +void ItemFrame::setItem(std::shared_ptr item) { if(item != NULL) { @@ -106,7 +106,7 @@ void ItemFrame::readAdditionalSaveData(CompoundTag *tag) HangingEntity::readAdditionalSaveData(tag); } -bool ItemFrame::interact(shared_ptr player) +bool ItemFrame::interact(std::shared_ptr player) { if(!player->isAllowedToInteract(shared_from_this())) { @@ -115,7 +115,7 @@ bool ItemFrame::interact(shared_ptr player) if (getItem() == NULL) { - shared_ptr item = player->getCarriedItem(); + std::shared_ptr item = player->getCarriedItem(); if (item != NULL) { diff --git a/Minecraft.World/Entities/Mobs/ItemFrame.h b/Minecraft.World/Entities/Mobs/ItemFrame.h index 63ed5bfb2..13a2b1e45 100644 --- a/Minecraft.World/Entities/Mobs/ItemFrame.h +++ b/Minecraft.World/Entities/Mobs/ItemFrame.h @@ -30,12 +30,12 @@ protected: public: - shared_ptr getItem(); - void setItem(shared_ptr item); + std::shared_ptr getItem(); + void setItem(std::shared_ptr item); int getRotation(); void setRotation(int rotation); virtual void addAdditonalSaveData(CompoundTag *tag); virtual void readAdditionalSaveData(CompoundTag *tag); - virtual bool interact(shared_ptr player); + virtual bool interact(std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/Mobs/LavaSlime.cpp b/Minecraft.World/Entities/Mobs/LavaSlime.cpp index 388667063..9e4735356 100644 --- a/Minecraft.World/Entities/Mobs/LavaSlime.cpp +++ b/Minecraft.World/Entities/Mobs/LavaSlime.cpp @@ -48,9 +48,9 @@ ePARTICLE_TYPE LavaSlime::getParticleName() return eParticleType_flame; } -shared_ptr LavaSlime::createChild() +std::shared_ptr LavaSlime::createChild() { - return shared_ptr( new LavaSlime(level) ); + return std::shared_ptr( new LavaSlime(level) ); } int LavaSlime::getDeathLoot() diff --git a/Minecraft.World/Entities/Mobs/LavaSlime.h b/Minecraft.World/Entities/Mobs/LavaSlime.h index 08857ca92..8a2e5db9b 100644 --- a/Minecraft.World/Entities/Mobs/LavaSlime.h +++ b/Minecraft.World/Entities/Mobs/LavaSlime.h @@ -20,7 +20,7 @@ public: protected: virtual ePARTICLE_TYPE getParticleName(); - virtual shared_ptr createChild(); + virtual std::shared_ptr createChild(); virtual int getDeathLoot(); virtual void dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel); diff --git a/Minecraft.World/Entities/Mobs/LightningBolt.cpp b/Minecraft.World/Entities/Mobs/LightningBolt.cpp index d9847c34f..76193141c 100644 --- a/Minecraft.World/Entities/Mobs/LightningBolt.cpp +++ b/Minecraft.World/Entities/Mobs/LightningBolt.cpp @@ -105,11 +105,11 @@ void LightningBolt::tick() // 4J - added clientside check if( !level->isClientSide ) { - vector > *entities = level->getEntities(shared_from_this(), AABB::newTemp(x - r, y - r, z - r, x + r, y + 6 + r, z + r)); + vector > *entities = level->getEntities(shared_from_this(), AABB::newTemp(x - r, y - r, z - r, x + r, y + 6 + r, z + r)); AUTO_VAR(itEnd, entities->end()); for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { - shared_ptr e = (*it); //entities->at(i); + std::shared_ptr e = (*it); //entities->at(i); e->thunderHit(this); } } diff --git a/Minecraft.World/Entities/Mobs/Minecart.cpp b/Minecraft.World/Entities/Mobs/Minecart.cpp index 0b371c89f..6ddcd4e14 100644 --- a/Minecraft.World/Entities/Mobs/Minecart.cpp +++ b/Minecraft.World/Entities/Mobs/Minecart.cpp @@ -135,7 +135,7 @@ void Minecart::defineSynchedData() } -AABB *Minecart::getCollideAgainstBox(shared_ptr entity) +AABB *Minecart::getCollideAgainstBox(std::shared_ptr entity) { return entity->bb; } @@ -183,7 +183,7 @@ bool Minecart::hurt(DamageSource *source, int hurtDamage) // Untrusted players shouldn't be able to damage minecarts or boats. if (dynamic_cast(source) != NULL) { - shared_ptr attacker = source->getDirectEntity(); + std::shared_ptr attacker = source->getDirectEntity(); if (dynamic_pointer_cast(attacker) != NULL && !dynamic_pointer_cast(attacker)->isAllowedToHurtEntity( shared_from_this() )) @@ -200,7 +200,7 @@ bool Minecart::hurt(DamageSource *source, int hurtDamage) if( rider.lock() != NULL && rider.lock() == source->getEntity() ) hurtDamage += 1; // 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 - shared_ptr player = dynamic_pointer_cast(source->getEntity()); + std::shared_ptr player = dynamic_pointer_cast(source->getEntity()); if (player != NULL && player->abilities.instabuild) this->setDamage(100); this->setDamage(getDamage() + (hurtDamage * 10)); @@ -213,10 +213,10 @@ bool Minecart::hurt(DamageSource *source, int hurtDamage) spawnAtLocation(Item::minecart->id, 1, 0); if (type == Minecart::CHEST) { - shared_ptr container = dynamic_pointer_cast( shared_from_this() ); + std::shared_ptr container = dynamic_pointer_cast( shared_from_this() ); for (unsigned int i = 0; i < container->getContainerSize(); i++) { - shared_ptr item = container->getItem(i); + std::shared_ptr item = container->getItem(i); if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; @@ -229,7 +229,7 @@ bool Minecart::hurt(DamageSource *source, int hurtDamage) if (count > item->count) count = item->count; item->count -= count; - shared_ptr itemEntity = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ) ) ); + std::shared_ptr itemEntity = std::shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, std::shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ) ) ); float pow = 0.05f; itemEntity->xd = (float) random->nextGaussian() * pow; itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; @@ -268,7 +268,7 @@ void Minecart::remove() { for (unsigned int i = 0; i < getContainerSize(); i++) { - shared_ptr item = getItem(i); + std::shared_ptr item = getItem(i); if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; @@ -281,7 +281,7 @@ void Minecart::remove() if (count > item->count) count = item->count; item->count -= count; - shared_ptr itemEntity = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ) ) ); + std::shared_ptr itemEntity = std::shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, std::shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ) ) ); float pow = 0.05f; itemEntity->xd = (float) random->nextGaussian() * pow; itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; @@ -408,7 +408,7 @@ void Minecart::tick() xd = pow * xD / dd; zd = pow * zD / dd; - shared_ptr sharedRider = rider.lock(); + std::shared_ptr sharedRider = rider.lock(); if (sharedRider != NULL) { double riderDist = (sharedRider->xd * sharedRider->xd + sharedRider->zd * sharedRider->zd); @@ -667,16 +667,16 @@ void Minecart::tick() // if (!level->isClientSide) { { - vector > *entities = level->getEntities(shared_from_this(), this->bb->grow(0.2f, 0, 0.2f)); + vector > *entities = level->getEntities(shared_from_this(), this->bb->grow(0.2f, 0, 0.2f)); if (entities != NULL && !entities->empty()) { AUTO_VAR(itEnd, entities->end()); for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { - shared_ptr e = (*it); //entities->at(i); + std::shared_ptr e = (*it); //entities->at(i); if (e != rider.lock() && e->isPushable() && e->GetType() == eTYPE_MINECART) { - shared_ptr cart = dynamic_pointer_cast(e); + std::shared_ptr cart = dynamic_pointer_cast(e); cart->m_bHasPushedCartThisTick = false; cart->push(shared_from_this()); @@ -887,7 +887,7 @@ void Minecart::readAdditionalSaveData(CompoundTag *base) { CompoundTag *tag = inventoryList->get(i); unsigned int slot = tag->getByte(L"Slot") & 0xff; - if (slot >= 0 && slot < items->length) (*items)[slot] = shared_ptr( ItemInstance::fromTag(tag) ); + if (slot >= 0 && slot < items->length) (*items)[slot] = std::shared_ptr( ItemInstance::fromTag(tag) ); } } } @@ -898,7 +898,7 @@ float Minecart::getShadowHeightOffs() return 0; } -void Minecart::push(shared_ptr e) +void Minecart::push(std::shared_ptr e) { if (level->isClientSide) return; @@ -952,7 +952,7 @@ void Minecart::push(shared_ptr e) double xdd = (e->xd + xd); double zdd = (e->zd + zd); - shared_ptr cart = dynamic_pointer_cast(e); + std::shared_ptr cart = dynamic_pointer_cast(e); if (cart != NULL && cart->type == Minecart::FURNACE && type != Minecart::FURNACE) { xd *= 0.2f; @@ -1015,24 +1015,24 @@ unsigned int Minecart::getContainerSize() return 9 * 3; } -shared_ptr Minecart::getItem(unsigned int slot) +std::shared_ptr Minecart::getItem(unsigned int slot) { return (*items)[slot]; } -shared_ptr Minecart::removeItem(unsigned int slot, int count) +std::shared_ptr Minecart::removeItem(unsigned int slot, int count) { if ( (*items)[slot] != NULL) { if ( (*items)[slot]->count <= count) { - shared_ptr item = (*items)[slot]; + std::shared_ptr item = (*items)[slot]; (*items)[slot] = nullptr; return item; } else { - shared_ptr i = (*items)[slot]->remove(count); + std::shared_ptr i = (*items)[slot]->remove(count); if ((*items)[slot]->count == 0) (*items)[slot] = nullptr; return i; } @@ -1040,18 +1040,18 @@ shared_ptr Minecart::removeItem(unsigned int slot, int count) return nullptr; } -shared_ptr Minecart::removeItemNoUpdate(int slot) +std::shared_ptr Minecart::removeItemNoUpdate(int slot) { if ( (*items)[slot] != NULL) { - shared_ptr item = (*items)[slot]; + std::shared_ptr item = (*items)[slot]; (*items)[slot] = nullptr; return item; } return nullptr; } -void Minecart::setItem(unsigned int slot, shared_ptr item) +void Minecart::setItem(unsigned int slot, std::shared_ptr item) { (*items)[slot] = item; if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); @@ -1071,7 +1071,7 @@ void Minecart::setChanged() { } -bool Minecart::interact(shared_ptr player) +bool Minecart::interact(std::shared_ptr player) { if (type == Minecart::RIDEABLE) { @@ -1096,7 +1096,7 @@ bool Minecart::interact(shared_ptr player) } else if (type == Minecart::FURNACE) { - shared_ptr selected = player->inventory->getSelected(); + std::shared_ptr selected = player->inventory->getSelected(); if (selected != NULL && selected->id == Item::coal->id) { if (--selected->count == 0) player->inventory->setItem(player->inventory->selected, nullptr); @@ -1142,7 +1142,7 @@ void Minecart::lerpMotion(double xd, double yd, double zd) lzd = this->zd = zd; } -bool Minecart::stillValid(shared_ptr player) +bool Minecart::stillValid(std::shared_ptr player) { if (this->removed) return false; if (player->distanceToSqr(shared_from_this()) > 8 * 8) return false; diff --git a/Minecraft.World/Entities/Mobs/Minecart.h b/Minecraft.World/Entities/Mobs/Minecart.h index 95c416fae..ac42944d1 100644 --- a/Minecraft.World/Entities/Mobs/Minecart.h +++ b/Minecraft.World/Entities/Mobs/Minecart.h @@ -49,7 +49,7 @@ protected: virtual void defineSynchedData(); public: - virtual AABB *getCollideAgainstBox(shared_ptr entity); + virtual AABB *getCollideAgainstBox(std::shared_ptr entity); virtual AABB *getCollideBox(); virtual bool isPushable(); @@ -75,16 +75,16 @@ protected: public: virtual float getShadowHeightOffs(); - virtual void push(shared_ptr e); + virtual void push(std::shared_ptr e); virtual unsigned int getContainerSize(); - virtual shared_ptr getItem(unsigned int slot); - virtual shared_ptr removeItem(unsigned int slot, int count); - virtual shared_ptr removeItemNoUpdate(int slot); - virtual void setItem(unsigned int slot, shared_ptr item); + virtual std::shared_ptr getItem(unsigned int slot); + virtual std::shared_ptr removeItem(unsigned int slot, int count); + virtual std::shared_ptr removeItemNoUpdate(int slot); + virtual void setItem(unsigned int slot, std::shared_ptr item); int getName(); virtual int getMaxStackSize(); virtual void setChanged(); - virtual bool interact(shared_ptr player); + virtual bool interact(std::shared_ptr player); virtual float getLootContent(); private: @@ -95,7 +95,7 @@ private: public: virtual void lerpTo(double x, double y, double z, float yRot, float xRot, int steps); virtual void lerpMotion(double xd, double yd, double zd); - virtual bool stillValid(shared_ptr player); + virtual bool stillValid(std::shared_ptr player); protected: bool hasFuel(); diff --git a/Minecraft.World/Entities/Mobs/MushroomCow.cpp b/Minecraft.World/Entities/Mobs/MushroomCow.cpp index 5ab568b96..71985b333 100644 --- a/Minecraft.World/Entities/Mobs/MushroomCow.cpp +++ b/Minecraft.World/Entities/Mobs/MushroomCow.cpp @@ -20,18 +20,18 @@ MushroomCow::MushroomCow(Level *level) : Cow(level) this->setSize(0.9f, 1.3f); } -bool MushroomCow::interact(shared_ptr player) +bool MushroomCow::interact(std::shared_ptr player) { - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); if (item != NULL && item->id == Item::bowl_Id && getAge() >= 0) { if (item->count == 1) { - player->inventory->setItem(player->inventory->selected, shared_ptr( new ItemInstance(Item::mushroomStew) ) ); + player->inventory->setItem(player->inventory->selected, std::shared_ptr( new ItemInstance(Item::mushroomStew) ) ); return true; } - if (player->inventory->add(shared_ptr(new ItemInstance(Item::mushroomStew))) && !player->abilities.instabuild) + if (player->inventory->add(std::shared_ptr(new ItemInstance(Item::mushroomStew))) && !player->abilities.instabuild) { player->inventory->removeItem(player->inventory->selected, 1); return true; @@ -45,14 +45,14 @@ bool MushroomCow::interact(shared_ptr player) { // 4J Stu - We don't need to check spawn limits when adding the new cow, as we are removing the MushroomCow remove(); - shared_ptr cow = shared_ptr( new Cow(level) ); + std::shared_ptr cow = std::shared_ptr( new Cow(level) ); cow->moveTo(x, y, z, yRot, xRot); cow->setHealth(getHealth()); cow->yBodyRot = yBodyRot; level->addEntity(cow); for (int i = 0; i < 5; i++) { - level->addEntity( shared_ptr( new ItemEntity(level, x, y + bbHeight, z, shared_ptr( new ItemInstance(Tile::mushroom2))) )); + level->addEntity( std::shared_ptr( new ItemEntity(level, x, y + bbHeight, z, std::shared_ptr( new ItemInstance(Tile::mushroom2))) )); } return true; } @@ -70,12 +70,12 @@ bool MushroomCow::canSpawn() return ( level->getTile(xt, yt - 1, zt) == Tile::grass_Id || level->getTile(xt, yt - 1, zt) == Tile::mycel_Id ) && level->getDaytimeRawBrightness(xt, yt, zt) > 8 && PathfinderMob::canSpawn(); } -shared_ptr MushroomCow::getBreedOffspring(shared_ptr target) +std::shared_ptr MushroomCow::getBreedOffspring(std::shared_ptr target) { // 4J - added limit to number of animals that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - return shared_ptr( new MushroomCow(level) ); + return std::shared_ptr( new MushroomCow(level) ); } else { diff --git a/Minecraft.World/Entities/Mobs/MushroomCow.h b/Minecraft.World/Entities/Mobs/MushroomCow.h index 4ec974761..27bc9e35e 100644 --- a/Minecraft.World/Entities/Mobs/MushroomCow.h +++ b/Minecraft.World/Entities/Mobs/MushroomCow.h @@ -11,7 +11,7 @@ public: public: MushroomCow(Level *level); - virtual bool interact(shared_ptr player); + virtual bool interact(std::shared_ptr player); virtual bool canSpawn(); // 4J added - virtual shared_ptr getBreedOffspring(shared_ptr target); + virtual std::shared_ptr getBreedOffspring(std::shared_ptr target); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/Mobs/Ocelot.cpp b/Minecraft.World/Entities/Mobs/Ocelot.cpp index d1f17c7ef..f6355f5dc 100644 --- a/Minecraft.World/Entities/Mobs/Ocelot.cpp +++ b/Minecraft.World/Entities/Mobs/Ocelot.cpp @@ -184,7 +184,7 @@ int Ozelot::getDeathLoot() return Item::leather_Id; } -bool Ozelot::doHurtTarget(shared_ptr target) +bool Ozelot::doHurtTarget(std::shared_ptr target) { return target->hurt(DamageSource::mobAttack(dynamic_pointer_cast(shared_from_this())), 3); } @@ -199,9 +199,9 @@ void Ozelot::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) { } -bool Ozelot::interact(shared_ptr player) +bool Ozelot::interact(std::shared_ptr player) { - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); if (isTame()) { if (equalsIgnoreCase(player->getUUID(), getOwnerUUID())) @@ -250,12 +250,12 @@ bool Ozelot::interact(shared_ptr player) return TamableAnimal::interact(player); } -shared_ptr Ozelot::getBreedOffspring(shared_ptr target) +std::shared_ptr Ozelot::getBreedOffspring(std::shared_ptr target) { // 4J - added limit to number of animals that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - shared_ptr offspring = shared_ptr( new Ozelot(level) ); + std::shared_ptr offspring = std::shared_ptr( new Ozelot(level) ); if (isTame()) { offspring->setOwnerUUID(getOwnerUUID()); @@ -270,17 +270,17 @@ shared_ptr Ozelot::getBreedOffspring(shared_ptr target) } } -bool Ozelot::isFood(shared_ptr itemInstance) +bool Ozelot::isFood(std::shared_ptr itemInstance) { return itemInstance != NULL && itemInstance->id == Item::fish_raw_Id; } -bool Ozelot::canMate(shared_ptr animal) +bool Ozelot::canMate(std::shared_ptr animal) { if (animal == shared_from_this()) return false; if (!isTame()) return false; - shared_ptr partner = dynamic_pointer_cast(animal); + std::shared_ptr partner = dynamic_pointer_cast(animal); if (partner == NULL) return false; if (!partner->isTame()) return false; diff --git a/Minecraft.World/Entities/Mobs/Ocelot.h b/Minecraft.World/Entities/Mobs/Ocelot.h index 2ee29e66b..8ca188331 100644 --- a/Minecraft.World/Entities/Mobs/Ocelot.h +++ b/Minecraft.World/Entities/Mobs/Ocelot.h @@ -58,17 +58,17 @@ protected: virtual int getDeathLoot(); public: - virtual bool doHurtTarget(shared_ptr target); + virtual bool doHurtTarget(std::shared_ptr target); virtual bool hurt(DamageSource *source, int dmg); protected: virtual void dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel); public: - virtual bool interact(shared_ptr player); - virtual shared_ptr getBreedOffspring(shared_ptr target); - virtual bool isFood(shared_ptr itemInstance); - virtual bool canMate(shared_ptr animal); + virtual bool interact(std::shared_ptr player); + virtual std::shared_ptr getBreedOffspring(std::shared_ptr target); + virtual bool isFood(std::shared_ptr itemInstance); + virtual bool canMate(std::shared_ptr animal); virtual int getCatType(); virtual void setCatType(int type); virtual bool canSpawn(); diff --git a/Minecraft.World/Entities/Mobs/Painting.cpp b/Minecraft.World/Entities/Mobs/Painting.cpp index 5752f6673..ba31f5140 100644 --- a/Minecraft.World/Entities/Mobs/Painting.cpp +++ b/Minecraft.World/Entities/Mobs/Painting.cpp @@ -73,7 +73,7 @@ Painting::Painting(Level *level, int xTile, int yTile, int zTile, int dir) : Han // 4J Stu - If you use this ctor, then you need to call the PaintingPostConstructor } -// 4J Stu - Added this so that we can use some shared_ptr functions that were needed in the ctor +// 4J Stu - Added this so that we can use some std::shared_ptr functions that were needed in the ctor void Painting::PaintingPostConstructor(int dir) { vector *survivableMotives = new vector(); @@ -144,5 +144,5 @@ int Painting::getHeight() void Painting::dropItem() { - spawnAtLocation(shared_ptr(new ItemInstance(Item::painting)), 0.0f); + spawnAtLocation(std::shared_ptr(new ItemInstance(Item::painting)), 0.0f); } \ No newline at end of file diff --git a/Minecraft.World/Entities/Mobs/Painting.h b/Minecraft.World/Entities/Mobs/Painting.h index 6fd5ed3ef..7c986a01e 100644 --- a/Minecraft.World/Entities/Mobs/Painting.h +++ b/Minecraft.World/Entities/Mobs/Painting.h @@ -87,7 +87,7 @@ public: Painting(Level *level, int xTile, int yTile, int zTile, int dir); Painting(Level *level, int x, int y, int z, int dir, wstring motiveName); - // 4J Stu - Added this so that we can use some shared_ptr functions that were needed in the ctor + // 4J Stu - Added this so that we can use some std::shared_ptr functions that were needed in the ctor void PaintingPostConstructor(int dir); protected: diff --git a/Minecraft.World/Entities/Mobs/Pig.cpp b/Minecraft.World/Entities/Mobs/Pig.cpp index 5a1592c5b..de8a2f599 100644 --- a/Minecraft.World/Entities/Mobs/Pig.cpp +++ b/Minecraft.World/Entities/Mobs/Pig.cpp @@ -56,7 +56,7 @@ int Pig::getMaxHealth() bool Pig::canBeControlledByRider() { - shared_ptr item = dynamic_pointer_cast(rider.lock())->getCarriedItem(); + std::shared_ptr item = dynamic_pointer_cast(rider.lock())->getCarriedItem(); return item != NULL && item->id == Item::carrotOnAStick_Id; } @@ -94,7 +94,7 @@ int Pig::getDeathSound() return eSoundType_MOB_PIG_DEATH; } -bool Pig::interact(shared_ptr player) +bool Pig::interact(std::shared_ptr player) { if(!Animal::interact(player)) { @@ -153,7 +153,7 @@ void Pig::setSaddle(bool value) void Pig::thunderHit(const LightningBolt *lightningBolt) { if (level->isClientSide) return; - shared_ptr pz = shared_ptr( new PigZombie(level) ); + std::shared_ptr pz = std::shared_ptr( new PigZombie(level) ); pz->moveTo(x, y, z, yRot, xRot); level->addEntity(pz); remove(); @@ -168,12 +168,12 @@ void Pig::causeFallDamage(float distance) } } -shared_ptr Pig::getBreedOffspring(shared_ptr target) +std::shared_ptr Pig::getBreedOffspring(std::shared_ptr target) { // 4J - added limit to number of animals that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - return shared_ptr( new Pig(level) ); + return std::shared_ptr( new Pig(level) ); } else { @@ -181,7 +181,7 @@ shared_ptr Pig::getBreedOffspring(shared_ptr target) } } -bool Pig::isFood(shared_ptr itemInstance) +bool Pig::isFood(std::shared_ptr itemInstance) { return itemInstance != NULL && itemInstance->id == Item::carrots_Id; } diff --git a/Minecraft.World/Entities/Mobs/Pig.h b/Minecraft.World/Entities/Mobs/Pig.h index adcfbf4e3..34695b745 100644 --- a/Minecraft.World/Entities/Mobs/Pig.h +++ b/Minecraft.World/Entities/Mobs/Pig.h @@ -37,7 +37,7 @@ protected: virtual int getDeathSound(); public: - virtual bool interact(shared_ptr player); + virtual bool interact(std::shared_ptr player); protected: virtual int getDeathLoot(); @@ -52,7 +52,7 @@ protected: virtual void causeFallDamage(float distance); public: - virtual shared_ptr getBreedOffspring(shared_ptr target); - bool isFood(shared_ptr itemInstance); + virtual std::shared_ptr getBreedOffspring(std::shared_ptr target); + bool isFood(std::shared_ptr itemInstance); ControlledByPlayerGoal *getControlGoal(); }; diff --git a/Minecraft.World/Entities/Mobs/PigZombie.cpp b/Minecraft.World/Entities/Mobs/PigZombie.cpp index 0eeaf7142..de9998c32 100644 --- a/Minecraft.World/Entities/Mobs/PigZombie.cpp +++ b/Minecraft.World/Entities/Mobs/PigZombie.cpp @@ -14,11 +14,11 @@ -shared_ptr PigZombie::sword; +std::shared_ptr PigZombie::sword; void PigZombie::staticCtor() { - PigZombie::sword = shared_ptr( new ItemInstance(Item::sword_gold, 1) ); + PigZombie::sword = std::shared_ptr( new ItemInstance(Item::sword_gold, 1) ); } void PigZombie::_init() @@ -86,13 +86,13 @@ void PigZombie::readAdditionalSaveData(CompoundTag *tag) angerTime = tag->getShort(L"Anger"); } -shared_ptr PigZombie::findAttackTarget() +std::shared_ptr PigZombie::findAttackTarget() { #ifndef _FINAL_BUILD #ifdef _DEBUG_MENUS_ENABLED if(app.GetMobsDontAttackEnabled()) { - return shared_ptr(); + return std::shared_ptr(); } #endif #endif @@ -103,17 +103,17 @@ shared_ptr PigZombie::findAttackTarget() bool PigZombie::hurt(DamageSource *source, int dmg) { - shared_ptr sourceEntity = source->getEntity(); + std::shared_ptr sourceEntity = source->getEntity(); if (dynamic_pointer_cast(sourceEntity) != NULL) { - vector > *nearby = level->getEntities( shared_from_this(), bb->grow(32, 32, 32)); + vector > *nearby = level->getEntities( shared_from_this(), bb->grow(32, 32, 32)); AUTO_VAR(itEnd, nearby->end()); for (AUTO_VAR(it, nearby->begin()); it != itEnd; it++) { - shared_ptr e = *it; //nearby->at(i); + std::shared_ptr e = *it; //nearby->at(i); if (dynamic_pointer_cast(e) != NULL) { - shared_ptr pigZombie = dynamic_pointer_cast(e); + std::shared_ptr pigZombie = dynamic_pointer_cast(e); pigZombie->alert(sourceEntity); } } @@ -122,7 +122,7 @@ bool PigZombie::hurt(DamageSource *source, int dmg) return Zombie::hurt(source, dmg); } -void PigZombie::alert(shared_ptr target) +void PigZombie::alert(std::shared_ptr target) { this->attackTarget = target; angerTime = 20 * 20 + random->nextInt(20 * 20); @@ -162,7 +162,7 @@ void PigZombie::dropRareDeathLoot(int rareLootLevel) { if (rareLootLevel > 0) { - shared_ptr sword = shared_ptr( new ItemInstance(Item::sword_gold) ); + std::shared_ptr sword = std::shared_ptr( new ItemInstance(Item::sword_gold) ); EnchantmentHelper::enchantItem(random, sword, 5); spawnAtLocation(sword, 0); } @@ -195,8 +195,8 @@ void PigZombie::finalizeMobSpawn() setVillager(false); } -shared_ptr PigZombie::getCarriedItem() +std::shared_ptr PigZombie::getCarriedItem() { - // TODO 4J - could be of const shared_ptr type. - return (shared_ptr ) sword; + // TODO 4J - could be of const std::shared_ptr type. + return (std::shared_ptr ) sword; } diff --git a/Minecraft.World/Entities/Mobs/PigZombie.h b/Minecraft.World/Entities/Mobs/PigZombie.h index b47efacb4..ad792d65f 100644 --- a/Minecraft.World/Entities/Mobs/PigZombie.h +++ b/Minecraft.World/Entities/Mobs/PigZombie.h @@ -32,13 +32,13 @@ public: virtual void readAdditionalSaveData(CompoundTag *tag); protected: - virtual shared_ptr findAttackTarget(); + virtual std::shared_ptr findAttackTarget(); public: virtual bool hurt(DamageSource *source, int dmg); private: - void alert(shared_ptr target); + void alert(std::shared_ptr target); protected: virtual int getAmbientSound(); @@ -49,12 +49,12 @@ protected: virtual int getDeathLoot(); private: - static shared_ptr sword; + static std::shared_ptr sword; public: virtual void finalizeMobSpawn(); - shared_ptr getCarriedItem(); + std::shared_ptr getCarriedItem(); static void staticCtor(); }; diff --git a/Minecraft.World/Entities/Mobs/Sheep.cpp b/Minecraft.World/Entities/Mobs/Sheep.cpp index 5ec0e8668..98ecdf6da 100644 --- a/Minecraft.World/Entities/Mobs/Sheep.cpp +++ b/Minecraft.World/Entities/Mobs/Sheep.cpp @@ -68,9 +68,9 @@ Sheep::Sheep(Level *level) : Animal( level ) goalSelector.addGoal(7, new LookAtPlayerGoal(this, typeid(Player), 6)); goalSelector.addGoal(8, new RandomLookAroundGoal(this)); - container = shared_ptr(new CraftingContainer(new SheepContainer(), 2, 1)); - container->setItem(0, shared_ptr( new ItemInstance(Item::dye_powder, 1, 0))); - container->setItem(1, shared_ptr( new ItemInstance(Item::dye_powder, 1, 0))); + container = std::shared_ptr(new CraftingContainer(new SheepContainer(), 2, 1)); + container->setItem(0, std::shared_ptr( new ItemInstance(Item::dye_powder, 1, 0))); + container->setItem(1, std::shared_ptr( new ItemInstance(Item::dye_powder, 1, 0))); } bool Sheep::useNewAi() @@ -108,7 +108,7 @@ void Sheep::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) if(!isSheared()) { // killing a non-sheared sheep will drop a single block of cloth - spawnAtLocation(shared_ptr( new ItemInstance(Tile::cloth_Id, 1, getColor()) ), 0.0f); + spawnAtLocation(std::shared_ptr( new ItemInstance(Tile::cloth_Id, 1, getColor()) ), 0.0f); } } @@ -160,9 +160,9 @@ float Sheep::getHeadEatAngleScale(float a) return ((xRot / (180.0f / PI))); } -bool Sheep::interact(shared_ptr player) +bool Sheep::interact(std::shared_ptr player) { - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); // 4J-JEV: Fix for #88212, // Untrusted players shouldn't be able to sheer sheep. @@ -177,7 +177,7 @@ bool Sheep::interact(shared_ptr player) int count = 1 + random->nextInt(3); for (int i = 0; i < count; i++) { - shared_ptr ie = spawnAtLocation(shared_ptr( new ItemInstance(Tile::cloth_Id, 1, getColor()) ), 1.0f); + std::shared_ptr ie = spawnAtLocation(std::shared_ptr( new ItemInstance(Tile::cloth_Id, 1, getColor()) ), 1.0f); ie->yd += random->nextFloat() * 0.05f; ie->xd += (random->nextFloat() - random->nextFloat()) * 0.1f; ie->zd += (random->nextFloat() - random->nextFloat()) * 0.1f; @@ -272,13 +272,13 @@ int Sheep::getSheepColor(Random *random) return 0; // white } -shared_ptr Sheep::getBreedOffspring(shared_ptr target) +std::shared_ptr Sheep::getBreedOffspring(std::shared_ptr target) { // 4J - added limit to number of animals that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - shared_ptr otherSheep = dynamic_pointer_cast( target ); - shared_ptr sheep = shared_ptr( new Sheep(level) ); + std::shared_ptr otherSheep = dynamic_pointer_cast( target ); + std::shared_ptr sheep = std::shared_ptr( new Sheep(level) ); int color = getOffspringColor(dynamic_pointer_cast(shared_from_this()), otherSheep); sheep->setColor(15 - color); return sheep; @@ -309,7 +309,7 @@ void Sheep::finalizeMobSpawn() setColor(Sheep::getSheepColor(level->random)); } -int Sheep::getOffspringColor(shared_ptr animal, shared_ptr partner) +int Sheep::getOffspringColor(std::shared_ptr animal, std::shared_ptr partner) { int parent1DyeColor = getDyeColor(animal); int parent2DyeColor = getDyeColor(partner); @@ -317,7 +317,7 @@ int Sheep::getOffspringColor(shared_ptr animal, shared_ptr partn container->getItem(0)->setAuxValue(parent1DyeColor); container->getItem(1)->setAuxValue(parent2DyeColor); - shared_ptr instance = Recipes::getInstance()->getItemFor(container, animal->level); + std::shared_ptr instance = Recipes::getInstance()->getItemFor(container, animal->level); int color = 0; if (instance != NULL && instance->getItem()->id == Item::dye_powder_Id) @@ -331,7 +331,7 @@ int Sheep::getOffspringColor(shared_ptr animal, shared_ptr partn return color; } -int Sheep::getDyeColor(shared_ptr animal) +int Sheep::getDyeColor(std::shared_ptr animal) { return 15 - dynamic_pointer_cast(animal)->getColor(); } diff --git a/Minecraft.World/Entities/Mobs/Sheep.h b/Minecraft.World/Entities/Mobs/Sheep.h index 28369137c..53ab85cfb 100644 --- a/Minecraft.World/Entities/Mobs/Sheep.h +++ b/Minecraft.World/Entities/Mobs/Sheep.h @@ -15,10 +15,10 @@ class Sheep : public Animal private: class SheepContainer : public AbstractContainerMenu { - bool stillValid(shared_ptr player) { return false; } + bool stillValid(std::shared_ptr player) { return false; } }; - shared_ptr container; + std::shared_ptr container; public: eINSTANCEOF GetType() { return eTYPE_SHEEP; } static Entity *create(Level *level) { return new Sheep(level); } @@ -58,7 +58,7 @@ public: float getHeadEatPositionScale(float a); float getHeadEatAngleScale(float a); - virtual bool interact(shared_ptr player); + virtual bool interact(std::shared_ptr player); virtual void addAdditonalSaveData(CompoundTag *tag); virtual void readAdditionalSaveData(CompoundTag *tag); @@ -74,13 +74,13 @@ public: void setSheared(bool value); static int getSheepColor(Random *random); - virtual shared_ptr getBreedOffspring(shared_ptr target); + virtual std::shared_ptr getBreedOffspring(std::shared_ptr target); virtual void ate(); void finalizeMobSpawn(); private: - int getOffspringColor(shared_ptr animal, shared_ptr partner); - int getDyeColor(shared_ptr animal); + int getOffspringColor(std::shared_ptr animal, std::shared_ptr partner); + int getDyeColor(std::shared_ptr animal); }; diff --git a/Minecraft.World/Entities/Mobs/Silverfish.cpp b/Minecraft.World/Entities/Mobs/Silverfish.cpp index 1ec48a60e..11fef1385 100644 --- a/Minecraft.World/Entities/Mobs/Silverfish.cpp +++ b/Minecraft.World/Entities/Mobs/Silverfish.cpp @@ -35,12 +35,12 @@ bool Silverfish::makeStepSound() return false; } -shared_ptr Silverfish::findAttackTarget() +std::shared_ptr Silverfish::findAttackTarget() { #ifndef _FINAL_BUILD if(app.GetMobsDontAttackEnabled()) { - return shared_ptr(); + return std::shared_ptr(); } #endif @@ -77,7 +77,7 @@ bool Silverfish::hurt(DamageSource *source, int dmg) return Monster::hurt(source, dmg); } -void Silverfish::checkHurtTarget(shared_ptr target, float d) +void Silverfish::checkHurtTarget(std::shared_ptr target, float d) { // super.checkHurtTarget(target, d); @@ -197,7 +197,7 @@ bool Silverfish::canSpawn() { if (Monster::canSpawn()) { - shared_ptr nearestPlayer = level->getNearestPlayer(shared_from_this(), 5.0); + std::shared_ptr nearestPlayer = level->getNearestPlayer(shared_from_this(), 5.0); return nearestPlayer == NULL; } return false; diff --git a/Minecraft.World/Entities/Mobs/Silverfish.h b/Minecraft.World/Entities/Mobs/Silverfish.h index 510218cc3..4a98c688f 100644 --- a/Minecraft.World/Entities/Mobs/Silverfish.h +++ b/Minecraft.World/Entities/Mobs/Silverfish.h @@ -17,7 +17,7 @@ public: protected: virtual bool makeStepSound(); - virtual shared_ptr findAttackTarget(); + virtual std::shared_ptr findAttackTarget(); virtual int getAmbientSound(); virtual int getHurtSound(); @@ -27,7 +27,7 @@ public: virtual bool hurt(DamageSource *source, int dmg); protected: - virtual void checkHurtTarget(shared_ptr target, float d); + virtual void checkHurtTarget(std::shared_ptr target, float d); virtual void playStepSound(int xt, int yt, int zt, int t); virtual int getDeathLoot(); diff --git a/Minecraft.World/Entities/Mobs/Skeleton.cpp b/Minecraft.World/Entities/Mobs/Skeleton.cpp index eeac0eb6b..483a439ae 100644 --- a/Minecraft.World/Entities/Mobs/Skeleton.cpp +++ b/Minecraft.World/Entities/Mobs/Skeleton.cpp @@ -68,9 +68,9 @@ int Skeleton::getDeathSound() return eSoundType_MOB_SKELETON_HURT; } -shared_ptr Skeleton::bow; +std::shared_ptr Skeleton::bow; -shared_ptr Skeleton::getCarriedItem() +std::shared_ptr Skeleton::getCarriedItem() { return bow; } @@ -101,7 +101,7 @@ void Skeleton::aiStep() void Skeleton::die(DamageSource *source) { Monster::die(source); - shared_ptr player = dynamic_pointer_cast( source->getEntity() ); + std::shared_ptr player = dynamic_pointer_cast( source->getEntity() ); if ( dynamic_pointer_cast( source->getDirectEntity() ) != NULL && player != NULL) { double xd = player->x - x; @@ -138,7 +138,7 @@ void Skeleton::dropRareDeathLoot(int rareLootLevel) { if (rareLootLevel > 0) { - shared_ptr bow = shared_ptr( new ItemInstance(Item::bow) ); + std::shared_ptr bow = std::shared_ptr( new ItemInstance(Item::bow) ); EnchantmentHelper::enchantItem(random, bow, 5); spawnAtLocation(bow, 0); } @@ -150,5 +150,5 @@ void Skeleton::dropRareDeathLoot(int rareLootLevel) void Skeleton::staticCtor() { - Skeleton::bow = shared_ptr( new ItemInstance(Item::bow, 1) ); + Skeleton::bow = std::shared_ptr( new ItemInstance(Item::bow, 1) ); } diff --git a/Minecraft.World/Entities/Mobs/Skeleton.h b/Minecraft.World/Entities/Mobs/Skeleton.h index 536beb327..db9a69785 100644 --- a/Minecraft.World/Entities/Mobs/Skeleton.h +++ b/Minecraft.World/Entities/Mobs/Skeleton.h @@ -20,7 +20,7 @@ protected: virtual int getDeathSound(); public: - virtual shared_ptr getCarriedItem(); + virtual std::shared_ptr getCarriedItem(); virtual MobType getMobType(); virtual void aiStep(); virtual void die(DamageSource *source); @@ -31,7 +31,7 @@ protected: virtual void dropRareDeathLoot(int rareLootLevel); private: - static shared_ptr bow; + static std::shared_ptr bow; public: diff --git a/Minecraft.World/Entities/Mobs/Slime.cpp b/Minecraft.World/Entities/Mobs/Slime.cpp index dec695bba..f3d905c6f 100644 --- a/Minecraft.World/Entities/Mobs/Slime.cpp +++ b/Minecraft.World/Entities/Mobs/Slime.cpp @@ -133,7 +133,7 @@ void Slime::tick() void Slime::serverAiStep() { checkDespawn(); - shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 16); + std::shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 16); if (player != NULL) { lookAt(player, 10, 20); @@ -176,9 +176,9 @@ int Slime::getJumpDelay() return random->nextInt(20) + 10; } -shared_ptr Slime::createChild() +std::shared_ptr Slime::createChild() { - return shared_ptr( new Slime(level) ); + return std::shared_ptr( new Slime(level) ); } void Slime::remove() @@ -196,7 +196,7 @@ void Slime::remove() { float xd = (i % 2 - 0.5f) * size / 4.0f; float zd = (i / 2 - 0.5f) * size / 4.0f; - shared_ptr slime = createChild(); + std::shared_ptr slime = createChild(); slime->setSize(size / 2); slime->moveTo(x + xd, y + 0.5, z + zd, random->nextFloat() * 360, 0); level->addEntity(slime); @@ -206,7 +206,7 @@ void Slime::remove() Mob::remove(); } -void Slime::playerTouch(shared_ptr player) +void Slime::playerTouch(std::shared_ptr player) { if (isDealsDamage()) { diff --git a/Minecraft.World/Entities/Mobs/Slime.h b/Minecraft.World/Entities/Mobs/Slime.h index 07d7e57a4..2a892b083 100644 --- a/Minecraft.World/Entities/Mobs/Slime.h +++ b/Minecraft.World/Entities/Mobs/Slime.h @@ -50,11 +50,11 @@ protected: virtual void serverAiStep(); virtual void decreaseSquish(); virtual int getJumpDelay(); - virtual shared_ptr createChild(); + virtual std::shared_ptr createChild(); public: virtual void remove(); - virtual void playerTouch(shared_ptr player); + virtual void playerTouch(std::shared_ptr player); protected: virtual bool isDealsDamage(); diff --git a/Minecraft.World/Entities/Mobs/SmallFireball.cpp b/Minecraft.World/Entities/Mobs/SmallFireball.cpp index e4dd7a9b1..108219961 100644 --- a/Minecraft.World/Entities/Mobs/SmallFireball.cpp +++ b/Minecraft.World/Entities/Mobs/SmallFireball.cpp @@ -11,7 +11,7 @@ SmallFireball::SmallFireball(Level *level) : Fireball(level) setSize(5 / 16.0f, 5 / 16.0f); } -SmallFireball::SmallFireball(Level *level, shared_ptr mob, double xa, double ya, double za) : Fireball(level, mob, xa, ya, za) +SmallFireball::SmallFireball(Level *level, std::shared_ptr mob, double xa, double ya, double za) : Fireball(level, mob, xa, ya, za) { setSize(5 / 16.0f, 5 / 16.0f); } diff --git a/Minecraft.World/Entities/Mobs/SmallFireball.h b/Minecraft.World/Entities/Mobs/SmallFireball.h index 38ad8efdc..3b63e2e08 100644 --- a/Minecraft.World/Entities/Mobs/SmallFireball.h +++ b/Minecraft.World/Entities/Mobs/SmallFireball.h @@ -12,7 +12,7 @@ public: public: SmallFireball(Level *level); - SmallFireball(Level *level, shared_ptr mob, double xa, double ya, double za); + SmallFireball(Level *level, std::shared_ptr mob, double xa, double ya, double za); SmallFireball(Level *level, double x, double y, double z, double xa, double ya, double za); protected: diff --git a/Minecraft.World/Entities/Mobs/Snowball.cpp b/Minecraft.World/Entities/Mobs/Snowball.cpp index e97c4a72d..889b349ec 100644 --- a/Minecraft.World/Entities/Mobs/Snowball.cpp +++ b/Minecraft.World/Entities/Mobs/Snowball.cpp @@ -19,7 +19,7 @@ Snowball::Snowball(Level *level) : Throwable(level) _init(); } -Snowball::Snowball(Level *level, shared_ptr mob) : Throwable(level,mob) +Snowball::Snowball(Level *level, std::shared_ptr mob) : Throwable(level,mob) { _init(); } diff --git a/Minecraft.World/Entities/Mobs/Snowball.h b/Minecraft.World/Entities/Mobs/Snowball.h index eb99f8f90..b17691b29 100644 --- a/Minecraft.World/Entities/Mobs/Snowball.h +++ b/Minecraft.World/Entities/Mobs/Snowball.h @@ -16,7 +16,7 @@ private: public: Snowball(Level *level); - Snowball(Level *level, shared_ptr mob); + Snowball(Level *level, std::shared_ptr mob); Snowball(Level *level, double x, double y, double z); protected: diff --git a/Minecraft.World/Entities/Mobs/Spider.cpp b/Minecraft.World/Entities/Mobs/Spider.cpp index c7be776ce..b374a41d9 100644 --- a/Minecraft.World/Entities/Mobs/Spider.cpp +++ b/Minecraft.World/Entities/Mobs/Spider.cpp @@ -61,13 +61,13 @@ bool Spider::makeStepSound() return false; } -shared_ptr Spider::findAttackTarget() +std::shared_ptr Spider::findAttackTarget() { #ifndef _FINAL_BUILD #ifdef _DEBUG_MENUS_ENABLED if(app.GetMobsDontAttackEnabled()) { - return shared_ptr(); + return std::shared_ptr(); } #endif #endif @@ -78,7 +78,7 @@ shared_ptr Spider::findAttackTarget() double maxDist = 16; return level->getNearestAttackablePlayer(shared_from_this(), maxDist); } - return shared_ptr(); + return std::shared_ptr(); } int Spider::getAmbientSound() @@ -96,7 +96,7 @@ int Spider::getDeathSound() return eSoundType_MOB_SPIDER_DEATH; } -void Spider::checkHurtTarget(shared_ptr target, float d) +void Spider::checkHurtTarget(std::shared_ptr target, float d) { float br = getBrightness(1); if (br > 0.5f && random->nextInt(100) == 0) diff --git a/Minecraft.World/Entities/Mobs/Spider.h b/Minecraft.World/Entities/Mobs/Spider.h index 1df49b08a..576cc9f57 100644 --- a/Minecraft.World/Entities/Mobs/Spider.h +++ b/Minecraft.World/Entities/Mobs/Spider.h @@ -25,11 +25,11 @@ public: protected: virtual bool makeStepSound(); - virtual shared_ptr findAttackTarget(); + virtual std::shared_ptr findAttackTarget(); virtual int getAmbientSound(); virtual int getHurtSound(); virtual int getDeathSound(); - virtual void checkHurtTarget(shared_ptr target, float d); + virtual void checkHurtTarget(std::shared_ptr target, float d); virtual int getDeathLoot(); virtual void dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel); diff --git a/Minecraft.World/Entities/Mobs/Squid.cpp b/Minecraft.World/Entities/Mobs/Squid.cpp index 48c6ee9b5..e2433aa37 100644 --- a/Minecraft.World/Entities/Mobs/Squid.cpp +++ b/Minecraft.World/Entities/Mobs/Squid.cpp @@ -77,7 +77,7 @@ void Squid::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) int count = random->nextInt(3 + playerBonusLevel) + 1; for (int i = 0; i < count; i++) { - spawnAtLocation(shared_ptr( new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLACK) ), 0.0f); + spawnAtLocation(std::shared_ptr( new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLACK) ), 0.0f); } } diff --git a/Minecraft.World/Entities/Mobs/ThrownEgg.cpp b/Minecraft.World/Entities/Mobs/ThrownEgg.cpp index 29876cd44..780b4491d 100644 --- a/Minecraft.World/Entities/Mobs/ThrownEgg.cpp +++ b/Minecraft.World/Entities/Mobs/ThrownEgg.cpp @@ -21,7 +21,7 @@ ThrownEgg::ThrownEgg(Level *level) : Throwable(level) _init(); } -ThrownEgg::ThrownEgg(Level *level, shared_ptr mob) : Throwable(level,mob) +ThrownEgg::ThrownEgg(Level *level, std::shared_ptr mob) : Throwable(level,mob) { _init(); } @@ -47,7 +47,7 @@ void ThrownEgg::onHit(HitResult *res) if (random->nextInt(32) == 0) count = 4; for (int i = 0; i < count; i++) { - shared_ptr chicken = shared_ptr( new Chicken(level) ); + std::shared_ptr chicken = std::shared_ptr( new Chicken(level) ); chicken->setAge(-20 * 60 * 20); chicken->moveTo(x, y, z, yRot, 0); diff --git a/Minecraft.World/Entities/Mobs/ThrownEgg.h b/Minecraft.World/Entities/Mobs/ThrownEgg.h index 6f273c288..15ef3d69e 100644 --- a/Minecraft.World/Entities/Mobs/ThrownEgg.h +++ b/Minecraft.World/Entities/Mobs/ThrownEgg.h @@ -15,7 +15,7 @@ private: public: ThrownEgg(Level *level); - ThrownEgg(Level *level, shared_ptr mob); + ThrownEgg(Level *level, std::shared_ptr mob); ThrownEgg(Level *level, double x, double y, double z); protected: diff --git a/Minecraft.World/Entities/Mobs/ThrownEnderPearl.cpp b/Minecraft.World/Entities/Mobs/ThrownEnderPearl.cpp index 77cf1ce77..5cf125998 100644 --- a/Minecraft.World/Entities/Mobs/ThrownEnderPearl.cpp +++ b/Minecraft.World/Entities/Mobs/ThrownEnderPearl.cpp @@ -16,7 +16,7 @@ ThrownEnderpearl::ThrownEnderpearl(Level *level) : Throwable(level) this->defineSynchedData(); } -ThrownEnderpearl::ThrownEnderpearl(Level *level, shared_ptr mob) : Throwable(level,mob) +ThrownEnderpearl::ThrownEnderpearl(Level *level, std::shared_ptr mob) : Throwable(level,mob) { // 4J Stu - This function call had to be moved here from the Entity ctor to ensure that // the derived version of the function is called @@ -47,7 +47,7 @@ void ThrownEnderpearl::onHit(HitResult *res) { // Fix for #67486 - TCR #001: BAS Game Stability: Customer Encountered: TU8: Code: Gameplay: The title crashes on Host's console when Client Player leaves the game before the Ender Pearl thrown by him touches the ground. // If the owner has been removed, then ignore - shared_ptr serverPlayer = dynamic_pointer_cast(owner); + std::shared_ptr serverPlayer = dynamic_pointer_cast(owner); if (serverPlayer != NULL && !serverPlayer->removed) { if(!serverPlayer->connection->done && serverPlayer->level == this->level) diff --git a/Minecraft.World/Entities/Mobs/ThrownEnderPearl.h b/Minecraft.World/Entities/Mobs/ThrownEnderPearl.h index c079c411d..bf24eb0b3 100644 --- a/Minecraft.World/Entities/Mobs/ThrownEnderPearl.h +++ b/Minecraft.World/Entities/Mobs/ThrownEnderPearl.h @@ -11,7 +11,7 @@ public: static Entity *create(Level *level) { return new ThrownEnderpearl(level); } ThrownEnderpearl(Level *level); - ThrownEnderpearl(Level *level, shared_ptr mob); + ThrownEnderpearl(Level *level, std::shared_ptr mob); ThrownEnderpearl(Level *level, double x, double y, double z); protected: diff --git a/Minecraft.World/Entities/Mobs/ThrownExpBottle.cpp b/Minecraft.World/Entities/Mobs/ThrownExpBottle.cpp index f8e55c1d9..c5e67b6dc 100644 --- a/Minecraft.World/Entities/Mobs/ThrownExpBottle.cpp +++ b/Minecraft.World/Entities/Mobs/ThrownExpBottle.cpp @@ -11,7 +11,7 @@ ThrownExpBottle::ThrownExpBottle(Level *level) : Throwable(level) { } -ThrownExpBottle::ThrownExpBottle(Level *level, shared_ptr mob) : Throwable(level,mob) +ThrownExpBottle::ThrownExpBottle(Level *level, std::shared_ptr mob) : Throwable(level,mob) { } @@ -47,7 +47,7 @@ void ThrownExpBottle::onHit(HitResult *res) { int newCount = ExperienceOrb::getExperienceValue(xpCount); xpCount -= newCount; - level->addEntity(shared_ptr( new ExperienceOrb(level, x, y, z, newCount) ) ); + level->addEntity(std::shared_ptr( new ExperienceOrb(level, x, y, z, newCount) ) ); } remove(); diff --git a/Minecraft.World/Entities/Mobs/ThrownExpBottle.h b/Minecraft.World/Entities/Mobs/ThrownExpBottle.h index dca1eaa00..7f533991b 100644 --- a/Minecraft.World/Entities/Mobs/ThrownExpBottle.h +++ b/Minecraft.World/Entities/Mobs/ThrownExpBottle.h @@ -11,7 +11,7 @@ public: static Entity *create(Level *level) { return new ThrownExpBottle(level); } public: ThrownExpBottle(Level *level); - ThrownExpBottle(Level *level, shared_ptr mob); + ThrownExpBottle(Level *level, std::shared_ptr mob); ThrownExpBottle(Level *level, double x, double y, double z); protected: diff --git a/Minecraft.World/Entities/Mobs/ThrownPotion.cpp b/Minecraft.World/Entities/Mobs/ThrownPotion.cpp index 115f19480..abe71172b 100644 --- a/Minecraft.World/Entities/Mobs/ThrownPotion.cpp +++ b/Minecraft.World/Entities/Mobs/ThrownPotion.cpp @@ -27,7 +27,7 @@ ThrownPotion::ThrownPotion(Level *level) : Throwable(level) _init(); } -ThrownPotion::ThrownPotion(Level *level, shared_ptr mob, int potionValue) : Throwable(level,mob) +ThrownPotion::ThrownPotion(Level *level, std::shared_ptr mob, int potionValue) : Throwable(level,mob) { _init(); @@ -74,15 +74,15 @@ void ThrownPotion::onHit(HitResult *res) if (mobEffects != NULL && !mobEffects->empty()) { AABB *aoe = bb->grow(SPLASH_RANGE, SPLASH_RANGE / 2, SPLASH_RANGE); - vector > *entitiesOfClass = level->getEntitiesOfClass(typeid(Mob), aoe); + vector > *entitiesOfClass = level->getEntitiesOfClass(typeid(Mob), aoe); if (entitiesOfClass != NULL && !entitiesOfClass->empty()) { //for (Entity e : entitiesOfClass) for(AUTO_VAR(it, entitiesOfClass->begin()); it != entitiesOfClass->end(); ++it) { - //shared_ptr e = *it; - shared_ptr e = dynamic_pointer_cast( *it ); + //std::shared_ptr e = *it; + std::shared_ptr e = dynamic_pointer_cast( *it ); double dist = distanceToSqr(e); if (dist < SPLASH_RANGE_SQ) { diff --git a/Minecraft.World/Entities/Mobs/ThrownPotion.h b/Minecraft.World/Entities/Mobs/ThrownPotion.h index 6eed9203d..412d12a1b 100644 --- a/Minecraft.World/Entities/Mobs/ThrownPotion.h +++ b/Minecraft.World/Entities/Mobs/ThrownPotion.h @@ -22,7 +22,7 @@ private: public: ThrownPotion(Level *level); - ThrownPotion(Level *level, shared_ptr mob, int potionValue); + ThrownPotion(Level *level, std::shared_ptr mob, int potionValue); ThrownPotion(Level *level, double x, double y, double z, int potionValue); protected: diff --git a/Minecraft.World/Entities/Mobs/Villager.cpp b/Minecraft.World/Entities/Mobs/Villager.cpp index 32121f24e..b86a64f24 100644 --- a/Minecraft.World/Entities/Mobs/Villager.cpp +++ b/Minecraft.World/Entities/Mobs/Villager.cpp @@ -94,7 +94,7 @@ void Villager::serverAiMobStep() level->villages->queryUpdateAround(Mth::floor(x), Mth::floor(y), Mth::floor(z)); villageUpdateInterval = 70 + random->nextInt(50); - shared_ptr _village = level->villages->getClosestVillage(Mth::floor(x), Mth::floor(y), Mth::floor(z), Villages::MaxDoorDist); + std::shared_ptr _village = level->villages->getClosestVillage(Mth::floor(x), Mth::floor(y), Mth::floor(z), Villages::MaxDoorDist); village = _village; if (_village == NULL) clearRestriction(); else @@ -145,10 +145,10 @@ void Villager::serverAiMobStep() AgableMob::serverAiMobStep(); } -bool Villager::interact(shared_ptr player) +bool Villager::interact(std::shared_ptr player) { // [EB]: Truly dislike this code but I don't see another easy way - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); bool holdingSpawnEgg = item != NULL && item->id == Item::monsterPlacer_Id; if (!holdingSpawnEgg && isAlive() && !isTrading() && !isBaby()) @@ -281,15 +281,15 @@ bool Villager::isChasing() return chasing; } -void Villager::setLastHurtByMob(shared_ptr mob) +void Villager::setLastHurtByMob(std::shared_ptr mob) { AgableMob::setLastHurtByMob(mob); - shared_ptr _village = village.lock(); + std::shared_ptr _village = village.lock(); if (_village != NULL && mob != NULL) { _village->addAggressor(mob); - shared_ptr player = dynamic_pointer_cast(mob); + std::shared_ptr player = dynamic_pointer_cast(mob); if (player) { int amount = -1; @@ -308,15 +308,15 @@ void Villager::setLastHurtByMob(shared_ptr mob) void Villager::die(DamageSource *source) { - shared_ptr _village = village.lock(); + std::shared_ptr _village = village.lock(); if (_village != NULL) { - shared_ptr sourceEntity = source->getEntity(); + std::shared_ptr sourceEntity = source->getEntity(); if (sourceEntity != NULL) { if ((sourceEntity->GetType() & eTYPE_PLAYER) == eTYPE_PLAYER) { - shared_ptr player = dynamic_pointer_cast(sourceEntity); + std::shared_ptr player = dynamic_pointer_cast(sourceEntity); _village->modifyStanding(player->getName(), -2); } else if ((sourceEntity->GetType() & eTYPE_ENEMY) == eTYPE_ENEMY) @@ -328,7 +328,7 @@ void Villager::die(DamageSource *source) { // 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); + std::shared_ptr nearestPlayer = level->getNearestPlayer(shared_from_this(), 16.0f); if (nearestPlayer != NULL) { _village->resetNoBreedTimer(); @@ -339,12 +339,12 @@ void Villager::die(DamageSource *source) AgableMob::die(source); } -void Villager::setTradingPlayer(shared_ptr player) +void Villager::setTradingPlayer(std::shared_ptr player) { tradingPlayer = weak_ptr(player); } -shared_ptr Villager::getTradingPlayer() +std::shared_ptr Villager::getTradingPlayer() { return tradingPlayer.lock(); } @@ -381,7 +381,7 @@ void Villager::notifyTrade(MerchantRecipe *activeRecipe) } } -void Villager::notifyTradeUpdated(shared_ptr item) +void Villager::notifyTradeUpdated(std::shared_ptr item) { if (!level->isClientSide && (ambientSoundTime > (-getAmbientSoundInterval() + SharedConstants::TICKS_PER_SECOND))) { @@ -397,7 +397,7 @@ void Villager::notifyTradeUpdated(shared_ptr item) } } -MerchantRecipeList *Villager::getOffers(shared_ptr forPlayer) +MerchantRecipeList *Villager::getOffers(std::shared_ptr forPlayer) { if (offers == NULL) { @@ -436,7 +436,7 @@ void Villager::addOffers(int addCount) addItemForPurchase(newOffers, Item::arrow_Id, random, getRecipeChance(.5f)); if (random->nextFloat() < .5f) { - newOffers->push_back(new MerchantRecipe(shared_ptr( new ItemInstance(Tile::gravel, 10) ), shared_ptr( new ItemInstance(Item::emerald) ), shared_ptr( new ItemInstance(Item::flint_Id, 2 + random->nextInt(2), 0)))); + newOffers->push_back(new MerchantRecipe(std::shared_ptr( new ItemInstance(Tile::gravel, 10) ), std::shared_ptr( new ItemInstance(Item::emerald) ), std::shared_ptr( new ItemInstance(Item::flint_Id, 2 + random->nextInt(2), 0)))); } break; case PROFESSION_BUTCHER: @@ -493,10 +493,10 @@ void Villager::addOffers(int addCount) { Enchantment *enchantment = Enchantment::validEnchantments[random->nextInt(Enchantment::validEnchantments.size())]; int level = Mth::nextInt(random, enchantment->getMinLevel(), enchantment->getMaxLevel()); - shared_ptr book = Item::enchantedBook->createForEnchantment(new EnchantmentInstance(enchantment, level)); + std::shared_ptr book = Item::enchantedBook->createForEnchantment(new EnchantmentInstance(enchantment, level)); int cost = 2 + random->nextInt(5 + (level * 10)) + 3 * level; - newOffers->push_back(new MerchantRecipe(shared_ptr(new ItemInstance(Item::book)), shared_ptr(new ItemInstance(Item::emerald, cost)), book)); + newOffers->push_back(new MerchantRecipe(std::shared_ptr(new ItemInstance(Item::book)), std::shared_ptr(new ItemInstance(Item::emerald, cost)), book)); } break; case PROFESSION_PRIEST: @@ -514,9 +514,9 @@ void Villager::addOffers(int addCount) int id = enchantItems[i]; if (random->nextFloat() < getRecipeChance(.05f)) { - newOffers->push_back(new MerchantRecipe(shared_ptr(new ItemInstance(id, 1, 0)), - shared_ptr(new ItemInstance(Item::emerald, 2 + random->nextInt(3), 0)), - EnchantmentHelper::enchantItem(random, shared_ptr(new ItemInstance(id, 1, 0)), 5 + random->nextInt(15)))); + newOffers->push_back(new MerchantRecipe(std::shared_ptr(new ItemInstance(id, 1, 0)), + std::shared_ptr(new ItemInstance(Item::emerald, 2 + random->nextInt(3), 0)), + EnchantmentHelper::enchantItem(random, std::shared_ptr(new ItemInstance(id, 1, 0)), 5 + random->nextInt(15)))); } } } @@ -636,9 +636,9 @@ void Villager::addItemForTradeIn(MerchantRecipeList *list, int itemId, Random *r } } -shared_ptr Villager::getItemTradeInValue(int itemId, Random *random) +std::shared_ptr Villager::getItemTradeInValue(int itemId, Random *random) { - return shared_ptr(new ItemInstance(itemId, getTradeInValue(itemId, random), 0)); + return std::shared_ptr(new ItemInstance(itemId, getTradeInValue(itemId, random), 0)); } int Villager::getTradeInValue(int itemId, Random *random) @@ -670,17 +670,17 @@ void Villager::addItemForPurchase(MerchantRecipeList *list, int itemId, Random * if (random->nextFloat() < likelyHood) { int purchaseCost = getPurchaseCost(itemId, random); - shared_ptr rubyItem; - shared_ptr resultItem; + std::shared_ptr rubyItem; + std::shared_ptr resultItem; if (purchaseCost < 0) { - rubyItem = shared_ptr( new ItemInstance(Item::emerald_Id, 1, 0) ); - resultItem = shared_ptr( new ItemInstance(itemId, -purchaseCost, 0) ); + rubyItem = std::shared_ptr( new ItemInstance(Item::emerald_Id, 1, 0) ); + resultItem = std::shared_ptr( new ItemInstance(itemId, -purchaseCost, 0) ); } else { - rubyItem = shared_ptr( new ItemInstance(Item::emerald_Id, purchaseCost, 0) ); - resultItem = shared_ptr( new ItemInstance(itemId, 1, 0) ); + rubyItem = std::shared_ptr( new ItemInstance(Item::emerald_Id, purchaseCost, 0) ); + resultItem = std::shared_ptr( new ItemInstance(itemId, 1, 0) ); } list->push_back(new MerchantRecipe(rubyItem, resultItem)); } @@ -742,12 +742,12 @@ void Villager::setRewardPlayersInVillage() rewardPlayersOnFirstVillage = true; } -shared_ptr Villager::getBreedOffspring(shared_ptr target) +std::shared_ptr Villager::getBreedOffspring(std::shared_ptr target) { // 4J - added limit to villagers that can be bred if(level->canCreateMore(GetType(), Level::eSpawnType_Breed) ) { - shared_ptr villager = shared_ptr(new Villager(level)); + std::shared_ptr villager = std::shared_ptr(new Villager(level)); villager->finalizeMobSpawn(); return villager; } diff --git a/Minecraft.World/Entities/Mobs/Villager.h b/Minecraft.World/Entities/Mobs/Villager.h index 75302cd10..e4550f3ef 100644 --- a/Minecraft.World/Entities/Mobs/Villager.h +++ b/Minecraft.World/Entities/Mobs/Villager.h @@ -58,7 +58,7 @@ protected: virtual void serverAiMobStep(); public: - virtual bool interact(shared_ptr player); + virtual bool interact(std::shared_ptr player); protected: virtual void defineSynchedData(); @@ -83,7 +83,7 @@ public: void setInLove(bool inLove); void setChasing(bool chasing); bool isChasing(); - void setLastHurtByMob(shared_ptr mob); + void setLastHurtByMob(std::shared_ptr mob); void die(DamageSource *source); void handleEntityEvent(uint8_t id); @@ -92,12 +92,12 @@ private: void addParticlesAroundSelf(ePARTICLE_TYPE particle); public: - void setTradingPlayer(shared_ptr player); - shared_ptr getTradingPlayer(); + void setTradingPlayer(std::shared_ptr player); + std::shared_ptr getTradingPlayer(); bool isTrading(); void notifyTrade(MerchantRecipe *activeRecipe); - void notifyTradeUpdated(shared_ptr item); - MerchantRecipeList *getOffers(shared_ptr forPlayer); + void notifyTradeUpdated(std::shared_ptr item); + MerchantRecipeList *getOffers(std::shared_ptr forPlayer); private: float baseRecipeChanceMod; @@ -125,7 +125,7 @@ private: * @param likelyHood */ static void addItemForTradeIn(MerchantRecipeList *list, int itemId, Random *random, float likelyHood); - static shared_ptr getItemTradeInValue(int itemId, Random *random); + static std::shared_ptr getItemTradeInValue(int itemId, Random *random); static int getTradeInValue(int itemId, Random *random); /** @@ -143,7 +143,7 @@ private: public: void finalizeMobSpawn(); void setRewardPlayersInVillage(); - shared_ptr getBreedOffspring(shared_ptr target); + std::shared_ptr getBreedOffspring(std::shared_ptr target); virtual int getDisplayName(); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/Mobs/VillagerGolem.cpp b/Minecraft.World/Entities/Mobs/VillagerGolem.cpp index e79bbef91..ff49cead2 100644 --- a/Minecraft.World/Entities/Mobs/VillagerGolem.cpp +++ b/Minecraft.World/Entities/Mobs/VillagerGolem.cpp @@ -69,7 +69,7 @@ void VillagerGolem::serverAiMobStep() if (--villageUpdateInterval <= 0) { villageUpdateInterval = 70 + random->nextInt(50); - shared_ptr _village = level->villages->getClosestVillage(Mth::floor(x), Mth::floor(y), Mth::floor(z), Villages::MaxDoorDist); + std::shared_ptr _village = level->villages->getClosestVillage(Mth::floor(x), Mth::floor(y), Mth::floor(z), Villages::MaxDoorDist); village = _village; if (_village == NULL) clearRestriction(); else @@ -133,7 +133,7 @@ void VillagerGolem::readAdditionalSaveData(CompoundTag *tag) setPlayerCreated(tag->getBoolean(L"PlayerCreated")); } -bool VillagerGolem::doHurtTarget(shared_ptr target) +bool VillagerGolem::doHurtTarget(std::shared_ptr target) { attackAnimationTick = 10; level->broadcastEntityEvent(shared_from_this(), EntityEvent::START_ATTACKING); @@ -157,7 +157,7 @@ void VillagerGolem::handleEntityEvent(uint8_t id) else Golem::handleEntityEvent(id); } -shared_ptr VillagerGolem::getVillage() +std::shared_ptr VillagerGolem::getVillage() { return village.lock(); } diff --git a/Minecraft.World/Entities/Mobs/VillagerGolem.h b/Minecraft.World/Entities/Mobs/VillagerGolem.h index e1662474d..17a0bf6dd 100644 --- a/Minecraft.World/Entities/Mobs/VillagerGolem.h +++ b/Minecraft.World/Entities/Mobs/VillagerGolem.h @@ -43,9 +43,9 @@ public: virtual bool canAttackType(eINSTANCEOF targetType); virtual void addAdditonalSaveData(CompoundTag *tag); virtual void readAdditionalSaveData(CompoundTag *tag); - virtual bool doHurtTarget(shared_ptr target); + virtual bool doHurtTarget(std::shared_ptr target); virtual void handleEntityEvent(uint8_t id); - virtual shared_ptr getVillage(); + virtual std::shared_ptr getVillage(); virtual int getAttackAnimationTick(); virtual void offerFlower(bool offer); diff --git a/Minecraft.World/Entities/Mobs/Wolf.cpp b/Minecraft.World/Entities/Mobs/Wolf.cpp index 7f1841238..b5c233a8b 100644 --- a/Minecraft.World/Entities/Mobs/Wolf.cpp +++ b/Minecraft.World/Entities/Mobs/Wolf.cpp @@ -60,7 +60,7 @@ bool Wolf::useNewAi() return true; } -void Wolf::setTarget(shared_ptr target) +void Wolf::setTarget(std::shared_ptr target) { TamableAnimal::setTarget(target); if ( dynamic_pointer_cast(target) == NULL ) @@ -292,7 +292,7 @@ int Wolf::getMaxHeadXRot() bool Wolf::hurt(DamageSource *source, int dmg) { if (isInvulnerable()) return false; - shared_ptr sourceEntity = source->getEntity(); + std::shared_ptr sourceEntity = source->getEntity(); sitGoal->wantToSit(false); if (sourceEntity != NULL && !(dynamic_pointer_cast(sourceEntity) != NULL || dynamic_pointer_cast(sourceEntity) != NULL)) { @@ -302,7 +302,7 @@ bool Wolf::hurt(DamageSource *source, int dmg) return TamableAnimal::hurt(source, dmg); } -bool Wolf::doHurtTarget(shared_ptr target) +bool Wolf::doHurtTarget(std::shared_ptr target) { int damage = isTame() ? 4 : 2; return target->hurt(DamageSource::mobAttack(dynamic_pointer_cast(shared_from_this())), damage); @@ -322,9 +322,9 @@ void Wolf::tame(const wstring &wsOwnerUUID, bool bDisplayTamingParticles, bool b spawnTamingParticles(bDisplayTamingParticles); } -bool Wolf::interact(shared_ptr player) +bool Wolf::interact(std::shared_ptr player) { - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); if (isTame()) { @@ -451,7 +451,7 @@ float Wolf::getTailAngle() return 0.20f * PI; } -bool Wolf::isFood(shared_ptr item) +bool Wolf::isFood(std::shared_ptr item) { if (item == NULL) return false; if (dynamic_cast(Item::items[item->id]) == NULL) return false; @@ -498,12 +498,12 @@ int Wolf::GetSynchedHealth() return getEntityData()->getInteger(DATA_HEALTH_ID); } -shared_ptr Wolf::getBreedOffspring(shared_ptr target) +std::shared_ptr Wolf::getBreedOffspring(std::shared_ptr target) { // 4J - added limit to wolves that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - shared_ptr pBabyWolf = shared_ptr( new Wolf(level) ); + std::shared_ptr pBabyWolf = std::shared_ptr( new Wolf(level) ); if(!getOwnerUUID().empty()) { @@ -532,11 +532,11 @@ void Wolf::setIsInterested(bool value) } } -bool Wolf::canMate(shared_ptr animal) +bool Wolf::canMate(std::shared_ptr animal) { if (animal == shared_from_this()) return false; if (!isTame()) return false; - shared_ptr partner = dynamic_pointer_cast(animal); + std::shared_ptr partner = dynamic_pointer_cast(animal); if (partner == NULL) return false; if (!partner->isTame()) return false; if (partner->isSitting()) return false; diff --git a/Minecraft.World/Entities/Mobs/Wolf.h b/Minecraft.World/Entities/Mobs/Wolf.h index a604efb93..8b3e69c4a 100644 --- a/Minecraft.World/Entities/Mobs/Wolf.h +++ b/Minecraft.World/Entities/Mobs/Wolf.h @@ -26,7 +26,7 @@ private: public: Wolf(Level *level); virtual bool useNewAi(); - virtual void setTarget(shared_ptr target); + virtual void setTarget(std::shared_ptr target); protected: virtual void serverAiMobStep(); @@ -61,11 +61,11 @@ public: float getHeadHeight(); int getMaxHeadXRot(); virtual bool hurt(DamageSource *source, int dmg); - virtual bool doHurtTarget(shared_ptr target); - virtual bool interact(shared_ptr player); + virtual bool doHurtTarget(std::shared_ptr target); + virtual bool interact(std::shared_ptr player); virtual void handleEntityEvent(uint8_t id); float getTailAngle(); - virtual bool isFood(shared_ptr item); + virtual bool isFood(std::shared_ptr item); virtual int getMaxSpawnClusterSize(); bool isAngry(); void setAngry(bool value); @@ -77,10 +77,10 @@ public: int GetSynchedHealth(); protected: - virtual shared_ptr getBreedOffspring(shared_ptr target); + virtual std::shared_ptr getBreedOffspring(std::shared_ptr target); public: virtual void setIsInterested(bool isInterested); - virtual bool canMate(shared_ptr animal); + virtual bool canMate(std::shared_ptr animal); bool isInterested(); }; diff --git a/Minecraft.World/Entities/Mobs/Zombie.cpp b/Minecraft.World/Entities/Mobs/Zombie.cpp index 1c8d7b560..276b0a194 100644 --- a/Minecraft.World/Entities/Mobs/Zombie.cpp +++ b/Minecraft.World/Entities/Mobs/Zombie.cpp @@ -211,7 +211,7 @@ void Zombie::readAdditionalSaveData(CompoundTag *tag) if (tag->contains(L"ConversionTime") && tag->getInt(L"ConversionTime") > -1) startConverting(tag->getInt(L"ConversionTime")); } -void Zombie::killed(shared_ptr mob) +void Zombie::killed(std::shared_ptr mob) { Monster::killed(mob); @@ -220,7 +220,7 @@ void Zombie::killed(shared_ptr mob) if( !level->canCreateMore( GetType(), Level::eSpawnType_Egg) ) return; if (level->difficulty == Difficulty::NORMAL && random->nextBoolean()) return; - shared_ptr zombie = shared_ptr(new Zombie(level)); + std::shared_ptr zombie = std::shared_ptr(new Zombie(level)); zombie->copyPosition(mob); level->removeEntity(mob); zombie->finalizeMobSpawn(); @@ -263,9 +263,9 @@ void Zombie::finalizeMobSpawn() #endif } -bool Zombie::interact(shared_ptr player) +bool Zombie::interact(std::shared_ptr player) { - shared_ptr item = player->getSelectedItem(); + std::shared_ptr item = player->getSelectedItem(); if (item != NULL && item->getItem() == Item::apple_gold && item->getAuxValue() == 0 && isVillager() && hasEffect(MobEffect::weakness)) { @@ -319,7 +319,7 @@ bool Zombie::isConverting() void Zombie::finishConversion() { - shared_ptr villager = shared_ptr(new Villager(level)); + std::shared_ptr villager = std::shared_ptr(new Villager(level)); villager->copyPosition(shared_from_this()); villager->finalizeMobSpawn(); villager->setRewardPlayersInVillage(); diff --git a/Minecraft.World/Entities/Mobs/Zombie.h b/Minecraft.World/Entities/Mobs/Zombie.h index 7a65d5858..58ae1459d 100644 --- a/Minecraft.World/Entities/Mobs/Zombie.h +++ b/Minecraft.World/Entities/Mobs/Zombie.h @@ -64,9 +64,9 @@ protected: public: virtual void addAdditonalSaveData(CompoundTag *tag); virtual void readAdditionalSaveData(CompoundTag *tag); - void killed(shared_ptr mob); + void killed(std::shared_ptr mob); virtual void finalizeMobSpawn(); - bool interact(shared_ptr player); + bool interact(std::shared_ptr player); protected: void startConverting(int time); diff --git a/Minecraft.World/Entities/Monster.cpp b/Minecraft.World/Entities/Monster.cpp index ef4a6e24e..95f74179a 100644 --- a/Minecraft.World/Entities/Monster.cpp +++ b/Minecraft.World/Entities/Monster.cpp @@ -46,25 +46,25 @@ void Monster::tick() if (!level->isClientSide && (level->difficulty == Difficulty::PEACEFUL || Minecraft::GetInstance()->isTutorial() ) ) remove(); } -shared_ptr Monster::findAttackTarget() +std::shared_ptr Monster::findAttackTarget() { #ifndef _FINAL_BUILD if(app.GetMobsDontAttackEnabled()) { - return shared_ptr(); + return std::shared_ptr(); } #endif - shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 16); + std::shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 16); if (player != NULL && canSee(player) ) return player; - return shared_ptr(); + return std::shared_ptr(); } bool Monster::hurt(DamageSource *source, int dmg) { if (PathfinderMob::hurt(source, dmg)) { - shared_ptr sourceEntity = source->getEntity(); + std::shared_ptr sourceEntity = source->getEntity(); if (rider.lock() == sourceEntity || riding == sourceEntity) return true; if (sourceEntity != shared_from_this()) @@ -82,7 +82,7 @@ bool Monster::hurt(DamageSource *source, int dmg) * @param target * @return */ -bool Monster::doHurtTarget(shared_ptr target) +bool Monster::doHurtTarget(std::shared_ptr target) { int dmg = attackDamage; if (hasEffect(MobEffect::damageBoost)) @@ -106,7 +106,7 @@ bool Monster::doHurtTarget(shared_ptr target) target->setOnFire(fireAspect * 4); } - shared_ptr mob = dynamic_pointer_cast(target); + std::shared_ptr mob = dynamic_pointer_cast(target); if (mob != NULL) { ThornsEnchantment::doThornsAfterAttack(shared_from_this(), mob, random); @@ -116,7 +116,7 @@ bool Monster::doHurtTarget(shared_ptr target) return didHurt; } -void Monster::checkHurtTarget(shared_ptr target, float distance) +void Monster::checkHurtTarget(std::shared_ptr target, float distance) { if (attackTime <= 0 && distance < 2.0f && target->bb->y1 > bb->y0 && target->bb->y0 < bb->y1) { diff --git a/Minecraft.World/Entities/Monster.h b/Minecraft.World/Entities/Monster.h index 2bad48dad..804760ee4 100644 --- a/Minecraft.World/Entities/Monster.h +++ b/Minecraft.World/Entities/Monster.h @@ -27,14 +27,14 @@ public: virtual void tick(); protected: - virtual shared_ptr findAttackTarget(); + virtual std::shared_ptr findAttackTarget(); public: virtual bool hurt(DamageSource *source, int dmg); - virtual bool doHurtTarget(shared_ptr target); + virtual bool doHurtTarget(std::shared_ptr target); protected: - virtual void checkHurtTarget(shared_ptr target, float distance); + virtual void checkHurtTarget(std::shared_ptr target, float distance); public: virtual float getWalkTargetValue(int x, int y, int z); diff --git a/Minecraft.World/Entities/PathfinderMob.cpp b/Minecraft.World/Entities/PathfinderMob.cpp index 5b0978d1f..ee5be6439 100644 --- a/Minecraft.World/Entities/PathfinderMob.cpp +++ b/Minecraft.World/Entities/PathfinderMob.cpp @@ -206,7 +206,7 @@ void PathfinderMob::findRandomStrollLocation(int quadrant/*=-1*/) // 4J - added } } -void PathfinderMob::checkHurtTarget(shared_ptr target, float d) +void PathfinderMob::checkHurtTarget(std::shared_ptr target, float d) { } @@ -215,9 +215,9 @@ float PathfinderMob::getWalkTargetValue(int x, int y, int z) return 0; } -shared_ptr PathfinderMob::findAttackTarget() +std::shared_ptr PathfinderMob::findAttackTarget() { - return shared_ptr(); + return std::shared_ptr(); } @@ -240,12 +240,12 @@ void PathfinderMob::setPath(Path *path) this->path = path; } -shared_ptr PathfinderMob::getAttackTarget() +std::shared_ptr PathfinderMob::getAttackTarget() { return attackTarget; } -void PathfinderMob::setAttackTarget(shared_ptr attacker) +void PathfinderMob::setAttackTarget(std::shared_ptr attacker) { attackTarget = attacker; } diff --git a/Minecraft.World/Entities/PathfinderMob.h b/Minecraft.World/Entities/PathfinderMob.h index fdbadf8c2..df759f485 100644 --- a/Minecraft.World/Entities/PathfinderMob.h +++ b/Minecraft.World/Entities/PathfinderMob.h @@ -18,27 +18,27 @@ private: Path *path; protected: - shared_ptr attackTarget; + std::shared_ptr attackTarget; bool holdGround; int fleeTime; virtual bool shouldHoldGround(); virtual void serverAiStep(); virtual void findRandomStrollLocation(int quadrant = -1); - virtual void checkHurtTarget(shared_ptr target, float d); + virtual void checkHurtTarget(std::shared_ptr target, float d); public: virtual float getWalkTargetValue(int x, int y, int z); protected: - virtual shared_ptr findAttackTarget(); + virtual std::shared_ptr findAttackTarget(); public: virtual bool canSpawn(); bool isPathFinding(); void setPath(Path *path); - shared_ptr getAttackTarget(); - void setAttackTarget(shared_ptr attacker); + std::shared_ptr getAttackTarget(); + void setAttackTarget(std::shared_ptr attacker); protected: float getWalkingSpeedModifier(); diff --git a/Minecraft.World/Entities/SyncedEntityData.cpp b/Minecraft.World/Entities/SyncedEntityData.cpp index ac505d727..47012bd69 100644 --- a/Minecraft.World/Entities/SyncedEntityData.cpp +++ b/Minecraft.World/Entities/SyncedEntityData.cpp @@ -18,7 +18,7 @@ void SynchedEntityData::define(int id, int value) MemSect(17); checkId(id); int type = TYPE_INT; - shared_ptr dataItem = shared_ptr( new DataItem(type, id, value) ); + std::shared_ptr dataItem = std::shared_ptr( new DataItem(type, id, value) ); itemsById[id] = dataItem; MemSect(0); m_isEmpty = false; @@ -29,7 +29,7 @@ void SynchedEntityData::define(int id, uint8_t value) MemSect(17); checkId(id); int type = TYPE_BYTE; - shared_ptr dataItem = shared_ptr( new DataItem(type, id, value) ); + std::shared_ptr dataItem = std::shared_ptr( new DataItem(type, id, value) ); itemsById[id] = dataItem; MemSect(0); m_isEmpty = false; @@ -40,7 +40,7 @@ void SynchedEntityData::define(int id, short value) MemSect(17); checkId(id); int type = TYPE_SHORT; - shared_ptr dataItem = shared_ptr( new DataItem(type, id, value) ); + std::shared_ptr dataItem = std::shared_ptr( new DataItem(type, id, value) ); itemsById[id] = dataItem; MemSect(0); m_isEmpty = false; @@ -51,7 +51,7 @@ void SynchedEntityData::define(int id, const wstring& value) MemSect(17); checkId(id); int type = TYPE_STRING; - shared_ptr dataItem = shared_ptr( new DataItem(type, id, value) ); + std::shared_ptr dataItem = std::shared_ptr( new DataItem(type, id, value) ); itemsById[id] = dataItem; MemSect(0); m_isEmpty = false; @@ -62,7 +62,7 @@ void SynchedEntityData::defineNULL(int id, void *pVal) MemSect(17); checkId(id); int type = TYPE_ITEMINSTANCE; - shared_ptr dataItem = shared_ptr( new DataItem(type, id, shared_ptr()) ); + std::shared_ptr dataItem = std::shared_ptr( new DataItem(type, id, std::shared_ptr()) ); itemsById[id] = dataItem; MemSect(0); m_isEmpty = false; @@ -108,7 +108,7 @@ wstring SynchedEntityData::getString(int id) return itemsById[id]->getValue_wstring(); } -shared_ptr SynchedEntityData::getItemInstance(int id) +std::shared_ptr SynchedEntityData::getItemInstance(int id) { //assert(false); // 4J - not currently implemented return itemsById[id]->getValue_itemInstance(); @@ -122,7 +122,7 @@ Pos *SynchedEntityData::getPos(int id) void SynchedEntityData::set(int id, int value) { - shared_ptr dataItem = itemsById[id]; + std::shared_ptr dataItem = itemsById[id]; // update the value if it has changed if (value != dataItem->getValue_int()) @@ -135,7 +135,7 @@ void SynchedEntityData::set(int id, int value) void SynchedEntityData::set(int id, uint8_t value) { - shared_ptr dataItem = itemsById[id]; + std::shared_ptr dataItem = itemsById[id]; // update the value if it has changed if (value != dataItem->getValue_byte()) @@ -148,7 +148,7 @@ void SynchedEntityData::set(int id, uint8_t value) void SynchedEntityData::set(int id, short value) { - shared_ptr dataItem = itemsById[id]; + std::shared_ptr dataItem = itemsById[id]; // update the value if it has changed if (value != dataItem->getValue_short()) @@ -161,7 +161,7 @@ void SynchedEntityData::set(int id, short value) void SynchedEntityData::set(int id, const wstring& value) { - shared_ptr dataItem = itemsById[id]; + std::shared_ptr dataItem = itemsById[id]; // update the value if it has changed if (value != dataItem->getValue_wstring()) @@ -172,9 +172,9 @@ void SynchedEntityData::set(int id, const wstring& value) } } -void SynchedEntityData::set(int id, shared_ptr value) +void SynchedEntityData::set(int id, std::shared_ptr value) { - shared_ptr dataItem = itemsById[id]; + std::shared_ptr dataItem = itemsById[id]; // update the value if it has changed if (value != dataItem->getValue_itemInstance()) @@ -196,7 +196,7 @@ bool SynchedEntityData::isDirty() return m_isDirty; } -void SynchedEntityData::pack(vector > *items, DataOutputStream *output) // TODO throws IOException +void SynchedEntityData::pack(vector > *items, DataOutputStream *output) // TODO throws IOException { if (items != NULL) @@ -204,7 +204,7 @@ void SynchedEntityData::pack(vector > *items, DataOutputStr AUTO_VAR(itEnd, items->end()); for (AUTO_VAR(it, items->begin()); it != itEnd; it++) { - shared_ptr dataItem = *it; + std::shared_ptr dataItem = *it; writeDataItem(output, dataItem); } } @@ -213,24 +213,24 @@ void SynchedEntityData::pack(vector > *items, DataOutputStr output->writeByte(EOF_MARKER); } -vector > *SynchedEntityData::packDirty() +vector > *SynchedEntityData::packDirty() { - vector > *result = NULL; + vector > *result = NULL; if (m_isDirty) { AUTO_VAR(itEnd, itemsById.end()); for ( AUTO_VAR(it, itemsById.begin()); it != itEnd; it++ ) { - shared_ptr dataItem = (*it).second; + std::shared_ptr dataItem = (*it).second; if (dataItem->isDirty()) { dataItem->setDirty(false); if (result == NULL) { - result = new vector >(); + result = new vector >(); } result->push_back(dataItem); } @@ -246,7 +246,7 @@ void SynchedEntityData::packAll(DataOutputStream *output) // throws IOException AUTO_VAR(itEnd, itemsById.end()); for (AUTO_VAR(it, itemsById.begin()); it != itEnd; it++ ) { - shared_ptr dataItem = (*it).second; + std::shared_ptr dataItem = (*it).second; writeDataItem(output, dataItem); } @@ -254,18 +254,18 @@ void SynchedEntityData::packAll(DataOutputStream *output) // throws IOException output->writeByte(EOF_MARKER); } -vector > *SynchedEntityData::getAll() +vector > *SynchedEntityData::getAll() { - vector > *result = NULL; + vector > *result = NULL; AUTO_VAR(itEnd, itemsById.end()); for (AUTO_VAR(it, itemsById.begin()); it != itEnd; it++ ) { if (result == NULL) { - result = new vector >(); + result = new vector >(); } - shared_ptr dataItem = (*it).second; + std::shared_ptr dataItem = (*it).second; result->push_back(dataItem); } @@ -273,7 +273,7 @@ vector > *SynchedEntityData::getAll() } -void SynchedEntityData::writeDataItem(DataOutputStream *output, shared_ptr dataItem) //throws IOException +void SynchedEntityData::writeDataItem(DataOutputStream *output, std::shared_ptr dataItem) //throws IOException { // pack type and id int header = ((dataItem->getType() << TYPE_SHIFT) | (dataItem->getId() & MAX_ID_VALUE)) & 0xff; @@ -296,7 +296,7 @@ void SynchedEntityData::writeDataItem(DataOutputStream *output, shared_ptr instance = (shared_ptr )dataItem->getValue_itemInstance(); + std::shared_ptr instance = (std::shared_ptr )dataItem->getValue_itemInstance(); Packet::writeItem(instance, output); } break; @@ -307,10 +307,10 @@ void SynchedEntityData::writeDataItem(DataOutputStream *output, shared_ptr > *SynchedEntityData::unpack(DataInputStream *input) //throws IOException +vector > *SynchedEntityData::unpack(DataInputStream *input) //throws IOException { - vector > *result = NULL; + vector > *result = NULL; int currentHeader = input->readByte(); @@ -319,40 +319,40 @@ vector > *SynchedEntityData::unpack(Data if (result == NULL) { - result = new vector >(); + result = new vector >(); } // split type and id int itemType = (currentHeader & TYPE_MASK) >> TYPE_SHIFT; int itemId = (currentHeader & MAX_ID_VALUE); - shared_ptr item = shared_ptr(); + std::shared_ptr item = std::shared_ptr(); switch (itemType) { case TYPE_BYTE: { uint8_t dataRead = input->readByte(); - item = shared_ptr( new DataItem(itemType, itemId, dataRead) ); + item = std::shared_ptr( new DataItem(itemType, itemId, dataRead) ); } break; case TYPE_SHORT: { short dataRead = input->readShort(); - item = shared_ptr( new DataItem(itemType, itemId, dataRead) ); + item = std::shared_ptr( new DataItem(itemType, itemId, dataRead) ); } break; case TYPE_INT: { int dataRead = input->readInt(); - item = shared_ptr( new DataItem(itemType, itemId, dataRead) ); + item = std::shared_ptr( new DataItem(itemType, itemId, dataRead) ); } break; case TYPE_STRING: - item = shared_ptr( new DataItem(itemType, itemId, Packet::readUtf(input, MAX_STRING_DATA_LENGTH)) ); + item = std::shared_ptr( new DataItem(itemType, itemId, Packet::readUtf(input, MAX_STRING_DATA_LENGTH)) ); break; case TYPE_ITEMINSTANCE: { - item = shared_ptr(new DataItem(itemType, itemId, Packet::readItem(input))); + item = std::shared_ptr(new DataItem(itemType, itemId, Packet::readItem(input))); } break; default: @@ -375,12 +375,12 @@ vector > *SynchedEntityData::unpack(Data * @param items */ -void SynchedEntityData::assignValues(vector > *items) +void SynchedEntityData::assignValues(vector > *items) { AUTO_VAR(itEnd, items->end()); for (AUTO_VAR(it, items->begin()); it != itEnd; it++) { - shared_ptr item = *it; + std::shared_ptr item = *it; AUTO_VAR(itemFromId, itemsById.find(item->getId())); if (itemFromId != itemsById.end() ) { @@ -421,7 +421,7 @@ int SynchedEntityData::getSizeInBytes() AUTO_VAR(itEnd, itemsById.end()); for (AUTO_VAR(it, itemsById.begin()); it != itEnd; it++ ) { - shared_ptr dataItem = (*it).second; + std::shared_ptr dataItem = (*it).second; size += 1; @@ -480,7 +480,7 @@ SynchedEntityData::DataItem::DataItem(int type, int id, const wstring& value) : this->dirty = true; } -SynchedEntityData::DataItem::DataItem(int type, int id, shared_ptr itemInstance) : type( type ), id( id ) +SynchedEntityData::DataItem::DataItem(int type, int id, std::shared_ptr itemInstance) : type( type ), id( id ) { this->value_itemInstance = itemInstance; this->dirty = true; @@ -511,7 +511,7 @@ void SynchedEntityData::DataItem::setValue(const wstring& value) this->value_wstring = value; } -void SynchedEntityData::DataItem::setValue(shared_ptr itemInstance) +void SynchedEntityData::DataItem::setValue(std::shared_ptr itemInstance) { this->value_itemInstance = itemInstance; } @@ -536,7 +536,7 @@ wstring SynchedEntityData::DataItem::getValue_wstring() return value_wstring; } -shared_ptr SynchedEntityData::DataItem::getValue_itemInstance() +std::shared_ptr SynchedEntityData::DataItem::getValue_itemInstance() { return value_itemInstance; } diff --git a/Minecraft.World/Entities/SyncedEntityData.h b/Minecraft.World/Entities/SyncedEntityData.h index f561e1568..666a8432e 100644 --- a/Minecraft.World/Entities/SyncedEntityData.h +++ b/Minecraft.World/Entities/SyncedEntityData.h @@ -19,7 +19,7 @@ public: int value_int; short value_short; wstring value_wstring; - shared_ptr value_itemInstance; + std::shared_ptr value_itemInstance; bool dirty; public: @@ -27,7 +27,7 @@ public: DataItem(int type, int id, uint8_t value); DataItem(int type, int id, int value); DataItem(int type, int id, const wstring& value); - DataItem(int type, int id, shared_ptr itemInstance); + DataItem(int type, int id, std::shared_ptr itemInstance); DataItem(int type, int id, short value); int getId(); @@ -35,12 +35,12 @@ public: void setValue(int value); void setValue(short value); void setValue(const wstring& value); - void setValue(shared_ptr value); + void setValue(std::shared_ptr value); uint8_t getValue_byte(); int getValue_int(); short getValue_short(); wstring getValue_wstring(); - shared_ptr getValue_itemInstance(); + std::shared_ptr getValue_itemInstance(); int getType(); bool isDirty(); void setDirty(bool dirty); @@ -71,7 +71,7 @@ private: // the id value must fit in the remaining bits static const int MAX_ID_VALUE = ~TYPE_MASK & 0xff; - unordered_map > itemsById; + unordered_map > itemsById; bool m_isDirty; public: @@ -91,27 +91,27 @@ public: int getInteger(int id); float getFloat(int id); wstring getString(int id); - shared_ptr getItemInstance(int id); + std::shared_ptr getItemInstance(int id); Pos *getPos(int id); // 4J - using overloads rather than template here void set(int id, uint8_t value); void set(int id, int value); void set(int id, short value); void set(int id, const wstring& value); - void set(int id, shared_ptr); + void set(int id, std::shared_ptr); void markDirty(int id); bool isDirty(); - static void pack(vector > *items, DataOutputStream *output); // TODO throws IOException - vector > *packDirty(); + static void pack(vector > *items, DataOutputStream *output); // TODO throws IOException + vector > *packDirty(); void packAll(DataOutputStream *output); // throws IOException - vector > *getAll(); + vector > *getAll(); private: - static void writeDataItem(DataOutputStream *output, shared_ptr dataItem); //throws IOException + static void writeDataItem(DataOutputStream *output, std::shared_ptr dataItem); //throws IOException public: - static vector > *unpack(DataInputStream *input); // throws IOException + static vector > *unpack(DataInputStream *input); // throws IOException /** * Assigns values from a list of data items. @@ -119,7 +119,7 @@ public: * @param items */ public: - void assignValues(vector > *items); + void assignValues(vector > *items); bool isEmpty(); // 4J Added diff --git a/Minecraft.World/Entities/TamableAnimal.cpp b/Minecraft.World/Entities/TamableAnimal.cpp index 075a9ba9e..0ab7bae27 100644 --- a/Minecraft.World/Entities/TamableAnimal.cpp +++ b/Minecraft.World/Entities/TamableAnimal.cpp @@ -148,7 +148,7 @@ void TamableAnimal::setOwnerUUID(const wstring &name) entityData->set(DATA_OWNERUUID_ID, name); } -shared_ptr TamableAnimal::getOwner() +std::shared_ptr TamableAnimal::getOwner() { return level->getPlayerByUUID(getOwnerUUID()); } diff --git a/Minecraft.World/Entities/TamableAnimal.h b/Minecraft.World/Entities/TamableAnimal.h index 8f0330964..644665da1 100644 --- a/Minecraft.World/Entities/TamableAnimal.h +++ b/Minecraft.World/Entities/TamableAnimal.h @@ -33,6 +33,6 @@ public: virtual void setSitting(bool value); virtual wstring getOwnerUUID(); virtual void setOwnerUUID(const wstring &name); - virtual shared_ptr getOwner(); + virtual std::shared_ptr getOwner(); virtual SitGoal *getSitGoal(); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/Throwable.cpp b/Minecraft.World/Entities/Throwable.cpp index 111774913..1c27dd1f8 100644 --- a/Minecraft.World/Entities/Throwable.cpp +++ b/Minecraft.World/Entities/Throwable.cpp @@ -37,7 +37,7 @@ bool Throwable::shouldRenderAtSqrDistance(double distance) return distance < size * size; } -Throwable::Throwable(Level *level, shared_ptr mob) : Entity(level) +Throwable::Throwable(Level *level, std::shared_ptr mob) : Entity(level) { _throwableInit(); this->owner = mob; @@ -171,12 +171,12 @@ void Throwable::tick() if (!level->isClientSide) { - shared_ptr hitEntity = nullptr; - vector > *objects = level->getEntities(shared_from_this(), this->bb->expand(xd, yd, zd)->grow(1, 1, 1)); + std::shared_ptr hitEntity = nullptr; + vector > *objects = level->getEntities(shared_from_this(), this->bb->expand(xd, yd, zd)->grow(1, 1, 1)); double nearest = 0; for (int i = 0; i < objects->size(); i++) { - shared_ptr e = objects->at(i); + std::shared_ptr e = objects->at(i); if (!e->isPickable() || (e == owner && flightTime < 5)) continue; float rr = 0.3f; diff --git a/Minecraft.World/Entities/Throwable.h b/Minecraft.World/Entities/Throwable.h index 4d7daea02..81f4caccd 100644 --- a/Minecraft.World/Entities/Throwable.h +++ b/Minecraft.World/Entities/Throwable.h @@ -20,7 +20,7 @@ public: int shakeTime; protected: - shared_ptr owner; + std::shared_ptr owner; private: int life; @@ -37,7 +37,7 @@ protected: public: virtual bool shouldRenderAtSqrDistance(double distance); - Throwable(Level *level, shared_ptr mob); + Throwable(Level *level, std::shared_ptr mob); Throwable(Level *level, double x, double y, double z); protected: diff --git a/Minecraft.World/Entities/WaterAnimal.cpp b/Minecraft.World/Entities/WaterAnimal.cpp index 0b4f84bec..a0711d20c 100644 --- a/Minecraft.World/Entities/WaterAnimal.cpp +++ b/Minecraft.World/Entities/WaterAnimal.cpp @@ -36,7 +36,7 @@ bool WaterAnimal::removeWhenFarAway() return true; } -int WaterAnimal::getExperienceReward(shared_ptr killedBy) +int WaterAnimal::getExperienceReward(std::shared_ptr killedBy) { return 1 + level->random->nextInt(3); } \ No newline at end of file diff --git a/Minecraft.World/Entities/WaterAnimal.h b/Minecraft.World/Entities/WaterAnimal.h index 90b626a64..59d1ed348 100644 --- a/Minecraft.World/Entities/WaterAnimal.h +++ b/Minecraft.World/Entities/WaterAnimal.h @@ -14,5 +14,5 @@ public: protected: virtual bool removeWhenFarAway(); - virtual int getExperienceReward(shared_ptr killedBy); + virtual int getExperienceReward(std::shared_ptr killedBy); }; diff --git a/Minecraft.World/Headers/net.minecraft.world.ContainerListener.h b/Minecraft.World/Headers/net.minecraft.world.ContainerListener.h index 1ac036a52..c18b24d16 100644 --- a/Minecraft.World/Headers/net.minecraft.world.ContainerListener.h +++ b/Minecraft.World/Headers/net.minecraft.world.ContainerListener.h @@ -13,6 +13,6 @@ namespace net_minecraft_world { friend class SimpleContainer; private: - virtual void containerChanged(shared_ptr simpleContainer) = 0; + virtual void containerChanged(std::shared_ptr simpleContainer) = 0; }; } \ No newline at end of file diff --git a/Minecraft.World/Headers/net.minecraft.world.inventory.ContainerListener.h b/Minecraft.World/Headers/net.minecraft.world.inventory.ContainerListener.h index ff9dfa2e2..c34c54f11 100644 --- a/Minecraft.World/Headers/net.minecraft.world.inventory.ContainerListener.h +++ b/Minecraft.World/Headers/net.minecraft.world.inventory.ContainerListener.h @@ -12,9 +12,9 @@ namespace net_minecraft_world_inventory class ContainerListener { public: - virtual void refreshContainer(AbstractContainerMenu *container, vector > *items) = 0; + virtual void refreshContainer(AbstractContainerMenu *container, vector > *items) = 0; - virtual void slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr item) = 0; + virtual void slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr item) = 0; virtual void setContainerData(AbstractContainerMenu *container, int id, int value) = 0; }; diff --git a/Minecraft.World/Items/ArmorItem.cpp b/Minecraft.World/Items/ArmorItem.cpp index 70b329c17..71ac4b01d 100644 --- a/Minecraft.World/Items/ArmorItem.cpp +++ b/Minecraft.World/Items/ArmorItem.cpp @@ -88,7 +88,7 @@ ArmorItem::ArmorItem(int id, const ArmorMaterial *armorType, int icon, int slot) maxStackSize = 1; } -int ArmorItem::getColor(shared_ptr item, int spriteLayer) +int ArmorItem::getColor(std::shared_ptr item, int spriteLayer) { if (spriteLayer > 0) { @@ -116,7 +116,7 @@ const _ArmorMaterial *ArmorItem::getMaterial() return armorType; } -bool ArmorItem::hasCustomColor(shared_ptr item) +bool ArmorItem::hasCustomColor(std::shared_ptr item) { if (armorType != ArmorMaterial::CLOTH) return false; if (!item->hasTag()) return false; @@ -126,7 +126,7 @@ bool ArmorItem::hasCustomColor(shared_ptr item) return true; } -int ArmorItem::getColor(shared_ptr item) +int ArmorItem::getColor(std::shared_ptr item) { if (armorType != ArmorMaterial::CLOTH) return -1; @@ -155,7 +155,7 @@ Icon *ArmorItem::getLayerIcon(int auxValue, int spriteLayer) return Item::getLayerIcon(auxValue, spriteLayer); } -void ArmorItem::clearColor(shared_ptr item) +void ArmorItem::clearColor(std::shared_ptr item) { if (armorType != ArmorMaterial::CLOTH) return; CompoundTag *tag = item->getTag(); @@ -164,7 +164,7 @@ void ArmorItem::clearColor(shared_ptr item) if (display->contains(L"color")) display->remove(L"color"); } -void ArmorItem::setColor(shared_ptr item, int color) +void ArmorItem::setColor(std::shared_ptr item, int color) { if (armorType != ArmorMaterial::CLOTH) { @@ -189,7 +189,7 @@ void ArmorItem::setColor(shared_ptr item, int color) display->putInt(L"color", color); } -bool ArmorItem::isValidRepairItem(shared_ptr source, shared_ptr repairItem) +bool ArmorItem::isValidRepairItem(std::shared_ptr source, std::shared_ptr repairItem) { if (armorType->getTierItemId() == repairItem->id) { diff --git a/Minecraft.World/Items/ArmorItem.h b/Minecraft.World/Items/ArmorItem.h index c711e2f9d..04b483e25 100644 --- a/Minecraft.World/Items/ArmorItem.h +++ b/Minecraft.World/Items/ArmorItem.h @@ -65,7 +65,7 @@ public: ArmorItem(int id, const ArmorMaterial *armorType, int icon, int slot); //@Override - int getColor(shared_ptr item, int spriteLayer); + int getColor(std::shared_ptr item, int spriteLayer); //@Override bool hasMultipleSpriteLayers(); @@ -73,15 +73,15 @@ public: virtual int getEnchantmentValue(); const ArmorMaterial *getMaterial(); - bool hasCustomColor(shared_ptr item); - int getColor(shared_ptr item); + bool hasCustomColor(std::shared_ptr item); + int getColor(std::shared_ptr item); //@Override Icon *getLayerIcon(int auxValue, int spriteLayer); - void clearColor(shared_ptr item); - void setColor(shared_ptr item, int color); + void clearColor(std::shared_ptr item); + void setColor(std::shared_ptr item, int color); - bool isValidRepairItem(shared_ptr source, shared_ptr repairItem); + bool isValidRepairItem(std::shared_ptr source, std::shared_ptr repairItem); //@Override void registerIcons(IconRegister *iconRegister); diff --git a/Minecraft.World/Items/BedItem.cpp b/Minecraft.World/Items/BedItem.cpp index 153235f7c..f6bda0d20 100644 --- a/Minecraft.World/Items/BedItem.cpp +++ b/Minecraft.World/Items/BedItem.cpp @@ -12,7 +12,7 @@ BedItem::BedItem(int id) : Item( id ) { } -bool BedItem::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) +bool BedItem::useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { if (face != Facing::UP) { diff --git a/Minecraft.World/Items/BedItem.h b/Minecraft.World/Items/BedItem.h index ad0297bd9..261423b3a 100644 --- a/Minecraft.World/Items/BedItem.h +++ b/Minecraft.World/Items/BedItem.h @@ -11,5 +11,5 @@ class BedItem : public Item public: BedItem(int id); - virtual bool 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=false); + virtual bool useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); }; \ No newline at end of file diff --git a/Minecraft.World/Items/BoatItem.cpp b/Minecraft.World/Items/BoatItem.cpp index c1b0b5a34..60cbdf311 100644 --- a/Minecraft.World/Items/BoatItem.cpp +++ b/Minecraft.World/Items/BoatItem.cpp @@ -12,7 +12,7 @@ BoatItem::BoatItem(int id) : Item( id ) this->maxStackSize = 1; } -bool BoatItem::TestUse(Level *level, shared_ptr player) +bool BoatItem::TestUse(Level *level, std::shared_ptr player) { // 4J-PB - added for tooltips to test use // 4J TODO really we should have the crosshair hitresult telling us if it hit water, and at what distance, so we don't need to do this again @@ -49,7 +49,7 @@ bool BoatItem::TestUse(Level *level, shared_ptr player) delete hr; return false; } -shared_ptr BoatItem::use(shared_ptr itemInstance, Level *level, shared_ptr player) +std::shared_ptr BoatItem::use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { float a = 1; @@ -80,11 +80,11 @@ shared_ptr BoatItem::use(shared_ptr itemInstance, Le Vec3 *b = player->getViewVector(a); bool hitEntity = false; float overlap = 1; - vector > *objects = level->getEntities(player, player->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap)); + vector > *objects = level->getEntities(player, player->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap)); //for (int i = 0; i < objects.size(); i++) { for(AUTO_VAR(it, objects->begin()); it != objects->end(); ++it) { - shared_ptr e = *it; //objects.get(i); + std::shared_ptr e = *it; //objects.get(i); if (!e->isPickable()) continue; float rr = e->getPickRadius(); @@ -110,7 +110,7 @@ shared_ptr BoatItem::use(shared_ptr itemInstance, Le if (level->getTile(xt, yt, zt) == Tile::topSnow_Id) yt--; if( level->countInstanceOf(eTYPE_BOAT, true) < Level::MAX_XBOX_BOATS ) // 4J - added limit { - level->addEntity( shared_ptr( new Boat(level, xt + 0.5f, yt + 1.0f, zt + 0.5f) ) ); + level->addEntity( std::shared_ptr( new Boat(level, xt + 0.5f, yt + 1.0f, zt + 0.5f) ) ); if (!player->abilities.instabuild) { itemInstance->count--; diff --git a/Minecraft.World/Items/BoatItem.h b/Minecraft.World/Items/BoatItem.h index 81bc4e18e..08a2ccf71 100644 --- a/Minecraft.World/Items/BoatItem.h +++ b/Minecraft.World/Items/BoatItem.h @@ -11,8 +11,8 @@ public: BoatItem(int id); - virtual bool TestUse(Level *level, shared_ptr player); - virtual shared_ptr use(shared_ptr itemInstance, Level *level, shared_ptr player); + virtual bool TestUse(Level *level, std::shared_ptr player); + virtual std::shared_ptr use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); /* * public boolean useOn(ItemInstance instance, Player player, Level level, diff --git a/Minecraft.World/Items/BookItem.cpp b/Minecraft.World/Items/BookItem.cpp index 0c6c1afc9..7dba89a24 100644 --- a/Minecraft.World/Items/BookItem.cpp +++ b/Minecraft.World/Items/BookItem.cpp @@ -6,7 +6,7 @@ BookItem::BookItem(int id) : Item(id) { } -bool BookItem::isEnchantable(shared_ptr itemInstance) +bool BookItem::isEnchantable(std::shared_ptr itemInstance) { return itemInstance->count == 1; } diff --git a/Minecraft.World/Items/BookItem.h b/Minecraft.World/Items/BookItem.h index f60fc417d..8bb5d1188 100644 --- a/Minecraft.World/Items/BookItem.h +++ b/Minecraft.World/Items/BookItem.h @@ -7,6 +7,6 @@ class BookItem : public Item public: BookItem(int id); - bool isEnchantable(shared_ptr itemInstance); + bool isEnchantable(std::shared_ptr itemInstance); int getEnchantmentValue(); }; \ No newline at end of file diff --git a/Minecraft.World/Items/BottleItem.cpp b/Minecraft.World/Items/BottleItem.cpp index d404cfb02..268a7d442 100644 --- a/Minecraft.World/Items/BottleItem.cpp +++ b/Minecraft.World/Items/BottleItem.cpp @@ -15,7 +15,7 @@ Icon *BottleItem::getIcon(int auxValue) return Item::potion->getIcon(0); } -shared_ptr BottleItem::use(shared_ptr itemInstance, Level *level, shared_ptr player) +std::shared_ptr BottleItem::use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, true); if (hr == NULL) return itemInstance; @@ -40,13 +40,13 @@ shared_ptr BottleItem::use(shared_ptr itemInstance, itemInstance->count--; if (itemInstance->count <= 0) { - return shared_ptr( new ItemInstance( (Item *)Item::potion) ); + return std::shared_ptr( new ItemInstance( (Item *)Item::potion) ); } else { - if (!player->inventory->add(shared_ptr( new ItemInstance( (Item *)Item::potion) ))) + if (!player->inventory->add(std::shared_ptr( new ItemInstance( (Item *)Item::potion) ))) { - player->drop( shared_ptr( new ItemInstance(Item::potion_Id, 1, 0) )); + player->drop( std::shared_ptr( new ItemInstance(Item::potion_Id, 1, 0) )); } } } @@ -60,7 +60,7 @@ shared_ptr BottleItem::use(shared_ptr itemInstance, } // 4J-PB - added to allow tooltips -bool BottleItem::TestUse(Level *level, shared_ptr player) +bool BottleItem::TestUse(Level *level, std::shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, true); if (hr == NULL) return false; diff --git a/Minecraft.World/Items/BottleItem.h b/Minecraft.World/Items/BottleItem.h index a8f5bc097..400902e76 100644 --- a/Minecraft.World/Items/BottleItem.h +++ b/Minecraft.World/Items/BottleItem.h @@ -12,8 +12,8 @@ public: //@Override Icon *getIcon(int auxValue); - virtual shared_ptr use(shared_ptr itemInstance, Level *level, shared_ptr player); - virtual bool TestUse(Level *level, shared_ptr player); + virtual std::shared_ptr use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); + virtual bool TestUse(Level *level, std::shared_ptr player); //@Override void registerIcons(IconRegister *iconRegister); diff --git a/Minecraft.World/Items/BowItem.cpp b/Minecraft.World/Items/BowItem.cpp index 148619c0e..d052b2f87 100644 --- a/Minecraft.World/Items/BowItem.cpp +++ b/Minecraft.World/Items/BowItem.cpp @@ -18,7 +18,7 @@ BowItem::BowItem(int id) : Item( id ) icons = NULL; } -void BowItem::releaseUsing(shared_ptr itemInstance, Level *level, shared_ptr player, int durationLeft) +void BowItem::releaseUsing(std::shared_ptr itemInstance, Level *level, std::shared_ptr player, int durationLeft) { bool infiniteArrows = player->abilities.instabuild || EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowInfinite->id, itemInstance) > 0; @@ -30,7 +30,7 @@ void BowItem::releaseUsing(shared_ptr itemInstance, Level *level, if (pow < 0.1) return; if (pow > 1) pow = 1; - shared_ptr arrow = shared_ptr( new Arrow(level, player, pow * 2.0f) ); + std::shared_ptr arrow = std::shared_ptr( new Arrow(level, player, pow * 2.0f) ); if (pow == 1) arrow->setCritArrow(true); int damageBonus = EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowBonus->id, itemInstance); if (damageBonus > 0) @@ -62,22 +62,22 @@ void BowItem::releaseUsing(shared_ptr itemInstance, Level *level, } } -shared_ptr BowItem::useTimeDepleted(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr BowItem::useTimeDepleted(std::shared_ptr instance, Level *level, std::shared_ptr player) { return instance; } -int BowItem::getUseDuration(shared_ptr itemInstance) +int BowItem::getUseDuration(std::shared_ptr itemInstance) { return 20 * 60 * 60; } -UseAnim BowItem::getUseAnimation(shared_ptr itemInstance) +UseAnim BowItem::getUseAnimation(std::shared_ptr itemInstance) { return UseAnim_bow; } -shared_ptr BowItem::use(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr BowItem::use(std::shared_ptr instance, Level *level, std::shared_ptr player) { if (player->abilities.instabuild || player->inventory->hasResource(Item::arrow_Id)) { diff --git a/Minecraft.World/Items/BowItem.h b/Minecraft.World/Items/BowItem.h index b4eba1113..76b795f98 100644 --- a/Minecraft.World/Items/BowItem.h +++ b/Minecraft.World/Items/BowItem.h @@ -18,11 +18,11 @@ private: public: BowItem(int id); - virtual void releaseUsing(shared_ptr itemInstance, Level *level, shared_ptr player, int durationLeft); - virtual shared_ptr useTimeDepleted(shared_ptr instance, Level *level, shared_ptr player); - virtual int getUseDuration(shared_ptr itemInstance); - virtual UseAnim getUseAnimation(shared_ptr itemInstance); - virtual shared_ptr use(shared_ptr instance, Level *level, shared_ptr player); + virtual void releaseUsing(std::shared_ptr itemInstance, Level *level, std::shared_ptr player, int durationLeft); + virtual std::shared_ptr useTimeDepleted(std::shared_ptr instance, Level *level, std::shared_ptr player); + virtual int getUseDuration(std::shared_ptr itemInstance); + virtual UseAnim getUseAnimation(std::shared_ptr itemInstance); + virtual std::shared_ptr use(std::shared_ptr instance, Level *level, std::shared_ptr player); virtual int getEnchantmentValue(); //@Override diff --git a/Minecraft.World/Items/BowlFoodItem.cpp b/Minecraft.World/Items/BowlFoodItem.cpp index 7ec470997..cd48d1306 100644 --- a/Minecraft.World/Items/BowlFoodItem.cpp +++ b/Minecraft.World/Items/BowlFoodItem.cpp @@ -8,9 +8,9 @@ BowlFoodItem::BowlFoodItem(int id, int nutrition) : FoodItem( id, nutrition, fal setMaxStackSize(1); } -shared_ptr BowlFoodItem::useTimeDepleted(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr BowlFoodItem::useTimeDepleted(std::shared_ptr instance, Level *level, std::shared_ptr player) { FoodItem::useTimeDepleted(instance, level, player); - return shared_ptr(new ItemInstance(Item::bowl)); + return std::shared_ptr(new ItemInstance(Item::bowl)); } \ No newline at end of file diff --git a/Minecraft.World/Items/BowlFoodItem.h b/Minecraft.World/Items/BowlFoodItem.h index 77980bc29..1c488c7e3 100644 --- a/Minecraft.World/Items/BowlFoodItem.h +++ b/Minecraft.World/Items/BowlFoodItem.h @@ -10,5 +10,5 @@ class BowlFoodItem : public FoodItem public: BowlFoodItem(int id, int nutrition); - shared_ptr useTimeDepleted(shared_ptr instance, Level *level, shared_ptr player); + std::shared_ptr useTimeDepleted(std::shared_ptr instance, Level *level, std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.World/Items/BucketItem.cpp b/Minecraft.World/Items/BucketItem.cpp index 16216a41a..e7ae4f0ed 100644 --- a/Minecraft.World/Items/BucketItem.cpp +++ b/Minecraft.World/Items/BucketItem.cpp @@ -24,7 +24,7 @@ BucketItem::BucketItem(int id, int content) : Item( id ) this->content = content; } -bool BucketItem::TestUse(Level *level, shared_ptr player) +bool BucketItem::TestUse(Level *level, std::shared_ptr player) { // double x = player->xo + (player->x - player->xo); // double y = player->yo + (player->y - player->yo) + 1.62 - player->heightOffset; @@ -99,7 +99,7 @@ bool BucketItem::TestUse(Level *level, shared_ptr player) return false; } -shared_ptr BucketItem::use(shared_ptr itemInstance, Level *level, shared_ptr player) +std::shared_ptr BucketItem::use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { float a = 1; @@ -120,11 +120,11 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, if (!level->mayInteract(player, xt, yt, zt,content)) { app.DebugPrintf("!!!!!!!!!!! Can't place that here\n"); - shared_ptr servPlayer = dynamic_pointer_cast(player); + std::shared_ptr servPlayer = dynamic_pointer_cast(player); if( servPlayer != NULL ) { app.DebugPrintf("Sending ChatPacket::e_ChatCannotPlaceLava to player\n"); - servPlayer->connection->send( shared_ptr( new ChatPacket(L"", ChatPacket::e_ChatCannotPlaceLava ) ) ); + servPlayer->connection->send( std::shared_ptr( new ChatPacket(L"", ChatPacket::e_ChatCannotPlaceLava ) ) ); } delete hr; @@ -145,13 +145,13 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, if (--itemInstance->count <= 0) { - return shared_ptr( new ItemInstance(Item::bucket_water) ); + return std::shared_ptr( new ItemInstance(Item::bucket_water) ); } else { - if (!player->inventory->add(shared_ptr( new ItemInstance(Item::bucket_water)))) + if (!player->inventory->add(std::shared_ptr( new ItemInstance(Item::bucket_water)))) { - player->drop(shared_ptr(new ItemInstance(Item::bucket_water_Id, 1, 0))); + player->drop(std::shared_ptr(new ItemInstance(Item::bucket_water_Id, 1, 0))); } return itemInstance; } @@ -172,13 +172,13 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, } if (--itemInstance->count <= 0) { - return shared_ptr( new ItemInstance(Item::bucket_lava) ); + return std::shared_ptr( new ItemInstance(Item::bucket_lava) ); } else { - if (!player->inventory->add(shared_ptr( new ItemInstance(Item::bucket_lava)))) + if (!player->inventory->add(std::shared_ptr( new ItemInstance(Item::bucket_lava)))) { - player->drop(shared_ptr(new ItemInstance(Item::bucket_lava_Id, 1, 0))); + player->drop(std::shared_ptr(new ItemInstance(Item::bucket_lava_Id, 1, 0))); } return itemInstance; } @@ -187,7 +187,7 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, else if (content < 0) { delete hr; - return shared_ptr( new ItemInstance(Item::bucket_empty) ); + return std::shared_ptr( new ItemInstance(Item::bucket_empty) ); } else { @@ -203,7 +203,7 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, if (emptyBucket(level, x, y, z, xt, yt, zt) && !player->abilities.instabuild) { - return shared_ptr( new ItemInstance(Item::bucket_empty) ); + return std::shared_ptr( new ItemInstance(Item::bucket_empty) ); } } @@ -217,13 +217,13 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, delete hr; if (--itemInstance->count <= 0) { - return shared_ptr( new ItemInstance(Item::milk) ); + return std::shared_ptr( new ItemInstance(Item::milk) ); } else { - if (!player->inventory->add(shared_ptr( new ItemInstance(Item::milk)))) + if (!player->inventory->add(std::shared_ptr( new ItemInstance(Item::milk)))) { - player->drop(shared_ptr(new ItemInstance(Item::milk_Id, 1, 0))); + player->drop(std::shared_ptr(new ItemInstance(Item::milk_Id, 1, 0))); } return itemInstance; } diff --git a/Minecraft.World/Items/BucketItem.h b/Minecraft.World/Items/BucketItem.h index 500d19d87..f865ba21e 100644 --- a/Minecraft.World/Items/BucketItem.h +++ b/Minecraft.World/Items/BucketItem.h @@ -13,8 +13,8 @@ private: public: BucketItem(int id, int content); - virtual bool TestUse(Level *level, shared_ptr player); - virtual shared_ptr use(shared_ptr itemInstance, Level *level, shared_ptr player); + virtual bool TestUse(Level *level, std::shared_ptr player); + virtual std::shared_ptr use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); // TU9 bool emptyBucket(Level *level, double x, double y, double z, int xt, int yt, int zt); diff --git a/Minecraft.World/Items/CarrotOnAStickItem.cpp b/Minecraft.World/Items/CarrotOnAStickItem.cpp index 6a51b7290..99dae0937 100644 --- a/Minecraft.World/Items/CarrotOnAStickItem.cpp +++ b/Minecraft.World/Items/CarrotOnAStickItem.cpp @@ -21,11 +21,11 @@ bool CarrotOnAStickItem::isMirroredArt() return true; } -shared_ptr CarrotOnAStickItem::use(shared_ptr itemInstance, Level *level, shared_ptr player) +std::shared_ptr CarrotOnAStickItem::use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { if (player->isRiding()) { - shared_ptr pig = dynamic_pointer_cast(player->riding); + std::shared_ptr pig = dynamic_pointer_cast(player->riding); if(pig) { if (pig->getControlGoal()->canBoost() && itemInstance->getMaxDamage() - itemInstance->getAuxValue() >= 7) @@ -35,7 +35,7 @@ shared_ptr CarrotOnAStickItem::use(shared_ptr itemIn if (itemInstance->count == 0) { - shared_ptr replacement = shared_ptr(new ItemInstance(Item::fishingRod)); + std::shared_ptr replacement = std::shared_ptr(new ItemInstance(Item::fishingRod)); replacement->setTag(itemInstance->tag); return replacement; } diff --git a/Minecraft.World/Items/CarrotOnAStickItem.h b/Minecraft.World/Items/CarrotOnAStickItem.h index 5e98f5926..ef58c40f3 100644 --- a/Minecraft.World/Items/CarrotOnAStickItem.h +++ b/Minecraft.World/Items/CarrotOnAStickItem.h @@ -9,5 +9,5 @@ public: bool isHandEquipped(); bool isMirroredArt(); - shared_ptr use(shared_ptr itemInstance, Level *level, shared_ptr player); + std::shared_ptr use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.World/Items/CoalItem.cpp b/Minecraft.World/Items/CoalItem.cpp index 3bd37b9c5..f206df499 100644 --- a/Minecraft.World/Items/CoalItem.cpp +++ b/Minecraft.World/Items/CoalItem.cpp @@ -12,7 +12,7 @@ CoalItem::CoalItem(int id) : Item( id ) setMaxDamage(0); } -unsigned int CoalItem::getDescriptionId(shared_ptr instance) +unsigned int CoalItem::getDescriptionId(std::shared_ptr instance) { if (instance->getAuxValue() == CHAR_COAL) { diff --git a/Minecraft.World/Items/CoalItem.h b/Minecraft.World/Items/CoalItem.h index 24814548a..70c2acb74 100644 --- a/Minecraft.World/Items/CoalItem.h +++ b/Minecraft.World/Items/CoalItem.h @@ -13,5 +13,5 @@ public: CoalItem(int id); - virtual unsigned int getDescriptionId(shared_ptr instance); + virtual unsigned int getDescriptionId(std::shared_ptr instance); }; \ No newline at end of file diff --git a/Minecraft.World/Items/ComplexItem.cpp b/Minecraft.World/Items/ComplexItem.cpp index d8376bcbd..62e80dadf 100644 --- a/Minecraft.World/Items/ComplexItem.cpp +++ b/Minecraft.World/Items/ComplexItem.cpp @@ -13,7 +13,7 @@ bool ComplexItem::isComplex() return true; } -shared_ptr ComplexItem::getUpdatePacket(shared_ptr itemInstance, Level *level, shared_ptr player) +std::shared_ptr ComplexItem::getUpdatePacket(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { return nullptr; } \ No newline at end of file diff --git a/Minecraft.World/Items/ComplexItem.h b/Minecraft.World/Items/ComplexItem.h index 28aba7915..036781a4a 100644 --- a/Minecraft.World/Items/ComplexItem.h +++ b/Minecraft.World/Items/ComplexItem.h @@ -14,5 +14,5 @@ protected: public: virtual bool isComplex(); - virtual shared_ptr getUpdatePacket(shared_ptr itemInstance, Level *level, shared_ptr player); + virtual std::shared_ptr getUpdatePacket(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); }; diff --git a/Minecraft.World/Items/DiggerItem.cpp b/Minecraft.World/Items/DiggerItem.cpp index 4de4f88fb..ce65b2ddf 100644 --- a/Minecraft.World/Items/DiggerItem.cpp +++ b/Minecraft.World/Items/DiggerItem.cpp @@ -14,27 +14,27 @@ DiggerItem::DiggerItem(int id, int attackDamage, const Tier *tier, TileArray *ti this->attackDamage = attackDamage + tier->getAttackDamageBonus(); } -float DiggerItem::getDestroySpeed(shared_ptr itemInstance, Tile *tile) +float DiggerItem::getDestroySpeed(std::shared_ptr itemInstance, Tile *tile) { for (unsigned int i = 0; i < tiles->length; i++) if ( (*tiles)[i] == tile) return speed; return 1; } -bool DiggerItem::hurtEnemy(shared_ptr itemInstance, shared_ptr mob, shared_ptr attacker) +bool DiggerItem::hurtEnemy(std::shared_ptr itemInstance, std::shared_ptr mob, std::shared_ptr attacker) { itemInstance->hurt(2, attacker); return true; } -bool DiggerItem::mineBlock(shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, shared_ptr owner) +bool DiggerItem::mineBlock(std::shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, std::shared_ptr owner) { // Don't damage tools if the tile can be destroyed in one hit. if (Tile::tiles[tile]->getDestroySpeed(level, x, y, z) != 0.0) itemInstance->hurt(1, owner); return true; } -int DiggerItem::getAttackDamage(shared_ptr entity) +int DiggerItem::getAttackDamage(std::shared_ptr entity) { return attackDamage; } @@ -54,7 +54,7 @@ const Item::Tier *DiggerItem::getTier() return tier; } -bool DiggerItem::isValidRepairItem(shared_ptr source, shared_ptr repairItem) +bool DiggerItem::isValidRepairItem(std::shared_ptr source, std::shared_ptr repairItem) { if (tier->getTierItemId() == repairItem->id) { diff --git a/Minecraft.World/Items/DiggerItem.h b/Minecraft.World/Items/DiggerItem.h index 4a4eeb07d..747c755fe 100644 --- a/Minecraft.World/Items/DiggerItem.h +++ b/Minecraft.World/Items/DiggerItem.h @@ -19,13 +19,13 @@ protected: DiggerItem(int id, int attackDamage, const Tier *tier, TileArray *tiles); public: - virtual float getDestroySpeed(shared_ptr itemInstance, Tile *tile); - virtual bool hurtEnemy(shared_ptr itemInstance, shared_ptr mob, shared_ptr attacker); - virtual bool mineBlock(shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, shared_ptr owner); - virtual int getAttackDamage(shared_ptr entity); + virtual float getDestroySpeed(std::shared_ptr itemInstance, Tile *tile); + virtual bool hurtEnemy(std::shared_ptr itemInstance, std::shared_ptr mob, std::shared_ptr attacker); + virtual bool mineBlock(std::shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, std::shared_ptr owner); + virtual int getAttackDamage(std::shared_ptr entity); virtual bool isHandEquipped(); virtual int getEnchantmentValue(); const Tier *getTier(); - bool isValidRepairItem(shared_ptr source, shared_ptr repairItem); + bool isValidRepairItem(std::shared_ptr source, std::shared_ptr repairItem); }; \ No newline at end of file diff --git a/Minecraft.World/Items/DoorItem.cpp b/Minecraft.World/Items/DoorItem.cpp index 53f44cbfc..2e217a66c 100644 --- a/Minecraft.World/Items/DoorItem.cpp +++ b/Minecraft.World/Items/DoorItem.cpp @@ -18,7 +18,7 @@ DoorItem::DoorItem(int id, Material *material) : Item(id) maxStackSize = 1; } -bool DoorItem::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) +bool DoorItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { if (face != Facing::UP) return false; y++; diff --git a/Minecraft.World/Items/DoorItem.h b/Minecraft.World/Items/DoorItem.h index 843c768bf..635d8148c 100644 --- a/Minecraft.World/Items/DoorItem.h +++ b/Minecraft.World/Items/DoorItem.h @@ -15,6 +15,6 @@ private: public: DoorItem(int id, Material *material); - virtual bool 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=false); + virtual bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); static void place(Level *level, int x, int y, int z, int dir, Tile *tile); }; diff --git a/Minecraft.World/Items/DyePowderItem.cpp b/Minecraft.World/Items/DyePowderItem.cpp index 7e3c614c0..f9a038033 100644 --- a/Minecraft.World/Items/DyePowderItem.cpp +++ b/Minecraft.World/Items/DyePowderItem.cpp @@ -108,18 +108,18 @@ Icon *DyePowderItem::getIcon(int itemAuxValue) return icons[colorValue]; } -unsigned int DyePowderItem::getDescriptionId(shared_ptr itemInstance) +unsigned int DyePowderItem::getDescriptionId(std::shared_ptr itemInstance) { int colorValue = Mth::clamp(itemInstance->getAuxValue(), 0, 15); return COLOR_DESCS[colorValue]; } -unsigned int DyePowderItem::getUseDescriptionId(shared_ptr itemInstance) +unsigned int DyePowderItem::getUseDescriptionId(std::shared_ptr itemInstance) { return COLOR_USE_DESCS[itemInstance->getAuxValue()]; } -bool DyePowderItem::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) +bool DyePowderItem::useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { if (!player->mayBuild(x, y, z)) return false; @@ -289,11 +289,11 @@ mainloop: continue; return false; } -bool DyePowderItem::interactEnemy(shared_ptr itemInstance, shared_ptr mob) +bool DyePowderItem::interactEnemy(std::shared_ptr itemInstance, std::shared_ptr mob) { if (dynamic_pointer_cast( mob ) != NULL) { - shared_ptr sheep = dynamic_pointer_cast(mob); + std::shared_ptr sheep = dynamic_pointer_cast(mob); // convert to tile-based color value (0 is white instead of black) int newColor = ClothTile::getTileDataForItemAuxValue(itemInstance->getAuxValue()); if (!sheep->isSheared() && sheep->getColor() != newColor) diff --git a/Minecraft.World/Items/DyePowderItem.h b/Minecraft.World/Items/DyePowderItem.h index b96b40878..df6147b90 100644 --- a/Minecraft.World/Items/DyePowderItem.h +++ b/Minecraft.World/Items/DyePowderItem.h @@ -40,10 +40,10 @@ public: DyePowderItem(int id); virtual Icon *getIcon(int itemAuxValue); - virtual unsigned int getDescriptionId(shared_ptr itemInstance); - virtual unsigned int getUseDescriptionId(shared_ptr itemInstance); - virtual bool 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=false); - virtual bool interactEnemy(shared_ptr itemInstance, shared_ptr mob); + virtual unsigned int getDescriptionId(std::shared_ptr itemInstance); + virtual unsigned int getUseDescriptionId(std::shared_ptr itemInstance); + virtual bool useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); + virtual bool interactEnemy(std::shared_ptr itemInstance, std::shared_ptr mob); //@Override void registerIcons(IconRegister *iconRegister); diff --git a/Minecraft.World/Items/EggItem.cpp b/Minecraft.World/Items/EggItem.cpp index 29457cafe..4a47cf489 100644 --- a/Minecraft.World/Items/EggItem.cpp +++ b/Minecraft.World/Items/EggItem.cpp @@ -19,13 +19,13 @@ EggItem::EggItem(int id) : Item( id ) this->maxStackSize = 16; } -shared_ptr EggItem::use(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr EggItem::use(std::shared_ptr instance, Level *level, std::shared_ptr player) { if (!player->abilities.instabuild) { instance->count--; } level->playSound( dynamic_pointer_cast(player), eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); - if (!level->isClientSide) level->addEntity( shared_ptr( new ThrownEgg(level, dynamic_pointer_cast( player )) )); + if (!level->isClientSide) level->addEntity( std::shared_ptr( new ThrownEgg(level, dynamic_pointer_cast( player )) )); return instance; } diff --git a/Minecraft.World/Items/EggItem.h b/Minecraft.World/Items/EggItem.h index 83f09db58..a5763a5e3 100644 --- a/Minecraft.World/Items/EggItem.h +++ b/Minecraft.World/Items/EggItem.h @@ -11,5 +11,5 @@ class EggItem : public Item public: EggItem(int id); - virtual shared_ptr use(shared_ptr instance, Level *level, shared_ptr player); + virtual std::shared_ptr use(std::shared_ptr instance, Level *level, std::shared_ptr player); }; diff --git a/Minecraft.World/Items/EnchantedBookItem.cpp b/Minecraft.World/Items/EnchantedBookItem.cpp index 5419266c8..963646a89 100644 --- a/Minecraft.World/Items/EnchantedBookItem.cpp +++ b/Minecraft.World/Items/EnchantedBookItem.cpp @@ -10,17 +10,17 @@ EnchantedBookItem::EnchantedBookItem(int id) : Item(id) { } -bool EnchantedBookItem::isFoil(shared_ptr itemInstance) +bool EnchantedBookItem::isFoil(std::shared_ptr itemInstance) { return true; } -bool EnchantedBookItem::isEnchantable(shared_ptr itemInstance) +bool EnchantedBookItem::isEnchantable(std::shared_ptr itemInstance) { return false; } -const Rarity *EnchantedBookItem::getRarity(shared_ptr itemInstance) +const Rarity *EnchantedBookItem::getRarity(std::shared_ptr itemInstance) { ListTag *enchantments = getEnchantments(itemInstance); if (enchantments && enchantments->size() > 0) @@ -33,7 +33,7 @@ const Rarity *EnchantedBookItem::getRarity(shared_ptr itemInstance } } -ListTag *EnchantedBookItem::getEnchantments(shared_ptr item) +ListTag *EnchantedBookItem::getEnchantments(std::shared_ptr item) { if (item->tag == NULL || !item->tag->contains((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str())) { @@ -43,7 +43,7 @@ ListTag *EnchantedBookItem::getEnchantments(shared_ptr *) item->tag->get((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str()); } -void EnchantedBookItem::appendHoverText(shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) +void EnchantedBookItem::appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) { Item::appendHoverText(itemInstance, player, lines, advanced, unformattedStrings); @@ -66,7 +66,7 @@ void EnchantedBookItem::appendHoverText(shared_ptr itemInstance, s } } -void EnchantedBookItem::addEnchantment(shared_ptr item, EnchantmentInstance *enchantment) +void EnchantedBookItem::addEnchantment(std::shared_ptr item, EnchantmentInstance *enchantment) { ListTag *enchantments = getEnchantments(item); bool add = true; @@ -101,14 +101,14 @@ void EnchantedBookItem::addEnchantment(shared_ptr item, Enchantmen item->getTag()->put((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str(), enchantments); } -shared_ptr EnchantedBookItem::createForEnchantment(EnchantmentInstance *enchant) +std::shared_ptr EnchantedBookItem::createForEnchantment(EnchantmentInstance *enchant) { - shared_ptr item = shared_ptr(new ItemInstance(this)); + std::shared_ptr item = std::shared_ptr(new ItemInstance(this)); addEnchantment(item, enchant); return item; } -void EnchantedBookItem::createForEnchantment(Enchantment *enchant, vector > *items) +void EnchantedBookItem::createForEnchantment(Enchantment *enchant, vector > *items) { for (int i = enchant->getMinLevel(); i <= enchant->getMaxLevel(); i++) { @@ -116,10 +116,10 @@ void EnchantedBookItem::createForEnchantment(Enchantment *enchant, vector EnchantedBookItem::createForRandomLoot(Random *random) +std::shared_ptr EnchantedBookItem::createForRandomLoot(Random *random) { Enchantment *enchantment = Enchantment::validEnchantments[random->nextInt(Enchantment::validEnchantments.size())]; - shared_ptr book = shared_ptr(new ItemInstance(id, 1, 0)); + std::shared_ptr book = std::shared_ptr(new ItemInstance(id, 1, 0)); int level = Mth::nextInt(random, enchantment->getMinLevel(), enchantment->getMaxLevel()); addEnchantment(book, new EnchantmentInstance(enchantment, level)); @@ -135,7 +135,7 @@ WeighedTreasure *EnchantedBookItem::createForRandomTreasure(Random *random) WeighedTreasure *EnchantedBookItem::createForRandomTreasure(Random *random, int minCount, int maxCount, int weight) { Enchantment *enchantment = Enchantment::validEnchantments[random->nextInt(Enchantment::validEnchantments.size())]; - shared_ptr book = shared_ptr(new ItemInstance(id, 1, 0)); + std::shared_ptr book = std::shared_ptr(new ItemInstance(id, 1, 0)); int level = Mth::nextInt(random, enchantment->getMinLevel(), enchantment->getMaxLevel()); addEnchantment(book, new EnchantmentInstance(enchantment, level)); diff --git a/Minecraft.World/Items/EnchantedBookItem.h b/Minecraft.World/Items/EnchantedBookItem.h index c67f208ff..5b642b72c 100644 --- a/Minecraft.World/Items/EnchantedBookItem.h +++ b/Minecraft.World/Items/EnchantedBookItem.h @@ -11,15 +11,15 @@ public: EnchantedBookItem(int id); - bool isFoil(shared_ptr itemInstance); - bool isEnchantable(shared_ptr itemInstance); - const Rarity *getRarity(shared_ptr itemInstance); - ListTag *getEnchantments(shared_ptr item); - void appendHoverText(shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); - void addEnchantment(shared_ptr item, EnchantmentInstance *enchantment); - shared_ptr createForEnchantment(EnchantmentInstance *enchant); - void createForEnchantment(Enchantment *enchant, vector > *items); - shared_ptr createForRandomLoot(Random *random); + bool isFoil(std::shared_ptr itemInstance); + bool isEnchantable(std::shared_ptr itemInstance); + const Rarity *getRarity(std::shared_ptr itemInstance); + ListTag *getEnchantments(std::shared_ptr item); + void appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); + void addEnchantment(std::shared_ptr item, EnchantmentInstance *enchantment); + std::shared_ptr createForEnchantment(EnchantmentInstance *enchant); + void createForEnchantment(Enchantment *enchant, vector > *items); + std::shared_ptr createForRandomLoot(Random *random); WeighedTreasure *createForRandomTreasure(Random *random); WeighedTreasure *createForRandomTreasure(Random *random, int minCount, int maxCount, int weight); }; \ No newline at end of file diff --git a/Minecraft.World/Items/EnderEyeItem.cpp b/Minecraft.World/Items/EnderEyeItem.cpp index 87ad55985..fab8d038a 100644 --- a/Minecraft.World/Items/EnderEyeItem.cpp +++ b/Minecraft.World/Items/EnderEyeItem.cpp @@ -13,7 +13,7 @@ EnderEyeItem::EnderEyeItem(int id) : Item(id) { } -bool EnderEyeItem::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) +bool EnderEyeItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { int targetType = level->getTile(x, y, z); int targetData = level->getData(x, y, z); @@ -132,7 +132,7 @@ bool EnderEyeItem::useOn(shared_ptr instance, shared_ptr p return false; } -bool EnderEyeItem::TestUse(Level *level, shared_ptr player) +bool EnderEyeItem::TestUse(Level *level, std::shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, false); if (hr != NULL && hr->type == HitResult::TILE) @@ -185,7 +185,7 @@ bool EnderEyeItem::TestUse(Level *level, shared_ptr player) return false; } -shared_ptr EnderEyeItem::use(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr EnderEyeItem::use(std::shared_ptr instance, Level *level, std::shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, false); if (hr != NULL && hr->type == HitResult::TILE) @@ -206,7 +206,7 @@ shared_ptr EnderEyeItem::use(shared_ptr instance, Le { if((level->dimension->id==LevelData::DIMENSION_OVERWORLD) && level->getLevelData()->getHasStronghold()) { - shared_ptr eyeOfEnderSignal = shared_ptr( new EyeOfEnderSignal(level, player->x, player->y + 1.62 - player->heightOffset, player->z) ); + std::shared_ptr eyeOfEnderSignal = std::shared_ptr( new EyeOfEnderSignal(level, player->x, player->y + 1.62 - player->heightOffset, player->z) ); eyeOfEnderSignal->signalTo(level->getLevelData()->getXStronghold()<<4, player->y + 1.62 - player->heightOffset, level->getLevelData()->getZStronghold()<<4); level->addEntity(eyeOfEnderSignal); @@ -221,7 +221,7 @@ shared_ptr EnderEyeItem::use(shared_ptr instance, Le /*TilePos *nearestMapFeature = level->findNearestMapFeature(LargeFeature::STRONGHOLD, (int) player->x, (int) player->y, (int) player->z); if (nearestMapFeature != NULL) { - shared_ptr eyeOfEnderSignal = shared_ptr( new EyeOfEnderSignal(level, player->x, player->y + 1.62 - player->heightOffset, player->z) ); + std::shared_ptr eyeOfEnderSignal = std::shared_ptr( new EyeOfEnderSignal(level, player->x, player->y + 1.62 - player->heightOffset, player->z) ); eyeOfEnderSignal->signalTo(nearestMapFeature->x, nearestMapFeature->y, nearestMapFeature->z); delete nearestMapFeature; level->addEntity(eyeOfEnderSignal); diff --git a/Minecraft.World/Items/EnderEyeItem.h b/Minecraft.World/Items/EnderEyeItem.h index 72036aa5a..cbe56cfb1 100644 --- a/Minecraft.World/Items/EnderEyeItem.h +++ b/Minecraft.World/Items/EnderEyeItem.h @@ -7,7 +7,7 @@ class EnderEyeItem : public Item public: EnderEyeItem(int id); - virtual bool 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=false); - virtual bool TestUse(Level *level, shared_ptr player); - virtual shared_ptr use(shared_ptr instance, Level *level, shared_ptr player); + virtual bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); + virtual bool TestUse(Level *level, std::shared_ptr player); + virtual std::shared_ptr use(std::shared_ptr instance, Level *level, std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.World/Items/EnderPearlItem.cpp b/Minecraft.World/Items/EnderPearlItem.cpp index dcd394284..414890739 100644 --- a/Minecraft.World/Items/EnderPearlItem.cpp +++ b/Minecraft.World/Items/EnderPearlItem.cpp @@ -10,12 +10,12 @@ EnderpearlItem::EnderpearlItem(int id) : Item(id) this->maxStackSize = 16; } -bool EnderpearlItem::TestUse(Level *level, shared_ptr player) +bool EnderpearlItem::TestUse(Level *level, std::shared_ptr player) { return true; } -shared_ptr EnderpearlItem::use(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr EnderpearlItem::use(std::shared_ptr instance, Level *level, std::shared_ptr player) { // 4J-PB - Not sure why this was disabled for creative mode, so commenting out //if (player->abilities.instabuild) return instance; @@ -28,7 +28,7 @@ shared_ptr EnderpearlItem::use(shared_ptr instance, level->playSound(player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); if (!level->isClientSide) { - level->addEntity( shared_ptr( new ThrownEnderpearl(level, player) ) ); + level->addEntity( std::shared_ptr( new ThrownEnderpearl(level, player) ) ); } return instance; } \ No newline at end of file diff --git a/Minecraft.World/Items/EnderPearlItem.h b/Minecraft.World/Items/EnderPearlItem.h index 84913b9ec..5dbcb619d 100644 --- a/Minecraft.World/Items/EnderPearlItem.h +++ b/Minecraft.World/Items/EnderPearlItem.h @@ -7,7 +7,7 @@ class EnderpearlItem : public Item public: EnderpearlItem(int id); - virtual shared_ptr use(shared_ptr instance, Level *level, shared_ptr player); + virtual std::shared_ptr use(std::shared_ptr instance, Level *level, std::shared_ptr player); // 4J added - virtual bool TestUse(Level *level, shared_ptr player); + virtual bool TestUse(Level *level, std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.World/Items/ExperienceItem.cpp b/Minecraft.World/Items/ExperienceItem.cpp index 9808c2e2a..20bdb5b1e 100644 --- a/Minecraft.World/Items/ExperienceItem.cpp +++ b/Minecraft.World/Items/ExperienceItem.cpp @@ -10,23 +10,23 @@ ExperienceItem::ExperienceItem(int id) : Item(id) { } -bool ExperienceItem::isFoil(shared_ptr itemInstance) +bool ExperienceItem::isFoil(std::shared_ptr itemInstance) { return true; } -bool ExperienceItem::TestUse(Level *level, shared_ptr player) +bool ExperienceItem::TestUse(Level *level, std::shared_ptr player) { return true; } -shared_ptr ExperienceItem::use(shared_ptr itemInstance, Level *level, shared_ptr player) +std::shared_ptr ExperienceItem::use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { if (!player->abilities.instabuild) { itemInstance->count--; } level->playSound(player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); - if (!level->isClientSide) level->addEntity( shared_ptr( new ThrownExpBottle(level, player) )); + if (!level->isClientSide) level->addEntity( std::shared_ptr( new ThrownExpBottle(level, player) )); return itemInstance; } \ No newline at end of file diff --git a/Minecraft.World/Items/ExperienceItem.h b/Minecraft.World/Items/ExperienceItem.h index c8e95925b..c0d18dcf7 100644 --- a/Minecraft.World/Items/ExperienceItem.h +++ b/Minecraft.World/Items/ExperienceItem.h @@ -9,7 +9,7 @@ class ExperienceItem : public Item public: ExperienceItem(int id); - virtual bool isFoil(shared_ptr itemInstance); - virtual shared_ptr use(shared_ptr itemInstance, Level *level, shared_ptr player); - virtual bool TestUse(Level *level, shared_ptr player); + virtual bool isFoil(std::shared_ptr itemInstance); + virtual std::shared_ptr use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); + virtual bool TestUse(Level *level, std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.World/Items/FireChargeItem.cpp b/Minecraft.World/Items/FireChargeItem.cpp index abf8bb2dc..84d90f154 100644 --- a/Minecraft.World/Items/FireChargeItem.cpp +++ b/Minecraft.World/Items/FireChargeItem.cpp @@ -13,7 +13,7 @@ FireChargeItem::FireChargeItem(int id) : Item(id) m_dragonFireballIcon = NULL; } -bool FireChargeItem::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) +bool FireChargeItem::useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { if (level->isClientSide) { diff --git a/Minecraft.World/Items/FireChargeItem.h b/Minecraft.World/Items/FireChargeItem.h index c0890a46d..440222b4d 100644 --- a/Minecraft.World/Items/FireChargeItem.h +++ b/Minecraft.World/Items/FireChargeItem.h @@ -13,7 +13,7 @@ private: public: FireChargeItem(int id); - virtual bool 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); + virtual bool useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly); virtual Icon *getIcon(int itemAuxValue); virtual void registerIcons(IconRegister *iconRegister); diff --git a/Minecraft.World/Items/FishingRodItem.cpp b/Minecraft.World/Items/FishingRodItem.cpp index 11d44cd76..b9d4f49ea 100644 --- a/Minecraft.World/Items/FishingRodItem.cpp +++ b/Minecraft.World/Items/FishingRodItem.cpp @@ -32,7 +32,7 @@ bool FishingRodItem::isMirroredArt() return true; } -shared_ptr FishingRodItem::use(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr FishingRodItem::use(std::shared_ptr instance, Level *level, std::shared_ptr player) { if (player->fishing != NULL) { @@ -46,9 +46,9 @@ shared_ptr FishingRodItem::use(shared_ptr instance, if (!level->isClientSide) { // 4J Stu - Move the player->fishing out of the ctor as we cannot reference 'this' - shared_ptr hook = shared_ptr( new FishingHook(level, player) ); + std::shared_ptr hook = std::shared_ptr( new FishingHook(level, player) ); player->fishing = hook; - level->addEntity( shared_ptr( hook ) ); + level->addEntity( std::shared_ptr( hook ) ); } player->swing(); } diff --git a/Minecraft.World/Items/FishingRodItem.h b/Minecraft.World/Items/FishingRodItem.h index a6df606d4..42c02eb55 100644 --- a/Minecraft.World/Items/FishingRodItem.h +++ b/Minecraft.World/Items/FishingRodItem.h @@ -19,7 +19,7 @@ public: virtual bool isHandEquipped(); virtual bool isMirroredArt(); - virtual shared_ptr use(shared_ptr instance, Level *level, shared_ptr player); + virtual std::shared_ptr use(std::shared_ptr instance, Level *level, std::shared_ptr player); //@Override void registerIcons(IconRegister *iconRegister); diff --git a/Minecraft.World/Items/FlintAndSteelItem.cpp b/Minecraft.World/Items/FlintAndSteelItem.cpp index 4a6736130..99d8dad6b 100644 --- a/Minecraft.World/Items/FlintAndSteelItem.cpp +++ b/Minecraft.World/Items/FlintAndSteelItem.cpp @@ -15,7 +15,7 @@ FlintAndSteelItem::FlintAndSteelItem(int id) : Item( id ) setMaxDamage(64); } -bool FlintAndSteelItem::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) +bool FlintAndSteelItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { // 4J-PB - Adding a test only version to allow tooltips to be displayed if (face == 0) y--; diff --git a/Minecraft.World/Items/FlintAndSteelItem.h b/Minecraft.World/Items/FlintAndSteelItem.h index 4456330ad..d8ddce651 100644 --- a/Minecraft.World/Items/FlintAndSteelItem.h +++ b/Minecraft.World/Items/FlintAndSteelItem.h @@ -10,5 +10,5 @@ class FlintAndSteelItem : public Item public: FlintAndSteelItem(int id); - virtual bool 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=false); + virtual bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); }; diff --git a/Minecraft.World/Items/FoodItem.cpp b/Minecraft.World/Items/FoodItem.cpp index 7e045a348..c25313a53 100644 --- a/Minecraft.World/Items/FoodItem.cpp +++ b/Minecraft.World/Items/FoodItem.cpp @@ -33,7 +33,7 @@ FoodItem::FoodItem(int id, int nutrition, bool isMeat) _init(); } -shared_ptr FoodItem::useTimeDepleted(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr FoodItem::useTimeDepleted(std::shared_ptr instance, Level *level, std::shared_ptr player) { instance->count--; player->getFoodData()->eat(this); @@ -45,7 +45,7 @@ shared_ptr FoodItem::useTimeDepleted(shared_ptr inst return instance; } -void FoodItem::addEatEffect(shared_ptr instance, Level *level, shared_ptr player) +void FoodItem::addEatEffect(std::shared_ptr instance, Level *level, std::shared_ptr player) { if (!level->isClientSide && effectId > 0 && level->random->nextFloat() < effectProbability) { @@ -54,17 +54,17 @@ void FoodItem::addEatEffect(shared_ptr instance, Level *level, sha } -int FoodItem::getUseDuration(shared_ptr itemInstance) +int FoodItem::getUseDuration(std::shared_ptr itemInstance) { return EAT_DURATION; } -UseAnim FoodItem::getUseAnimation(shared_ptr itemInstance) +UseAnim FoodItem::getUseAnimation(std::shared_ptr itemInstance) { return UseAnim_eat; } -shared_ptr FoodItem::use(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr FoodItem::use(std::shared_ptr instance, Level *level, std::shared_ptr player) { if (player->canEat(canAlwaysEat)) { @@ -114,7 +114,7 @@ FoodItem *FoodItem::setCanAlwaysEat() } // 4J Added -bool FoodItem::canEat(shared_ptr player) +bool FoodItem::canEat(std::shared_ptr player) { return player->canEat(canAlwaysEat); } diff --git a/Minecraft.World/Items/FoodItem.h b/Minecraft.World/Items/FoodItem.h index 16e6ce3f6..2100a3b3e 100644 --- a/Minecraft.World/Items/FoodItem.h +++ b/Minecraft.World/Items/FoodItem.h @@ -26,16 +26,16 @@ public: FoodItem(int id, int nutrition, float saturationMod, bool isMeat); FoodItem(int id, int nutrition, bool isMeat); - virtual shared_ptr useTimeDepleted(shared_ptr instance, Level *level, shared_ptr player); + virtual std::shared_ptr useTimeDepleted(std::shared_ptr instance, Level *level, std::shared_ptr player); protected: - virtual void addEatEffect(shared_ptr instance, Level *level, shared_ptr player); + virtual void addEatEffect(std::shared_ptr instance, Level *level, std::shared_ptr player); public: - virtual int getUseDuration(shared_ptr itemInstance); - virtual UseAnim getUseAnimation(shared_ptr itemInstance); + virtual int getUseDuration(std::shared_ptr itemInstance); + virtual UseAnim getUseAnimation(std::shared_ptr itemInstance); - virtual shared_ptr use(shared_ptr instance, Level *level, shared_ptr player); + virtual std::shared_ptr use(std::shared_ptr instance, Level *level, std::shared_ptr player); int getNutrition(); float getSaturationModifier(); @@ -45,5 +45,5 @@ public: FoodItem *setCanAlwaysEat(); // 4J Added - bool canEat(shared_ptr player); + bool canEat(std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.World/Items/GoldenAppleItem.cpp b/Minecraft.World/Items/GoldenAppleItem.cpp index 2a09dd32f..a085570b2 100644 --- a/Minecraft.World/Items/GoldenAppleItem.cpp +++ b/Minecraft.World/Items/GoldenAppleItem.cpp @@ -10,12 +10,12 @@ GoldenAppleItem::GoldenAppleItem(int id, int nutrition, float saturationMod, boo setStackedByData(true); } -bool GoldenAppleItem::isFoil(shared_ptr itemInstance) +bool GoldenAppleItem::isFoil(std::shared_ptr itemInstance) { return itemInstance->getAuxValue() > 0; } -const Rarity *GoldenAppleItem::getRarity(shared_ptr itemInstance) +const Rarity *GoldenAppleItem::getRarity(std::shared_ptr itemInstance) { if (itemInstance->getAuxValue() == 0) { @@ -24,7 +24,7 @@ const Rarity *GoldenAppleItem::getRarity(shared_ptr itemInstance) return Rarity::epic; } -void GoldenAppleItem::addEatEffect(shared_ptr instance, Level *level, shared_ptr player) +void GoldenAppleItem::addEatEffect(std::shared_ptr instance, Level *level, std::shared_ptr player) { if (instance->getAuxValue() > 0) { @@ -47,7 +47,7 @@ unsigned int GoldenAppleItem::getUseDescriptionId(int iData /*= -1*/) else return IDS_DESC_ENCHANTED_GOLDENAPPLE; } -unsigned int GoldenAppleItem::getUseDescriptionId(shared_ptr instance) +unsigned int GoldenAppleItem::getUseDescriptionId(std::shared_ptr instance) { return this->getUseDescriptionId(instance->getAuxValue()); } \ No newline at end of file diff --git a/Minecraft.World/Items/GoldenAppleItem.h b/Minecraft.World/Items/GoldenAppleItem.h index 722bb2a9c..052fcb49f 100644 --- a/Minecraft.World/Items/GoldenAppleItem.h +++ b/Minecraft.World/Items/GoldenAppleItem.h @@ -9,13 +9,13 @@ public: GoldenAppleItem(int id, int nutrition, float saturationMod, bool isMeat); - virtual bool isFoil(shared_ptr itemInstance); - virtual const Rarity *getRarity(shared_ptr itemInstance); + virtual bool isFoil(std::shared_ptr itemInstance); + virtual const Rarity *getRarity(std::shared_ptr itemInstance); // 4J-JEV: Enchanted goldenapples and goldenapples each require their own tooltips. virtual unsigned int getUseDescriptionId(int iData /*= -1*/); - virtual unsigned int getUseDescriptionId(shared_ptr instance); + virtual unsigned int getUseDescriptionId(std::shared_ptr instance); protected: - void addEatEffect(shared_ptr instance, Level *level, shared_ptr player); + void addEatEffect(std::shared_ptr instance, Level *level, std::shared_ptr player); }; diff --git a/Minecraft.World/Items/HangingEntityItem.cpp b/Minecraft.World/Items/HangingEntityItem.cpp index afe430e8b..03cf121cb 100644 --- a/Minecraft.World/Items/HangingEntityItem.cpp +++ b/Minecraft.World/Items/HangingEntityItem.cpp @@ -19,7 +19,7 @@ HangingEntityItem::HangingEntityItem(int id, eINSTANCEOF eClassType) : Item(id) // setItemCategory(CreativeModeTab.TAB_DECORATIONS); } -bool HangingEntityItem::useOn(shared_ptr instance, shared_ptr player, Level *level, int xt, int yt, int zt, int face, float clickX, float clickY, float clickZ, bool bTestOnly) +bool HangingEntityItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int xt, int yt, int zt, int face, float clickX, float clickY, float clickZ, bool bTestOnly) { if (face == Facing::DOWN) return false; if (face == Facing::UP) return false; @@ -33,7 +33,7 @@ bool HangingEntityItem::useOn(shared_ptr instance, shared_ptr entity = createEntity(level, xt, yt, zt, dir); + std::shared_ptr entity = createEntity(level, xt, yt, zt, dir); //if (!player->mayUseItemAt(xt, yt, zt, face, instance)) return false; if (!player->mayBuild(xt, yt, zt)) return false; @@ -65,18 +65,18 @@ bool HangingEntityItem::useOn(shared_ptr instance, shared_ptr HangingEntityItem::createEntity(Level *level, int x, int y, int z, int dir) +std::shared_ptr HangingEntityItem::createEntity(Level *level, int x, int y, int z, int dir) { if (eType == eTYPE_PAINTING) { - shared_ptr painting = shared_ptr(new Painting(level, x, y, z, dir)); + std::shared_ptr painting = std::shared_ptr(new Painting(level, x, y, z, dir)); painting->PaintingPostConstructor(dir); return dynamic_pointer_cast (painting); } else if (eType == eTYPE_ITEM_FRAME) { - shared_ptr itemFrame = shared_ptr(new ItemFrame(level, x, y, z, dir)); + std::shared_ptr itemFrame = std::shared_ptr(new ItemFrame(level, x, y, z, dir)); return dynamic_pointer_cast (itemFrame); } diff --git a/Minecraft.World/Items/HangingEntityItem.h b/Minecraft.World/Items/HangingEntityItem.h index e927f24ed..06bba50d0 100644 --- a/Minecraft.World/Items/HangingEntityItem.h +++ b/Minecraft.World/Items/HangingEntityItem.h @@ -13,9 +13,9 @@ private: public: HangingEntityItem(int id, eINSTANCEOF eClassType); - virtual bool useOn(shared_ptr instance, shared_ptr player, Level *level, int xt, int yt, int zt, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly);//, float clickX, float clickY, float clickZ); + virtual bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int xt, int yt, int zt, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly);//, float clickX, float clickY, float clickZ); private: - shared_ptr createEntity(Level *level, int x, int y, int z, int dir) ; + std::shared_ptr createEntity(Level *level, int x, int y, int z, int dir) ; }; diff --git a/Minecraft.World/Items/HatchetItem.cpp b/Minecraft.World/Items/HatchetItem.cpp index e777f2d0e..a61caece1 100644 --- a/Minecraft.World/Items/HatchetItem.cpp +++ b/Minecraft.World/Items/HatchetItem.cpp @@ -23,7 +23,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) +float HatchetItem::getDestroySpeed(std::shared_ptr itemInstance, Tile *tile) { if (tile != NULL && tile->material == Material::wood) { diff --git a/Minecraft.World/Items/HatchetItem.h b/Minecraft.World/Items/HatchetItem.h index afb6dfc02..2959e38b1 100644 --- a/Minecraft.World/Items/HatchetItem.h +++ b/Minecraft.World/Items/HatchetItem.h @@ -11,5 +11,5 @@ private: public: static void staticCtor(); HatchetItem(int id, const Tier *tier); - virtual float getDestroySpeed(shared_ptr itemInstance, Tile *tile); // 4J - brought forward from 1.2.3 + virtual float getDestroySpeed(std::shared_ptr itemInstance, Tile *tile); // 4J - brought forward from 1.2.3 }; diff --git a/Minecraft.World/Items/HoeItem.cpp b/Minecraft.World/Items/HoeItem.cpp index 80543f1df..16871abac 100644 --- a/Minecraft.World/Items/HoeItem.cpp +++ b/Minecraft.World/Items/HoeItem.cpp @@ -12,7 +12,7 @@ HoeItem::HoeItem(int id, const Tier *tier) : Item(id) setMaxDamage(tier->getUses()); } -bool HoeItem::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) +bool HoeItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { if (!player->mayBuild(x, y, z)) return false; diff --git a/Minecraft.World/Items/HoeItem.h b/Minecraft.World/Items/HoeItem.h index a4d015ac9..e353d6cb6 100644 --- a/Minecraft.World/Items/HoeItem.h +++ b/Minecraft.World/Items/HoeItem.h @@ -12,7 +12,7 @@ protected: public: HoeItem(int id, const Tier *tier); - virtual bool 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=false); + virtual bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); virtual bool isHandEquipped(); const Tier *getTier(); diff --git a/Minecraft.World/Items/Item.cpp b/Minecraft.World/Items/Item.cpp index a256a7c1d..84c42ebc8 100644 --- a/Minecraft.World/Items/Item.cpp +++ b/Minecraft.World/Items/Item.cpp @@ -605,37 +605,37 @@ Icon *Item::getIcon(int auxValue) return icon; } -Icon *Item::getIcon(shared_ptr itemInstance) +Icon *Item::getIcon(std::shared_ptr itemInstance) { return getIcon(itemInstance->getAuxValue()); } -const bool Item::useOn(shared_ptr itemInstance, Level *level, int x, int y, int z, int face, bool bTestUseOnOnly) +const bool Item::useOn(std::shared_ptr itemInstance, Level *level, int x, int y, int z, int face, bool bTestUseOnOnly) { return false; } -bool Item::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) +bool Item::useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { return false; } -float Item::getDestroySpeed(shared_ptr itemInstance, Tile *tile) +float Item::getDestroySpeed(std::shared_ptr itemInstance, Tile *tile) { return 1; } -bool Item::TestUse(Level *level, shared_ptr player) +bool Item::TestUse(Level *level, std::shared_ptr player) { return false; } -shared_ptr Item::use(shared_ptr itemInstance, Level *level, shared_ptr player) +std::shared_ptr Item::use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { return itemInstance; } -shared_ptr Item::useTimeDepleted(shared_ptr itemInstance, Level *level, shared_ptr player) +std::shared_ptr Item::useTimeDepleted(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { return itemInstance; } @@ -689,7 +689,7 @@ bool Item::canBeDepleted() * @param attacker * @return */ -bool Item::hurtEnemy(shared_ptr itemInstance, shared_ptr mob, shared_ptr attacker) +bool Item::hurtEnemy(std::shared_ptr itemInstance, std::shared_ptr mob, std::shared_ptr attacker) { return false; } @@ -705,12 +705,12 @@ bool Item::hurtEnemy(shared_ptr itemInstance, shared_ptr mob, * @param owner * @return */ -bool Item::mineBlock(shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, shared_ptr owner) +bool Item::mineBlock(std::shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, std::shared_ptr owner) { return false; } -int Item::getAttackDamage(shared_ptr entity) +int Item::getAttackDamage(std::shared_ptr entity) { return 1; } @@ -720,7 +720,7 @@ bool Item::canDestroySpecial(Tile *tile) return false; } -bool Item::interactEnemy(shared_ptr itemInstance, shared_ptr mob) +bool Item::interactEnemy(std::shared_ptr itemInstance, std::shared_ptr mob) { return false; } @@ -753,7 +753,7 @@ LPCWSTR Item::getDescription() //return I18n::get(getDescriptionId()); } -LPCWSTR Item::getDescription(shared_ptr instance) +LPCWSTR Item::getDescription(std::shared_ptr instance) { return app.GetString(getDescriptionId(instance)); //return I18n::get(getDescriptionId(instance)); @@ -764,7 +764,7 @@ unsigned int Item::getDescriptionId(int iData /*= -1*/) return descriptionId; } -unsigned int Item::getDescriptionId(shared_ptr instance) +unsigned int Item::getDescriptionId(std::shared_ptr instance) { return descriptionId; } @@ -780,7 +780,7 @@ unsigned int Item::getUseDescriptionId() return useDescriptionId; } -unsigned int Item::getUseDescriptionId(shared_ptr instance) +unsigned int Item::getUseDescriptionId(std::shared_ptr instance) { return useDescriptionId; } @@ -791,7 +791,7 @@ Item *Item::setCraftingRemainingItem(Item *craftingRemainingItem) return this; } -bool Item::shouldMoveCraftingResultToInventory(shared_ptr instance) +bool Item::shouldMoveCraftingResultToInventory(std::shared_ptr instance) { // Default is good for the vast majority of items return true; @@ -817,15 +817,15 @@ wstring Item::getName() return L"";//I18n::get(getDescriptionId() + L".name"); } -int Item::getColor(shared_ptr item, int spriteLayer) +int Item::getColor(std::shared_ptr item, int spriteLayer) { return 0xffffff; } -void Item::inventoryTick(shared_ptr itemInstance, Level *level, shared_ptr owner, int slot, bool selected) { +void Item::inventoryTick(std::shared_ptr itemInstance, Level *level, std::shared_ptr owner, int slot, bool selected) { } -void Item::onCraftedBy(shared_ptr itemInstance, Level *level, shared_ptr player) +void Item::onCraftedBy(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { } @@ -834,17 +834,17 @@ bool Item::isComplex() return false; } -UseAnim Item::getUseAnimation(shared_ptr itemInstance) +UseAnim Item::getUseAnimation(std::shared_ptr itemInstance) { return UseAnim_none; } -int Item::getUseDuration(shared_ptr itemInstance) +int Item::getUseDuration(std::shared_ptr itemInstance) { return 0; } -void Item::releaseUsing(shared_ptr itemInstance, Level *level, shared_ptr player, int durationLeft) +void Item::releaseUsing(std::shared_ptr itemInstance, Level *level, std::shared_ptr player, int durationLeft) { } @@ -864,35 +864,35 @@ bool Item::hasPotionBrewingFormula() return !potionBrewingFormula.empty(); } -void Item::appendHoverText(shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) +void Item::appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) { } -wstring Item::getHoverName(shared_ptr itemInstance) +wstring Item::getHoverName(std::shared_ptr itemInstance) { //String elementName = ("" + Language.getInstance().getElementName(getDescription(itemInstance))).trim(); //return elementName; return app.GetString(getDescriptionId(itemInstance)); } -bool Item::isFoil(shared_ptr itemInstance) +bool Item::isFoil(std::shared_ptr itemInstance) { if (itemInstance->isEnchanted()) return true; return false; } -const Rarity *Item::getRarity(shared_ptr itemInstance) +const Rarity *Item::getRarity(std::shared_ptr itemInstance) { if (itemInstance->isEnchanted()) return Rarity::rare; return Rarity::common; } -bool Item::isEnchantable(shared_ptr itemInstance) +bool Item::isEnchantable(std::shared_ptr itemInstance) { return getMaxStackSize() == 1 && canBeDepleted(); } -HitResult *Item::getPlayerPOVHitResult(Level *level, shared_ptr player, bool alsoPickLiquid) +HitResult *Item::getPlayerPOVHitResult(Level *level, std::shared_ptr player, bool alsoPickLiquid) { float a = 1; @@ -935,7 +935,7 @@ Icon *Item::getLayerIcon(int auxValue, int spriteLayer) return getIcon(auxValue); } -bool Item::isValidRepairItem(shared_ptr source, shared_ptr repairItem) +bool Item::isValidRepairItem(std::shared_ptr source, std::shared_ptr repairItem) { return false; } diff --git a/Minecraft.World/Items/Item.h b/Minecraft.World/Items/Item.h index 50623bd08..8cd7ac846 100644 --- a/Minecraft.World/Items/Item.h +++ b/Minecraft.World/Items/Item.h @@ -618,15 +618,15 @@ public: virtual int getIconType(); virtual Icon *getIcon(int auxValue); - Icon *getIcon(shared_ptr itemInstance); + Icon *getIcon(std::shared_ptr itemInstance); - const bool useOn(shared_ptr itemInstance, Level *level, int x, int y, int z, int face, bool bTestUseOnOnly=false); + const bool useOn(std::shared_ptr itemInstance, Level *level, int x, int y, int z, int face, bool bTestUseOnOnly=false); - virtual bool 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=false); - virtual float getDestroySpeed(shared_ptr itemInstance, Tile *tile); - virtual bool TestUse(Level *level, shared_ptr player); - virtual shared_ptr use(shared_ptr itemInstance, Level *level, shared_ptr player); - virtual shared_ptr useTimeDepleted(shared_ptr itemInstance, Level *level, shared_ptr player); + virtual bool useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); + virtual float getDestroySpeed(std::shared_ptr itemInstance, Tile *tile); + virtual bool TestUse(Level *level, std::shared_ptr player); + virtual std::shared_ptr use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); + virtual std::shared_ptr useTimeDepleted(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); virtual int getMaxStackSize(); virtual int getLevelDataForAuxValue(int auxValue); bool isStackedByData(); @@ -651,7 +651,7 @@ public: * @param attacker * @return */ - virtual bool hurtEnemy(shared_ptr itemInstance, shared_ptr mob, shared_ptr attacker); + virtual bool hurtEnemy(std::shared_ptr itemInstance, std::shared_ptr mob, std::shared_ptr attacker); /** * Returns true when the item was used to mine more efficiently @@ -664,35 +664,35 @@ public: * @param owner * @return */ - virtual bool mineBlock(shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, shared_ptr owner); - virtual int getAttackDamage(shared_ptr entity); + virtual bool mineBlock(std::shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, std::shared_ptr owner); + virtual int getAttackDamage(std::shared_ptr entity); virtual bool canDestroySpecial(Tile *tile); - virtual bool interactEnemy(shared_ptr itemInstance, shared_ptr mob); + virtual bool interactEnemy(std::shared_ptr itemInstance, std::shared_ptr mob); Item *handEquipped(); virtual bool isHandEquipped(); virtual bool isMirroredArt(); Item *setDescriptionId(unsigned int id); LPCWSTR getDescription(); - LPCWSTR getDescription(shared_ptr instance); + LPCWSTR getDescription(std::shared_ptr instance); virtual unsigned int getDescriptionId(int iData = -1); - virtual unsigned int getDescriptionId(shared_ptr instance); + virtual unsigned int getDescriptionId(std::shared_ptr instance); Item *setUseDescriptionId(unsigned int id); virtual unsigned int getUseDescriptionId(); - virtual unsigned int getUseDescriptionId(shared_ptr instance); + virtual unsigned int getUseDescriptionId(std::shared_ptr instance); Item *setCraftingRemainingItem(Item *craftingRemainingItem); - virtual bool shouldMoveCraftingResultToInventory(shared_ptr instance); + virtual bool shouldMoveCraftingResultToInventory(std::shared_ptr instance); virtual bool shouldOverrideMultiplayerNBT(); Item *getCraftingRemainingItem(); bool hasCraftingRemainingItem(); std::wstring getName(); - virtual int getColor(shared_ptr item, int spriteLayer); - virtual void inventoryTick(shared_ptr itemInstance, Level *level, shared_ptr owner, int slot, bool selected); - virtual void onCraftedBy(shared_ptr itemInstance, Level *level, shared_ptr player); + virtual int getColor(std::shared_ptr item, int spriteLayer); + virtual void inventoryTick(std::shared_ptr itemInstance, Level *level, std::shared_ptr owner, int slot, bool selected); + virtual void onCraftedBy(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); virtual bool isComplex(); - virtual UseAnim getUseAnimation(shared_ptr itemInstance); - virtual int getUseDuration(shared_ptr itemInstance); - virtual void releaseUsing(shared_ptr itemInstance, Level *level, shared_ptr player, int durationLeft); + virtual UseAnim getUseAnimation(std::shared_ptr itemInstance); + virtual int getUseDuration(std::shared_ptr itemInstance); + virtual void releaseUsing(std::shared_ptr itemInstance, Level *level, std::shared_ptr player, int durationLeft); protected: virtual Item *setPotionBrewingFormula(const wstring &potionBrewingFormula); @@ -700,19 +700,19 @@ protected: public: virtual wstring getPotionBrewingFormula(); virtual bool hasPotionBrewingFormula(); - virtual void appendHoverText(shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); // 4J Added unformattedStrings - virtual wstring getHoverName(shared_ptr itemInstance); - virtual bool isFoil(shared_ptr itemInstance); - virtual const Rarity *getRarity(shared_ptr itemInstance); - virtual bool isEnchantable(shared_ptr itemInstance); + virtual void appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); // 4J Added unformattedStrings + virtual wstring getHoverName(std::shared_ptr itemInstance); + virtual bool isFoil(std::shared_ptr itemInstance); + virtual const Rarity *getRarity(std::shared_ptr itemInstance); + virtual bool isEnchantable(std::shared_ptr itemInstance); protected: - HitResult *getPlayerPOVHitResult(Level *level, shared_ptr player, bool alsoPickLiquid); + HitResult *getPlayerPOVHitResult(Level *level, std::shared_ptr player, bool alsoPickLiquid); public: virtual int getEnchantmentValue(); virtual bool hasMultipleSpriteLayers(); virtual Icon *getLayerIcon(int auxValue, int spriteLayer); - virtual bool isValidRepairItem(shared_ptr source, shared_ptr repairItem); + virtual bool isValidRepairItem(std::shared_ptr source, std::shared_ptr repairItem); virtual void registerIcons(IconRegister *iconRegister); }; diff --git a/Minecraft.World/Items/ItemInstance.cpp b/Minecraft.World/Items/ItemInstance.cpp index 30710f60b..8b091b5de 100644 --- a/Minecraft.World/Items/ItemInstance.cpp +++ b/Minecraft.World/Items/ItemInstance.cpp @@ -70,9 +70,9 @@ ItemInstance::ItemInstance(int id, int count, int damage) _init(id,count,damage); } -shared_ptr ItemInstance::fromTag(CompoundTag *itemTag) +std::shared_ptr ItemInstance::fromTag(CompoundTag *itemTag) { - shared_ptr itemInstance = shared_ptr(new ItemInstance()); + std::shared_ptr itemInstance = std::shared_ptr(new ItemInstance()); itemInstance->load(itemTag); return itemInstance->getItem() != NULL ? itemInstance : nullptr; } @@ -82,9 +82,9 @@ ItemInstance::~ItemInstance() if(tag != NULL) delete tag; } -shared_ptr ItemInstance::remove(int count) +std::shared_ptr ItemInstance::remove(int count) { - shared_ptr ii = shared_ptr( new ItemInstance(id, count, auxValue) ); + std::shared_ptr ii = std::shared_ptr( new ItemInstance(id, count, auxValue) ); if (tag != NULL) ii->tag = (CompoundTag *) tag->copy(); this->count -= count; @@ -111,7 +111,7 @@ int ItemInstance::getIconType() return getItem()->getIconType(); } -bool ItemInstance::useOn(shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) +bool ItemInstance::useOn(std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { return getItem()->useOn(shared_from_this(), player, level, x, y, z, face, clickX, clickY, clickZ, bTestUseOnOnly); } @@ -121,17 +121,17 @@ float ItemInstance::getDestroySpeed(Tile *tile) return getItem()->getDestroySpeed(shared_from_this(), tile); } -bool ItemInstance::TestUse(Level *level, shared_ptr player) +bool ItemInstance::TestUse(Level *level, std::shared_ptr player) { return getItem()->TestUse( level, player); } -shared_ptr ItemInstance::use(Level *level, shared_ptr player) +std::shared_ptr ItemInstance::use(Level *level, std::shared_ptr player) { return getItem()->use(shared_from_this(), level, player); } -shared_ptr ItemInstance::useTimeDepleted(Level *level, shared_ptr player) +std::shared_ptr ItemInstance::useTimeDepleted(Level *level, std::shared_ptr player) { return getItem()->useTimeDepleted(shared_from_this(), level, player); } @@ -209,14 +209,14 @@ int ItemInstance::getMaxDamage() return Item::items[id]->getMaxDamage(); } -void ItemInstance::hurt(int i, shared_ptr owner) +void ItemInstance::hurt(int i, std::shared_ptr owner) { if (!isDamageableItem()) { return; } - shared_ptr player = dynamic_pointer_cast(owner); + std::shared_ptr player = dynamic_pointer_cast(owner); if (i > 0 && player != NULL) { int enchanted = EnchantmentHelper::getDigDurability(player->inventory); @@ -242,19 +242,19 @@ void ItemInstance::hurt(int i, shared_ptr owner) } } -void ItemInstance::hurtEnemy(shared_ptr mob, shared_ptr attacker) +void ItemInstance::hurtEnemy(std::shared_ptr mob, std::shared_ptr attacker) { //bool used = Item::items[id]->hurtEnemy(shared_from_this(), mob, attacker); } -void ItemInstance::mineBlock(Level *level, int tile, int x, int y, int z, shared_ptr owner) +void ItemInstance::mineBlock(Level *level, int tile, int x, int y, int z, std::shared_ptr owner) { //bool used = Item::items[id]->mineBlock( shared_from_this(), level, tile, x, y, z, owner); } -int ItemInstance::getAttackDamage(shared_ptr entity) +int ItemInstance::getAttackDamage(std::shared_ptr entity) { return Item::items[id]->getAttackDamage(entity); } @@ -264,14 +264,14 @@ bool ItemInstance::canDestroySpecial(Tile *tile) return Item::items[id]->canDestroySpecial(tile); } -bool ItemInstance::interactEnemy(shared_ptr mob) +bool ItemInstance::interactEnemy(std::shared_ptr mob) { return Item::items[id]->interactEnemy(shared_from_this(), mob); } -shared_ptr ItemInstance::copy() const +std::shared_ptr ItemInstance::copy() const { - shared_ptr copy = shared_ptr( new ItemInstance(id, count, auxValue) ); + std::shared_ptr copy = std::shared_ptr( new ItemInstance(id, count, auxValue) ); if (tag != NULL) { copy->tag = (CompoundTag *) tag->copy(); @@ -295,7 +295,7 @@ ItemInstance *ItemInstance::copy_not_shared() const } // 4J Brought forward from 1.2 -bool ItemInstance::tagMatches(shared_ptr a, shared_ptr b) +bool ItemInstance::tagMatches(std::shared_ptr a, std::shared_ptr b) { if (a == NULL && b == NULL) return true; if (a == NULL || b == NULL) return false; @@ -311,14 +311,14 @@ bool ItemInstance::tagMatches(shared_ptr a, shared_ptr a, shared_ptr b) +bool ItemInstance::matches(std::shared_ptr a, std::shared_ptr b) { if (a == NULL && b == NULL) return true; if (a == NULL || b == NULL) return false; return a->matches(b); } -bool ItemInstance::matches(shared_ptr b) +bool ItemInstance::matches(std::shared_ptr b) { if (count != b->count) return false; if (id != b->id) return false; @@ -341,12 +341,12 @@ bool ItemInstance::matches(shared_ptr b) * @param b * @return */ -bool ItemInstance::sameItem(shared_ptr b) +bool ItemInstance::sameItem(std::shared_ptr b) { return id == b->id && auxValue == b->auxValue; } -bool ItemInstance::sameItemWithTags(shared_ptr b) +bool ItemInstance::sameItemWithTags(std::shared_ptr b) { if (id != b->id) return false; if (auxValue != b->auxValue) return false; @@ -384,7 +384,7 @@ ItemInstance *ItemInstance::setDescriptionId(unsigned int id) return this; } -shared_ptr ItemInstance::clone(shared_ptr item) +std::shared_ptr ItemInstance::clone(std::shared_ptr item) { return item == NULL ? nullptr : item->copy(); } @@ -406,13 +406,13 @@ wstring ItemInstance::toString() return oss.str(); } -void ItemInstance::inventoryTick(Level *level, shared_ptr owner, int slot, bool selected) +void ItemInstance::inventoryTick(Level *level, std::shared_ptr owner, int slot, bool selected) { if (popTime > 0) popTime--; Item::items[id]->inventoryTick(shared_from_this(), level, owner, slot, selected); } -void ItemInstance::onCraftedBy(Level *level, shared_ptr player, int craftCount) +void ItemInstance::onCraftedBy(Level *level, std::shared_ptr player, int craftCount) { // 4J Stu Added for tutorial callback player->onCrafted(shared_from_this()); @@ -425,7 +425,7 @@ void ItemInstance::onCraftedBy(Level *level, shared_ptr player, int craf Item::items[id]->onCraftedBy(shared_from_this(), level, player); } -bool ItemInstance::equals(shared_ptr ii) +bool ItemInstance::equals(std::shared_ptr ii) { return id == ii->id && count == ii->count && auxValue == ii->auxValue; } @@ -440,7 +440,7 @@ UseAnim ItemInstance::getUseAnimation() return getItem()->getUseAnimation(shared_from_this()); } -void ItemInstance::releaseUsing(Level *level, shared_ptr player, int durationLeft) +void ItemInstance::releaseUsing(Level *level, std::shared_ptr player, int durationLeft) { getItem()->releaseUsing(shared_from_this(), level, player, durationLeft); } @@ -501,7 +501,7 @@ bool ItemInstance::hasCustomHoverName() return tag->getCompound(L"display")->contains(L"Name"); } -vector *ItemInstance::getHoverText(shared_ptr player, bool advanced, vector &unformattedStrings) +vector *ItemInstance::getHoverText(std::shared_ptr player, bool advanced, vector &unformattedStrings) { vector *lines = new vector(); Item *item = Item::items[id]; @@ -568,7 +568,7 @@ vector *ItemInstance::getHoverText(shared_ptr player, bool adva } // 4J Added -vector *ItemInstance::getHoverTextOnly(shared_ptr player, bool advanced, vector &unformattedStrings) +vector *ItemInstance::getHoverTextOnly(std::shared_ptr player, bool advanced, vector &unformattedStrings) { vector *lines = new vector(); Item *item = Item::items[id]; @@ -698,12 +698,12 @@ bool ItemInstance::isFramed() return frame != NULL; } -void ItemInstance::setFramed(shared_ptr frame) +void ItemInstance::setFramed(std::shared_ptr frame) { this->frame = frame; } -shared_ptr ItemInstance::getFrame() +std::shared_ptr ItemInstance::getFrame() { return frame; } diff --git a/Minecraft.World/Items/ItemInstance.h b/Minecraft.World/Items/ItemInstance.h index acef2350a..82f6e4a53 100644 --- a/Minecraft.World/Items/ItemInstance.h +++ b/Minecraft.World/Items/ItemInstance.h @@ -44,7 +44,7 @@ private: void _init(int id, int count, int auxValue); // TU9 - shared_ptr frame; + std::shared_ptr frame; public: ItemInstance(Tile *tile); @@ -58,22 +58,22 @@ public: ItemInstance(Item *item, int count, int auxValue); ItemInstance(int id, int count, int damage); - static shared_ptr fromTag(CompoundTag *itemTag); + static std::shared_ptr fromTag(CompoundTag *itemTag); private: ItemInstance() { _init(-1,0,0); } public: ~ItemInstance(); - shared_ptr remove(int count); + std::shared_ptr remove(int count); Item *getItem() const; Icon *getIcon(); int getIconType(); - bool useOn(shared_ptr player, Level *level, int x, int y, int z, int face, float clickX = 0.0f, float clickY = 0.0f, float clickZ = 0.0f, bool bTestUseOnOnly=false); + bool useOn(std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX = 0.0f, float clickY = 0.0f, float clickZ = 0.0f, bool bTestUseOnOnly=false); float getDestroySpeed(Tile *tile); - bool TestUse(Level *level, shared_ptr player); - shared_ptr use(Level *level, shared_ptr player); - shared_ptr useTimeDepleted(Level *level, shared_ptr player); + bool TestUse(Level *level, std::shared_ptr player); + std::shared_ptr use(Level *level, std::shared_ptr player); + std::shared_ptr useTimeDepleted(Level *level, std::shared_ptr player); CompoundTag *save(CompoundTag *compoundTag); void load(CompoundTag *compoundTag); int getMaxStackSize(); @@ -85,16 +85,16 @@ public: int getAuxValue() const; void setAuxValue(int value); int getMaxDamage(); - void hurt(int i, shared_ptr owner); - void hurtEnemy(shared_ptr mob, shared_ptr attacker); - void mineBlock(Level *level, int tile, int x, int y, int z, shared_ptr owner); - int getAttackDamage(shared_ptr entity); + void hurt(int i, std::shared_ptr owner); + void hurtEnemy(std::shared_ptr mob, std::shared_ptr attacker); + void mineBlock(Level *level, int tile, int x, int y, int z, std::shared_ptr owner); + int getAttackDamage(std::shared_ptr entity); bool canDestroySpecial(Tile *tile); - bool interactEnemy(shared_ptr mob); - shared_ptr copy() const; + bool interactEnemy(std::shared_ptr mob); + std::shared_ptr copy() const; ItemInstance *copy_not_shared() const; // 4J Stu - Added for use in recipes - static bool tagMatches(shared_ptr a, shared_ptr b); // 4J Brought forward from 1.2 - static bool matches(shared_ptr a, shared_ptr b); + static bool tagMatches(std::shared_ptr a, std::shared_ptr b); // 4J Brought forward from 1.2 + static bool matches(std::shared_ptr a, std::shared_ptr b); // 4J-PB int GetCount() {return count;} @@ -102,24 +102,24 @@ public: bool GetForceNumberDisplay() {return m_bForceNumberDisplay;} // to force the display of 0 and 1 on the required trading items when you have o or 1 of the item private: - bool matches(shared_ptr b); + bool matches(std::shared_ptr b); public: - bool sameItem(shared_ptr b); - bool sameItemWithTags(shared_ptr b); //4J Added + bool sameItem(std::shared_ptr b); + bool sameItemWithTags(std::shared_ptr b); //4J Added bool sameItem_not_shared(ItemInstance *b); // 4J Stu - Added this for the one time I need it virtual unsigned int getUseDescriptionId(); // 4J Added virtual unsigned int getDescriptionId(int iData = -1); virtual ItemInstance *setDescriptionId(unsigned int id); - static shared_ptr clone(shared_ptr item); + static std::shared_ptr clone(std::shared_ptr item); wstring toString(); - void inventoryTick(Level *level, shared_ptr owner, int slot, bool selected); - void onCraftedBy(Level *level, shared_ptr player, int craftCount); - bool equals(shared_ptr ii); + void inventoryTick(Level *level, std::shared_ptr owner, int slot, bool selected); + void onCraftedBy(Level *level, std::shared_ptr player, int craftCount); + bool equals(std::shared_ptr ii); int getUseDuration(); UseAnim getUseAnimation(); - void releaseUsing(Level *level, shared_ptr player, int durationLeft); + void releaseUsing(Level *level, std::shared_ptr player, int durationLeft); // 4J Stu - Brought forward these functions for enchanting/game rules bool hasTag(); @@ -129,8 +129,8 @@ public: wstring getHoverName(); void setHoverName(const wstring &name); bool hasCustomHoverName(); - vector *getHoverText(shared_ptr player, bool advanced, vector &unformattedStrings); - vector *getHoverTextOnly(shared_ptr player, bool advanced, vector &unformattedStrings); // 4J Added + vector *getHoverText(std::shared_ptr player, bool advanced, vector &unformattedStrings); + vector *getHoverTextOnly(std::shared_ptr player, bool advanced, vector &unformattedStrings); // 4J Added bool isFoil(); const Rarity *getRarity(); bool isEnchantable(); @@ -146,8 +146,8 @@ public: // TU9 bool isFramed(); - void setFramed(shared_ptr frame); - shared_ptr getFrame(); + void setFramed(std::shared_ptr frame); + std::shared_ptr getFrame(); int getBaseRepairCost(); void setRepairCost(int cost); diff --git a/Minecraft.World/Items/MapItem.cpp b/Minecraft.World/Items/MapItem.cpp index 293398aee..e15558f8e 100644 --- a/Minecraft.World/Items/MapItem.cpp +++ b/Minecraft.World/Items/MapItem.cpp @@ -19,10 +19,10 @@ MapItem::MapItem(int id) : ComplexItem(id) this->setMaxStackSize(1); } -shared_ptr MapItem::getSavedData(short idNum, Level *level) +std::shared_ptr MapItem::getSavedData(short idNum, Level *level) { std::wstring id = wstring( L"map_" ) + _toString(idNum); - shared_ptr mapItemSavedData = dynamic_pointer_cast(level->getSavedData(typeid(MapItemSavedData), id)); + std::shared_ptr mapItemSavedData = dynamic_pointer_cast(level->getSavedData(typeid(MapItemSavedData), id)); if (mapItemSavedData == NULL) { @@ -32,20 +32,20 @@ shared_ptr MapItem::getSavedData(short idNum, Level *level) int aux = idNum; id = wstring( L"map_" ) + _toString(aux); - mapItemSavedData = shared_ptr( new MapItemSavedData(id) ); + mapItemSavedData = std::shared_ptr( new MapItemSavedData(id) ); - level->setSavedData(id, (shared_ptr ) mapItemSavedData); + level->setSavedData(id, (std::shared_ptr ) mapItemSavedData); } return mapItemSavedData; } -shared_ptr MapItem::getSavedData(shared_ptr itemInstance, Level *level) +std::shared_ptr MapItem::getSavedData(std::shared_ptr itemInstance, Level *level) { MemSect(31); std::wstring id = wstring( L"map_" ) + _toString(itemInstance->getAuxValue() ); MemSect(0); - shared_ptr mapItemSavedData = dynamic_pointer_cast( level->getSavedData(typeid(MapItemSavedData), id ) ); + std::shared_ptr mapItemSavedData = dynamic_pointer_cast( level->getSavedData(typeid(MapItemSavedData), id ) ); bool newData = false; if (mapItemSavedData == NULL) @@ -55,7 +55,7 @@ shared_ptr MapItem::getSavedData(shared_ptr item //itemInstance->setAuxValue(level->getFreeAuxValueFor(L"map")); id = wstring( L"map_" ) + _toString(itemInstance->getAuxValue() ); - mapItemSavedData = shared_ptr( new MapItemSavedData(id) ); + mapItemSavedData = std::shared_ptr( new MapItemSavedData(id) ); newData = true; } @@ -78,13 +78,13 @@ shared_ptr MapItem::getSavedData(shared_ptr item mapItemSavedData->setDirty(); - level->setSavedData(id, (shared_ptr ) mapItemSavedData); + level->setSavedData(id, (std::shared_ptr ) mapItemSavedData); } return mapItemSavedData; } -void MapItem::update(Level *level, shared_ptr player, shared_ptr data) +void MapItem::update(Level *level, std::shared_ptr player, std::shared_ptr data) { if (level->dimension->id != data->dimension) { @@ -259,20 +259,20 @@ void MapItem::update(Level *level, shared_ptr player, shared_ptr itemInstance, Level *level, shared_ptr owner, int slot, bool selected) +void MapItem::inventoryTick(std::shared_ptr itemInstance, Level *level, std::shared_ptr owner, int slot, bool selected) { if (level->isClientSide) return; - shared_ptr data = getSavedData(itemInstance, level); + std::shared_ptr data = getSavedData(itemInstance, level); if (dynamic_pointer_cast(owner) != NULL) { - shared_ptr player = dynamic_pointer_cast(owner); + std::shared_ptr player = dynamic_pointer_cast(owner); // 4J Stu - If the player has a map that belongs to another player, then merge the data over and change this map id to the owners id int ownersAuxValue = level->getAuxValueForMap(player->getXuid(), data->dimension, data->x, data->z, data->scale); if(ownersAuxValue != itemInstance->getAuxValue() ) { - shared_ptr ownersData = getSavedData(ownersAuxValue,level); + std::shared_ptr ownersData = getSavedData(ownersAuxValue,level); ownersData->x = data->x; ownersData->z = data->z; @@ -298,7 +298,7 @@ void MapItem::inventoryTick(shared_ptr itemInstance, Level *level, } } -void MapItem::onCraftedBy(shared_ptr itemInstance, Level *level, shared_ptr player) +void MapItem::onCraftedBy(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { wchar_t buf[64]; @@ -318,14 +318,14 @@ void MapItem::onCraftedBy(shared_ptr itemInstance, Level *level, s swprintf(buf,64,L"map_%d", itemInstance->getAuxValue()); std::wstring id = wstring(buf); - shared_ptr data = getSavedData(itemInstance->getAuxValue(), level); + std::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 ) { - data = shared_ptr( new MapItemSavedData(id) ); + data = std::shared_ptr( new MapItemSavedData(id) ); } - level->setSavedData(id, (shared_ptr ) data); + level->setSavedData(id, (std::shared_ptr ) data); data->scale = mapScale; // 4J-PB - for Xbox maps, we'll centre them on the origin of the world, since we can fit the whole world in our map @@ -335,13 +335,13 @@ void MapItem::onCraftedBy(shared_ptr itemInstance, Level *level, s data->setDirty(); } -shared_ptr MapItem::getUpdatePacket(shared_ptr itemInstance, Level *level, shared_ptr player) +std::shared_ptr MapItem::getUpdatePacket(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { charArray data = MapItem::getSavedData(itemInstance, level)->getUpdatePacket(itemInstance, level, player); if (data.data == NULL || data.length == 0) return nullptr; - shared_ptr retval = shared_ptr(new ComplexItemDataPacket((short) Item::map->id, (short) itemInstance->getAuxValue(), data)); + std::shared_ptr retval = std::shared_ptr(new ComplexItemDataPacket((short) Item::map->id, (short) itemInstance->getAuxValue(), data)); delete data.data; return retval; } diff --git a/Minecraft.World/Items/MapItem.h b/Minecraft.World/Items/MapItem.h index dc16339d1..ddeb0b5eb 100644 --- a/Minecraft.World/Items/MapItem.h +++ b/Minecraft.World/Items/MapItem.h @@ -14,10 +14,10 @@ public: public: // 4J Stu - Was protected in Java, but then we can't access it where we need it MapItem(int id); - static shared_ptr getSavedData(short idNum, Level *level); - shared_ptr getSavedData(shared_ptr itemInstance, Level *level); - void update(Level *level, shared_ptr player, shared_ptr data); - virtual void inventoryTick(shared_ptr itemInstance, Level *level, shared_ptr owner, int slot, bool selected); - virtual void onCraftedBy(shared_ptr itemInstance, Level *level, shared_ptr player); - shared_ptr getUpdatePacket(shared_ptr itemInstance, Level *level, shared_ptr player); + static std::shared_ptr getSavedData(short idNum, Level *level); + std::shared_ptr getSavedData(std::shared_ptr itemInstance, Level *level); + void update(Level *level, std::shared_ptr player, std::shared_ptr data); + virtual void inventoryTick(std::shared_ptr itemInstance, Level *level, std::shared_ptr owner, int slot, bool selected); + virtual void onCraftedBy(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); + std::shared_ptr getUpdatePacket(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); }; diff --git a/Minecraft.World/Items/MilkBucketItem.cpp b/Minecraft.World/Items/MilkBucketItem.cpp index 15145b34f..5911b38d4 100644 --- a/Minecraft.World/Items/MilkBucketItem.cpp +++ b/Minecraft.World/Items/MilkBucketItem.cpp @@ -8,7 +8,7 @@ MilkBucketItem::MilkBucketItem(int id) : Item( id ) setMaxStackSize(1); } -shared_ptr MilkBucketItem::useTimeDepleted(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr MilkBucketItem::useTimeDepleted(std::shared_ptr instance, Level *level, std::shared_ptr player) { if (!player->abilities.instabuild) instance->count--; @@ -19,22 +19,22 @@ shared_ptr MilkBucketItem::useTimeDepleted(shared_ptrcount <= 0) { - return shared_ptr( new ItemInstance(Item::bucket_empty) ); + return std::shared_ptr( new ItemInstance(Item::bucket_empty) ); } return instance; } -int MilkBucketItem::getUseDuration(shared_ptr itemInstance) +int MilkBucketItem::getUseDuration(std::shared_ptr itemInstance) { return DRINK_DURATION; } -UseAnim MilkBucketItem::getUseAnimation(shared_ptr itemInstance) +UseAnim MilkBucketItem::getUseAnimation(std::shared_ptr itemInstance) { return UseAnim_drink; } -shared_ptr MilkBucketItem::use(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr MilkBucketItem::use(std::shared_ptr instance, Level *level, std::shared_ptr player) { player->startUsingItem(instance, getUseDuration(instance)); return instance; diff --git a/Minecraft.World/Items/MilkBucketItem.h b/Minecraft.World/Items/MilkBucketItem.h index 672e31439..32c9a2155 100644 --- a/Minecraft.World/Items/MilkBucketItem.h +++ b/Minecraft.World/Items/MilkBucketItem.h @@ -10,8 +10,8 @@ private: public: MilkBucketItem(int id); - virtual shared_ptr useTimeDepleted(shared_ptr instance, Level *level, shared_ptr player); - virtual int getUseDuration(shared_ptr itemInstance); - virtual UseAnim getUseAnimation(shared_ptr itemInstance); - virtual shared_ptr use(shared_ptr instance, Level *level, shared_ptr player); + virtual std::shared_ptr useTimeDepleted(std::shared_ptr instance, Level *level, std::shared_ptr player); + virtual int getUseDuration(std::shared_ptr itemInstance); + virtual UseAnim getUseAnimation(std::shared_ptr itemInstance); + virtual std::shared_ptr use(std::shared_ptr instance, Level *level, std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.World/Items/MinecartItem.cpp b/Minecraft.World/Items/MinecartItem.cpp index c190e3176..8e12e2dbf 100644 --- a/Minecraft.World/Items/MinecartItem.cpp +++ b/Minecraft.World/Items/MinecartItem.cpp @@ -12,7 +12,7 @@ MinecartItem::MinecartItem(int id, int type) : Item(id) this->type = type; } -bool MinecartItem::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) +bool MinecartItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { // 4J-PB - Adding a test only version to allow tooltips to be displayed int targetType = level->getTile(x, y, z); @@ -23,7 +23,7 @@ bool MinecartItem::useOn(shared_ptr instance, shared_ptr p { if (!level->isClientSide) { - level->addEntity(shared_ptr( new Minecart(level, x + 0.5f, y + 0.5f, z + 0.5f, type) ) ); + level->addEntity(std::shared_ptr( new Minecart(level, x + 0.5f, y + 0.5f, z + 0.5f, type) ) ); } instance->count--; } diff --git a/Minecraft.World/Items/MinecartItem.h b/Minecraft.World/Items/MinecartItem.h index c63082a12..4566ed9af 100644 --- a/Minecraft.World/Items/MinecartItem.h +++ b/Minecraft.World/Items/MinecartItem.h @@ -10,5 +10,5 @@ public: MinecartItem(int id, int type); - virtual bool 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=false); + virtual bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); }; \ No newline at end of file diff --git a/Minecraft.World/Items/MonsterPlacerItem.cpp b/Minecraft.World/Items/MonsterPlacerItem.cpp index 531425bb3..bdfea35c1 100644 --- a/Minecraft.World/Items/MonsterPlacerItem.cpp +++ b/Minecraft.World/Items/MonsterPlacerItem.cpp @@ -18,7 +18,7 @@ MonsterPlacerItem::MonsterPlacerItem(int id) : Item(id) overlay = NULL; } -wstring MonsterPlacerItem::getHoverName(shared_ptr itemInstance) +wstring MonsterPlacerItem::getHoverName(std::shared_ptr itemInstance) { wstring elementName = getDescription(); @@ -36,7 +36,7 @@ wstring MonsterPlacerItem::getHoverName(shared_ptr itemInstance) return elementName; } -int MonsterPlacerItem::getColor(shared_ptr item, int spriteLayer) +int MonsterPlacerItem::getColor(std::shared_ptr item, int spriteLayer) { AUTO_VAR(it, EntityIO::idsSpawnableInCreative.find(item->getAuxValue())); if (it != EntityIO::idsSpawnableInCreative.end()) @@ -65,9 +65,9 @@ Icon *MonsterPlacerItem::getLayerIcon(int auxValue, int spriteLayer) } // 4J-PB - added for dispenser -shared_ptr MonsterPlacerItem::canSpawn(int iAuxVal, Level *level, int *piResult) +std::shared_ptr MonsterPlacerItem::canSpawn(int iAuxVal, Level *level, int *piResult) { - shared_ptr newEntity = EntityIO::newById(iAuxVal, level); + std::shared_ptr newEntity = EntityIO::newById(iAuxVal, level); if (newEntity != NULL) { bool canSpawn = false; @@ -166,7 +166,7 @@ shared_ptr MonsterPlacerItem::canSpawn(int iAuxVal, Level *level, int *p return nullptr; } -bool MonsterPlacerItem::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) +bool MonsterPlacerItem::useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { if (level->isClientSide) { @@ -181,7 +181,7 @@ bool MonsterPlacerItem::useOn(shared_ptr itemInstance, shared_ptr< // 4J Stu - Force adding this as a tile update level->setTile(x,y,z,0); level->setTile(x,y,z,Tile::mobSpawner_Id); - shared_ptr mste = dynamic_pointer_cast( level->getTileEntity(x,y,z) ); + std::shared_ptr mste = dynamic_pointer_cast( level->getTileEntity(x,y,z) ); if(mste != NULL) { mste->setEntityId( EntityIO::getEncodeId(itemInstance->getAuxValue()) ); @@ -254,20 +254,20 @@ bool MonsterPlacerItem::useOn(shared_ptr itemInstance, shared_ptr< return true; } -shared_ptr MonsterPlacerItem::spawnMobAt(Level *level, int mobId, double x, double y, double z, int *piResult) +std::shared_ptr MonsterPlacerItem::spawnMobAt(Level *level, int mobId, double x, double y, double z, int *piResult) { if (EntityIO::idsSpawnableInCreative.find(mobId) == EntityIO::idsSpawnableInCreative.end()) { return nullptr; } - shared_ptr newEntity = nullptr; + std::shared_ptr newEntity = nullptr; for (int i = 0; i < SPAWN_COUNT; i++) { newEntity = canSpawn(mobId, level, piResult); - shared_ptr mob = dynamic_pointer_cast(newEntity); + std::shared_ptr mob = dynamic_pointer_cast(newEntity); if (mob) { newEntity->moveTo(x, y, z, Mth::wrapDegrees(level->random->nextFloat() * 360), 0); diff --git a/Minecraft.World/Items/MonsterPlacerItem.h b/Minecraft.World/Items/MonsterPlacerItem.h index f1cead6d7..bccca9150 100644 --- a/Minecraft.World/Items/MonsterPlacerItem.h +++ b/Minecraft.World/Items/MonsterPlacerItem.h @@ -27,15 +27,15 @@ public: MonsterPlacerItem(int id); - virtual wstring getHoverName(shared_ptr itemInstance); - virtual int getColor(shared_ptr item, int spriteLayer); + virtual wstring getHoverName(std::shared_ptr itemInstance); + virtual int getColor(std::shared_ptr item, int spriteLayer); virtual bool hasMultipleSpriteLayers(); virtual Icon *getLayerIcon(int auxValue, int spriteLayer); - virtual bool 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=false); - static shared_ptr spawnMobAt(Level *level, int mobId, double x, double y, double z, int *piResult); // 4J Added piResult param + virtual bool useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); + static std::shared_ptr spawnMobAt(Level *level, int mobId, double x, double y, double z, int *piResult); // 4J Added piResult param // 4J-PB added for dispenser - static shared_ptr canSpawn(int iAuxVal, Level *level, int *piResult); + static std::shared_ptr canSpawn(int iAuxVal, Level *level, int *piResult); //@Override void registerIcons(IconRegister *iconRegister); diff --git a/Minecraft.World/Items/PickaxeItem.cpp b/Minecraft.World/Items/PickaxeItem.cpp index 01c8da534..a02de8060 100644 --- a/Minecraft.World/Items/PickaxeItem.cpp +++ b/Minecraft.World/Items/PickaxeItem.cpp @@ -52,7 +52,7 @@ bool PickaxeItem::canDestroySpecial(Tile *tile) } // 4J - brought forward from 1.2.3 -float PickaxeItem::getDestroySpeed(shared_ptr itemInstance, Tile *tile) +float PickaxeItem::getDestroySpeed(std::shared_ptr itemInstance, Tile *tile) { if (tile != NULL && (tile->material == Material::metal || tile->material == Material::heavyMetal || tile->material == Material::stone)) { diff --git a/Minecraft.World/Items/PickaxeItem.h b/Minecraft.World/Items/PickaxeItem.h index 52dac5107..f13c8d341 100644 --- a/Minecraft.World/Items/PickaxeItem.h +++ b/Minecraft.World/Items/PickaxeItem.h @@ -16,5 +16,5 @@ public: // public: virtual bool canDestroySpecial(Tile *tile); - virtual float getDestroySpeed(shared_ptr itemInstance, Tile *tile); // 4J - brought forward from 1.2.3 + virtual float getDestroySpeed(std::shared_ptr itemInstance, Tile *tile); // 4J - brought forward from 1.2.3 }; diff --git a/Minecraft.World/Items/PotionItem.cpp b/Minecraft.World/Items/PotionItem.cpp index 1ea741017..af185e0a7 100644 --- a/Minecraft.World/Items/PotionItem.cpp +++ b/Minecraft.World/Items/PotionItem.cpp @@ -30,7 +30,7 @@ PotionItem::PotionItem(int id) : Item(id) iconOverlay = NULL; } -vector *PotionItem::getMobEffects(shared_ptr potion) +vector *PotionItem::getMobEffects(std::shared_ptr potion) { return getMobEffects(potion->getAuxValue()); } @@ -48,7 +48,7 @@ vector *PotionItem::getMobEffects(int auxValue) return effects; } -shared_ptr PotionItem::useTimeDepleted(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr PotionItem::useTimeDepleted(std::shared_ptr instance, Level *level, std::shared_ptr player) { if (!player->abilities.instabuild) instance->count--; @@ -68,46 +68,46 @@ shared_ptr PotionItem::useTimeDepleted(shared_ptr in { if (instance->count <= 0) { - return shared_ptr( new ItemInstance(Item::glassBottle) ); + return std::shared_ptr( new ItemInstance(Item::glassBottle) ); } else { - player->inventory->add( shared_ptr( new ItemInstance(Item::glassBottle) ) ); + player->inventory->add( std::shared_ptr( new ItemInstance(Item::glassBottle) ) ); } } return instance; } -int PotionItem::getUseDuration(shared_ptr itemInstance) +int PotionItem::getUseDuration(std::shared_ptr itemInstance) { return DRINK_DURATION; } -UseAnim PotionItem::getUseAnimation(shared_ptr itemInstance) +UseAnim PotionItem::getUseAnimation(std::shared_ptr itemInstance) { return UseAnim_drink; } -bool PotionItem::TestUse(Level *level, shared_ptr player) +bool PotionItem::TestUse(Level *level, std::shared_ptr player) { return true; } -shared_ptr PotionItem::use(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr PotionItem::use(std::shared_ptr instance, Level *level, std::shared_ptr player) { if (isThrowable(instance->getAuxValue())) { if (!player->abilities.instabuild) instance->count--; level->playSound(player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); - if (!level->isClientSide) level->addEntity(shared_ptr( new ThrownPotion(level, player, instance->getAuxValue()) )); + if (!level->isClientSide) level->addEntity(std::shared_ptr( new ThrownPotion(level, player, instance->getAuxValue()) )); return instance; } player->startUsingItem(instance, getUseDuration(instance)); return instance; } -bool PotionItem::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) +bool PotionItem::useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { return false; } @@ -140,7 +140,7 @@ int PotionItem::getColor(int data) return PotionBrewing::getColorValue(data, false); } -int PotionItem::getColor(shared_ptr item, int spriteLayer) +int PotionItem::getColor(std::shared_ptr item, int spriteLayer) { if (spriteLayer > 0) { @@ -173,7 +173,7 @@ bool PotionItem::hasInstantenousEffects(int itemAuxValue) return false; } -wstring PotionItem::getHoverName(shared_ptr itemInstance) +wstring PotionItem::getHoverName(std::shared_ptr itemInstance) { if (itemInstance->getAuxValue() == 0) { @@ -212,7 +212,7 @@ wstring PotionItem::getHoverName(shared_ptr itemInstance) return elementName; } -void PotionItem::appendHoverText(shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) +void PotionItem::appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) { if (itemInstance->getAuxValue() == 0) { @@ -281,13 +281,13 @@ void PotionItem::appendHoverText(shared_ptr itemInstance, shared_p } } -bool PotionItem::isFoil(shared_ptr itemInstance) +bool PotionItem::isFoil(std::shared_ptr itemInstance) { vector *mobEffects = getMobEffects(itemInstance); return mobEffects != NULL && !mobEffects->empty(); } -unsigned int PotionItem::getUseDescriptionId(shared_ptr instance) +unsigned int PotionItem::getUseDescriptionId(std::shared_ptr instance) { int brew = instance->getAuxValue(); diff --git a/Minecraft.World/Items/PotionItem.h b/Minecraft.World/Items/PotionItem.h index d03d33081..0d5dd1817 100644 --- a/Minecraft.World/Items/PotionItem.h +++ b/Minecraft.World/Items/PotionItem.h @@ -24,26 +24,26 @@ private: public: PotionItem(int id); - virtual vector *getMobEffects(shared_ptr potion); + virtual vector *getMobEffects(std::shared_ptr potion); virtual vector *getMobEffects(int auxValue); - virtual shared_ptr useTimeDepleted(shared_ptr instance, Level *level, shared_ptr player); - virtual int getUseDuration(shared_ptr itemInstance); - virtual UseAnim getUseAnimation(shared_ptr itemInstance); - virtual shared_ptr use(shared_ptr instance, Level *level, shared_ptr player); - virtual bool TestUse(Level *level, shared_ptr player); - virtual bool 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=false); + virtual std::shared_ptr useTimeDepleted(std::shared_ptr instance, Level *level, std::shared_ptr player); + virtual int getUseDuration(std::shared_ptr itemInstance); + virtual UseAnim getUseAnimation(std::shared_ptr itemInstance); + virtual std::shared_ptr use(std::shared_ptr instance, Level *level, std::shared_ptr player); + virtual bool TestUse(Level *level, std::shared_ptr player); + virtual bool useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); virtual Icon *getIcon(int auxValue); virtual Icon *getLayerIcon(int auxValue, int spriteLayer); static bool isThrowable(int auxValue); int getColor(int data); - virtual int getColor(shared_ptr item, int spriteLayer); + virtual int getColor(std::shared_ptr item, int spriteLayer); virtual bool hasMultipleSpriteLayers(); virtual bool hasInstantenousEffects(int itemAuxValue); - virtual wstring getHoverName(shared_ptr itemInstance); - virtual void appendHoverText(shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); - virtual bool isFoil(shared_ptr itemInstance); + virtual wstring getHoverName(std::shared_ptr itemInstance); + virtual void appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); + virtual bool isFoil(std::shared_ptr itemInstance); - virtual unsigned int getUseDescriptionId(shared_ptr instance); + virtual unsigned int getUseDescriptionId(std::shared_ptr instance); //@Override void registerIcons(IconRegister *iconRegister); diff --git a/Minecraft.World/Items/RecordingItem.cpp b/Minecraft.World/Items/RecordingItem.cpp index cf4bffb40..b2f3a50b3 100644 --- a/Minecraft.World/Items/RecordingItem.cpp +++ b/Minecraft.World/Items/RecordingItem.cpp @@ -17,7 +17,7 @@ Icon *RecordingItem::getIcon(int auxValue) return icon; } -bool RecordingItem::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) +bool RecordingItem::useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { // 4J-PB - Adding a test only version to allow tooltips to be displayed if (level->getTile(x, y, z) == Tile::recordPlayer_Id && level->getData(x, y, z) == 0) @@ -40,9 +40,9 @@ bool RecordingItem::useOn(shared_ptr itemInstance, shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) +void RecordingItem::appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) { - eMinecraftColour rarityColour = getRarity(shared_ptr())->color; + eMinecraftColour rarityColour = getRarity(std::shared_ptr())->color; int colour = app.GetHTMLColour(rarityColour); wchar_t formatted[256]; @@ -53,7 +53,7 @@ void RecordingItem::appendHoverText(shared_ptr itemInstance, share unformattedStrings.push_back(recording); } -const Rarity *RecordingItem::getRarity(shared_ptr itemInstance) +const Rarity *RecordingItem::getRarity(std::shared_ptr itemInstance) { return (Rarity *)Rarity::rare; } diff --git a/Minecraft.World/Items/RecordingItem.h b/Minecraft.World/Items/RecordingItem.h index 9b184c6a2..5aba0b51d 100644 --- a/Minecraft.World/Items/RecordingItem.h +++ b/Minecraft.World/Items/RecordingItem.h @@ -13,10 +13,10 @@ public: // 4J Stu - Was protected in Java, but the can't access it where we need //@Override Icon *getIcon(int auxValue); - virtual bool 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=false); + virtual bool useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); - virtual void appendHoverText(shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); - virtual const Rarity *getRarity(shared_ptr itemInstance); + virtual void appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); + virtual const Rarity *getRarity(std::shared_ptr itemInstance); //@Override void registerIcons(IconRegister *iconRegister); diff --git a/Minecraft.World/Items/RedstoneItem.cpp b/Minecraft.World/Items/RedstoneItem.cpp index 0a79d429f..f4487c440 100644 --- a/Minecraft.World/Items/RedstoneItem.cpp +++ b/Minecraft.World/Items/RedstoneItem.cpp @@ -10,7 +10,7 @@ RedStoneItem::RedStoneItem(int id) : Item(id) { } -bool RedStoneItem::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) +bool RedStoneItem::useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { // 4J-PB - Adding a test only version to allow tooltips to be displayed if (level->getTile(x, y, z) != Tile::topSnow_Id) diff --git a/Minecraft.World/Items/RedstoneItem.h b/Minecraft.World/Items/RedstoneItem.h index 01be92ffa..eeba4a9e5 100644 --- a/Minecraft.World/Items/RedstoneItem.h +++ b/Minecraft.World/Items/RedstoneItem.h @@ -9,5 +9,5 @@ using namespace std; RedStoneItem(int id); public: - virtual bool 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=false); + virtual bool useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); }; \ No newline at end of file diff --git a/Minecraft.World/Items/SaddleItem.cpp b/Minecraft.World/Items/SaddleItem.cpp index 54a3b642a..6356c2d68 100644 --- a/Minecraft.World/Items/SaddleItem.cpp +++ b/Minecraft.World/Items/SaddleItem.cpp @@ -9,11 +9,11 @@ SaddleItem::SaddleItem(int id) : Item(id) maxStackSize = 1; } -bool SaddleItem::interactEnemy(shared_ptr itemInstance, shared_ptr mob) +bool SaddleItem::interactEnemy(std::shared_ptr itemInstance, std::shared_ptr mob) { if ( dynamic_pointer_cast(mob) ) { - shared_ptr pig = dynamic_pointer_cast(mob); + std::shared_ptr pig = dynamic_pointer_cast(mob); if (!pig->hasSaddle() && !pig->isBaby()) { pig->setSaddle(true); @@ -24,7 +24,7 @@ bool SaddleItem::interactEnemy(shared_ptr itemInstance, shared_ptr return false; } -bool SaddleItem::hurtEnemy(shared_ptr itemInstance, shared_ptr mob, shared_ptr attacker) +bool SaddleItem::hurtEnemy(std::shared_ptr itemInstance, std::shared_ptr mob, std::shared_ptr attacker) { interactEnemy(itemInstance, mob); return true; diff --git a/Minecraft.World/Items/SaddleItem.h b/Minecraft.World/Items/SaddleItem.h index 129922db4..de65ff502 100644 --- a/Minecraft.World/Items/SaddleItem.h +++ b/Minecraft.World/Items/SaddleItem.h @@ -8,6 +8,6 @@ class SaddleItem : public Item public: SaddleItem(int id); - virtual bool interactEnemy(shared_ptr itemInstance, shared_ptr mob); - virtual bool hurtEnemy(shared_ptr itemInstance, shared_ptr mob, shared_ptr attacker); + virtual bool interactEnemy(std::shared_ptr itemInstance, std::shared_ptr mob); + virtual bool hurtEnemy(std::shared_ptr itemInstance, std::shared_ptr mob, std::shared_ptr attacker); }; \ No newline at end of file diff --git a/Minecraft.World/Items/SeedFoodItem.cpp b/Minecraft.World/Items/SeedFoodItem.cpp index dece26bd2..4110f9dd8 100644 --- a/Minecraft.World/Items/SeedFoodItem.cpp +++ b/Minecraft.World/Items/SeedFoodItem.cpp @@ -11,7 +11,7 @@ SeedFoodItem::SeedFoodItem(int id, int nutrition, float saturationMod, int resul } -bool SeedFoodItem::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) +bool SeedFoodItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { if (face != Facing::UP) return false; diff --git a/Minecraft.World/Items/SeedFoodItem.h b/Minecraft.World/Items/SeedFoodItem.h index fe24430f8..0b9b79b5d 100644 --- a/Minecraft.World/Items/SeedFoodItem.h +++ b/Minecraft.World/Items/SeedFoodItem.h @@ -11,5 +11,5 @@ private: public: SeedFoodItem(int id, int nutrition, float saturationMod, int resultId, int targetLand); - bool 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); + bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly); }; \ No newline at end of file diff --git a/Minecraft.World/Items/SeedItem.cpp b/Minecraft.World/Items/SeedItem.cpp index b41dcb916..321da2234 100644 --- a/Minecraft.World/Items/SeedItem.cpp +++ b/Minecraft.World/Items/SeedItem.cpp @@ -14,7 +14,7 @@ SeedItem::SeedItem(int id, int resultId, int targetLand) : Item(id) this->targetLand = targetLand; } -bool SeedItem::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) +bool SeedItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { // 4J-PB - Adding a test only version to allow tooltips to be displayed if (face != 1) return false; diff --git a/Minecraft.World/Items/SeedItem.h b/Minecraft.World/Items/SeedItem.h index c16a76ce8..3b702d9c1 100644 --- a/Minecraft.World/Items/SeedItem.h +++ b/Minecraft.World/Items/SeedItem.h @@ -12,5 +12,5 @@ private: public: SeedItem(int id, int resultId, int targetLand); - virtual bool 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=false); + virtual bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); }; \ No newline at end of file diff --git a/Minecraft.World/Items/ShearsItem.cpp b/Minecraft.World/Items/ShearsItem.cpp index 606a3e957..1f0a54c78 100644 --- a/Minecraft.World/Items/ShearsItem.cpp +++ b/Minecraft.World/Items/ShearsItem.cpp @@ -9,7 +9,7 @@ ShearsItem::ShearsItem(int itemId) : Item(itemId) setMaxDamage(238); } -bool ShearsItem::mineBlock(shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, shared_ptr owner) +bool ShearsItem::mineBlock(std::shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, std::shared_ptr owner) { if (tile == Tile::leaves_Id || tile == Tile::web_Id || tile == Tile::tallgrass_Id || tile == Tile::vine_Id || tile == Tile::tripWire_Id) { @@ -24,7 +24,7 @@ bool ShearsItem::canDestroySpecial(Tile *tile) return tile->id == Tile::web_Id || tile->id == Tile::redStoneDust_Id || tile->id == Tile::tripWire_Id; } -float ShearsItem::getDestroySpeed(shared_ptr itemInstance, Tile *tile) +float ShearsItem::getDestroySpeed(std::shared_ptr itemInstance, Tile *tile) { if (tile->id == Tile::web_Id || tile->id == Tile::leaves_Id) { diff --git a/Minecraft.World/Items/ShearsItem.h b/Minecraft.World/Items/ShearsItem.h index 060786455..eb1e795f9 100644 --- a/Minecraft.World/Items/ShearsItem.h +++ b/Minecraft.World/Items/ShearsItem.h @@ -7,7 +7,7 @@ class ShearsItem : public Item { public: ShearsItem(int itemId); - virtual bool mineBlock(shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, shared_ptr owner); + virtual bool mineBlock(std::shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, std::shared_ptr owner); virtual bool canDestroySpecial(Tile *tile); - virtual float getDestroySpeed(shared_ptr itemInstance, Tile *tile); + virtual float getDestroySpeed(std::shared_ptr itemInstance, Tile *tile); }; \ No newline at end of file diff --git a/Minecraft.World/Items/SignItem.cpp b/Minecraft.World/Items/SignItem.cpp index a117819f2..3c53ce38a 100644 --- a/Minecraft.World/Items/SignItem.cpp +++ b/Minecraft.World/Items/SignItem.cpp @@ -13,7 +13,7 @@ SignItem::SignItem(int id) : Item(id) maxStackSize = 16; } -bool SignItem::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) +bool SignItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { // 4J-PB - Adding a test only version to allow tooltips to be displayed if (face == 0) return false; @@ -43,7 +43,7 @@ bool SignItem::useOn(shared_ptr instance, shared_ptr playe } instance->count--; - shared_ptr ste = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); + std::shared_ptr ste = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); if (ste != NULL) player->openTextEdit(ste); // 4J-JEV: Hook for durango 'BlockPlaced' event. diff --git a/Minecraft.World/Items/SignItem.h b/Minecraft.World/Items/SignItem.h index 6265e7593..29992fd73 100644 --- a/Minecraft.World/Items/SignItem.h +++ b/Minecraft.World/Items/SignItem.h @@ -8,5 +8,5 @@ class SignItem : public Item public: SignItem(int id); - virtual bool 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=false); + virtual bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); }; \ No newline at end of file diff --git a/Minecraft.World/Items/SnowballItem.cpp b/Minecraft.World/Items/SnowballItem.cpp index 17c22e6b1..fd29d3ac3 100644 --- a/Minecraft.World/Items/SnowballItem.cpp +++ b/Minecraft.World/Items/SnowballItem.cpp @@ -11,13 +11,13 @@ SnowballItem::SnowballItem(int id) : Item(id) this->maxStackSize = 16; } -shared_ptr SnowballItem::use(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr SnowballItem::use(std::shared_ptr instance, Level *level, std::shared_ptr player) { if (!player->abilities.instabuild) { instance->count--; } - level->playSound((shared_ptr ) player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); - if (!level->isClientSide) level->addEntity( shared_ptr( new Snowball(level, player) ) ); + level->playSound((std::shared_ptr ) player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); + if (!level->isClientSide) level->addEntity( std::shared_ptr( new Snowball(level, player) ) ); return instance; } \ No newline at end of file diff --git a/Minecraft.World/Items/SnowballItem.h b/Minecraft.World/Items/SnowballItem.h index bf2d20cb8..97680968a 100644 --- a/Minecraft.World/Items/SnowballItem.h +++ b/Minecraft.World/Items/SnowballItem.h @@ -8,5 +8,5 @@ class SnowballItem : public Item public: SnowballItem(int id); - virtual shared_ptr use(shared_ptr instance, Level *level, shared_ptr player); + virtual std::shared_ptr use(std::shared_ptr instance, Level *level, std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.World/Items/TileItems/ClothTileItem.cpp b/Minecraft.World/Items/TileItems/ClothTileItem.cpp index d96cc59e9..8e03cfa1d 100644 --- a/Minecraft.World/Items/TileItems/ClothTileItem.cpp +++ b/Minecraft.World/Items/TileItems/ClothTileItem.cpp @@ -61,7 +61,7 @@ int ClothTileItem::getLevelDataForAuxValue(int auxValue) return auxValue; } -unsigned int ClothTileItem::getDescriptionId(shared_ptr instance) +unsigned int ClothTileItem::getDescriptionId(std::shared_ptr instance) { if(getTileId() == Tile::woolCarpet_Id) return CARPET_COLOR_DESCS[ClothTile::getTileDataForItemAuxValue(instance->getAuxValue())]; else return COLOR_DESCS[ClothTile::getTileDataForItemAuxValue(instance->getAuxValue())]; diff --git a/Minecraft.World/Items/TileItems/ClothTileItem.h b/Minecraft.World/Items/TileItems/ClothTileItem.h index e909df439..7898e3668 100644 --- a/Minecraft.World/Items/TileItems/ClothTileItem.h +++ b/Minecraft.World/Items/TileItems/ClothTileItem.h @@ -13,5 +13,5 @@ public: virtual Icon *getIcon(int itemAuxValue); virtual int getLevelDataForAuxValue(int auxValue); - virtual unsigned int getDescriptionId(shared_ptr instance); + virtual unsigned int getDescriptionId(std::shared_ptr instance); }; \ No newline at end of file diff --git a/Minecraft.World/Items/TileItems/ColoredTileItem.cpp b/Minecraft.World/Items/TileItems/ColoredTileItem.cpp index b38af2d9b..f3d6b72be 100644 --- a/Minecraft.World/Items/TileItems/ColoredTileItem.cpp +++ b/Minecraft.World/Items/TileItems/ColoredTileItem.cpp @@ -18,7 +18,7 @@ ColoredTileItem::~ColoredTileItem() if(descriptionPostfixes.data != NULL) delete [] descriptionPostfixes.data; } -int ColoredTileItem::getColor(shared_ptr item, int spriteLayer) +int ColoredTileItem::getColor(std::shared_ptr item, int spriteLayer) { return colorTile->getColor(item->getAuxValue()); } @@ -45,7 +45,7 @@ ColoredTileItem *ColoredTileItem::setDescriptionPostfixes(intArray descriptionPo return this; } -unsigned int ColoredTileItem::getDescriptionId(shared_ptr instance) +unsigned int ColoredTileItem::getDescriptionId(std::shared_ptr instance) { if (descriptionPostfixes.data == NULL) { diff --git a/Minecraft.World/Items/TileItems/ColoredTileItem.h b/Minecraft.World/Items/TileItems/ColoredTileItem.h index cc3ef1e70..dfe5ebe64 100644 --- a/Minecraft.World/Items/TileItems/ColoredTileItem.h +++ b/Minecraft.World/Items/TileItems/ColoredTileItem.h @@ -16,10 +16,10 @@ public: ColoredTileItem(int id, bool stackedByData); ~ColoredTileItem(); - virtual int getColor(shared_ptr item, int spriteLayer); + virtual int getColor(std::shared_ptr item, int spriteLayer); virtual Icon *getIcon(int auxValue); virtual int getLevelDataForAuxValue(int auxValue); ColoredTileItem *setDescriptionPostfixes(intArray descriptionPostfixes); - virtual unsigned int getDescriptionId(shared_ptr instance); + virtual unsigned int getDescriptionId(std::shared_ptr instance); }; diff --git a/Minecraft.World/Items/TileItems/LeafTileItem.cpp b/Minecraft.World/Items/TileItems/LeafTileItem.cpp index bbda44f8d..8885b8f7e 100644 --- a/Minecraft.World/Items/TileItems/LeafTileItem.cpp +++ b/Minecraft.World/Items/TileItems/LeafTileItem.cpp @@ -22,7 +22,7 @@ Icon *LeafTileItem::getIcon(int itemAuxValue) } -int LeafTileItem::getColor(shared_ptr item, int spriteLayer) +int LeafTileItem::getColor(std::shared_ptr item, int spriteLayer) { int data = item->getAuxValue(); if ((data & LeafTile::EVERGREEN_LEAF) == LeafTile::EVERGREEN_LEAF) @@ -36,7 +36,7 @@ int LeafTileItem::getColor(shared_ptr item, int spriteLayer) return FoliageColor::getDefaultColor(); } -unsigned int LeafTileItem::getDescriptionId(shared_ptr instance) +unsigned int LeafTileItem::getDescriptionId(std::shared_ptr instance) { int auxValue = instance->getAuxValue(); if (auxValue < 0 || auxValue >= LeafTile::LEAF_NAMES_LENGTH) diff --git a/Minecraft.World/Items/TileItems/LeafTileItem.h b/Minecraft.World/Items/TileItems/LeafTileItem.h index cd3115905..cc95cbd5e 100644 --- a/Minecraft.World/Items/TileItems/LeafTileItem.h +++ b/Minecraft.World/Items/TileItems/LeafTileItem.h @@ -11,7 +11,7 @@ public: virtual int getLevelDataForAuxValue(int auxValue); virtual Icon *getIcon(int itemAuxValue); - virtual int getColor(shared_ptr item, int spriteLayer); + virtual int getColor(std::shared_ptr item, int spriteLayer); - virtual unsigned int getDescriptionId(shared_ptr instance); + virtual unsigned int getDescriptionId(std::shared_ptr instance); }; diff --git a/Minecraft.World/Items/TileItems/MultiTextureTileItem.cpp b/Minecraft.World/Items/TileItems/MultiTextureTileItem.cpp index 39d619312..287c95dfb 100644 --- a/Minecraft.World/Items/TileItems/MultiTextureTileItem.cpp +++ b/Minecraft.World/Items/TileItems/MultiTextureTileItem.cpp @@ -33,7 +33,7 @@ unsigned int MultiTextureTileItem::getDescriptionId(int iData) return nameExtensions[iData]; } -unsigned int MultiTextureTileItem::getDescriptionId(shared_ptr instance) +unsigned int MultiTextureTileItem::getDescriptionId(std::shared_ptr instance) { int auxValue = instance->getAuxValue(); if (auxValue < 0 || auxValue >= m_iNameExtensionsLength) diff --git a/Minecraft.World/Items/TileItems/MultiTextureTileItem.h b/Minecraft.World/Items/TileItems/MultiTextureTileItem.h index 078357ea1..f2a4fdd35 100644 --- a/Minecraft.World/Items/TileItems/MultiTextureTileItem.h +++ b/Minecraft.World/Items/TileItems/MultiTextureTileItem.h @@ -18,5 +18,5 @@ public: virtual Icon *getIcon(int itemAuxValue); virtual int getLevelDataForAuxValue(int auxValue); virtual unsigned int getDescriptionId(int iData = -1); - virtual unsigned int getDescriptionId(shared_ptr instance); + virtual unsigned int getDescriptionId(std::shared_ptr instance); }; diff --git a/Minecraft.World/Items/TileItems/PlanterTileItem.cpp b/Minecraft.World/Items/TileItems/PlanterTileItem.cpp index a6c8c28b3..cf83d87f6 100644 --- a/Minecraft.World/Items/TileItems/PlanterTileItem.cpp +++ b/Minecraft.World/Items/TileItems/PlanterTileItem.cpp @@ -15,7 +15,7 @@ TilePlanterItem::TilePlanterItem(int id, Tile *tile) : Item(id) this->tileId = tile->id; } -bool TilePlanterItem::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) +bool TilePlanterItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { // 4J-PB - Adding a test only version to allow tooltips to be displayed int currentTile = level->getTile(x, y, z); diff --git a/Minecraft.World/Items/TileItems/PlanterTileItem.h b/Minecraft.World/Items/TileItems/PlanterTileItem.h index e6b1e8536..e7e9387e6 100644 --- a/Minecraft.World/Items/TileItems/PlanterTileItem.h +++ b/Minecraft.World/Items/TileItems/PlanterTileItem.h @@ -11,5 +11,5 @@ private: public: TilePlanterItem(int id, Tile *tile); - virtual bool 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=false); + virtual bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); }; \ No newline at end of file diff --git a/Minecraft.World/Items/TileItems/SaplingTileItem.cpp b/Minecraft.World/Items/TileItems/SaplingTileItem.cpp index f84c668f1..868d4cc51 100644 --- a/Minecraft.World/Items/TileItems/SaplingTileItem.cpp +++ b/Minecraft.World/Items/TileItems/SaplingTileItem.cpp @@ -20,7 +20,7 @@ Icon *SaplingTileItem::getIcon(int itemAuxValue) } // 4J brought forward to have unique names for different sapling types -unsigned int SaplingTileItem::getDescriptionId(shared_ptr instance) +unsigned int SaplingTileItem::getDescriptionId(std::shared_ptr instance) { int auxValue = instance->getAuxValue(); if (auxValue < 0 || auxValue >= Sapling::SAPLING_NAMES_SIZE) diff --git a/Minecraft.World/Items/TileItems/SaplingTileItem.h b/Minecraft.World/Items/TileItems/SaplingTileItem.h index f0b03cc4b..feabb0de8 100644 --- a/Minecraft.World/Items/TileItems/SaplingTileItem.h +++ b/Minecraft.World/Items/TileItems/SaplingTileItem.h @@ -12,5 +12,5 @@ public: virtual Icon *getIcon(int itemAuxValue); // 4J brought forward to have unique names for different sapling types - virtual unsigned int getDescriptionId(shared_ptr instance); + virtual unsigned int getDescriptionId(std::shared_ptr instance); }; \ No newline at end of file diff --git a/Minecraft.World/Items/TileItems/SkullItem.cpp b/Minecraft.World/Items/TileItems/SkullItem.cpp index 16759ac53..18972c409 100644 --- a/Minecraft.World/Items/TileItems/SkullItem.cpp +++ b/Minecraft.World/Items/TileItems/SkullItem.cpp @@ -18,7 +18,7 @@ SkullItem::SkullItem(int id) : Item(id) setStackedByData(true); } -bool SkullItem::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) //float clickX, float clickY, float clickZ) +bool SkullItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) //float clickX, float clickY, float clickZ) { if (face == 0) return false; if (!level->getMaterial(x, y, z)->isSolid()) return false; @@ -45,8 +45,8 @@ bool SkullItem::useOn(shared_ptr instance, shared_ptr play rot = Mth::floor(((player->yRot) * 16) / 360 + 0.5) & 15; } - shared_ptr skullTE = level->getTileEntity(x, y, z); - shared_ptr skull = dynamic_pointer_cast(skullTE); + std::shared_ptr skullTE = level->getTileEntity(x, y, z); + std::shared_ptr skull = dynamic_pointer_cast(skullTE); if (skull != NULL) { @@ -65,7 +65,7 @@ bool SkullItem::useOn(shared_ptr instance, shared_ptr play return true; } -bool SkullItem::mayPlace(Level *level, int x, int y, int z, int face, shared_ptr player, shared_ptr item) +bool SkullItem::mayPlace(Level *level, int x, int y, int z, int face, std::shared_ptr player, std::shared_ptr item) { int currentTile = level->getTile(x, y, z); if (currentTile == Tile::topSnow_Id) @@ -108,7 +108,7 @@ unsigned int SkullItem::getDescriptionId(int iData) return NAMES[iData]; } -unsigned int SkullItem::getDescriptionId(shared_ptr instance) +unsigned int SkullItem::getDescriptionId(std::shared_ptr instance) { int auxValue = instance->getAuxValue(); if (auxValue < 0 || auxValue >= SKULL_COUNT) @@ -118,7 +118,7 @@ unsigned int SkullItem::getDescriptionId(shared_ptr instance) return NAMES[auxValue]; } -wstring SkullItem::getHoverName(shared_ptr itemInstance) +wstring SkullItem::getHoverName(std::shared_ptr itemInstance) { #if 0 if (itemInstance->getAuxValue() == SkullTileEntity::TYPE_CHAR && itemInstance->hasTag() && itemInstance->getTag()->contains(L"SkullOwner")) diff --git a/Minecraft.World/Items/TileItems/SkullItem.h b/Minecraft.World/Items/TileItems/SkullItem.h index 97e3ff2d8..d95ce1692 100644 --- a/Minecraft.World/Items/TileItems/SkullItem.h +++ b/Minecraft.World/Items/TileItems/SkullItem.h @@ -18,12 +18,12 @@ private: public: SkullItem(int id); - bool 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=false); - bool mayPlace(Level *level, int x, int y, int z, int face, shared_ptr player, shared_ptr item); + bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); + bool mayPlace(Level *level, int x, int y, int z, int face, std::shared_ptr player, std::shared_ptr item); Icon *getIcon(int itemAuxValue); int getLevelDataForAuxValue(int auxValue); virtual unsigned int getDescriptionId(int iData = -1); - unsigned int getDescriptionId(shared_ptr instance); - wstring getHoverName(shared_ptr itemInstance); + unsigned int getDescriptionId(std::shared_ptr instance); + wstring getHoverName(std::shared_ptr itemInstance); void registerIcons(IconRegister *iconRegister); }; \ No newline at end of file diff --git a/Minecraft.World/Items/TileItems/SmoothStoneBrickTileItem.cpp b/Minecraft.World/Items/TileItems/SmoothStoneBrickTileItem.cpp index eb61ea2f1..17ec843f7 100644 --- a/Minecraft.World/Items/TileItems/SmoothStoneBrickTileItem.cpp +++ b/Minecraft.World/Items/TileItems/SmoothStoneBrickTileItem.cpp @@ -21,7 +21,7 @@ int SmoothStoneBrickTileItem::getLevelDataForAuxValue(int auxValue) return auxValue; } -unsigned int SmoothStoneBrickTileItem::getDescriptionId(shared_ptr instance) +unsigned int SmoothStoneBrickTileItem::getDescriptionId(std::shared_ptr instance) { int auxValue = instance->getAuxValue(); if (auxValue < 0 || auxValue >= SmoothStoneBrickTile::SMOOTH_STONE_BRICK_NAMES_LENGTH) diff --git a/Minecraft.World/Items/TileItems/SmoothStoneBrickTileItem.h b/Minecraft.World/Items/TileItems/SmoothStoneBrickTileItem.h index 18b640a36..94f71ec01 100644 --- a/Minecraft.World/Items/TileItems/SmoothStoneBrickTileItem.h +++ b/Minecraft.World/Items/TileItems/SmoothStoneBrickTileItem.h @@ -13,5 +13,5 @@ public: virtual Icon *getIcon(int itemAuxValue); virtual int getLevelDataForAuxValue(int auxValue); - virtual unsigned int getDescriptionId(shared_ptr instance); + virtual unsigned int getDescriptionId(std::shared_ptr instance); }; \ No newline at end of file diff --git a/Minecraft.World/Items/TileItems/StoneMonsterTileItem.cpp b/Minecraft.World/Items/TileItems/StoneMonsterTileItem.cpp index da7cfefd7..490f2874e 100644 --- a/Minecraft.World/Items/TileItems/StoneMonsterTileItem.cpp +++ b/Minecraft.World/Items/TileItems/StoneMonsterTileItem.cpp @@ -19,7 +19,7 @@ Icon *StoneMonsterTileItem::getIcon(int itemAuxValue) return Tile::monsterStoneEgg->getTexture(0, itemAuxValue); } -unsigned int StoneMonsterTileItem::getDescriptionId(shared_ptr instance) +unsigned int StoneMonsterTileItem::getDescriptionId(std::shared_ptr instance) { int auxValue = instance->getAuxValue(); if (auxValue < 0 || auxValue >= StoneMonsterTile::STONE_MONSTER_NAMES_LENGTH) diff --git a/Minecraft.World/Items/TileItems/StoneMonsterTileItem.h b/Minecraft.World/Items/TileItems/StoneMonsterTileItem.h index bb12d2e1d..6a4ec228d 100644 --- a/Minecraft.World/Items/TileItems/StoneMonsterTileItem.h +++ b/Minecraft.World/Items/TileItems/StoneMonsterTileItem.h @@ -12,5 +12,5 @@ public: virtual int getLevelDataForAuxValue(int auxValue); virtual Icon *getIcon(int itemAuxValue); - virtual unsigned int getDescriptionId(shared_ptr instance); + virtual unsigned int getDescriptionId(std::shared_ptr instance); }; \ No newline at end of file diff --git a/Minecraft.World/Items/TileItems/StoneSlabTileItem.cpp b/Minecraft.World/Items/TileItems/StoneSlabTileItem.cpp index 46387e95d..602b139e2 100644 --- a/Minecraft.World/Items/TileItems/StoneSlabTileItem.cpp +++ b/Minecraft.World/Items/TileItems/StoneSlabTileItem.cpp @@ -27,12 +27,12 @@ int StoneSlabTileItem::getLevelDataForAuxValue(int auxValue) return auxValue; } -unsigned int StoneSlabTileItem::getDescriptionId(shared_ptr instance) +unsigned int StoneSlabTileItem::getDescriptionId(std::shared_ptr instance) { return halfTile->getAuxName(instance->getAuxValue()); } -bool StoneSlabTileItem::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) +bool StoneSlabTileItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { if (isFull) { @@ -74,7 +74,7 @@ bool StoneSlabTileItem::useOn(shared_ptr instance, shared_ptr player, shared_ptr item) +bool StoneSlabTileItem::mayPlace(Level *level, int x, int y, int z, int face,std::shared_ptr player, std::shared_ptr item) { int ox = x, oy = y, oz = z; @@ -108,7 +108,7 @@ bool StoneSlabTileItem::mayPlace(Level *level, int x, int y, int z, int face,sha return TileItem::mayPlace(level, ox, oy, oz, face, player, item); } -bool StoneSlabTileItem::tryConvertTargetTile(shared_ptr instance, shared_ptr player, Level *level, int x, int y, int z, int face, bool bTestUseOnOnly) +bool StoneSlabTileItem::tryConvertTargetTile(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, bool bTestUseOnOnly) { if (face == 0) y--; if (face == 1) y++; diff --git a/Minecraft.World/Items/TileItems/StoneSlabTileItem.h b/Minecraft.World/Items/TileItems/StoneSlabTileItem.h index 0096ff9d2..d27d4dc0c 100644 --- a/Minecraft.World/Items/TileItems/StoneSlabTileItem.h +++ b/Minecraft.World/Items/TileItems/StoneSlabTileItem.h @@ -15,10 +15,10 @@ public: virtual Icon *getIcon(int itemAuxValue); virtual int getLevelDataForAuxValue(int auxValue); - virtual unsigned int getDescriptionId(shared_ptr instance); - virtual bool 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=false); + virtual unsigned int getDescriptionId(std::shared_ptr instance); + virtual bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); - virtual bool mayPlace(Level *level, int x, int y, int z, int face,shared_ptr player, shared_ptr item); + virtual bool mayPlace(Level *level, int x, int y, int z, int face,std::shared_ptr player, std::shared_ptr item); private: - bool tryConvertTargetTile(shared_ptr instance, shared_ptr player, Level *level, int x, int y, int z, int face, bool bTestUseOnOnly); + bool tryConvertTargetTile(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, bool bTestUseOnOnly); }; \ No newline at end of file diff --git a/Minecraft.World/Items/TileItems/TileItem.cpp b/Minecraft.World/Items/TileItems/TileItem.cpp index 256930642..e01188e2b 100644 --- a/Minecraft.World/Items/TileItems/TileItem.cpp +++ b/Minecraft.World/Items/TileItems/TileItem.cpp @@ -46,7 +46,7 @@ Icon *TileItem::getIcon(int auxValue) return Tile::tiles[tileId]->getTexture(Facing::UP, auxValue); } -bool TileItem::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) +bool TileItem::useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { // 4J-PB - Adding a test only version to allow tooltips to be displayed int currentTile = level->getTile(x, y, z); @@ -162,7 +162,7 @@ bool TileItem::useOn(shared_ptr instance, shared_ptr playe } -bool TileItem::mayPlace(Level *level, int x, int y, int z, int face, shared_ptr player, shared_ptr item) +bool TileItem::mayPlace(Level *level, int x, int y, int z, int face, std::shared_ptr player, std::shared_ptr item) { int currentTile = level->getTile(x, y, z); if (currentTile == Tile::topSnow_Id) @@ -188,7 +188,7 @@ int TileItem::getColor(int itemAuxValue, int spriteLayer) return Tile::tiles[tileId]->getColor(); } -unsigned int TileItem::getDescriptionId(shared_ptr instance) +unsigned int TileItem::getDescriptionId(std::shared_ptr instance) { return Tile::tiles[tileId]->getDescriptionId(); } @@ -200,7 +200,7 @@ unsigned int TileItem::getDescriptionId(int iData /*= -1*/) } -unsigned int TileItem::getUseDescriptionId(shared_ptr instance) +unsigned int TileItem::getUseDescriptionId(std::shared_ptr instance) { return Tile::tiles[tileId]->getUseDescriptionId(); } diff --git a/Minecraft.World/Items/TileItems/TileItem.h b/Minecraft.World/Items/TileItems/TileItem.h index 764acc1a6..aeb47b715 100644 --- a/Minecraft.World/Items/TileItems/TileItem.h +++ b/Minecraft.World/Items/TileItems/TileItem.h @@ -26,18 +26,18 @@ public: //@Override Icon *getIcon(int auxValue); - virtual bool 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=false); - virtual unsigned int getDescriptionId(shared_ptr instance); + virtual bool useOn(std::shared_ptr instance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); + virtual unsigned int getDescriptionId(std::shared_ptr instance); virtual unsigned int getDescriptionId(int iData = -1); // 4J Added virtual int getColor(int itemAuxValue, int spriteLayer); // 4J Added - virtual unsigned int getUseDescriptionId(shared_ptr instance); + virtual unsigned int getUseDescriptionId(std::shared_ptr instance); virtual unsigned int getUseDescriptionId(); - virtual bool mayPlace(Level *level, int x, int y, int z, int face, shared_ptr player, shared_ptr item); + virtual bool mayPlace(Level *level, int x, int y, int z, int face, std::shared_ptr player, std::shared_ptr item); //@Override virtual void registerIcons(IconRegister *iconRegister); diff --git a/Minecraft.World/Items/TileItems/TreeTileItem.cpp b/Minecraft.World/Items/TileItems/TreeTileItem.cpp index d83997d78..1d7ebf711 100644 --- a/Minecraft.World/Items/TileItems/TreeTileItem.cpp +++ b/Minecraft.World/Items/TileItems/TreeTileItem.cpp @@ -20,7 +20,7 @@ int TreeTileItem::getLevelDataForAuxValue(int auxValue) return auxValue; } -unsigned int TreeTileItem::getDescriptionId(shared_ptr instance) +unsigned int TreeTileItem::getDescriptionId(std::shared_ptr instance) { int auxValue = instance->getAuxValue(); if (auxValue < 0 || auxValue >= TreeTile::TREE_NAMES_LENGTH) diff --git a/Minecraft.World/Items/TileItems/TreeTileItem.h b/Minecraft.World/Items/TileItems/TreeTileItem.h index 7f7b28255..06acf5949 100644 --- a/Minecraft.World/Items/TileItems/TreeTileItem.h +++ b/Minecraft.World/Items/TileItems/TreeTileItem.h @@ -14,5 +14,5 @@ public: virtual Icon *getIcon(int itemAuxValue); virtual int getLevelDataForAuxValue(int auxValue); - virtual unsigned int getDescriptionId(shared_ptr instance); + virtual unsigned int getDescriptionId(std::shared_ptr instance); }; \ No newline at end of file diff --git a/Minecraft.World/Items/TileItems/WaterLilyTileItem.cpp b/Minecraft.World/Items/TileItems/WaterLilyTileItem.cpp index abb0cbd7c..20592046c 100644 --- a/Minecraft.World/Items/TileItems/WaterLilyTileItem.cpp +++ b/Minecraft.World/Items/TileItems/WaterLilyTileItem.cpp @@ -10,7 +10,7 @@ WaterLilyTileItem::WaterLilyTileItem(int id) : ColoredTileItem(id, false) { } -bool WaterLilyTileItem::TestUse(Level *level, shared_ptr player) +bool WaterLilyTileItem::TestUse(Level *level, std::shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, true); if (hr == NULL) return false; @@ -39,7 +39,7 @@ bool WaterLilyTileItem::TestUse(Level *level, shared_ptr player) return false; } -shared_ptr WaterLilyTileItem::use(shared_ptr itemInstance, Level *level, shared_ptr player) +std::shared_ptr WaterLilyTileItem::use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, true); if (hr == NULL) return itemInstance; diff --git a/Minecraft.World/Items/TileItems/WaterLilyTileItem.h b/Minecraft.World/Items/TileItems/WaterLilyTileItem.h index c0c5db993..3fc233142 100644 --- a/Minecraft.World/Items/TileItems/WaterLilyTileItem.h +++ b/Minecraft.World/Items/TileItems/WaterLilyTileItem.h @@ -8,7 +8,7 @@ public: using ColoredTileItem::getColor; WaterLilyTileItem(int id); - virtual shared_ptr use(shared_ptr itemInstance, Level *level, shared_ptr player); - virtual bool TestUse(Level *level, shared_ptr player); + virtual std::shared_ptr use(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); + virtual bool TestUse(Level *level, std::shared_ptr player); virtual int getColor(int data, int spriteLayer); }; diff --git a/Minecraft.World/Items/WeaponItem.cpp b/Minecraft.World/Items/WeaponItem.cpp index 4ae29f9ed..d25fd5d42 100644 --- a/Minecraft.World/Items/WeaponItem.cpp +++ b/Minecraft.World/Items/WeaponItem.cpp @@ -13,7 +13,7 @@ WeaponItem::WeaponItem(int id, const Tier *tier) : Item(id), tier( tier ) damage = 4 + tier->getAttackDamageBonus(); } -float WeaponItem::getDestroySpeed(shared_ptr itemInstance, Tile *tile) +float WeaponItem::getDestroySpeed(std::shared_ptr itemInstance, Tile *tile) { if (tile->id == Tile::web_Id) { @@ -23,20 +23,20 @@ float WeaponItem::getDestroySpeed(shared_ptr itemInstance, Tile *t return 1.5f; } -bool WeaponItem::hurtEnemy(shared_ptr itemInstance, shared_ptr mob, shared_ptr attacker) +bool WeaponItem::hurtEnemy(std::shared_ptr itemInstance, std::shared_ptr mob, std::shared_ptr attacker) { itemInstance->hurt(1, attacker); return true; } -bool WeaponItem::mineBlock(shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, shared_ptr owner) +bool WeaponItem::mineBlock(std::shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, std::shared_ptr owner) { // Don't damage weapons if the tile can be destroyed in one hit. if (Tile::tiles[tile]->getDestroySpeed(level, x, y, z) != 0.0) itemInstance->hurt(2, owner); return true; } -int WeaponItem::getAttackDamage(shared_ptr entity) +int WeaponItem::getAttackDamage(std::shared_ptr entity) { return damage; } @@ -46,17 +46,17 @@ bool WeaponItem::isHandEquipped() return true; } -UseAnim WeaponItem::getUseAnimation(shared_ptr itemInstance) +UseAnim WeaponItem::getUseAnimation(std::shared_ptr itemInstance) { return UseAnim_block; } -int WeaponItem::getUseDuration(shared_ptr itemInstance) +int WeaponItem::getUseDuration(std::shared_ptr itemInstance) { return 20 * 60 * 60; // Block for a maximum of one hour! } -shared_ptr WeaponItem::use(shared_ptr instance, Level *level, shared_ptr player) +std::shared_ptr WeaponItem::use(std::shared_ptr instance, Level *level, std::shared_ptr player) { player->startUsingItem(instance, getUseDuration(instance)); return instance; @@ -77,7 +77,7 @@ const Item::Tier *WeaponItem::getTier() return tier; } -bool WeaponItem::isValidRepairItem(shared_ptr source, shared_ptr repairItem) +bool WeaponItem::isValidRepairItem(std::shared_ptr source, std::shared_ptr repairItem) { if (tier->getTierItemId() == repairItem->id) { diff --git a/Minecraft.World/Items/WeaponItem.h b/Minecraft.World/Items/WeaponItem.h index 2150f6e9c..162866d6d 100644 --- a/Minecraft.World/Items/WeaponItem.h +++ b/Minecraft.World/Items/WeaponItem.h @@ -12,17 +12,17 @@ private: public: WeaponItem(int id, const Tier *tier); - virtual float getDestroySpeed(shared_ptr itemInstance, Tile *tile); - virtual bool hurtEnemy(shared_ptr itemInstance, shared_ptr mob, shared_ptr attacker); - virtual bool mineBlock(shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, shared_ptr owner); - virtual int getAttackDamage(shared_ptr entity); + virtual float getDestroySpeed(std::shared_ptr itemInstance, Tile *tile); + virtual bool hurtEnemy(std::shared_ptr itemInstance, std::shared_ptr mob, std::shared_ptr attacker); + virtual bool mineBlock(std::shared_ptr itemInstance, Level *level, int tile, int x, int y, int z, std::shared_ptr owner); + virtual int getAttackDamage(std::shared_ptr entity); virtual bool isHandEquipped(); - virtual UseAnim getUseAnimation(shared_ptr itemInstance); - virtual int getUseDuration(shared_ptr itemInstance); - virtual shared_ptr use(shared_ptr instance, Level *level, shared_ptr player); + virtual UseAnim getUseAnimation(std::shared_ptr itemInstance); + virtual int getUseDuration(std::shared_ptr itemInstance); + virtual std::shared_ptr use(std::shared_ptr instance, Level *level, std::shared_ptr player); virtual bool canDestroySpecial(Tile *tile); virtual int getEnchantmentValue(); const Tier *getTier(); - bool isValidRepairItem(shared_ptr source, shared_ptr repairItem); + bool isValidRepairItem(std::shared_ptr source, std::shared_ptr repairItem); }; \ No newline at end of file diff --git a/Minecraft.World/Level/ChunkPos.cpp b/Minecraft.World/Level/ChunkPos.cpp index bcc0401c0..fcc58cbc1 100644 --- a/Minecraft.World/Level/ChunkPos.cpp +++ b/Minecraft.World/Level/ChunkPos.cpp @@ -21,7 +21,7 @@ int ChunkPos::hashCode() return h1 ^ h2; } -double ChunkPos::distanceToSqr(shared_ptr e) +double ChunkPos::distanceToSqr(std::shared_ptr e) { double xPos = x * 16 + 8; double zPos = z * 16 + 8; diff --git a/Minecraft.World/Level/ChunkPos.h b/Minecraft.World/Level/ChunkPos.h index 119ee86cc..8a9cb4f61 100644 --- a/Minecraft.World/Level/ChunkPos.h +++ b/Minecraft.World/Level/ChunkPos.h @@ -13,7 +13,7 @@ public: static __int64 hashCode(int x, int z); int hashCode(); - double distanceToSqr(shared_ptr e); + double distanceToSqr(std::shared_ptr e); double distanceToSqr(double px, double pz); // 4J added int getMiddleBlockX(); diff --git a/Minecraft.World/Level/DerivedLevelData.cpp b/Minecraft.World/Level/DerivedLevelData.cpp index a3235594d..e167e4407 100644 --- a/Minecraft.World/Level/DerivedLevelData.cpp +++ b/Minecraft.World/Level/DerivedLevelData.cpp @@ -17,7 +17,7 @@ CompoundTag *DerivedLevelData::createTag() return wrapped->createTag(); } -CompoundTag *DerivedLevelData::createTag(vector > *players) +CompoundTag *DerivedLevelData::createTag(vector > *players) { return wrapped->createTag(players); } diff --git a/Minecraft.World/Level/DerivedLevelData.h b/Minecraft.World/Level/DerivedLevelData.h index a39f7d04a..c3ab42630 100644 --- a/Minecraft.World/Level/DerivedLevelData.h +++ b/Minecraft.World/Level/DerivedLevelData.h @@ -15,7 +15,7 @@ protected: public: CompoundTag *createTag(); - CompoundTag *createTag(vector > *players); + CompoundTag *createTag(vector > *players); __int64 getSeed(); int getXSpawn(); int getYSpawn(); diff --git a/Minecraft.World/Level/EmptyLevelChunk.cpp b/Minecraft.World/Level/EmptyLevelChunk.cpp index a11f45944..71a3dddc1 100644 --- a/Minecraft.World/Level/EmptyLevelChunk.cpp +++ b/Minecraft.World/Level/EmptyLevelChunk.cpp @@ -94,15 +94,15 @@ int EmptyLevelChunk::getRawBrightness(int x, int y, int z, int skyDampen) return 0; } -void EmptyLevelChunk::addEntity(shared_ptr e) +void EmptyLevelChunk::addEntity(std::shared_ptr e) { } -void EmptyLevelChunk::removeEntity(shared_ptr e) +void EmptyLevelChunk::removeEntity(std::shared_ptr e) { } -void EmptyLevelChunk::removeEntity(shared_ptr e, int yc) +void EmptyLevelChunk::removeEntity(std::shared_ptr e, int yc) { } @@ -115,16 +115,16 @@ void EmptyLevelChunk::skyBrightnessChanged() { } -shared_ptr EmptyLevelChunk::getTileEntity(int x, int y, int z) +std::shared_ptr EmptyLevelChunk::getTileEntity(int x, int y, int z) { - return shared_ptr(); + return std::shared_ptr(); } -void EmptyLevelChunk::addTileEntity(shared_ptr te) +void EmptyLevelChunk::addTileEntity(std::shared_ptr te) { } -void EmptyLevelChunk::setTileEntity(int x, int y, int z, shared_ptr tileEntity) +void EmptyLevelChunk::setTileEntity(int x, int y, int z, std::shared_ptr tileEntity) { } @@ -144,11 +144,11 @@ void EmptyLevelChunk::markUnsaved() { } -void EmptyLevelChunk::getEntities(shared_ptr except, AABB bb, vector > &es) +void EmptyLevelChunk::getEntities(std::shared_ptr except, AABB bb, vector > &es) { } -void EmptyLevelChunk::getEntitiesOfClass(const type_info& ec, AABB bb, vector > &es) +void EmptyLevelChunk::getEntitiesOfClass(const type_info& ec, AABB bb, vector > &es) { } diff --git a/Minecraft.World/Level/EmptyLevelChunk.h b/Minecraft.World/Level/EmptyLevelChunk.h index 7582b532a..f846f0c9b 100644 --- a/Minecraft.World/Level/EmptyLevelChunk.h +++ b/Minecraft.World/Level/EmptyLevelChunk.h @@ -28,20 +28,20 @@ public: void getNeighbourBrightnesses(int *brightnesses, LightLayer::variety layer, int x, int y, int z); // 4J added void setBrightness(LightLayer::variety layer, int x, int y, int z, int brightness); int getRawBrightness(int x, int y, int z, int skyDampen); - void addEntity(shared_ptr e); - void removeEntity(shared_ptr e); - void removeEntity(shared_ptr e, int yc); + void addEntity(std::shared_ptr e); + void removeEntity(std::shared_ptr e); + void removeEntity(std::shared_ptr e, int yc); bool isSkyLit(int x, int y, int z); void skyBrightnessChanged(); - shared_ptr getTileEntity(int x, int y, int z); - void addTileEntity(shared_ptr te); - void setTileEntity(int x, int y, int z, shared_ptr tileEntity); + std::shared_ptr getTileEntity(int x, int y, int z); + void addTileEntity(std::shared_ptr te); + void setTileEntity(int x, int y, int z, std::shared_ptr tileEntity); void removeTileEntity(int x, int y, int z); void load(); void unload(bool unloadTileEntities) ; // 4J - added parameter void markUnsaved(); - void getEntities(shared_ptr except, AABB bb, vector > &es); - void getEntitiesOfClass(const type_info& ec, AABB bb, vector > &es); + void getEntities(std::shared_ptr except, AABB bb, vector > &es); + void getEntitiesOfClass(const type_info& ec, AABB bb, vector > &es); int countEntities(); bool shouldSave(bool force); void setBlocks(byteArray newBlocks, int sub); diff --git a/Minecraft.World/Level/Events/LevelListener.h b/Minecraft.World/Level/Events/LevelListener.h index 315bc7576..671df0d17 100644 --- a/Minecraft.World/Level/Events/LevelListener.h +++ b/Minecraft.World/Level/Events/LevelListener.h @@ -18,23 +18,23 @@ public: //virtual void playSound(const wstring& name, double x, double y, double z, float volume, float pitch) = 0; virtual void playSound(int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f) = 0; - virtual void playSound(shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f) = 0; + virtual void playSound(std::shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f) = 0; // 4J removed - virtual void addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za) = 0; virtual void addParticle(ePARTICLE_TYPE name, double x, double y, double z, double xa, double ya, double za) = 0; // 4J added - virtual void entityAdded(shared_ptr entity) = 0; + virtual void entityAdded(std::shared_ptr entity) = 0; - virtual void entityRemoved(shared_ptr entity) = 0; + virtual void entityRemoved(std::shared_ptr entity) = 0; - virtual void playerRemoved(shared_ptr entity) = 0; // 4J added - for when a player is removed from the level's player array, not just the entity storage + virtual void playerRemoved(std::shared_ptr entity) = 0; // 4J added - for when a player is removed from the level's player array, not just the entity storage virtual void skyColorChanged() = 0; virtual void playStreamingMusic(const wstring& name, int x, int y, int z) = 0; - virtual void levelEvent(shared_ptr source, int type, int x, int y, int z, int data) = 0; + virtual void levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data) = 0; virtual void destroyTileProgress(int id, int x, int y, int z, int progress) = 0; }; \ No newline at end of file diff --git a/Minecraft.World/Level/Events/VillageSiege.cpp b/Minecraft.World/Level/Events/VillageSiege.cpp index 5a5f5506d..ae31a0c69 100644 --- a/Minecraft.World/Level/Events/VillageSiege.cpp +++ b/Minecraft.World/Level/Events/VillageSiege.cpp @@ -77,12 +77,12 @@ void VillageSiege::tick() bool VillageSiege::tryToSetupSiege() { - vector > *players = &level->players; + vector > *players = &level->players; //for (Player player : players) for(AUTO_VAR(it, players->begin()); it != players->end(); ++it) { - shared_ptr player = *it; - shared_ptr _village = level->villages->getClosestVillage((int) player->x, (int) player->y, (int) player->z, 1); + std::shared_ptr player = *it; + std::shared_ptr _village = level->villages->getClosestVillage((int) player->x, (int) player->y, (int) player->z, 1); village = _village; if (_village == NULL) continue; @@ -101,11 +101,11 @@ bool VillageSiege::tryToSetupSiege() spawnY = center->y; spawnZ = center->z + (int) (Mth::sin(level->random->nextFloat() * PI * 2.f) * radius * 0.9); overlaps = false; - vector > *villages = level->villages->getVillages(); + vector > *villages = level->villages->getVillages(); //for (Village v : level.villages.getVillages()) for(AUTO_VAR(itV, villages->begin()); itV != villages->end(); ++itV) { - shared_ptrv = *itV; + std::shared_ptrv = *itV; if (v == _village) continue; if (v->isInside(spawnX, spawnY, spawnZ)) { @@ -131,10 +131,10 @@ bool VillageSiege::trySpawn() { Vec3 *spawnPos = findRandomSpawnPos(spawnX, spawnY, spawnZ); if (spawnPos == NULL) return false; - shared_ptr mob; + std::shared_ptr mob; //try { - mob = shared_ptr( new Zombie(level) ); + mob = std::shared_ptr( new Zombie(level) ); mob->finalizeMobSpawn(); mob->setVillager(false); } @@ -144,7 +144,7 @@ bool VillageSiege::trySpawn() //} mob->moveTo(spawnPos->x, spawnPos->y, spawnPos->z, level->random->nextFloat() * 360, 0); level->addEntity(mob); - shared_ptr _village = village.lock(); + std::shared_ptr _village = village.lock(); if( _village == NULL ) return false; Pos *center = _village->getCenter(); @@ -154,7 +154,7 @@ bool VillageSiege::trySpawn() Vec3 *VillageSiege::findRandomSpawnPos(int x, int y, int z) { - shared_ptr _village = village.lock(); + std::shared_ptr _village = village.lock(); if( _village == NULL ) return NULL; for (int i = 0; i < 10; ++i) diff --git a/Minecraft.World/Level/Explosion.cpp b/Minecraft.World/Level/Explosion.cpp index fb1d62602..c0538c284 100644 --- a/Minecraft.World/Level/Explosion.cpp +++ b/Minecraft.World/Level/Explosion.cpp @@ -8,7 +8,7 @@ #include "Explosion.h" #include "../Util/SoundTypes.h" -Explosion::Explosion(Level *level, shared_ptr source, double x, double y, double z, float r) +Explosion::Explosion(Level *level, std::shared_ptr source, double x, double y, double z, float r) { fire = false; random = new Random(); @@ -97,14 +97,14 @@ void Explosion::explode() // Fix for 360 #123866 - [CRASH] TU13: Code: Compliance: Placing the TNT next to Ender Crystals will crash the title after a certain amount of time. // If we explode something next to an EnderCrystal then it creates a new explosion that overwrites the shared vector in the level // So copy it here instead of directly using the shared one - vector > *levelEntities = level->getEntities(source, AABB::newTemp(x0, y0, z0, x1, y1, z1)); - vector > entities(levelEntities->begin(), levelEntities->end() ); + vector > *levelEntities = level->getEntities(source, AABB::newTemp(x0, y0, z0, x1, y1, z1)); + vector > entities(levelEntities->begin(), levelEntities->end() ); Vec3 *center = Vec3::newTemp(x, y, z); AUTO_VAR(itEnd, entities.end()); for (AUTO_VAR(it, entities.begin()); it != itEnd; it++) { - shared_ptr e = *it; //entities->at(i); + std::shared_ptr e = *it; //entities->at(i); // 4J Stu - If the entity is not in a block that would be blown up, then they should not be damaged // Fix for #46606 - TU5: Content: Gameplay: The player can be damaged and killed by explosions behind obsidian walls @@ -149,7 +149,7 @@ void Explosion::explode() e->yd += ya * push; e->zd += za * push; - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = dynamic_pointer_cast(e); if (player != NULL) { //app.DebugPrintf("Adding player knockback (%f,%f,%f)\n", xa * pow, ya * pow, za * pow); @@ -255,7 +255,7 @@ Explosion::playerVec3Map *Explosion::getHitPlayers() return &hitPlayers; } -Vec3 *Explosion::getHitPlayerKnockback( shared_ptr player ) +Vec3 *Explosion::getHitPlayerKnockback( std::shared_ptr player ) { AUTO_VAR(it, hitPlayers.find(player)); diff --git a/Minecraft.World/Level/Explosion.h b/Minecraft.World/Level/Explosion.h index afbee106d..602126fa4 100644 --- a/Minecraft.World/Level/Explosion.h +++ b/Minecraft.World/Level/Explosion.h @@ -19,17 +19,17 @@ private: public: double x, y, z; - shared_ptr source; + std::shared_ptr source; float r; unordered_set toBlow; private: - typedef unordered_map, Vec3 * , PlayerKeyHash, PlayerKeyEq> playerVec3Map; + typedef unordered_map, Vec3 * , PlayerKeyHash, PlayerKeyEq> playerVec3Map; playerVec3Map hitPlayers; public: - Explosion(Level *level, shared_ptr source, double x, double y, double z, float r); + Explosion(Level *level, std::shared_ptr source, double x, double y, double z, float r); ~Explosion(); public: @@ -38,5 +38,5 @@ public: public: void finalizeExplosion(bool generateParticles, vector *toBlowDirect = NULL); // 4J - added toBlow parameter playerVec3Map *getHitPlayers(); - Vec3 *getHitPlayerKnockback( shared_ptr player ); + Vec3 *getHitPlayerKnockback( std::shared_ptr player ); }; \ No newline at end of file diff --git a/Minecraft.World/Level/Level.cpp b/Minecraft.World/Level/Level.cpp index 2ce4784c5..ea71b36de 100644 --- a/Minecraft.World/Level/Level.cpp +++ b/Minecraft.World/Level/Level.cpp @@ -558,20 +558,20 @@ BiomeSource *Level::getBiomeSource() return dimension->biomeSource; } -Level::Level(shared_ptr levelStorage, const wstring& name, Dimension *dimension, LevelSettings *levelSettings, bool doCreateChunkSource) +Level::Level(std::shared_ptr levelStorage, const wstring& name, Dimension *dimension, LevelSettings *levelSettings, bool doCreateChunkSource) : seaLevel(constSeaLevel) { _init(); - this->levelStorage = levelStorage;//shared_ptr(levelStorage); + this->levelStorage = levelStorage;//std::shared_ptr(levelStorage); this->dimension = dimension; this->levelData = new LevelData(levelSettings, name); if( !this->levelData->useNewSeaLevel() ) seaLevel = Level::genDepth / 2; // 4J added - sea level is one unit lower since 1.8.2, maintain older height for old levels this->savedDataStorage = new SavedDataStorage(levelStorage.get()); - shared_ptr savedVillages = dynamic_pointer_cast(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID)); + std::shared_ptr savedVillages = dynamic_pointer_cast(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID)); if (savedVillages == NULL) { - villages = shared_ptr(new Villages(this)); + villages = std::shared_ptr(new Villages(this)); savedDataStorage->set(Villages::VILLAGE_FILE_ID, villages); } else @@ -597,10 +597,10 @@ Level::Level(Level *level, Dimension *dimension) if( !this->levelData->useNewSeaLevel() ) seaLevel = Level::genDepth / 2; // 4J added - sea level is one unit lower since 1.8.2, maintain older height for old levels this->savedDataStorage = new SavedDataStorage( levelStorage.get() ); - shared_ptr savedVillages = dynamic_pointer_cast(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID)); + std::shared_ptr savedVillages = dynamic_pointer_cast(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID)); if (savedVillages == NULL) { - villages = shared_ptr(new Villages(this)); + villages = std::shared_ptr(new Villages(this)); savedDataStorage->set(Villages::VILLAGE_FILE_ID, villages); } else @@ -617,29 +617,29 @@ Level::Level(Level *level, Dimension *dimension) } -Level::Level(shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings) +Level::Level(std::shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings) : seaLevel( constSeaLevel ) { _init(levelStorage, levelName, levelSettings, NULL, true); } -Level::Level(shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource) +Level::Level(std::shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource) : seaLevel( constSeaLevel ) { _init( levelStorage, levelName, levelSettings, fixedDimension, doCreateChunkSource ); } -void Level::_init(shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource) +void Level::_init(std::shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource) { _init(); - this->levelStorage = levelStorage;//shared_ptr(levelStorage); + this->levelStorage = levelStorage;//std::shared_ptr(levelStorage); this->savedDataStorage = new SavedDataStorage(levelStorage.get()); - shared_ptr savedVillages = dynamic_pointer_cast(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID)); + std::shared_ptr savedVillages = dynamic_pointer_cast(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID)); if (savedVillages == NULL) { - villages = shared_ptr(new Villages(this)); + villages = std::shared_ptr(new Villages(this)); savedDataStorage->set(Villages::VILLAGE_FILE_ID, villages); } else @@ -1581,7 +1581,7 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly) } -void Level::playSound(shared_ptr entity, int iSound, float volume, float pitch) +void Level::playSound(std::shared_ptr entity, int iSound, float volume, float pitch) { if(entity == NULL) return; AUTO_VAR(itEnd, listeners.end()); @@ -1648,7 +1648,7 @@ void Level::addParticle(ePARTICLE_TYPE id, double x, double y, double z, double (*it)->addParticle(id, x, y, z, xd, yd, zd); } -bool Level::addGlobalEntity(shared_ptr e) +bool Level::addGlobalEntity(std::shared_ptr e) { globalEntities.push_back(e); return true; @@ -1656,7 +1656,7 @@ bool Level::addGlobalEntity(shared_ptr e) #pragma optimize( "", off ) -bool Level::addEntity(shared_ptr e) +bool Level::addEntity(std::shared_ptr e) { int xc = Mth::floor(e->x / 16); int zc = Mth::floor(e->z / 16); @@ -1676,7 +1676,7 @@ bool Level::addEntity(shared_ptr e) { if (dynamic_pointer_cast( e ) != NULL) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = dynamic_pointer_cast(e); // 4J Stu - Added so we don't continually add the player to the players list while they are dead if( find( players.begin(), players.end(), e ) == players.end() ) @@ -1704,7 +1704,7 @@ bool Level::addEntity(shared_ptr e) #pragma optimize( "", on ) -void Level::entityAdded(shared_ptr e) +void Level::entityAdded(std::shared_ptr e) { AUTO_VAR(itEnd, listeners.end()); for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) @@ -1714,7 +1714,7 @@ void Level::entityAdded(shared_ptr e) } -void Level::entityRemoved(shared_ptr e) +void Level::entityRemoved(std::shared_ptr e) { AUTO_VAR(itEnd, listeners.end()); for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) @@ -1724,7 +1724,7 @@ void Level::entityRemoved(shared_ptr e) } // 4J added -void Level::playerRemoved(shared_ptr e) +void Level::playerRemoved(std::shared_ptr e) { AUTO_VAR(itEnd, listeners.end()); for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) @@ -1733,7 +1733,7 @@ void Level::playerRemoved(shared_ptr e) } } -void Level::removeEntity(shared_ptr e) +void Level::removeEntity(std::shared_ptr e) { if (e->rider.lock() != NULL) { @@ -1746,8 +1746,8 @@ void Level::removeEntity(shared_ptr e) e->remove(); if (dynamic_pointer_cast( e ) != NULL) { - vector >::iterator it = players.begin(); - vector >::iterator itEnd = players.end(); + vector >::iterator it = players.begin(); + vector >::iterator itEnd = players.end(); while( it != itEnd && *it != dynamic_pointer_cast(e) ) it++; @@ -1762,14 +1762,14 @@ void Level::removeEntity(shared_ptr e) } -void Level::removeEntityImmediately(shared_ptr e) +void Level::removeEntityImmediately(std::shared_ptr e) { e->remove(); if (dynamic_pointer_cast( e ) != NULL) { - vector >::iterator it = players.begin(); - vector >::iterator itEnd = players.end(); + vector >::iterator it = players.begin(); + vector >::iterator itEnd = players.end(); while( it != itEnd && *it != dynamic_pointer_cast(e) ) it++; @@ -1790,8 +1790,8 @@ void Level::removeEntityImmediately(shared_ptr e) } EnterCriticalSection(&m_entitiesCS); - vector >::iterator it = entities.begin(); - vector >::iterator endIt = entities.end(); + vector >::iterator it = entities.begin(); + vector >::iterator endIt = entities.end(); while( it != endIt && *it != e) it++; @@ -1823,7 +1823,7 @@ void Level::removeListener(LevelListener *listener) // 4J - added noEntities and blockAtEdge parameter -AABBList *Level::getCubes(shared_ptr source, AABB *box, bool noEntities, bool blockAtEdge) +AABBList *Level::getCubes(std::shared_ptr source, AABB *box, bool noEntities, bool blockAtEdge) { boxes.clear(); int x0 = Mth::floor(box->x0); @@ -1895,8 +1895,8 @@ AABBList *Level::getCubes(shared_ptr source, AABB *box, bool noEntities, if( noEntities ) return &boxes; double r = 0.25; - vector > *ee = getEntities(source, box->grow(r, r, r)); - vector >::iterator itEnd = ee->end(); + vector > *ee = getEntities(source, box->grow(r, r, r)); + vector >::iterator itEnd = ee->end(); for (AUTO_VAR(it, ee->begin()); it != itEnd; it++) { AABB *collideBox = (*it)->getCollideBox(); @@ -1986,7 +1986,7 @@ float Level::getSkyDarken(float a) -Vec3 *Level::getSkyColor(shared_ptr source, float a) +Vec3 *Level::getSkyColor(std::shared_ptr source, float a) { float td = getTimeOfDay(a); @@ -2197,10 +2197,10 @@ void Level::forceAddTileTick(int x, int y, int z, int tileId, int tickDelay) void Level::tickEntities() { //for (int i = 0; i < globalEntities.size(); i++) - vector >::iterator itGE = globalEntities.begin(); + vector >::iterator itGE = globalEntities.begin(); while( itGE != globalEntities.end() ) { - shared_ptr e = *itGE;//globalEntities.at(i); + std::shared_ptr e = *itGE;//globalEntities.at(i); e->tick(); if (e->removed) { @@ -2241,7 +2241,7 @@ void Level::tickEntities() AUTO_VAR(itETREnd, entitiesToRemove.end()); for (AUTO_VAR(it, entitiesToRemove.begin()); it != itETREnd; it++) { - shared_ptr e = *it;//entitiesToRemove.at(j); + std::shared_ptr e = *it;//entitiesToRemove.at(j); int xc = e->xChunk; int zc = e->zChunk; if (e->inChunk && hasChunk(xc, zc)) @@ -2267,7 +2267,7 @@ void Level::tickEntities() for (unsigned int i = 0; i < entities.size(); ) { - shared_ptr e = entities.at(i); + std::shared_ptr e = entities.at(i); if (e->riding != NULL) { @@ -2326,7 +2326,7 @@ void Level::tickEntities() updatingTileEntities = true; for (AUTO_VAR(it, tileEntityList.begin()); it != tileEntityList.end();) { - shared_ptr te = *it;//tilevector >.at(i); + std::shared_ptr te = *it;//tilevector >.at(i); if( !te->isRemoved() && te->hasLevel() ) { if (hasChunkAt(te->x, te->y, te->z)) @@ -2394,7 +2394,7 @@ void Level::tickEntities() { for( AUTO_VAR(it, pendingTileEntities.begin()); it != pendingTileEntities.end(); it++ ) { - shared_ptr e = *it; + std::shared_ptr e = *it; if( !e->isRemoved() ) { if( find(tileEntityList.begin(),tileEntityList.end(),e) == tileEntityList.end() ) @@ -2415,7 +2415,7 @@ void Level::tickEntities() LeaveCriticalSection(&m_tileEntityListCS); } -void Level::addAllPendingTileEntities(vector< shared_ptr >& entities) +void Level::addAllPendingTileEntities(vector< std::shared_ptr >& entities) { EnterCriticalSection(&m_tileEntityListCS); if( updatingTileEntities ) @@ -2435,13 +2435,13 @@ void Level::addAllPendingTileEntities(vector< shared_ptr >& entities LeaveCriticalSection(&m_tileEntityListCS); } -void Level::tick(shared_ptr e) +void Level::tick(std::shared_ptr e) { tick(e, true); } -void Level::tick(shared_ptr e, bool actual) +void Level::tick(std::shared_ptr e, bool actual) { int xc = Mth::floor(e->x); int zc = Mth::floor(e->z); @@ -2537,13 +2537,13 @@ bool Level::isUnobstructed(AABB *aabb) return isUnobstructed(aabb, nullptr); } -bool Level::isUnobstructed(AABB *aabb, shared_ptr ignore) +bool Level::isUnobstructed(AABB *aabb, std::shared_ptr ignore) { - vector > *ents = getEntities(nullptr, aabb); + vector > *ents = getEntities(nullptr, aabb); AUTO_VAR(itEnd, ents->end()); for (AUTO_VAR(it, ents->begin()); it != itEnd; it++) { - shared_ptr e = *it; + std::shared_ptr e = *it; if (!e->removed && e->blocksBuilding && e != ignore) return false; } return true; @@ -2658,7 +2658,7 @@ bool Level::containsFireTile(AABB *box) } -bool Level::checkAndHandleWater(AABB *box, Material *material, shared_ptr e) +bool Level::checkAndHandleWater(AABB *box, Material *material, std::shared_ptr e) { int x0 = Mth::floor(box->x0); int x1 = Mth::floor(box->x1 + 1); @@ -2758,15 +2758,15 @@ bool Level::containsLiquid(AABB *box, Material *material) } -shared_ptr Level::explode(shared_ptr source, double x, double y, double z, float r, bool destroyBlocks) +std::shared_ptr Level::explode(std::shared_ptr source, double x, double y, double z, float r, bool destroyBlocks) { return explode(source, x, y, z, r, false, destroyBlocks); } -shared_ptr Level::explode(shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks) +std::shared_ptr Level::explode(std::shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks) { - shared_ptr explosion = shared_ptr( new Explosion(this, source, x, y, z, r) ); + std::shared_ptr explosion = std::shared_ptr( new Explosion(this, source, x, y, z, r) ); explosion->fire = fire; explosion->destroyBlocks = destroyBlocks; explosion->explode(); @@ -2799,7 +2799,7 @@ float Level::getSeenPercent(Vec3 *center, AABB *bb) } -bool Level::extinguishFire(shared_ptr player, int x, int y, int z, int face) +bool Level::extinguishFire(std::shared_ptr player, int x, int y, int z, int face) { if (face == 0) y--; if (face == 1) y++; @@ -2818,9 +2818,9 @@ bool Level::extinguishFire(shared_ptr player, int x, int y, int z, int f } /* -shared_ptr Level::findSubclassOf(Entity::Class *entityClass) +std::shared_ptr Level::findSubclassOf(Entity::Class *entityClass) { - return shared_ptr(); + return std::shared_ptr(); } */ @@ -2841,7 +2841,7 @@ wstring Level::gatherChunkSourceStats() } -shared_ptr Level::getTileEntity(int x, int y, int z) +std::shared_ptr Level::getTileEntity(int x, int y, int z) { if (y >= Level::maxBuildHeight) { @@ -2852,14 +2852,14 @@ shared_ptr Level::getTileEntity(int x, int y, int z) if (lc != NULL) { - shared_ptr tileEntity = lc->getTileEntity(x & 15, y, z & 15); + std::shared_ptr tileEntity = lc->getTileEntity(x & 15, y, z & 15); if (tileEntity == NULL) { EnterCriticalSection(&m_tileEntityListCS); for( AUTO_VAR(it, pendingTileEntities.begin()); it != pendingTileEntities.end(); it++ ) { - shared_ptr e = *it; + std::shared_ptr e = *it; if (!e->isRemoved() && e->x == x && e->y == y && e->z == z) { @@ -2876,7 +2876,7 @@ shared_ptr Level::getTileEntity(int x, int y, int z) } -void Level::setTileEntity(int x, int y, int z, shared_ptr tileEntity) +void Level::setTileEntity(int x, int y, int z, std::shared_ptr tileEntity) { if (tileEntity != NULL && !tileEntity->isRemoved()) { @@ -2905,7 +2905,7 @@ void Level::setTileEntity(int x, int y, int z, shared_ptr tileEntity void Level::removeTileEntity(int x, int y, int z) { EnterCriticalSection(&m_tileEntityListCS); - shared_ptr te = getTileEntity(x, y, z); + std::shared_ptr te = getTileEntity(x, y, z); if (te != NULL && updatingTileEntities) { te->setRemoved(); @@ -2936,7 +2936,7 @@ void Level::removeTileEntity(int x, int y, int z) LeaveCriticalSection(&m_tileEntityListCS); } -void Level::markForRemoval(shared_ptr entity) +void Level::markForRemoval(std::shared_ptr entity) { tileEntitiesToUnload.push_back(entity); } @@ -3163,7 +3163,7 @@ void Level::buildAndPrepareChunksToPoll() AUTO_VAR(itEnd, players.end()); for (AUTO_VAR(it, players.begin()); it != itEnd; it++) { - shared_ptr player = *it; + std::shared_ptr player = *it; int xx = Mth::floor(player->x / 16); int zz = Mth::floor(player->z / 16); @@ -3183,7 +3183,7 @@ void Level::buildAndPrepareChunksToPoll() int *zz = new int[playerCount]; for (int i = 0; i < playerCount; i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; xx[i] = Mth::floor(player->x / 16); zz[i] = Mth::floor(player->z / 16); chunksToPoll.insert(ChunkPos(xx[i], zz[i] )); @@ -3239,7 +3239,7 @@ void Level::tickClientSideTiles(int xo, int zo, LevelChunk *lc) z += zo; 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); + std::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) { // 4J-PB - Fixed issue with cave audio event having 2 sounds at 192k @@ -3728,7 +3728,7 @@ vector *Level::fetchTicksInChunk(LevelChunk *chunk, bool remov } -vector > *Level::getEntities(shared_ptr except, AABB *bb) +vector > *Level::getEntities(std::shared_ptr except, AABB *bb) { MemSect(40); es.clear(); @@ -3768,13 +3768,13 @@ vector > *Level::getEntities(shared_ptr except, AABB } -vector > *Level::getEntitiesOfClass(const type_info& baseClass, AABB *bb) +vector > *Level::getEntitiesOfClass(const type_info& baseClass, AABB *bb) { int xc0 = Mth::floor((bb->x0 - 2) / 16); int xc1 = Mth::floor((bb->x1 + 2) / 16); int zc0 = Mth::floor((bb->z0 - 2) / 16); int zc1 = Mth::floor((bb->z1 + 2) / 16); - vector > *es = new vector >(); + vector > *es = new vector >(); #ifdef __PSVITA__ #ifdef _ENTITIES_RW_SECTION @@ -3805,15 +3805,15 @@ vector > *Level::getEntitiesOfClass(const type_info& baseClas return es; } -shared_ptr Level::getClosestEntityOfClass(const type_info& baseClass, AABB *bb, shared_ptr source) +std::shared_ptr Level::getClosestEntityOfClass(const type_info& baseClass, AABB *bb, std::shared_ptr source) { - vector > *entities = getEntitiesOfClass(baseClass, bb); - shared_ptr closest = nullptr; + vector > *entities = getEntitiesOfClass(baseClass, bb); + std::shared_ptr closest = nullptr; double closestDistSqr = Double::MAX_VALUE; //for (Entity entity : entities) for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { - shared_ptr entity = *it; + std::shared_ptr entity = *it; if (entity == source) continue; double distSqr = source->distanceToSqr(entity); if (distSqr > closestDistSqr) continue; @@ -3824,16 +3824,16 @@ shared_ptr Level::getClosestEntityOfClass(const type_info& baseClass, AA return closest; } -vector > Level::getAllEntities() +vector > Level::getAllEntities() { EnterCriticalSection(&m_entitiesCS); - vector > retVec = entities; + vector > retVec = entities; LeaveCriticalSection(&m_entitiesCS); return retVec; } -void Level::tileEntityChanged(int x, int y, int z, shared_ptr te) +void Level::tileEntityChanged(int x, int y, int z, std::shared_ptr te) { if (this->hasChunkAt(x, y, z)) { @@ -3849,7 +3849,7 @@ unsigned int Level::countInstanceOf(BaseObject::Class *clas) AUTO_VAR(itEnd, entities.end()); for (AUTO_VAR(it, entities.begin()); it != itEnd; it++) { - shared_ptr e = *it;//entities.at(i); + std::shared_ptr e = *it;//entities.at(i); if (clas->isAssignableFrom(e->getClass())) count++; } LeaveCriticalSection(&m_entitiesCS); @@ -3869,7 +3869,7 @@ unsigned int Level::countInstanceOf(eINSTANCEOF clas, bool singleType, unsigned AUTO_VAR(itEnd, entities.end()); for (AUTO_VAR(it, entities.begin()); it != itEnd; it++) { - shared_ptr e = *it;//entities.at(i); + std::shared_ptr e = *it;//entities.at(i); if( singleType ) { if (e->GetType() == clas) @@ -3904,7 +3904,7 @@ unsigned int Level::countInstanceOfInRange(eINSTANCEOF clas, bool singleType, in AUTO_VAR(itEnd, entities.end()); for (AUTO_VAR(it, entities.begin()); it != itEnd; it++) { - shared_ptr e = *it;//entities.at(i); + std::shared_ptr e = *it;//entities.at(i); float sd = e->distanceTo(x,y,z); if (sd * sd > range * range) @@ -3932,7 +3932,7 @@ unsigned int Level::countInstanceOfInRange(eINSTANCEOF clas, bool singleType, in return count; } -void Level::addEntities(vector > *list) +void Level::addEntities(vector > *list) { //entities.addAll(list); EnterCriticalSection(&m_entitiesCS); @@ -3973,13 +3973,13 @@ void Level::addEntities(vector > *list) } -void Level::removeEntities(vector > *list) +void Level::removeEntities(vector > *list) { //entitiesToRemove.addAll(list); entitiesToRemove.insert(entitiesToRemove.end(), list->begin(), list->end()); } -bool Level::mayPlace(int tileId, int x, int y, int z, bool ignoreEntities, int face, shared_ptr ignoreEntity) +bool Level::mayPlace(int tileId, int x, int y, int z, bool ignoreEntities, int face, std::shared_ptr ignoreEntity) { int targetType = getTile(x, y, z); Tile *targetTile = Tile::tiles[targetType]; @@ -4010,7 +4010,7 @@ int Level::getSeaLevel() } -Path *Level::findPath(shared_ptr from, shared_ptr to, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat) +Path *Level::findPath(std::shared_ptr from, std::shared_ptr to, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat) { int x = Mth::floor(from->x); int y = Mth::floor(from->y + 1); @@ -4029,7 +4029,7 @@ Path *Level::findPath(shared_ptr from, shared_ptr to, float maxD } -Path *Level::findPath(shared_ptr from, int xBest, int yBest, int zBest, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat) +Path *Level::findPath(std::shared_ptr from, int xBest, int yBest, int zBest, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat) { int x = Mth::floor(from->x); int y = Mth::floor(from->y); @@ -4092,21 +4092,21 @@ bool Level::hasNeighborSignal(int x, int y, int z) } // 4J Stu - Added maxYDist param -shared_ptr Level::getNearestPlayer(shared_ptr source, double maxDist, double maxYDist /*= -1*/) +std::shared_ptr Level::getNearestPlayer(std::shared_ptr source, double maxDist, double maxYDist /*= -1*/) { return getNearestPlayer(source->x, source->y, source->z, maxDist, maxYDist); } // 4J Stu - Added maxYDist param -shared_ptr Level::getNearestPlayer(double x, double y, double z, double maxDist, double maxYDist /*= -1*/) +std::shared_ptr Level::getNearestPlayer(double x, double y, double z, double maxDist, double maxYDist /*= -1*/) { MemSect(21); double best = -1; - shared_ptr result = nullptr; + std::shared_ptr result = nullptr; AUTO_VAR(itEnd, players.end()); for (AUTO_VAR(it, players.begin()); it != itEnd; it++) { - shared_ptr p = *it;//players.at(i); + std::shared_ptr p = *it;//players.at(i); double dist = p->distanceToSqr(x, y, z); // Allow specifying shorter distances in the vertical @@ -4123,14 +4123,14 @@ shared_ptr Level::getNearestPlayer(double x, double y, double z, double return result; } -shared_ptr Level::getNearestPlayer(double x, double z, double maxDist) +std::shared_ptr Level::getNearestPlayer(double x, double z, double maxDist) { double best = -1; - shared_ptr result = nullptr; + std::shared_ptr result = nullptr; AUTO_VAR(itEnd, players.end()); for (AUTO_VAR(it, players.begin()); it != itEnd; it++) { - shared_ptr p = *it; + std::shared_ptr p = *it; double dist = p->distanceToSqr(x, p->y, z); if ((maxDist < 0 || dist < maxDist * maxDist) && (best == -1 || dist < best)) { @@ -4141,20 +4141,20 @@ shared_ptr Level::getNearestPlayer(double x, double z, double maxDist) return result; } -shared_ptr Level::getNearestAttackablePlayer(shared_ptr source, double maxDist) +std::shared_ptr Level::getNearestAttackablePlayer(std::shared_ptr source, double maxDist) { return getNearestAttackablePlayer(source->x, source->y, source->z, maxDist); } -shared_ptr Level::getNearestAttackablePlayer(double x, double y, double z, double maxDist) +std::shared_ptr Level::getNearestAttackablePlayer(double x, double y, double z, double maxDist) { double best = -1; - shared_ptr result = nullptr; + std::shared_ptr result = nullptr; AUTO_VAR(itEnd, players.end()); for (AUTO_VAR(it, players.begin()); it != itEnd; it++) { - shared_ptr p = *it; + std::shared_ptr p = *it; if (p->abilities.invulnerable) { @@ -4190,7 +4190,7 @@ shared_ptr Level::getNearestAttackablePlayer(double x, double y, double return result; } -shared_ptr Level::getPlayerByName(const wstring& name) +std::shared_ptr Level::getPlayerByName(const wstring& name) { AUTO_VAR(itEnd, players.end()); for (AUTO_VAR(it, players.begin()); it != itEnd; it++) @@ -4200,10 +4200,10 @@ shared_ptr Level::getPlayerByName(const wstring& name) return *it; //players.at(i); } } - return shared_ptr(); + return std::shared_ptr(); } -shared_ptr Level::getPlayerByUUID(const wstring& name) +std::shared_ptr Level::getPlayerByUUID(const wstring& name) { AUTO_VAR(itEnd, players.end()); for (AUTO_VAR(it, players.begin()); it != itEnd; it++) @@ -4213,7 +4213,7 @@ shared_ptr Level::getPlayerByUUID(const wstring& name) return *it; //players.at(i); } } - return shared_ptr(); + return std::shared_ptr(); } // 4J Stu - Removed in 1.2.3 ? @@ -4353,7 +4353,7 @@ void Level::setTime(__int64 time) if ( timeDiff > 0 && levelData->getTime() != -1 ) { AUTO_VAR(itEnd, players.end()); - for (vector >::iterator it = players.begin(); it != itEnd; it++) + for (vector >::iterator it = players.begin(); it != itEnd; it++) { (*it)->awardStat( GenericStats::timePlayed(), GenericStats::param_time(timeDiff) ); } @@ -4396,7 +4396,7 @@ void Level::setSpawnPos(Pos *spawnPos) } -void Level::ensureAdded(shared_ptr entity) +void Level::ensureAdded(std::shared_ptr entity) { int xc = Mth::floor(entity->x / 16); int zc = Mth::floor(entity->z / 16); @@ -4419,13 +4419,13 @@ void Level::ensureAdded(shared_ptr entity) } -bool Level::mayInteract(shared_ptr player, int xt, int yt, int zt, int content) +bool Level::mayInteract(std::shared_ptr player, int xt, int yt, int zt, int content) { return true; } -void Level::broadcastEntityEvent(shared_ptr e, uint8_t event) +void Level::broadcastEntityEvent(std::shared_ptr e, uint8_t event) { } @@ -4506,13 +4506,13 @@ bool Level::isHumidAt(int x, int y, int z) } -void Level::setSavedData(const wstring& id, shared_ptr data) +void Level::setSavedData(const wstring& id, std::shared_ptr data) { savedDataStorage->set(id, data); } -shared_ptr Level::getSavedData(const type_info& clazz, const wstring& id) +std::shared_ptr Level::getSavedData(const type_info& clazz, const wstring& id) { return savedDataStorage->get(clazz, id); } @@ -4544,7 +4544,7 @@ void Level::levelEvent(int type, int x, int y, int z, int data) } -void Level::levelEvent(shared_ptr source, int type, int x, int y, int z, int data) +void Level::levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data) { AUTO_VAR(itEnd, listeners.end()); for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) diff --git a/Minecraft.World/Level/Level.h b/Minecraft.World/Level/Level.h index 05bea294a..47a974770 100644 --- a/Minecraft.World/Level/Level.h +++ b/Minecraft.World/Level/Level.h @@ -92,22 +92,22 @@ public: public: CRITICAL_SECTION m_entitiesCS; // 4J added - vector > entities; + vector > entities; protected: - vector > entitiesToRemove; + vector > entitiesToRemove; public: bool hasEntitiesToRemove(); // 4J added bool m_bDisableAddNewTileEntities; // 4J Added CRITICAL_SECTION m_tileEntityListCS; // 4J added - vector > tileEntityList; + vector > tileEntityList; private: - vector > pendingTileEntities; - vector > tileEntitiesToUnload; + vector > pendingTileEntities; + vector > tileEntitiesToUnload; bool updatingTileEntities; public: - vector > players; - vector > globalEntities; + vector > players; + vector > globalEntities; private: int cloudColor; @@ -140,16 +140,16 @@ protected: public: ChunkSource *chunkSource; // 4J - changed to public protected: - // This is the only shared_ptr ref to levelStorage - we need to keep this as long as at least one Level references it, + // This is the only std::shared_ptr ref to levelStorage - we need to keep this as long as at least one Level references it, // to be able to cope with moving from dimension to dimension where the Level(Level *level, Dimension *dimension) ctor is used - shared_ptr levelStorage; + std::shared_ptr levelStorage; LevelData *levelData; public: bool isFindingSpawn; SavedDataStorage *savedDataStorage; - shared_ptr villages; + std::shared_ptr villages; VillageSiege *villageSiege; public: @@ -160,13 +160,13 @@ private: // 4J Stu - Added these ctors to handle init of member variables void _init(); - void _init(shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource = true); + void _init(std::shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource = true); public: - Level(shared_ptrlevelStorage, const wstring& name, Dimension *dimension, LevelSettings *levelSettings, bool doCreateChunkSource = true); + Level(std::shared_ptrlevelStorage, const wstring& name, Dimension *dimension, LevelSettings *levelSettings, bool doCreateChunkSource = true); Level(Level *level, Dimension *dimension); - Level(shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings); - Level(shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource = true); + Level(std::shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings); + Level(std::shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource = true); virtual ~Level(); @@ -278,7 +278,7 @@ public: HitResult *clip(Vec3 *a, Vec3 *b, bool liquid); HitResult *clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly); - virtual void playSound(shared_ptr entity, int iSound, float volume, float pitch); + virtual void playSound(std::shared_ptr entity, int iSound, float volume, float pitch); virtual void playSound(double x, double y, double z, int iSound, float volume, float pitch, float fClipSoundDist=16.0f); virtual void playLocalSound(double x, double y, double z, int iSound, float volume, float pitch, float fClipSoundDist=16.0f); @@ -287,17 +287,17 @@ public: void playMusic(double x, double y, double z, const wstring& string, float volume); // 4J removed - void addParticle(const wstring& id, double x, double y, double z, double xd, double yd, double zd); void addParticle(ePARTICLE_TYPE id, double x, double y, double z, double xd, double yd, double zd); // 4J added - virtual bool addGlobalEntity(shared_ptr e); - virtual bool addEntity(shared_ptr e); + virtual bool addGlobalEntity(std::shared_ptr e); + virtual bool addEntity(std::shared_ptr e); protected: - virtual void entityAdded(shared_ptr e); - virtual void entityRemoved(shared_ptr e); - virtual void playerRemoved(shared_ptr e); // 4J added + virtual void entityAdded(std::shared_ptr e); + virtual void entityRemoved(std::shared_ptr e); + virtual void playerRemoved(std::shared_ptr e); // 4J added public: - virtual void removeEntity(shared_ptr e); - void removeEntityImmediately(shared_ptr e); + virtual void removeEntity(std::shared_ptr e); + void removeEntityImmediately(std::shared_ptr e); void addListener(LevelListener *listener); void removeListener(LevelListener *listener); @@ -305,11 +305,11 @@ private: AABBList boxes; public: - AABBList *getCubes(shared_ptr source, AABB *box, bool noEntities=false, bool blockAtEdge=false); // 4J - added noEntities & blockAtEdge parameters + AABBList *getCubes(std::shared_ptr source, AABB *box, bool noEntities=false, bool blockAtEdge=false); // 4J - added noEntities & blockAtEdge parameters AABBList *getTileCubes(AABB *box, bool blockAtEdge); // 4J Stu - Brought forward from 12w36 to fix #46282 - TU5: Gameplay: Exiting the minecart in a tight corridor damages the player int getOldSkyDarken(float a); // 4J - change brought forward from 1.8.2 float getSkyDarken(float a); // 4J - change brought forward from 1.8.2 - Vec3 *getSkyColor(shared_ptr source, float a); + Vec3 *getSkyColor(std::shared_ptr source, float a); float getTimeOfDay(float a); int getMoonPhase(float a); float getSunAngle(float a); @@ -324,29 +324,29 @@ public: virtual void addToTickNextTick(int x, int y, int z, int tileId, int tickDelay); virtual void forceAddTileTick(int x, int y, int z, int tileId, int tickDelay); virtual void tickEntities(); - void addAllPendingTileEntities(vector< shared_ptr >& entities); - void tick(shared_ptr e); - virtual void tick(shared_ptr e, bool actual); + void addAllPendingTileEntities(vector< std::shared_ptr >& entities); + void tick(std::shared_ptr e); + virtual void tick(std::shared_ptr e, bool actual); bool isUnobstructed(AABB *aabb); - bool isUnobstructed(AABB *aabb, shared_ptr ignore); + bool isUnobstructed(AABB *aabb, std::shared_ptr ignore); bool containsAnyBlocks(AABB *box); bool containsAnyLiquid(AABB *box); bool containsAnyLiquid_NoLoad(AABB *box); // 4J added bool containsFireTile(AABB *box); - bool checkAndHandleWater(AABB *box, Material *material, shared_ptr e); + bool checkAndHandleWater(AABB *box, Material *material, std::shared_ptr e); bool containsMaterial(AABB *box, Material *material); bool containsLiquid(AABB *box, Material *material); // 4J Stu - destroyBlocks param brought forward as part of fix for tnt cannons - shared_ptr explode(shared_ptr source, double x, double y, double z, float r, bool destroyBlocks); - virtual shared_ptr explode(shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks); + std::shared_ptr explode(std::shared_ptr source, double x, double y, double z, float r, bool destroyBlocks); + virtual std::shared_ptr explode(std::shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks); float getSeenPercent(Vec3 *center, AABB *bb); - bool extinguishFire(shared_ptr player, int x, int y, int z, int face); + bool extinguishFire(std::shared_ptr player, int x, int y, int z, int face); wstring gatherStats(); wstring gatherChunkSourceStats(); - virtual shared_ptr getTileEntity(int x, int y, int z); - void setTileEntity(int x, int y, int z, shared_ptr tileEntity); + virtual std::shared_ptr getTileEntity(int x, int y, int z); + void setTileEntity(int x, int y, int z, std::shared_ptr tileEntity); void removeTileEntity(int x, int y, int z); - void markForRemoval(shared_ptr entity); + void markForRemoval(std::shared_ptr entity); virtual bool isSolidRenderTile(int x, int y, int z); virtual bool isSolidBlockingTile(int x, int y, int z); bool isSolidBlockingTileInLoadedChunk(int x, int y, int z, bool valueIfNotLoaded); @@ -413,38 +413,38 @@ public: virtual vector *fetchTicksInChunk(LevelChunk *chunk, bool remove); private: - vector > es; + vector > es; public: bool isClientSide; - vector > *getEntities(shared_ptr except, AABB *bb); - vector > *getEntitiesOfClass(const type_info& baseClass, AABB *bb); - shared_ptr getClosestEntityOfClass(const type_info& baseClass, AABB *bb, shared_ptr source); - vector > getAllEntities(); - void tileEntityChanged(int x, int y, int z, shared_ptr te); + vector > *getEntities(std::shared_ptr except, AABB *bb); + vector > *getEntitiesOfClass(const type_info& baseClass, AABB *bb); + std::shared_ptr getClosestEntityOfClass(const type_info& baseClass, AABB *bb, std::shared_ptr source); + vector > getAllEntities(); + void tileEntityChanged(int x, int y, int z, std::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 countInstanceOfInRange(eINSTANCEOF clas, bool singleType, int range, int x, int y, int z); // 4J Added - void addEntities(vector > *list); - virtual void removeEntities(vector > *list); - bool mayPlace(int tileId, int x, int y, int z, bool ignoreEntities, int face, shared_ptr ignoreEntity); + void addEntities(vector > *list); + virtual void removeEntities(vector > *list); + bool mayPlace(int tileId, int x, int y, int z, bool ignoreEntities, int face, std::shared_ptr ignoreEntity); int getSeaLevel(); - Path *findPath(shared_ptr from, shared_ptr to, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat); - Path *findPath(shared_ptr from, int xBest, int yBest, int zBest, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat); + Path *findPath(std::shared_ptr from, std::shared_ptr to, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat); + Path *findPath(std::shared_ptr from, int xBest, int yBest, int zBest, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat); bool getDirectSignal(int x, int y, int z, int dir); bool hasDirectSignal(int x, int y, int z); bool getSignal(int x, int y, int z, int dir); bool hasNeighborSignal(int x, int y, int z); // 4J Added maxYDist param - shared_ptr getNearestPlayer(shared_ptr source, double maxDist, double maxYDist = -1); - shared_ptr getNearestPlayer(double x, double y, double z, double maxDist, double maxYDist = -1); - shared_ptr getNearestPlayer(double x, double z, double maxDist); - shared_ptr getNearestAttackablePlayer(shared_ptr source, double maxDist); - shared_ptr getNearestAttackablePlayer(double x, double y, double z, double maxDist); + std::shared_ptr getNearestPlayer(std::shared_ptr source, double maxDist, double maxYDist = -1); + std::shared_ptr getNearestPlayer(double x, double y, double z, double maxDist, double maxYDist = -1); + std::shared_ptr getNearestPlayer(double x, double z, double maxDist); + std::shared_ptr getNearestAttackablePlayer(std::shared_ptr source, double maxDist); + std::shared_ptr getNearestAttackablePlayer(double x, double y, double z, double maxDist); - shared_ptr getPlayerByName(const wstring& name); - shared_ptr getPlayerByUUID(const wstring& name); // 4J Added + std::shared_ptr getPlayerByName(const wstring& name); + std::shared_ptr getPlayerByUUID(const wstring& name); // 4J Added byteArray getBlocksAndData(int x, int y, int z, int xs, int ys, int zs, bool includeLighting = true); void setBlocksAndData(int x, int y, int z, int xs, int ys, int zs, byteArray data, bool includeLighting = true); virtual void disconnect(bool sendDisconnect = true); @@ -456,9 +456,9 @@ public: Pos *getSharedSpawnPos(); void setSpawnPos(int x, int y, int z); void setSpawnPos(Pos *spawnPos); - void ensureAdded(shared_ptr entity); - virtual bool mayInteract(shared_ptr player, int xt, int yt, int zt, int content); - virtual void broadcastEntityEvent(shared_ptr e, uint8_t event); + void ensureAdded(std::shared_ptr entity); + virtual bool mayInteract(std::shared_ptr player, int xt, int yt, int zt, int content); + virtual void broadcastEntityEvent(std::shared_ptr e, uint8_t event); ChunkSource *getChunkSource(); virtual void tileEvent(int x, int y, int z, int tile, int b0, int b1); LevelStorage *getLevelStorage(); @@ -476,11 +476,11 @@ public: bool isRaining(); bool isRainingAt(int x, int y, int z); bool isHumidAt(int x, int y, int z); - void setSavedData(const wstring& id, shared_ptr data); - shared_ptr getSavedData(const type_info& clazz, const wstring& id); + void setSavedData(const wstring& id, std::shared_ptr data); + std::shared_ptr getSavedData(const type_info& clazz, const wstring& id); int getFreeAuxValueFor(const wstring& id); void levelEvent(int type, int x, int y, int z, int data); - void levelEvent(shared_ptr source, int type, int x, int y, int z, int data); + void levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data); int getMaxBuildHeight(); int getHeight(); Random *getRandomFor(int x, int z, int blend); diff --git a/Minecraft.World/Level/LevelChunk.cpp b/Minecraft.World/Level/LevelChunk.cpp index 2edd40883..8497ef6f9 100644 --- a/Minecraft.World/Level/LevelChunk.cpp +++ b/Minecraft.World/Level/LevelChunk.cpp @@ -58,7 +58,7 @@ void LevelChunk::init(Level *level, int x, int z) #else EnterCriticalSection(&m_csEntities); #endif - entityBlocks = new vector > *[ENTITY_BLOCKS_LENGTH]; + entityBlocks = new vector > *[ENTITY_BLOCKS_LENGTH]; #ifdef _ENTITIES_RW_SECTION LeaveCriticalRWSection(&m_csEntities, true); #else @@ -90,7 +90,7 @@ void LevelChunk::init(Level *level, int x, int z) #endif for (int i = 0; i < ENTITY_BLOCKS_LENGTH; i++) { - entityBlocks[i] = new vector >(); + entityBlocks[i] = new vector >(); } #ifdef _ENTITIES_RW_SECTION LeaveCriticalRWSection(&m_csEntities, true); @@ -1016,7 +1016,7 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) // if (_tile > 0 && dynamic_cast(Tile::tiles[_tile]) != NULL) if (_tile > 0 && Tile::tiles[_tile] != NULL && Tile::tiles[_tile]->isEntityTile()) { - shared_ptr te = getTileEntity(x, y, z); + std::shared_ptr te = getTileEntity(x, y, z); if (te == NULL) { te = ((EntityTile *) Tile::tiles[_tile])->newTileEntity(level); @@ -1034,7 +1034,7 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) // else if (old > 0 && dynamic_cast(Tile::tiles[old]) != NULL) else if (old > 0 && Tile::tiles[_tile] != NULL && Tile::tiles[_tile]->isEntityTile()) { - shared_ptr te = getTileEntity(x, y, z); + std::shared_ptr te = getTileEntity(x, y, z); if (te != NULL) { te->clearCache(); @@ -1074,7 +1074,7 @@ bool LevelChunk::setData(int x, int y, int z, int val, int mask, bool *maskedBit int _tile = getTile(x, y, z); if (_tile > 0 && dynamic_cast( Tile::tiles[_tile] ) != NULL) { - shared_ptr te = getTileEntity(x, y, z); + std::shared_ptr te = getTileEntity(x, y, z); if (te != NULL) { te->clearCache(); @@ -1166,7 +1166,7 @@ int LevelChunk::getRawBrightness(int x, int y, int z, int skyDampen) return light; } -void LevelChunk::addEntity(shared_ptr e) +void LevelChunk::addEntity(std::shared_ptr e) { lastSaveHadEntities = true; @@ -1200,12 +1200,12 @@ void LevelChunk::addEntity(shared_ptr e) } -void LevelChunk::removeEntity(shared_ptr e) +void LevelChunk::removeEntity(std::shared_ptr e) { removeEntity(e, e->yChunk); } -void LevelChunk::removeEntity(shared_ptr e, int yc) +void LevelChunk::removeEntity(std::shared_ptr e, int yc) { if (yc < 0) yc = 0; if (yc >= ENTITY_BLOCKS_LENGTH) yc = ENTITY_BLOCKS_LENGTH - 1; @@ -1261,14 +1261,14 @@ void LevelChunk::skyBrightnessChanged() level->setTilesDirty(x0, y0, z0, x1, y1, z1); } -shared_ptr LevelChunk::getTileEntity(int x, int y, int z) +std::shared_ptr LevelChunk::getTileEntity(int x, int y, int z) { TilePos pos(x, y, z); // 4J Stu - Changed as we should not be using the [] accessor (causes an insert when we don't want one) - //shared_ptr tileEntity = tileEntities[pos]; + //std::shared_ptr tileEntity = tileEntities[pos]; EnterCriticalSection(&m_csTileEntities); - shared_ptr tileEntity = nullptr; + std::shared_ptr tileEntity = nullptr; AUTO_VAR(it, tileEntities.find(pos)); if (it == tileEntities.end()) @@ -1320,7 +1320,7 @@ shared_ptr LevelChunk::getTileEntity(int x, int y, int z) return tileEntity; } -void LevelChunk::addTileEntity(shared_ptr te) +void LevelChunk::addTileEntity(std::shared_ptr te) { int xx = (int)(te->x - this->x * 16); int yy = (int)te->y; @@ -1334,7 +1334,7 @@ void LevelChunk::addTileEntity(shared_ptr te) } } -void LevelChunk::setTileEntity(int x, int y, int z, shared_ptr tileEntity) +void LevelChunk::setTileEntity(int x, int y, int z, std::shared_ptr tileEntity) { TilePos pos(x, y, z); @@ -1371,7 +1371,7 @@ void LevelChunk::removeTileEntity(int x, int y, int z) AUTO_VAR(it, tileEntities.find(pos)); if( it != tileEntities.end() ) { - shared_ptr te = tileEntities[pos]; + std::shared_ptr te = tileEntities[pos]; tileEntities.erase(pos); if( te != NULL ) { @@ -1401,7 +1401,7 @@ void LevelChunk::load() for (int i = 0; i < entityTags->size(); i++) { CompoundTag *teTag = entityTags->get(i); - shared_ptr te = EntityIO::loadStatic(teTag, level); + std::shared_ptr te = EntityIO::loadStatic(teTag, level); if (te != NULL) { addEntity(te); @@ -1415,7 +1415,7 @@ void LevelChunk::load() for (int i = 0; i < tileEntityTags->size(); i++) { CompoundTag *teTag = tileEntityTags->get(i); - shared_ptr te = TileEntity::loadStatic(teTag); + std::shared_ptr te = TileEntity::loadStatic(teTag); if (te != NULL) { addTileEntity(te); @@ -1428,7 +1428,7 @@ void LevelChunk::load() } #endif - vector< shared_ptr > values; + vector< std::shared_ptr > values; EnterCriticalSection(&m_csTileEntities); for( AUTO_VAR(it, tileEntities.begin()); it != tileEntities.end(); it++ ) { @@ -1506,9 +1506,9 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter for (int i = 0; i < ENTITY_BLOCKS_LENGTH; i++) { AUTO_VAR(itEnd, entityBlocks[i]->end()); - for( vector >::iterator it = entityBlocks[i]->begin(); it != itEnd; it++ ) + for( vector >::iterator it = entityBlocks[i]->begin(); it != itEnd; it++ ) { - shared_ptr e = *it; + std::shared_ptr e = *it; CompoundTag *teTag = new CompoundTag(); if (e->save(teTag)) { @@ -1529,10 +1529,10 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter ListTag *tileEntityTags = new ListTag(); AUTO_VAR(itEnd,tileEntities.end()); - for( unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = tileEntities.begin(); + for( unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = tileEntities.begin(); it != itEnd; it++) { - shared_ptr te = it->second; + std::shared_ptr te = it->second; CompoundTag *teTag = new CompoundTag(); te->save(teTag); tileEntityTags->add(teTag); @@ -1560,7 +1560,7 @@ void LevelChunk::markUnsaved() } -void LevelChunk::getEntities(shared_ptr except, AABB *bb, vector > &es) +void LevelChunk::getEntities(std::shared_ptr except, AABB *bb, vector > &es) { int yc0 = Mth::floor((bb->y0 - 2) / 16); int yc1 = Mth::floor((bb->y1 + 2) / 16); @@ -1573,16 +1573,16 @@ void LevelChunk::getEntities(shared_ptr except, AABB *bb, vector > *entities = entityBlocks[yc]; + vector > *entities = entityBlocks[yc]; AUTO_VAR(itEnd, entities->end()); for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { - shared_ptr e = *it; //entities->at(i); + std::shared_ptr e = *it; //entities->at(i); if (e != except && e->bb->intersects(bb)) { es.push_back(e); - vector > *subs = e->getSubEntities(); + vector > *subs = e->getSubEntities(); if (subs != NULL) { for (int j = 0; j < subs->size(); j++) @@ -1602,7 +1602,7 @@ void LevelChunk::getEntities(shared_ptr except, AABB *bb, vector > &es) +void LevelChunk::getEntitiesOfClass(const type_info& ec, AABB *bb, vector > &es) { int yc0 = Mth::floor((bb->y0 - 2) / 16); int yc1 = Mth::floor((bb->y1 + 2) / 16); @@ -1630,12 +1630,12 @@ void LevelChunk::getEntitiesOfClass(const type_info& ec, AABB *bb, vector > *entities = entityBlocks[yc]; + vector > *entities = entityBlocks[yc]; AUTO_VAR(itEnd, entities->end()); for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { - shared_ptr e = *it; //entities->at(i); + std::shared_ptr e = *it; //entities->at(i); bool isAssignableFrom = false; // Some special cases where the base class is a general type that our class may be derived from, otherwise do a direct comparison of type_info diff --git a/Minecraft.World/Level/LevelChunk.h b/Minecraft.World/Level/LevelChunk.h index 201d9750a..9ac4f25ed 100644 --- a/Minecraft.World/Level/LevelChunk.h +++ b/Minecraft.World/Level/LevelChunk.h @@ -100,8 +100,8 @@ private: bool hasGapsToCheck; public: - unordered_map, TilePosKeyHash, TilePosKeyEq> tileEntities; - vector > **entityBlocks; + unordered_map, TilePosKeyHash, TilePosKeyEq> tileEntities; + vector > **entityBlocks; static const int sTerrainPopulatedFromHere = 2; static const int sTerrainPopulatedFromW = 4; @@ -188,14 +188,14 @@ public: virtual void getNeighbourBrightnesses(int *brightnesses, LightLayer::variety layer, int x, int y, int z); // 4J added virtual void setBrightness(LightLayer::variety layer, int x, int y, int z, int brightness); virtual int getRawBrightness(int x, int y, int z, int skyDampen); - virtual void addEntity(shared_ptr e); - virtual void removeEntity(shared_ptr e); - virtual void removeEntity(shared_ptr e, int yc); + virtual void addEntity(std::shared_ptr e); + virtual void removeEntity(std::shared_ptr e); + virtual void removeEntity(std::shared_ptr e, int yc); virtual bool isSkyLit(int x, int y, int z); virtual void skyBrightnessChanged(); - virtual shared_ptr getTileEntity(int x, int y, int z); - virtual void addTileEntity(shared_ptr te); - virtual void setTileEntity(int x, int y, int z, shared_ptr tileEntity); + virtual std::shared_ptr getTileEntity(int x, int y, int z); + virtual void addTileEntity(std::shared_ptr te); + virtual void setTileEntity(int x, int y, int z, std::shared_ptr tileEntity); virtual void removeTileEntity(int x, int y, int z); virtual void load(); virtual void unload(bool unloadTileEntities) ; // 4J - added parameter @@ -203,8 +203,8 @@ public: virtual bool isUnloaded(); #endif virtual void markUnsaved(); - virtual void getEntities(shared_ptr except, AABB *bb, vector > &es); - virtual void getEntitiesOfClass(const type_info& ec, AABB *bb, vector > &es); + virtual void getEntities(std::shared_ptr except, AABB *bb, vector > &es); + virtual void getEntitiesOfClass(const type_info& ec, AABB *bb, vector > &es); virtual int countEntities(); virtual bool shouldSave(bool force); virtual int getBlocksAndData(byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int p, bool includeLighting = true); // 4J - added includeLighting parameter diff --git a/Minecraft.World/Level/LevelData.cpp b/Minecraft.World/Level/LevelData.cpp index d24350dc5..c4a435a62 100644 --- a/Minecraft.World/Level/LevelData.cpp +++ b/Minecraft.World/Level/LevelData.cpp @@ -243,7 +243,7 @@ CompoundTag *LevelData::createTag() return tag; } -CompoundTag *LevelData::createTag(vector > *players) +CompoundTag *LevelData::createTag(vector > *players) { // 4J - removed all code for storing tags for players return createTag(); diff --git a/Minecraft.World/Level/LevelData.h b/Minecraft.World/Level/LevelData.h index 0afe9be24..9b837f074 100644 --- a/Minecraft.World/Level/LevelData.h +++ b/Minecraft.World/Level/LevelData.h @@ -58,7 +58,7 @@ public: LevelData(LevelSettings *levelSettings, const wstring& levelName); LevelData(LevelData *copy); CompoundTag *createTag(); - CompoundTag *createTag(vector > *players); + CompoundTag *createTag(vector > *players); enum { diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp index e617c5b7e..e08d675c0 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp @@ -351,7 +351,7 @@ LevelData *DirectoryLevelStorage::prepareLevel() return NULL; } -void DirectoryLevelStorage::saveLevelData(LevelData *levelData, vector > *players) +void DirectoryLevelStorage::saveLevelData(LevelData *levelData, vector > *players) { // 4J Jev, removed try/catch @@ -385,7 +385,7 @@ void DirectoryLevelStorage::saveLevelData(LevelData *levelData) delete root; } -void DirectoryLevelStorage::save(shared_ptr player) +void DirectoryLevelStorage::save(std::shared_ptr player) { // 4J Jev, removed try/catch. PlayerUID playerXuid = player->getXuid(); @@ -433,7 +433,7 @@ void DirectoryLevelStorage::save(shared_ptr player) } // 4J Changed return val to bool to check if new player or loaded player -bool DirectoryLevelStorage::load(shared_ptr player) +bool DirectoryLevelStorage::load(std::shared_ptr player) { bool newPlayer = true; CompoundTag *tag = loadPlayerDataTag( player->getXuid() ); @@ -746,7 +746,7 @@ void DirectoryLevelStorage::dontSaveMapMappingForPlayer(PlayerUID xuid) #endif } -void DirectoryLevelStorage::deleteMapFilesForPlayer(shared_ptr player) +void DirectoryLevelStorage::deleteMapFilesForPlayer(std::shared_ptr player) { PlayerUID playerXuid = player->getXuid(); if(playerXuid != INVALID_XUID) deleteMapFilesForPlayer(playerXuid); diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorage.h b/Minecraft.World/Level/Storage/DirectoryLevelStorage.h index d59c28f27..01d95d9ad 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorage.h +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorage.h @@ -119,10 +119,10 @@ public: void checkSession(); virtual ChunkStorage *createChunkStorage(Dimension *dimension); LevelData *prepareLevel(); - virtual void saveLevelData(LevelData *levelData, vector > *players); + virtual void saveLevelData(LevelData *levelData, vector > *players); virtual void saveLevelData(LevelData *levelData); - virtual void save(shared_ptr player); - virtual bool load(shared_ptr player); // 4J Changed return val to bool to check if new player or loaded player + virtual void save(std::shared_ptr player); + virtual bool load(std::shared_ptr player); // 4J Changed return val to bool to check if new player or loaded player virtual CompoundTag *loadPlayerDataTag(PlayerUID xuid); virtual void clearOldPlayerFiles(); // 4J Added PlayerIO *getPlayerIO(); @@ -133,7 +133,7 @@ public: // 4J Added virtual int getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, int centreZC, int scale); virtual void saveMapIdLookup(); - virtual void deleteMapFilesForPlayer(shared_ptr player); + virtual void deleteMapFilesForPlayer(std::shared_ptr player); virtual void saveAllCachedData(); void resetNetherPlayerPositions(); // 4J Added static wstring getPlayerDir() { return sc_szPlayerDir; } diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.cpp b/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.cpp index 6960572c1..6a1c31a37 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.cpp +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.cpp @@ -118,9 +118,9 @@ void DirectoryLevelStorageSource::deleteRecursive(vector *files) } } -shared_ptr DirectoryLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) +std::shared_ptr DirectoryLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) { - return shared_ptr (new DirectoryLevelStorage(saveFile, baseDir, levelId, createPlayerDir)); + return std::shared_ptr (new DirectoryLevelStorage(saveFile, baseDir, levelId, createPlayerDir)); } bool DirectoryLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId) diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.h b/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.h index 52f025ea6..929982fa6 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.h +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.h @@ -27,7 +27,7 @@ protected: static void deleteRecursive(vector *files); public: - virtual shared_ptr selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir); + virtual std::shared_ptr selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir); virtual bool isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId); virtual bool requiresConversion(ConsoleSaveFile *saveFile, const wstring& levelId); virtual bool convertLevel(ConsoleSaveFile *saveFile, const wstring& levelId, ProgressListener *progress); diff --git a/Minecraft.World/Level/Storage/EntityIO.cpp b/Minecraft.World/Level/Storage/EntityIO.cpp index 61da499c2..2d3f054db 100644 --- a/Minecraft.World/Level/Storage/EntityIO.cpp +++ b/Minecraft.World/Level/Storage/EntityIO.cpp @@ -98,29 +98,29 @@ void EntityIO::staticCtor() setId(DragonFireball::create, eTYPE_DRAGON_FIREBALL, L"DragonFireball", 1000); } -shared_ptr EntityIO::newEntity(const wstring& id, Level *level) +std::shared_ptr EntityIO::newEntity(const wstring& id, Level *level) { - shared_ptr entity; + std::shared_ptr entity; AUTO_VAR(it, idCreateMap->find(id)); if(it != idCreateMap->end() ) { entityCreateFn create = it->second; - if (create != NULL) entity = shared_ptr(create(level)); + if (create != NULL) entity = std::shared_ptr(create(level)); } return entity; } -shared_ptr EntityIO::loadStatic(CompoundTag *tag, Level *level) +std::shared_ptr EntityIO::loadStatic(CompoundTag *tag, Level *level) { - shared_ptr entity; + std::shared_ptr entity; AUTO_VAR(it, idCreateMap->find(tag->getString(L"id"))); if(it != idCreateMap->end() ) { entityCreateFn create = it->second; - if (create != NULL) entity = shared_ptr(create(level)); + if (create != NULL) entity = std::shared_ptr(create(level)); } if (entity != NULL) @@ -136,15 +136,15 @@ shared_ptr EntityIO::loadStatic(CompoundTag *tag, Level *level) return entity; } -shared_ptr EntityIO::newById(int id, Level *level) +std::shared_ptr EntityIO::newById(int id, Level *level) { - shared_ptr entity; + std::shared_ptr entity; AUTO_VAR(it, numCreateMap->find(id)); if(it != numCreateMap->end() ) { entityCreateFn create = it->second; - if (create != NULL) entity = shared_ptr(create(level)); + if (create != NULL) entity = std::shared_ptr(create(level)); } if (entity != NULL) @@ -157,9 +157,9 @@ shared_ptr EntityIO::newById(int id, Level *level) return entity; } -shared_ptr EntityIO::newByEnumType(eINSTANCEOF eType, Level *level) +std::shared_ptr EntityIO::newByEnumType(eINSTANCEOF eType, Level *level) { - shared_ptr entity; + std::shared_ptr entity; unordered_map::iterator it = classNumMap->find( eType ); if( it != classNumMap->end() ) @@ -168,20 +168,20 @@ 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 (create != NULL) entity = std::shared_ptr(create(level)); } } return entity; } -int EntityIO::getId(shared_ptr entity) +int EntityIO::getId(std::shared_ptr entity) { unordered_map::iterator it = classNumMap->find( entity->GetType() ); return (*it).second; } -wstring EntityIO::getEncodeId(shared_ptr entity) +wstring EntityIO::getEncodeId(std::shared_ptr entity) { unordered_map::iterator it = classIdMap->find( entity->GetType() ); if( it != classIdMap->end() ) diff --git a/Minecraft.World/Level/Storage/EntityIO.h b/Minecraft.World/Level/Storage/EntityIO.h index 19e1e0535..644a90191 100644 --- a/Minecraft.World/Level/Storage/EntityIO.h +++ b/Minecraft.World/Level/Storage/EntityIO.h @@ -44,12 +44,12 @@ private: public: static void staticCtor(); - static shared_ptr newEntity(const wstring& id, Level *level); - static shared_ptr loadStatic(CompoundTag *tag, Level *level); - static shared_ptr newById(int id, Level *level); - static shared_ptr newByEnumType(eINSTANCEOF eType, Level *level); - static int getId(shared_ptr entity); - static wstring getEncodeId(shared_ptr entity); + static std::shared_ptr newEntity(const wstring& id, Level *level); + static std::shared_ptr loadStatic(CompoundTag *tag, Level *level); + static std::shared_ptr newById(int id, Level *level); + static std::shared_ptr newByEnumType(eINSTANCEOF eType, Level *level); + static int getId(std::shared_ptr entity); + static wstring getEncodeId(std::shared_ptr entity); static int getId(const wstring &encodeId); static wstring getEncodeId(int entityIoValue); static int getNameId(int entityIoValue); diff --git a/Minecraft.World/Level/Storage/LevelSource.h b/Minecraft.World/Level/Storage/LevelSource.h index 4b050f08c..b3071783e 100644 --- a/Minecraft.World/Level/Storage/LevelSource.h +++ b/Minecraft.World/Level/Storage/LevelSource.h @@ -10,7 +10,7 @@ class LevelSource { public: virtual int getTile(int x, int y, int z) = 0; - virtual shared_ptr getTileEntity(int x, int y, int z) = 0; + virtual std::shared_ptr getTileEntity(int x, int y, int z) = 0; virtual int getLightColor(int x, int y, int z, int emitt, int tileId = -1) = 0; // 4J - brought forward from 1.8.2, added tileId virtual float getBrightness(int x, int y, int z, int emitt) = 0; virtual float getBrightness(int x, int y, int z) = 0; diff --git a/Minecraft.World/Level/Storage/LevelStorage.h b/Minecraft.World/Level/Storage/LevelStorage.h index 8c9e0fb91..487be5662 100644 --- a/Minecraft.World/Level/Storage/LevelStorage.h +++ b/Minecraft.World/Level/Storage/LevelStorage.h @@ -21,7 +21,7 @@ public: virtual LevelData *prepareLevel() = 0; virtual void checkSession() = 0; virtual ChunkStorage *createChunkStorage(Dimension *dimension) = 0; - virtual void saveLevelData(LevelData *levelData, vector > *players) = 0; + virtual void saveLevelData(LevelData *levelData, vector > *players) = 0; virtual void saveLevelData(LevelData *levelData) = 0; virtual PlayerIO *getPlayerIO() = 0; virtual void closeAll() = 0; diff --git a/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.cpp b/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.cpp index c3d18c4cd..a2d9cca5c 100644 --- a/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.cpp +++ b/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.cpp @@ -26,7 +26,7 @@ ChunkStorage *LevelStorageProfilerDecorator::createChunkStorage(Dimension *dimen return new ChunkStorageProfilerDecorator(capsulated->createChunkStorage(dimension)); } -void LevelStorageProfilerDecorator::saveLevelData(LevelData *levelData, vector > *players) +void LevelStorageProfilerDecorator::saveLevelData(LevelData *levelData, vector > *players) { capsulated->saveLevelData(levelData, players); } diff --git a/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.h b/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.h index 98ed76208..bd1751cca 100644 --- a/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.h +++ b/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.h @@ -18,7 +18,7 @@ public: LevelData *prepareLevel(); void checkSession(); ChunkStorage *createChunkStorage(Dimension *dimension); - void saveLevelData(LevelData *levelData, vector > *players); + void saveLevelData(LevelData *levelData, vector > *players); void saveLevelData(LevelData *levelData); PlayerIO *getPlayerIO(); void closeAll(); diff --git a/Minecraft.World/Level/Storage/LevelStorageSource.h b/Minecraft.World/Level/Storage/LevelStorageSource.h index 8a19cc773..9b6db3946 100644 --- a/Minecraft.World/Level/Storage/LevelStorageSource.h +++ b/Minecraft.World/Level/Storage/LevelStorageSource.h @@ -13,7 +13,7 @@ class LevelStorageSource { public: virtual wstring getName() = 0; - virtual shared_ptr selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) = 0; + virtual std::shared_ptr selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) = 0; virtual vector *getLevelList() = 0; virtual void clearAll() = 0; virtual LevelData *getDataTagFor(ConsoleSaveFile *saveFile, const wstring& levelId) = 0; diff --git a/Minecraft.World/Level/Storage/MapItemSavedData.cpp b/Minecraft.World/Level/Storage/MapItemSavedData.cpp index c173f2e5c..f9cf0672b 100644 --- a/Minecraft.World/Level/Storage/MapItemSavedData.cpp +++ b/Minecraft.World/Level/Storage/MapItemSavedData.cpp @@ -23,7 +23,7 @@ MapItemSavedData::MapDecoration::MapDecoration(char img, char x, char y, char ro this->visible = visible; } -MapItemSavedData::HoldingPlayer::HoldingPlayer(shared_ptr player, const MapItemSavedData *parent) : parent( parent ), player( player ) +MapItemSavedData::HoldingPlayer::HoldingPlayer(std::shared_ptr player, const MapItemSavedData *parent) : parent( parent ), player( player ) { // inited outside of ctor rowsDirtyMin = intArray(MapItem::IMAGE_WIDTH); @@ -48,7 +48,7 @@ MapItemSavedData::HoldingPlayer::~HoldingPlayer() delete lastSentDecorations.data; } -charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptr itemInstance) +charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(std::shared_ptr itemInstance) { if (--sendPosTick < 0) { @@ -125,7 +125,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptr servPlayer = dynamic_pointer_cast(player); + std::shared_ptr servPlayer = dynamic_pointer_cast(player); for (int d = 0; d < 10; d++) { int column = (tick * 11) % (MapItem::IMAGE_WIDTH); @@ -223,11 +223,11 @@ void MapItemSavedData::save(CompoundTag *tag) tag->putByteArray(L"colors", colors); } -void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptr item) +void MapItemSavedData::tickCarriedBy(std::shared_ptr player, std::shared_ptr item) { if (carriedByPlayers.find(player) == carriedByPlayers.end()) { - shared_ptr hp = shared_ptr( new HoldingPlayer(player, this ) ); + std::shared_ptr hp = std::shared_ptr( new HoldingPlayer(player, this ) ); carriedByPlayers.insert( playerHoldingPlayerMapType::value_type(player, hp) ); carriedBy.push_back(hp); } @@ -245,12 +245,12 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptr hp = *it; + std::shared_ptr hp = *it; // 4J Stu - Players in the same dimension as an item frame with a map need to be sent this data, so don't remove them if (hp->player->removed ) //|| (!hp->player->inventory->contains(item) && !item->isFramed() )) { - AUTO_VAR(it2, carriedByPlayers.find( (shared_ptr ) hp->player )); + AUTO_VAR(it2, carriedByPlayers.find( (std::shared_ptr ) hp->player )); if( it2 != carriedByPlayers.end() ) { carriedByPlayers.erase( it2 ); @@ -268,7 +268,7 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptrgetPlayerList(); for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3) { - shared_ptr serverPlayer = *it3; + std::shared_ptr serverPlayer = *it3; if(serverPlayer->dimension == 1) { atLeastOnePlayerInTheEnd = true; @@ -354,7 +354,7 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptrentities.begin()); it != playerLevel->entities.end(); ++it) { - shared_ptr ent = *it; + std::shared_ptr ent = *it; if((ent->GetType() & eTYPE_ENEMY) == 0) continue; @@ -393,7 +393,7 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptrgetPlayerList(); for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3) { - shared_ptr decorationPlayer = *it3; + std::shared_ptr decorationPlayer = *it3; if(decorationPlayer!=NULL && decorationPlayer->dimension == this->dimension) { float xd = (float) (decorationPlayer->x - x) / (1 << scale); @@ -470,12 +470,12 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptr itemInstance, Level *level, shared_ptr player) +charArray MapItemSavedData::getUpdatePacket(std::shared_ptr itemInstance, Level *level, std::shared_ptr player) { AUTO_VAR(it, carriedByPlayers.find(player)); if (it == carriedByPlayers.end() ) return charArray(); - shared_ptr hp = it->second; + std::shared_ptr hp = it->second; return hp->nextUpdatePacket(itemInstance); } @@ -486,7 +486,7 @@ void MapItemSavedData::setDirty(int x, int y0, int y1) AUTO_VAR(itEnd, carriedBy.end()); for (AUTO_VAR(it, carriedBy.begin()); it != itEnd; it++) { - shared_ptr hp = *it; //carriedBy.at(i); + std::shared_ptr hp = *it; //carriedBy.at(i); if (hp->rowsDirtyMin[x] < 0 || hp->rowsDirtyMin[x] > y0) hp->rowsDirtyMin[x] = y0; if (hp->rowsDirtyMax[x] < 0 || hp->rowsDirtyMax[x] < y1) hp->rowsDirtyMax[x] = y1; } @@ -534,7 +534,7 @@ void MapItemSavedData::handleComplexItemData(charArray &data) // 4J Added // We only have one map per player per dimension, so if they pickup someone elses map we merge their map data with ours // so that we can see everything that they discovered but still only have one map data ourself -void MapItemSavedData::mergeInMapData(shared_ptr dataToAdd) +void MapItemSavedData::mergeInMapData(std::shared_ptr dataToAdd) { int w = MapItem::IMAGE_WIDTH; int h = MapItem::IMAGE_HEIGHT; @@ -562,7 +562,7 @@ void MapItemSavedData::mergeInMapData(shared_ptr dataToAdd) } } -void MapItemSavedData::removeItemFrameDecoration(shared_ptr item) +void MapItemSavedData::removeItemFrameDecoration(std::shared_ptr item) { AUTO_VAR(frameDecoration, nonPlayerDecorations.find( item->getFrame()->entityId ) ); if ( frameDecoration != nonPlayerDecorations.end() ) diff --git a/Minecraft.World/Level/Storage/MapItemSavedData.h b/Minecraft.World/Level/Storage/MapItemSavedData.h index c8dd457ae..dfd6f4894 100644 --- a/Minecraft.World/Level/Storage/MapItemSavedData.h +++ b/Minecraft.World/Level/Storage/MapItemSavedData.h @@ -28,7 +28,7 @@ public: class HoldingPlayer { public: - const shared_ptr player; + const std::shared_ptr player; intArray rowsDirtyMin; intArray rowsDirtyMax; @@ -42,9 +42,9 @@ public: public: // 4J Stu - Had to add a reference to the MapItemSavedData object that created us as we try to access it's member variables - HoldingPlayer(shared_ptr player, const MapItemSavedData *parent); + HoldingPlayer(std::shared_ptr player, const MapItemSavedData *parent); ~HoldingPlayer(); - charArray nextUpdatePacket(shared_ptr itemInstance); + charArray nextUpdatePacket(std::shared_ptr itemInstance); }; public: @@ -53,10 +53,10 @@ public: uint8_t scale; byteArray colors; int step; - vector > carriedBy; + vector > carriedBy; private: - typedef unordered_map , shared_ptr , PlayerKeyHash, PlayerKeyEq> playerHoldingPlayerMapType; + typedef unordered_map , std::shared_ptr , PlayerKeyHash, PlayerKeyEq> playerHoldingPlayerMapType; playerHoldingPlayerMapType carriedByPlayers; public: @@ -75,15 +75,15 @@ public: virtual void load(CompoundTag *tag); virtual void save(CompoundTag *tag); - void tickCarriedBy(shared_ptr player, shared_ptr item); + void tickCarriedBy(std::shared_ptr player, std::shared_ptr item); - charArray getUpdatePacket(shared_ptr itemInstance, Level *level, shared_ptr player); + charArray getUpdatePacket(std::shared_ptr itemInstance, Level *level, std::shared_ptr player); using SavedData::setDirty; void setDirty(int x, int y0, int y1); void handleComplexItemData(charArray &data); // 4J Stu Added - void mergeInMapData(shared_ptr dataToAdd); - void removeItemFrameDecoration(shared_ptr item); + void mergeInMapData(std::shared_ptr dataToAdd); + void removeItemFrameDecoration(std::shared_ptr item); }; diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp b/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp index 8a7dbefa7..6fd3b310f 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp @@ -89,7 +89,7 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) return new McRegionChunkStorage(m_saveFile, L""); } -void McRegionLevelStorage::saveLevelData(LevelData *levelData, vector > *players) +void McRegionLevelStorage::saveLevelData(LevelData *levelData, vector > *players) { levelData->setVersion(MCREGION_VERSION_ID); MemSect(38); diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorage.h b/Minecraft.World/Level/Storage/McRegionLevelStorage.h index abaa17d18..72d5cc07f 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorage.h +++ b/Minecraft.World/Level/Storage/McRegionLevelStorage.h @@ -17,6 +17,6 @@ public: ~McRegionLevelStorage(); virtual ChunkStorage *createChunkStorage(Dimension *dimension); - virtual void saveLevelData(LevelData *levelData, vector > *players); + virtual void saveLevelData(LevelData *levelData, vector > *players); virtual void closeAll(); }; \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp b/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp index a45ba2ffa..c49fb9fa8 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp +++ b/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp @@ -74,10 +74,10 @@ void McRegionLevelStorageSource::clearAll() { } -shared_ptr McRegionLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) +std::shared_ptr McRegionLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) { // return new LevelStorageProfilerDecorator(new McRegionLevelStorage(baseDir, levelId, createPlayerDir)); - return shared_ptr(new McRegionLevelStorage(saveFile, baseDir, levelId, createPlayerDir)); + return std::shared_ptr(new McRegionLevelStorage(saveFile, baseDir, levelId, createPlayerDir)); } bool McRegionLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId) diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorageSource.h b/Minecraft.World/Level/Storage/McRegionLevelStorageSource.h index 76faa9e1d..f4bc23788 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorageSource.h +++ b/Minecraft.World/Level/Storage/McRegionLevelStorageSource.h @@ -17,7 +17,7 @@ public: virtual wstring getName(); virtual vector *getLevelList(); virtual void clearAll(); - virtual shared_ptr selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir); + virtual std::shared_ptr selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir); virtual bool isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId); virtual bool requiresConversion(ConsoleSaveFile *saveFile, const wstring& levelId); virtual bool convertLevel(ConsoleSaveFile *saveFile, const wstring& levelId, ProgressListener *progress); diff --git a/Minecraft.World/Level/Storage/MemoryLevelStorage.cpp b/Minecraft.World/Level/Storage/MemoryLevelStorage.cpp index 0926e8e1a..68c3c453a 100644 --- a/Minecraft.World/Level/Storage/MemoryLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/MemoryLevelStorage.cpp @@ -26,7 +26,7 @@ ChunkStorage *MemoryLevelStorage::createChunkStorage(Dimension *dimension) return new MemoryChunkStorage(); } -void MemoryLevelStorage::saveLevelData(LevelData *levelData, vector > *players) +void MemoryLevelStorage::saveLevelData(LevelData *levelData, vector > *players) { } @@ -43,11 +43,11 @@ void MemoryLevelStorage::closeAll() { } -void MemoryLevelStorage::save(shared_ptr player) +void MemoryLevelStorage::save(std::shared_ptr player) { } -bool MemoryLevelStorage::load(shared_ptr player) +bool MemoryLevelStorage::load(std::shared_ptr player) { return false; } diff --git a/Minecraft.World/Level/Storage/MemoryLevelStorage.h b/Minecraft.World/Level/Storage/MemoryLevelStorage.h index f623b66b1..93eff457d 100644 --- a/Minecraft.World/Level/Storage/MemoryLevelStorage.h +++ b/Minecraft.World/Level/Storage/MemoryLevelStorage.h @@ -20,12 +20,12 @@ public: virtual LevelData *prepareLevel(); virtual void checkSession(); virtual ChunkStorage *createChunkStorage(Dimension *dimension); - virtual void saveLevelData(LevelData *levelData, vector > *players); + virtual void saveLevelData(LevelData *levelData, vector > *players); virtual void saveLevelData(LevelData *levelData); virtual PlayerIO *getPlayerIO(); virtual void closeAll(); - virtual void save(shared_ptr player); - virtual bool load(shared_ptr player); + virtual void save(std::shared_ptr player); + virtual bool load(std::shared_ptr player); virtual CompoundTag *loadPlayerDataTag(const wstring& playerName); virtual ConsoleSavePath getDataFile(const wstring& id); }; \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/MemoryLevelStorageSource.cpp b/Minecraft.World/Level/Storage/MemoryLevelStorageSource.cpp index 0bb6d8457..46c549bc9 100644 --- a/Minecraft.World/Level/Storage/MemoryLevelStorageSource.cpp +++ b/Minecraft.World/Level/Storage/MemoryLevelStorageSource.cpp @@ -13,9 +13,9 @@ wstring MemoryLevelStorageSource::getName() return L"Memory Storage"; } -shared_ptr MemoryLevelStorageSource::selectLevel(const wstring& levelId, bool createPlayerDir) +std::shared_ptr MemoryLevelStorageSource::selectLevel(const wstring& levelId, bool createPlayerDir) { - return shared_ptr () new MemoryLevelStorage()); + return std::shared_ptr () new MemoryLevelStorage()); } vector *MemoryLevelStorageSource::getLevelList() diff --git a/Minecraft.World/Level/Storage/MemoryLevelStorageSource.h b/Minecraft.World/Level/Storage/MemoryLevelStorageSource.h index c53c04634..2d3de863b 100644 --- a/Minecraft.World/Level/Storage/MemoryLevelStorageSource.h +++ b/Minecraft.World/Level/Storage/MemoryLevelStorageSource.h @@ -8,7 +8,7 @@ class MemoryLevelStorageSource : public LevelStorageSource public: MemoryLevelStorageSource(); wstring getName(); - shared_ptr selectLevel(const wstring& levelId, bool createPlayerDir); + std::shared_ptr selectLevel(const wstring& levelId, bool createPlayerDir); vector *getLevelList(); void clearAll(); LevelData *getDataTagFor(const wstring& levelId); diff --git a/Minecraft.World/Level/Storage/MockedLevelStorage.cpp b/Minecraft.World/Level/Storage/MockedLevelStorage.cpp index 2a8c6838c..46e1c0d1f 100644 --- a/Minecraft.World/Level/Storage/MockedLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/MockedLevelStorage.cpp @@ -21,7 +21,7 @@ ChunkStorage *MockedLevelStorage::createChunkStorage(Dimension *dimension) return NULL; } -void MockedLevelStorage::saveLevelData(LevelData *levelData, vector > *players) +void MockedLevelStorage::saveLevelData(LevelData *levelData, vector > *players) { } diff --git a/Minecraft.World/Level/Storage/MockedLevelStorage.h b/Minecraft.World/Level/Storage/MockedLevelStorage.h index f00bc0da2..e045b03a9 100644 --- a/Minecraft.World/Level/Storage/MockedLevelStorage.h +++ b/Minecraft.World/Level/Storage/MockedLevelStorage.h @@ -11,7 +11,7 @@ public: virtual LevelData *prepareLevel(); virtual void checkSession(); virtual ChunkStorage *createChunkStorage(Dimension *dimension); - virtual void saveLevelData(LevelData *levelData, vector > *players); + virtual void saveLevelData(LevelData *levelData, vector > *players); virtual void saveLevelData(LevelData *levelData); virtual PlayerIO *getPlayerIO(); virtual void closeAll(); diff --git a/Minecraft.World/Level/Storage/OldChunkStorage.cpp b/Minecraft.World/Level/Storage/OldChunkStorage.cpp index ef2706a69..a531183a4 100644 --- a/Minecraft.World/Level/Storage/OldChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/OldChunkStorage.cpp @@ -211,9 +211,9 @@ bool OldChunkStorage::saveEntities(LevelChunk *lc, Level *level, CompoundTag *ta for (int i = 0; i < lc->ENTITY_BLOCKS_LENGTH; i++) { AUTO_VAR(itEnd, lc->entityBlocks[i]->end()); - for( vector >::iterator it = lc->entityBlocks[i]->begin(); it != itEnd; it++ ) + for( vector >::iterator it = lc->entityBlocks[i]->begin(); it != itEnd; it++ ) { - shared_ptr e = *it; + std::shared_ptr e = *it; lc->lastSaveHadEntities = true; CompoundTag *teTag = new CompoundTag(); if (e->save(teTag)) @@ -268,10 +268,10 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, DataOutputStream *dos) ListTag *tileEntityTags = new ListTag(); AUTO_VAR(itEnd, lc->tileEntities.end()); - for( unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); + for( unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); it != itEnd; it++) { - shared_ptr te = it->second; + std::shared_ptr te = it->second; CompoundTag *teTag = new CompoundTag(); te->save(teTag); tileEntityTags->add(teTag); @@ -357,10 +357,10 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, CompoundTag *tag) ListTag *tileEntityTags = new ListTag(); AUTO_VAR(itEnd, lc->tileEntities.end()); - for( unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); + for( unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); it != itEnd; it++) { - shared_ptr te = it->second; + std::shared_ptr te = it->second; CompoundTag *teTag = new CompoundTag(); te->save(teTag); tileEntityTags->add(teTag); @@ -402,7 +402,7 @@ void OldChunkStorage::loadEntities(LevelChunk *lc, Level *level, CompoundTag *ta for (int i = 0; i < entityTags->size(); i++) { CompoundTag *teTag = entityTags->get(i); - shared_ptr te = EntityIO::loadStatic(teTag, level); + std::shared_ptr te = EntityIO::loadStatic(teTag, level); lc->lastSaveHadEntities = true; if (te != NULL) { @@ -417,7 +417,7 @@ void OldChunkStorage::loadEntities(LevelChunk *lc, Level *level, CompoundTag *ta for (int i = 0; i < tileEntityTags->size(); i++) { CompoundTag *teTag = tileEntityTags->get(i); - shared_ptr te = TileEntity::loadStatic(teTag); + std::shared_ptr te = TileEntity::loadStatic(teTag); if (te != NULL) { lc->addTileEntity(te); diff --git a/Minecraft.World/Level/Storage/PlayerIO.h b/Minecraft.World/Level/Storage/PlayerIO.h index 559ab2eef..d1b81ed36 100644 --- a/Minecraft.World/Level/Storage/PlayerIO.h +++ b/Minecraft.World/Level/Storage/PlayerIO.h @@ -10,13 +10,13 @@ class Player; class PlayerIO { public: - virtual void save(shared_ptr player) = 0; - virtual bool load(shared_ptr player) = 0; // 4J Changed return val to bool to check if new player or loaded player + virtual void save(std::shared_ptr player) = 0; + virtual bool load(std::shared_ptr player) = 0; // 4J Changed return val to bool to check if new player or loaded player virtual CompoundTag *loadPlayerDataTag(PlayerUID xuid) = 0; // 4J Changed from string name to xuid // 4J Added virtual void clearOldPlayerFiles() = 0; virtual void saveMapIdLookup() = 0; - virtual void deleteMapFilesForPlayer(shared_ptr player) = 0; + virtual void deleteMapFilesForPlayer(std::shared_ptr player) = 0; virtual void saveAllCachedData() = 0; }; \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/PortalForcer.cpp b/Minecraft.World/Level/Storage/PortalForcer.cpp index b594acd36..6fa092bbf 100644 --- a/Minecraft.World/Level/Storage/PortalForcer.cpp +++ b/Minecraft.World/Level/Storage/PortalForcer.cpp @@ -11,7 +11,7 @@ PortalForcer::PortalForcer() } -void PortalForcer::force(Level *level, shared_ptr e) +void PortalForcer::force(Level *level, std::shared_ptr e) { if (level->dimension->id == 1) { @@ -54,7 +54,7 @@ void PortalForcer::force(Level *level, shared_ptr e) } -bool PortalForcer::findPortal(Level *level, shared_ptr e) +bool PortalForcer::findPortal(Level *level, std::shared_ptr e) { // 4J Stu - Decrease the range at which we search for a portal in the nether given our smaller nether int r = 16;//* 8; @@ -133,7 +133,7 @@ bool PortalForcer::findPortal(Level *level, shared_ptr e) } -bool PortalForcer::createPortal(Level *level, shared_ptr e) +bool PortalForcer::createPortal(Level *level, std::shared_ptr e) { // 4J Stu - Increase the range at which we try and create a portal to stop creating them floating in mid air over lava int r = 16 * 3; diff --git a/Minecraft.World/Level/Storage/PortalForcer.h b/Minecraft.World/Level/Storage/PortalForcer.h index feb2f1294..b3dcd4e6b 100644 --- a/Minecraft.World/Level/Storage/PortalForcer.h +++ b/Minecraft.World/Level/Storage/PortalForcer.h @@ -11,11 +11,11 @@ public: // 4J Stu Added - Java has no ctor, but we need to initialise random PortalForcer(); - void force(Level *level, shared_ptr e); + void force(Level *level, std::shared_ptr e); public: - bool findPortal(Level *level, shared_ptr e); + bool findPortal(Level *level, std::shared_ptr e); public: - bool createPortal(Level *level, shared_ptr e); + bool createPortal(Level *level, std::shared_ptr e); }; \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/Region.cpp b/Minecraft.World/Level/Storage/Region.cpp index 9cae8828a..4fe0fbd54 100644 --- a/Minecraft.World/Level/Storage/Region.cpp +++ b/Minecraft.World/Level/Storage/Region.cpp @@ -137,7 +137,7 @@ LevelChunk* Region::getLevelChunk(int x, int y, int z) -shared_ptr Region::getTileEntity(int x, int y, int z) +std::shared_ptr Region::getTileEntity(int x, int y, int z) { int xc = (x >> 4) - xc1; int zc = (z >> 4) - zc1; diff --git a/Minecraft.World/Level/Storage/Region.h b/Minecraft.World/Level/Storage/Region.h index 0d200a355..fad828ee8 100644 --- a/Minecraft.World/Level/Storage/Region.h +++ b/Minecraft.World/Level/Storage/Region.h @@ -23,7 +23,7 @@ public: virtual ~Region(); bool isAllEmpty(); int getTile(int x, int y, int z); - shared_ptr getTileEntity(int x, int y, int z); + std::shared_ptr getTileEntity(int x, int y, int z); float getBrightness(int x, int y, int z, int emitt); float getBrightness(int x, int y, int z); int getLightColor(int x, int y, int z, int emitt, int tileId = -1); // 4J - change brought forward from 1.8.2 diff --git a/Minecraft.World/Level/Storage/SavedDataStorage.cpp b/Minecraft.World/Level/Storage/SavedDataStorage.cpp index 4b6ae27e5..14437c385 100644 --- a/Minecraft.World/Level/Storage/SavedDataStorage.cpp +++ b/Minecraft.World/Level/Storage/SavedDataStorage.cpp @@ -11,8 +11,8 @@ SavedDataStorage::SavedDataStorage(LevelStorage *levelStorage) { /* - cache = new unordered_map >; - savedDatas = new vector >; + cache = new unordered_map >; + savedDatas = new vector >; usedAuxIds = new unordered_map; */ @@ -20,12 +20,12 @@ SavedDataStorage::SavedDataStorage(LevelStorage *levelStorage) loadAuxValues(); } -shared_ptr SavedDataStorage::get(const type_info& clazz, const wstring& id) +std::shared_ptr SavedDataStorage::get(const type_info& clazz, const wstring& id) { AUTO_VAR(it, cache.find( id )); if (it != cache.end()) return (*it).second; - shared_ptr data = nullptr; + std::shared_ptr data = nullptr; if (levelStorage != NULL) { //File file = levelStorage->getDataFile(id); @@ -37,11 +37,11 @@ shared_ptr SavedDataStorage::get(const type_info& clazz, const wstrin if( clazz == typeid(MapItemSavedData) ) { - data = dynamic_pointer_cast( shared_ptr(new MapItemSavedData(id)) ); + data = dynamic_pointer_cast( std::shared_ptr(new MapItemSavedData(id)) ); } else if( clazz == typeid(Villages) ) { - data = dynamic_pointer_cast( shared_ptr(new Villages(id) ) ); + data = dynamic_pointer_cast( std::shared_ptr(new Villages(id) ) ); } else { @@ -59,13 +59,13 @@ shared_ptr SavedDataStorage::get(const type_info& clazz, const wstrin if (data != NULL) { - cache.insert( unordered_map >::value_type( id , data ) ); + cache.insert( unordered_map >::value_type( id , data ) ); savedDatas.push_back(data); } return data; } -void SavedDataStorage::set(const wstring& id, shared_ptr data) +void SavedDataStorage::set(const wstring& id, std::shared_ptr data) { if (data == NULL) { @@ -91,7 +91,7 @@ void SavedDataStorage::save() AUTO_VAR(itEnd, savedDatas.end()); for (AUTO_VAR(it, savedDatas.begin()); it != itEnd; it++) { - shared_ptr data = *it; //savedDatas->at(i); + std::shared_ptr data = *it; //savedDatas->at(i); if (data->isDirty()) { save(data); @@ -100,7 +100,7 @@ void SavedDataStorage::save() } } -void SavedDataStorage::save(shared_ptr data) +void SavedDataStorage::save(std::shared_ptr data) { if (levelStorage == NULL) return; //File file = levelStorage->getDataFile(data->id); diff --git a/Minecraft.World/Level/Storage/SavedDataStorage.h b/Minecraft.World/Level/Storage/SavedDataStorage.h index 9a342ab62..d18ebcc60 100644 --- a/Minecraft.World/Level/Storage/SavedDataStorage.h +++ b/Minecraft.World/Level/Storage/SavedDataStorage.h @@ -9,22 +9,22 @@ class SavedDataStorage private: LevelStorage *levelStorage; - typedef unordered_map > cacheMapType; + typedef unordered_map > cacheMapType; cacheMapType cache; - vector > savedDatas; + vector > savedDatas; typedef unordered_map uaiMapType; uaiMapType usedAuxIds; public: SavedDataStorage(LevelStorage *); - shared_ptr get(const type_info& clazz, const wstring& id); - void set(const wstring& id, shared_ptr data); + std::shared_ptr get(const type_info& clazz, const wstring& id); + void set(const wstring& id, std::shared_ptr data); void save(); private: - void save(shared_ptr data); + void save(std::shared_ptr data); void loadAuxValues(); public: diff --git a/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp b/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp index c65b06ec0..ea2ec909c 100644 --- a/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp @@ -207,12 +207,12 @@ void ZonedChunkStorage::loadEntities(Level *level, LevelChunk *lc) int type = tag->getInt(L"_TYPE"); if (type == 0) { - shared_ptr e = EntityIO::loadStatic(tag, level); + std::shared_ptr e = EntityIO::loadStatic(tag, level); if (e != NULL) lc->addEntity(e); } else if (type == 1) { - shared_ptr te = TileEntity::loadStatic(tag); + std::shared_ptr te = TileEntity::loadStatic(tag); if (te != NULL) lc->addTileEntity(te); } } @@ -232,12 +232,12 @@ void ZonedChunkStorage::saveEntities(Level *level, LevelChunk *lc) #endif for (int i = 0; i < LevelChunk::ENTITY_BLOCKS_LENGTH; i++) { - vector > *entities = lc->entityBlocks[i]; + vector > *entities = lc->entityBlocks[i]; AUTO_VAR(itEndTags, entities->end()); for (AUTO_VAR(it, entities->begin()); it != itEndTags; it++) { - shared_ptr e = *it; //entities->at(j); + std::shared_ptr e = *it; //entities->at(j); CompoundTag *cp = new CompoundTag(); cp->putInt(L"_TYPE", 0); e->save(cp); @@ -250,10 +250,10 @@ void ZonedChunkStorage::saveEntities(Level *level, LevelChunk *lc) LeaveCriticalSection(&lc->m_csEntities); #endif - for( unordered_map , TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); + for( unordered_map , TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); it != lc->tileEntities.end(); it++) { - shared_ptr te = it->second; + std::shared_ptr te = it->second; CompoundTag *cp = new CompoundTag(); cp->putInt(L"_TYPE", 1); te->save(cp); diff --git a/Minecraft.World/Level/WaterLevelChunk.cpp b/Minecraft.World/Level/WaterLevelChunk.cpp index c5e303211..3c3784c57 100644 --- a/Minecraft.World/Level/WaterLevelChunk.cpp +++ b/Minecraft.World/Level/WaterLevelChunk.cpp @@ -53,15 +53,15 @@ void WaterLevelChunk::setBrightness(LightLayer::variety layer, int x, int y, int { } -void WaterLevelChunk::addEntity(shared_ptr e) +void WaterLevelChunk::addEntity(std::shared_ptr e) { } -void WaterLevelChunk::removeEntity(shared_ptr e) +void WaterLevelChunk::removeEntity(std::shared_ptr e) { } -void WaterLevelChunk::removeEntity(shared_ptr e, int yc) +void WaterLevelChunk::removeEntity(std::shared_ptr e, int yc) { } @@ -69,16 +69,16 @@ void WaterLevelChunk::skyBrightnessChanged() { } -shared_ptr WaterLevelChunk::getTileEntity(int x, int y, int z) +std::shared_ptr WaterLevelChunk::getTileEntity(int x, int y, int z) { - return shared_ptr(); + return std::shared_ptr(); } -void WaterLevelChunk::addTileEntity(shared_ptr te) +void WaterLevelChunk::addTileEntity(std::shared_ptr te) { } -void WaterLevelChunk::setTileEntity(int x, int y, int z, shared_ptr tileEntity) +void WaterLevelChunk::setTileEntity(int x, int y, int z, std::shared_ptr tileEntity) { } @@ -98,11 +98,11 @@ void WaterLevelChunk::markUnsaved() { } -void WaterLevelChunk::getEntities(shared_ptr except, AABB bb, vector > &es) +void WaterLevelChunk::getEntities(std::shared_ptr except, AABB bb, vector > &es) { } -void WaterLevelChunk::getEntitiesOfClass(const type_info& ec, AABB bb, vector > &es) +void WaterLevelChunk::getEntitiesOfClass(const type_info& ec, AABB bb, vector > &es) { } diff --git a/Minecraft.World/Level/WaterLevelChunk.h b/Minecraft.World/Level/WaterLevelChunk.h index 191387939..8bb95f18c 100644 --- a/Minecraft.World/Level/WaterLevelChunk.h +++ b/Minecraft.World/Level/WaterLevelChunk.h @@ -21,19 +21,19 @@ public: bool setData(int x, int y, int z, int val, int mask, bool *maskedBitsChanged); // 4J added mask void setBrightness(LightLayer::variety layer, int x, int y, int z, int brightness); void setLevelChunkBrightness(LightLayer::variety layer, int x, int y, int z, int brightness); // 4J added - calls the setBrightness method of the parent class - void addEntity(shared_ptr e); - void removeEntity(shared_ptr e); - void removeEntity(shared_ptr e, int yc); + void addEntity(std::shared_ptr e); + void removeEntity(std::shared_ptr e); + void removeEntity(std::shared_ptr e, int yc); void skyBrightnessChanged(); - shared_ptr getTileEntity(int x, int y, int z); - void addTileEntity(shared_ptr te); - void setTileEntity(int x, int y, int z, shared_ptr tileEntity); + std::shared_ptr getTileEntity(int x, int y, int z); + void addTileEntity(std::shared_ptr te); + void setTileEntity(int x, int y, int z, std::shared_ptr tileEntity); void removeTileEntity(int x, int y, int z); void load(); void unload(bool unloadTileEntities) ; // 4J - added parameter void markUnsaved(); - void getEntities(shared_ptr except, AABB bb, vector > &es); - void getEntitiesOfClass(const type_info& ec, AABB bb, vector > &es); + void getEntities(std::shared_ptr except, AABB bb, vector > &es); + void getEntitiesOfClass(const type_info& ec, AABB bb, vector > &es); int countEntities(); bool shouldSave(bool force); void setBlocks(byteArray newBlocks, int sub); diff --git a/Minecraft.World/Network/Connection.cpp b/Minecraft.World/Network/Connection.cpp index 42c36b8a0..2627c23ee 100644 --- a/Minecraft.World/Network/Connection.cpp +++ b/Minecraft.World/Network/Connection.cpp @@ -141,7 +141,7 @@ void Connection::setListener(PacketListener *packetListener) this->packetListener = packetListener; } -void Connection::send(shared_ptr packet) +void Connection::send(std::shared_ptr packet) { if (quitting) return; @@ -167,7 +167,7 @@ void Connection::send(shared_ptr packet) } -void Connection::queueSend(shared_ptr packet) +void Connection::queueSend(std::shared_ptr packet) { if (quitting) return; estimatedRemaining += packet->getEstimatedSize() + 1; @@ -185,7 +185,7 @@ bool Connection::writeTick() // try { if (!outgoing.empty() && (fakeLag == 0 || System::currentTimeMillis() - outgoing.front()->createTime >= fakeLag)) { - shared_ptr packet; + std::shared_ptr packet; EnterCriticalSection(&writeLock); @@ -218,7 +218,7 @@ bool Connection::writeTick() if ((slowWriteDelay-- <= 0) && !outgoing_slow.empty() && (fakeLag == 0 || System::currentTimeMillis() - outgoing_slow.front()->createTime >= fakeLag)) { - shared_ptr packet; + std::shared_ptr packet; //synchronized (writeLock) { @@ -296,7 +296,7 @@ bool Connection::readTick() //try { - shared_ptr packet = Packet::readPacket(dis, packetListener->isServerPacketListener()); + std::shared_ptr packet = Packet::readPacket(dis, packetListener->isServerPacketListener()); if (packet != NULL) { @@ -446,7 +446,7 @@ void Connection::tick() tickCount++; if (tickCount % 20 == 0) { - send( shared_ptr( new KeepAlivePacket() ) ); + send( std::shared_ptr( new KeepAlivePacket() ) ); } // 4J Stu - 1.8.2 changed from 100 to 1000 @@ -461,10 +461,10 @@ void Connection::tick() EnterCriticalSection(&incoming_cs); // 4J Stu - If disconnected, then we shouldn't process incoming packets - std::vector< shared_ptr > packetsToHandle; + std::vector< std::shared_ptr > packetsToHandle; while (!disconnected && !g_NetworkManager.IsLeavingGame() && g_NetworkManager.IsInSession() && !incoming.empty() && max-- >= 0) { - shared_ptr packet = incoming.front(); + std::shared_ptr packet = incoming.front(); packetsToHandle.push_back(packet); incoming.pop(); } diff --git a/Minecraft.World/Network/Connection.h b/Minecraft.World/Network/Connection.h index 7afa33ef6..1a39dea96 100644 --- a/Minecraft.World/Network/Connection.h +++ b/Minecraft.World/Network/Connection.h @@ -52,10 +52,10 @@ private: bool running; - queue > incoming; // 4J - was using synchronizedList... + queue > incoming; // 4J - was using synchronizedList... CRITICAL_SECTION incoming_cs; // ... now has this critical section - queue > outgoing; // 4J - was using synchronizedList - but don't think it is required as usage is wrapped in writeLock critical section - queue > outgoing_slow; // 4J - was using synchronizedList - but don't think it is required as usage is wrapped in writeLock critical section + queue > outgoing; // 4J - was using synchronizedList - but don't think it is required as usage is wrapped in writeLock critical section + queue > outgoing_slow; // 4J - was using synchronizedList - but don't think it is required as usage is wrapped in writeLock critical section PacketListener *packetListener; @@ -98,10 +98,10 @@ public: Connection(Socket *socket, const wstring& id, PacketListener *packetListener); // throws IOException void setListener(PacketListener *packetListener); - void send(shared_ptr packet); + void send(std::shared_ptr packet); public: - void queueSend(shared_ptr packet); + void queueSend(std::shared_ptr packet); private: int slowWriteDelay; diff --git a/Minecraft.World/Network/Packets/AddEntityPacket.cpp b/Minecraft.World/Network/Packets/AddEntityPacket.cpp index b42180161..73f3a197b 100644 --- a/Minecraft.World/Network/Packets/AddEntityPacket.cpp +++ b/Minecraft.World/Network/Packets/AddEntityPacket.cpp @@ -8,7 +8,7 @@ #include -void AddEntityPacket::_init(shared_ptr e, int type, int data, int xp, int yp, int zp, int yRotp, int xRotp) +void AddEntityPacket::_init(std::shared_ptr e, int type, int data, int xp, int yp, int zp, int yRotp, int xRotp) { id = e->entityId; // 4J Stu - We should add entities at their "last sent" position so that the relative update packets @@ -42,12 +42,12 @@ AddEntityPacket::AddEntityPacket() { } -AddEntityPacket::AddEntityPacket(shared_ptr e, int type, int yRotp, int xRotp, int xp, int yp, int zp ) +AddEntityPacket::AddEntityPacket(std::shared_ptr e, int type, int yRotp, int xRotp, int xp, int yp, int zp ) { _init(e, type, -1, xp, yp, zp, yRotp, xRotp); // 4J - changed "no data" value to be -1, we can have a valid entity id of 0 } -AddEntityPacket::AddEntityPacket(shared_ptr e, int type, int data, int yRotp, int xRotp, int xp, int yp, int zp ) +AddEntityPacket::AddEntityPacket(std::shared_ptr e, int type, int data, int yRotp, int xRotp, int xp, int yp, int zp ) { _init(e, type, data, xp, yp, zp, yRotp, xRotp); } diff --git a/Minecraft.World/Network/Packets/AddEntityPacket.h b/Minecraft.World/Network/Packets/AddEntityPacket.h index edbfa379a..82818b39e 100644 --- a/Minecraft.World/Network/Packets/AddEntityPacket.h +++ b/Minecraft.World/Network/Packets/AddEntityPacket.h @@ -40,12 +40,12 @@ public: uint8_t yRot,xRot; // 4J added private: - void _init(shared_ptr e, int type, int data, int xp, int yp, int zp, int yRotp, int xRotp ); + void _init(std::shared_ptr e, int type, int data, int xp, int yp, int zp, int yRotp, int xRotp ); public: AddEntityPacket(); - AddEntityPacket(shared_ptr e, int type, int yRotp, int xRotp, int xp, int yp, int zp); - AddEntityPacket(shared_ptr e, int type, int data, int yRotp, int xRotp, int xp, int yp, int zp ); + AddEntityPacket(std::shared_ptr e, int type, int yRotp, int xRotp, int xp, int yp, int zp); + AddEntityPacket(std::shared_ptr e, int type, int data, int yRotp, int xRotp, int xp, int yp, int zp ); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); @@ -53,6 +53,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new AddEntityPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new AddEntityPacket()); } virtual int getId() { return 23; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/AddExperienceOrbPacket.cpp b/Minecraft.World/Network/Packets/AddExperienceOrbPacket.cpp index 9b1b38a43..912d256bb 100644 --- a/Minecraft.World/Network/Packets/AddExperienceOrbPacket.cpp +++ b/Minecraft.World/Network/Packets/AddExperienceOrbPacket.cpp @@ -13,7 +13,7 @@ AddExperienceOrbPacket::AddExperienceOrbPacket() value = 0; } -AddExperienceOrbPacket::AddExperienceOrbPacket(shared_ptr e) +AddExperienceOrbPacket::AddExperienceOrbPacket(std::shared_ptr e) { id = e->entityId; x = Mth::floor(e->x * 32); diff --git a/Minecraft.World/Network/Packets/AddExperienceOrbPacket.h b/Minecraft.World/Network/Packets/AddExperienceOrbPacket.h index 59accfb31..33ae06429 100644 --- a/Minecraft.World/Network/Packets/AddExperienceOrbPacket.h +++ b/Minecraft.World/Network/Packets/AddExperienceOrbPacket.h @@ -12,13 +12,13 @@ public: int value; AddExperienceOrbPacket(); - AddExperienceOrbPacket(shared_ptr e); + AddExperienceOrbPacket(std::shared_ptr e); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); - static shared_ptr create() { return shared_ptr(new AddExperienceOrbPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new AddExperienceOrbPacket()); } virtual int getId() { return 26; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/AddGlobalEntityPacket.cpp b/Minecraft.World/Network/Packets/AddGlobalEntityPacket.cpp index c23e9e5a4..5bb235246 100644 --- a/Minecraft.World/Network/Packets/AddGlobalEntityPacket.cpp +++ b/Minecraft.World/Network/Packets/AddGlobalEntityPacket.cpp @@ -20,7 +20,7 @@ AddGlobalEntityPacket::AddGlobalEntityPacket() type = 0; } -AddGlobalEntityPacket::AddGlobalEntityPacket(shared_ptr e) +AddGlobalEntityPacket::AddGlobalEntityPacket(std::shared_ptr e) { id = e->entityId; x = Mth::floor(e->x * 32); diff --git a/Minecraft.World/Network/Packets/AddGlobalEntityPacket.h b/Minecraft.World/Network/Packets/AddGlobalEntityPacket.h index 80c10db2f..9f0f518c0 100644 --- a/Minecraft.World/Network/Packets/AddGlobalEntityPacket.h +++ b/Minecraft.World/Network/Packets/AddGlobalEntityPacket.h @@ -12,7 +12,7 @@ public: int type; AddGlobalEntityPacket(); - AddGlobalEntityPacket(shared_ptr e); + AddGlobalEntityPacket(std::shared_ptr e); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); @@ -20,6 +20,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new AddGlobalEntityPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new AddGlobalEntityPacket()); } virtual int getId() { return 71; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/AddMobPacket.cpp b/Minecraft.World/Network/Packets/AddMobPacket.cpp index 959c2a655..599d54e40 100644 --- a/Minecraft.World/Network/Packets/AddMobPacket.cpp +++ b/Minecraft.World/Network/Packets/AddMobPacket.cpp @@ -25,7 +25,7 @@ AddMobPacket::~AddMobPacket() delete unpack; } -AddMobPacket::AddMobPacket(shared_ptr mob, int yRotp, int xRotp, int xp, int yp, int zp, int yHeadRotp) +AddMobPacket::AddMobPacket(std::shared_ptr mob, int yRotp, int xRotp, int xp, int yp, int zp, int yHeadRotp) { id = mob->entityId; @@ -130,7 +130,7 @@ int AddMobPacket::getEstimatedSize() return size; } -vector > *AddMobPacket::getUnpackedData() +vector > *AddMobPacket::getUnpackedData() { if (unpack == NULL) { diff --git a/Minecraft.World/Network/Packets/AddMobPacket.h b/Minecraft.World/Network/Packets/AddMobPacket.h index 1254d763e..76017c449 100644 --- a/Minecraft.World/Network/Packets/AddMobPacket.h +++ b/Minecraft.World/Network/Packets/AddMobPacket.h @@ -16,22 +16,22 @@ public: uint8_t yRot, xRot, yHeadRot; private: - shared_ptr entityData; - vector > *unpack; + std::shared_ptr entityData; + vector > *unpack; public: AddMobPacket(); ~AddMobPacket(); - AddMobPacket(shared_ptr mob, int yRotp, int xRotp, int xp, int yp, int zp, int yHeadRotp); + AddMobPacket(std::shared_ptr mob, int yRotp, int xRotp, int xp, int yp, int zp, int yHeadRotp); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); - vector > *getUnpackedData(); + vector > *getUnpackedData(); public: - static shared_ptr create() { return shared_ptr(new AddMobPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new AddMobPacket()); } virtual int getId() { return 24; } }; diff --git a/Minecraft.World/Network/Packets/AddPaintingPacket.cpp b/Minecraft.World/Network/Packets/AddPaintingPacket.cpp index 2aa6c43ed..75585a950 100644 --- a/Minecraft.World/Network/Packets/AddPaintingPacket.cpp +++ b/Minecraft.World/Network/Packets/AddPaintingPacket.cpp @@ -17,7 +17,7 @@ AddPaintingPacket::AddPaintingPacket() motive = L""; } -AddPaintingPacket::AddPaintingPacket(shared_ptr e) +AddPaintingPacket::AddPaintingPacket(std::shared_ptr e) { id = e->entityId; x = e->xTile; diff --git a/Minecraft.World/Network/Packets/AddPaintingPacket.h b/Minecraft.World/Network/Packets/AddPaintingPacket.h index a5694b749..0a002ddb5 100644 --- a/Minecraft.World/Network/Packets/AddPaintingPacket.h +++ b/Minecraft.World/Network/Packets/AddPaintingPacket.h @@ -15,13 +15,13 @@ public: public: AddPaintingPacket(); - AddPaintingPacket(shared_ptr e); + AddPaintingPacket(std::shared_ptr e); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new AddPaintingPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new AddPaintingPacket()); } virtual int getId() { return 25; } }; diff --git a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp index 8d01e077a..c80979f6b 100644 --- a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp +++ b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp @@ -32,7 +32,7 @@ AddPlayerPacket::~AddPlayerPacket() if(unpack != NULL) delete unpack; } -AddPlayerPacket::AddPlayerPacket(shared_ptr player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp) +AddPlayerPacket::AddPlayerPacket(std::shared_ptr player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp) { id = player->entityId; name = player->name; @@ -50,7 +50,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(); + std::shared_ptr itemInstance = player->inventory->getSelected(); carriedItem = itemInstance == NULL ? 0 : itemInstance->id; this->xuid = xuid; @@ -132,7 +132,7 @@ int AddPlayerPacket::getEstimatedSize() return iSize; } -vector > *AddPlayerPacket::getUnpackedData() +vector > *AddPlayerPacket::getUnpackedData() { if (unpack == NULL) { diff --git a/Minecraft.World/Network/Packets/AddPlayerPacket.h b/Minecraft.World/Network/Packets/AddPlayerPacket.h index 0c8e915e1..909cfee9c 100644 --- a/Minecraft.World/Network/Packets/AddPlayerPacket.h +++ b/Minecraft.World/Network/Packets/AddPlayerPacket.h @@ -10,8 +10,8 @@ class AddPlayerPacket : public Packet, public enable_shared_from_this entityData; - vector > *unpack; + std::shared_ptr entityData; + vector > *unpack; public: int id; @@ -29,15 +29,15 @@ public: AddPlayerPacket(); ~AddPlayerPacket(); - AddPlayerPacket(shared_ptr player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp); + AddPlayerPacket(std::shared_ptr player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); - vector > *getUnpackedData(); + vector > *getUnpackedData(); public: - static shared_ptr create() { return shared_ptr(new AddPlayerPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new AddPlayerPacket()); } virtual int getId() { return 20; } }; diff --git a/Minecraft.World/Network/Packets/AnimatePacket.cpp b/Minecraft.World/Network/Packets/AnimatePacket.cpp index 70b38b9d0..9f2fb1fed 100644 --- a/Minecraft.World/Network/Packets/AnimatePacket.cpp +++ b/Minecraft.World/Network/Packets/AnimatePacket.cpp @@ -13,7 +13,7 @@ AnimatePacket::AnimatePacket() action = 0; } -AnimatePacket::AnimatePacket(shared_ptr e, int action) +AnimatePacket::AnimatePacket(std::shared_ptr e, int action) { id = e->entityId; this->action = action; diff --git a/Minecraft.World/Network/Packets/AnimatePacket.h b/Minecraft.World/Network/Packets/AnimatePacket.h index 0287b9a6e..201d36128 100644 --- a/Minecraft.World/Network/Packets/AnimatePacket.h +++ b/Minecraft.World/Network/Packets/AnimatePacket.h @@ -18,7 +18,7 @@ public: int action; AnimatePacket(); - AnimatePacket(shared_ptr e, int action); + AnimatePacket(std::shared_ptr e, int action); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); @@ -26,6 +26,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new AnimatePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new AnimatePacket()); } virtual int getId() { return 18; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/AwardStatPacket.h b/Minecraft.World/Network/Packets/AwardStatPacket.h index 6b79c0234..aad8511dc 100644 --- a/Minecraft.World/Network/Packets/AwardStatPacket.h +++ b/Minecraft.World/Network/Packets/AwardStatPacket.h @@ -24,7 +24,7 @@ public: virtual int getEstimatedSize(); virtual bool isAync(); - static shared_ptr create() { return shared_ptr(new AwardStatPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new AwardStatPacket()); } virtual int getId() { return 200; } public: diff --git a/Minecraft.World/Network/Packets/BlockRegionUpdatePacket.h b/Minecraft.World/Network/Packets/BlockRegionUpdatePacket.h index 54dfea4eb..ac38a3814 100644 --- a/Minecraft.World/Network/Packets/BlockRegionUpdatePacket.h +++ b/Minecraft.World/Network/Packets/BlockRegionUpdatePacket.h @@ -28,6 +28,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new BlockRegionUpdatePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new BlockRegionUpdatePacket()); } virtual int getId() { return 51; } }; diff --git a/Minecraft.World/Network/Packets/ChatPacket.h b/Minecraft.World/Network/Packets/ChatPacket.h index c480dfd02..2481e903a 100644 --- a/Minecraft.World/Network/Packets/ChatPacket.h +++ b/Minecraft.World/Network/Packets/ChatPacket.h @@ -92,7 +92,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ChatPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ChatPacket()); } virtual int getId() { return 3; } }; diff --git a/Minecraft.World/Network/Packets/ChunkTilesUpdatePacket.h b/Minecraft.World/Network/Packets/ChunkTilesUpdatePacket.h index 67fa10a43..11365b165 100644 --- a/Minecraft.World/Network/Packets/ChunkTilesUpdatePacket.h +++ b/Minecraft.World/Network/Packets/ChunkTilesUpdatePacket.h @@ -25,7 +25,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ChunkTilesUpdatePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ChunkTilesUpdatePacket()); } virtual int getId() { return 52; } }; diff --git a/Minecraft.World/Network/Packets/ChunkVisibilityAreaPacket.h b/Minecraft.World/Network/Packets/ChunkVisibilityAreaPacket.h index 330874970..cc7f337d2 100644 --- a/Minecraft.World/Network/Packets/ChunkVisibilityAreaPacket.h +++ b/Minecraft.World/Network/Packets/ChunkVisibilityAreaPacket.h @@ -25,6 +25,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ChunkVisibilityAreaPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ChunkVisibilityAreaPacket()); } virtual int getId() { return 155; } }; diff --git a/Minecraft.World/Network/Packets/ChunkVisibilityPacket.h b/Minecraft.World/Network/Packets/ChunkVisibilityPacket.h index 87d9f3b4f..8a509e6ac 100644 --- a/Minecraft.World/Network/Packets/ChunkVisibilityPacket.h +++ b/Minecraft.World/Network/Packets/ChunkVisibilityPacket.h @@ -22,7 +22,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ChunkVisibilityPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ChunkVisibilityPacket()); } virtual int getId() { return 50; } }; diff --git a/Minecraft.World/Network/Packets/ClientCommandPacket.h b/Minecraft.World/Network/Packets/ClientCommandPacket.h index 2f614ddf1..1dea6b222 100644 --- a/Minecraft.World/Network/Packets/ClientCommandPacket.h +++ b/Minecraft.World/Network/Packets/ClientCommandPacket.h @@ -19,6 +19,6 @@ public: int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ClientCommandPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ClientCommandPacket()); } virtual int getId() { return 205; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/ComplexItemDataPacket.h b/Minecraft.World/Network/Packets/ComplexItemDataPacket.h index 52de8f49d..f299647d3 100644 --- a/Minecraft.World/Network/Packets/ComplexItemDataPacket.h +++ b/Minecraft.World/Network/Packets/ComplexItemDataPacket.h @@ -20,7 +20,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ComplexItemDataPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ComplexItemDataPacket()); } virtual int getId() { return 131; } }; diff --git a/Minecraft.World/Network/Packets/ContainerAckPacket.h b/Minecraft.World/Network/Packets/ContainerAckPacket.h index 375510ac7..32ff3298d 100644 --- a/Minecraft.World/Network/Packets/ContainerAckPacket.h +++ b/Minecraft.World/Network/Packets/ContainerAckPacket.h @@ -23,7 +23,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ContainerAckPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ContainerAckPacket()); } virtual int getId() { return 106; } }; diff --git a/Minecraft.World/Network/Packets/ContainerButtonClickPacket.h b/Minecraft.World/Network/Packets/ContainerButtonClickPacket.h index 522c5f868..64ee6cb56 100644 --- a/Minecraft.World/Network/Packets/ContainerButtonClickPacket.h +++ b/Minecraft.World/Network/Packets/ContainerButtonClickPacket.h @@ -17,6 +17,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ContainerButtonClickPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ContainerButtonClickPacket()); } virtual int getId() { return 108; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/ContainerClickPacket.cpp b/Minecraft.World/Network/Packets/ContainerClickPacket.cpp index 3694dfe0b..5620b3064 100644 --- a/Minecraft.World/Network/Packets/ContainerClickPacket.cpp +++ b/Minecraft.World/Network/Packets/ContainerClickPacket.cpp @@ -21,7 +21,7 @@ ContainerClickPacket::ContainerClickPacket() quickKey = false; } -ContainerClickPacket::ContainerClickPacket(int containerId, int slotNum, int buttonNum, bool quickKey, shared_ptr item, short uid) +ContainerClickPacket::ContainerClickPacket(int containerId, int slotNum, int buttonNum, bool quickKey, std::shared_ptr item, short uid) { this->containerId = containerId; this->slotNum = slotNum; diff --git a/Minecraft.World/Network/Packets/ContainerClickPacket.h b/Minecraft.World/Network/Packets/ContainerClickPacket.h index 8bea7da53..47c7e4181 100644 --- a/Minecraft.World/Network/Packets/ContainerClickPacket.h +++ b/Minecraft.World/Network/Packets/ContainerClickPacket.h @@ -10,12 +10,12 @@ public: int slotNum; int buttonNum; short uid; - shared_ptr item; + std::shared_ptr item; bool quickKey; ContainerClickPacket(); ~ContainerClickPacket(); - ContainerClickPacket(int containerId, int slotNum, int buttonNum, bool quickKey, shared_ptr item, short uid); + ContainerClickPacket(int containerId, int slotNum, int buttonNum, bool quickKey, std::shared_ptr item, short uid); virtual void handle(PacketListener *listener); virtual void read(DataInputStream *dis); @@ -23,7 +23,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ContainerClickPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ContainerClickPacket()); } virtual int getId() { return 102; } }; diff --git a/Minecraft.World/Network/Packets/ContainerClosePacket.h b/Minecraft.World/Network/Packets/ContainerClosePacket.h index bf032a972..562646fa6 100644 --- a/Minecraft.World/Network/Packets/ContainerClosePacket.h +++ b/Minecraft.World/Network/Packets/ContainerClosePacket.h @@ -17,7 +17,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ContainerClosePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ContainerClosePacket()); } virtual int getId() { return 101; } }; diff --git a/Minecraft.World/Network/Packets/ContainerOpenPacket.h b/Minecraft.World/Network/Packets/ContainerOpenPacket.h index dbc65b9a2..3d351a936 100644 --- a/Minecraft.World/Network/Packets/ContainerOpenPacket.h +++ b/Minecraft.World/Network/Packets/ContainerOpenPacket.h @@ -30,7 +30,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ContainerOpenPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ContainerOpenPacket()); } virtual int getId() { return 100; } }; diff --git a/Minecraft.World/Network/Packets/ContainerSetContentPacket.cpp b/Minecraft.World/Network/Packets/ContainerSetContentPacket.cpp index cb20090a0..86c4039a8 100644 --- a/Minecraft.World/Network/Packets/ContainerSetContentPacket.cpp +++ b/Minecraft.World/Network/Packets/ContainerSetContentPacket.cpp @@ -17,13 +17,13 @@ ContainerSetContentPacket::ContainerSetContentPacket() containerId = 0; } -ContainerSetContentPacket::ContainerSetContentPacket(int containerId, vector > *newItems) +ContainerSetContentPacket::ContainerSetContentPacket(int containerId, vector > *newItems) { this->containerId = containerId; items = ItemInstanceArray((int)newItems->size()); for (unsigned int i = 0; i < items.length; i++) { - shared_ptr item = newItems->at(i); + std::shared_ptr item = newItems->at(i); items[i] = item == NULL ? nullptr : item->copy(); } } diff --git a/Minecraft.World/Network/Packets/ContainerSetContentPacket.h b/Minecraft.World/Network/Packets/ContainerSetContentPacket.h index 10315f58d..8e2a3c5a6 100644 --- a/Minecraft.World/Network/Packets/ContainerSetContentPacket.h +++ b/Minecraft.World/Network/Packets/ContainerSetContentPacket.h @@ -11,7 +11,7 @@ public: ContainerSetContentPacket(); ~ContainerSetContentPacket(); - ContainerSetContentPacket(int containerId, vector > *newItems); + ContainerSetContentPacket(int containerId, vector > *newItems); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); @@ -19,7 +19,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ContainerSetContentPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ContainerSetContentPacket()); } virtual int getId() { return 104; } }; diff --git a/Minecraft.World/Network/Packets/ContainerSetDataPacket.h b/Minecraft.World/Network/Packets/ContainerSetDataPacket.h index ce075e00e..6f694aeb5 100644 --- a/Minecraft.World/Network/Packets/ContainerSetDataPacket.h +++ b/Minecraft.World/Network/Packets/ContainerSetDataPacket.h @@ -19,6 +19,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ContainerSetDataPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ContainerSetDataPacket()); } virtual int getId() { return 105; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/ContainerSetSlotPacket.cpp b/Minecraft.World/Network/Packets/ContainerSetSlotPacket.cpp index 33a042f84..3bcb852ed 100644 --- a/Minecraft.World/Network/Packets/ContainerSetSlotPacket.cpp +++ b/Minecraft.World/Network/Packets/ContainerSetSlotPacket.cpp @@ -18,7 +18,7 @@ ContainerSetSlotPacket::ContainerSetSlotPacket() item = nullptr; } -ContainerSetSlotPacket::ContainerSetSlotPacket(int containerId, int slot, shared_ptr item) +ContainerSetSlotPacket::ContainerSetSlotPacket(int containerId, int slot, std::shared_ptr item) { this->containerId = containerId; this->slot = slot; diff --git a/Minecraft.World/Network/Packets/ContainerSetSlotPacket.h b/Minecraft.World/Network/Packets/ContainerSetSlotPacket.h index 61269df02..f996fc89e 100644 --- a/Minecraft.World/Network/Packets/ContainerSetSlotPacket.h +++ b/Minecraft.World/Network/Packets/ContainerSetSlotPacket.h @@ -12,10 +12,10 @@ public: int containerId; int slot; - shared_ptr item; + std::shared_ptr item; ContainerSetSlotPacket(); - ContainerSetSlotPacket(int containerId, int slot, shared_ptr item); + ContainerSetSlotPacket(int containerId, int slot, std::shared_ptr item); virtual void handle(PacketListener *listener); virtual void read(DataInputStream *dis); @@ -23,7 +23,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ContainerSetSlotPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ContainerSetSlotPacket()); } virtual int getId() { return 103; } }; diff --git a/Minecraft.World/Network/Packets/CraftItemPacket.h b/Minecraft.World/Network/Packets/CraftItemPacket.h index 9793d593a..b08d609ea 100644 --- a/Minecraft.World/Network/Packets/CraftItemPacket.h +++ b/Minecraft.World/Network/Packets/CraftItemPacket.h @@ -22,6 +22,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new CraftItemPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new CraftItemPacket()); } virtual int getId() { return 150; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/CustomPayloadPacket.h b/Minecraft.World/Network/Packets/CustomPayloadPacket.h index 95c5e708d..b794631bd 100644 --- a/Minecraft.World/Network/Packets/CustomPayloadPacket.h +++ b/Minecraft.World/Network/Packets/CustomPayloadPacket.h @@ -30,6 +30,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new CustomPayloadPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new CustomPayloadPacket()); } virtual int getId() { return 250; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/DebugOptionsPacket.h b/Minecraft.World/Network/Packets/DebugOptionsPacket.h index 9ac5ef2f8..d731ebdd0 100644 --- a/Minecraft.World/Network/Packets/DebugOptionsPacket.h +++ b/Minecraft.World/Network/Packets/DebugOptionsPacket.h @@ -21,6 +21,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new DebugOptionsPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new DebugOptionsPacket()); } virtual int getId() { return 152; } }; diff --git a/Minecraft.World/Network/Packets/DisconnectPacket.cpp b/Minecraft.World/Network/Packets/DisconnectPacket.cpp index 79d3f1005..184a4efc2 100644 --- a/Minecraft.World/Network/Packets/DisconnectPacket.cpp +++ b/Minecraft.World/Network/Packets/DisconnectPacket.cpp @@ -44,7 +44,7 @@ bool DisconnectPacket::canBeInvalidated() return true; } -bool DisconnectPacket::isInvalidatedBy(shared_ptr packet) +bool DisconnectPacket::isInvalidatedBy(std::shared_ptr packet) { return true; } \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/DisconnectPacket.h b/Minecraft.World/Network/Packets/DisconnectPacket.h index 349837549..e2815c2c0 100644 --- a/Minecraft.World/Network/Packets/DisconnectPacket.h +++ b/Minecraft.World/Network/Packets/DisconnectPacket.h @@ -63,10 +63,10 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); public: - static shared_ptr create() { return shared_ptr(new DisconnectPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new DisconnectPacket()); } virtual int getId() { return 255; } }; diff --git a/Minecraft.World/Network/Packets/EntityActionAtPositionPacket.cpp b/Minecraft.World/Network/Packets/EntityActionAtPositionPacket.cpp index 9140d1933..0738d3e5a 100644 --- a/Minecraft.World/Network/Packets/EntityActionAtPositionPacket.cpp +++ b/Minecraft.World/Network/Packets/EntityActionAtPositionPacket.cpp @@ -18,7 +18,7 @@ EntityActionAtPositionPacket::EntityActionAtPositionPacket() action = 0; } -EntityActionAtPositionPacket::EntityActionAtPositionPacket(shared_ptr e, int action, int x, int y, int z) +EntityActionAtPositionPacket::EntityActionAtPositionPacket(std::shared_ptr e, int action, int x, int y, int z) { this->action = action; this->x = x; diff --git a/Minecraft.World/Network/Packets/EntityActionAtPositionPacket.h b/Minecraft.World/Network/Packets/EntityActionAtPositionPacket.h index 352020178..57a730d90 100644 --- a/Minecraft.World/Network/Packets/EntityActionAtPositionPacket.h +++ b/Minecraft.World/Network/Packets/EntityActionAtPositionPacket.h @@ -10,7 +10,7 @@ public: int id, x, y, z, action; EntityActionAtPositionPacket(); - EntityActionAtPositionPacket(shared_ptr e, int action, int x, int y, int z); + EntityActionAtPositionPacket(std::shared_ptr e, int action, int x, int y, int z); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); @@ -18,6 +18,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new EntityActionAtPositionPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new EntityActionAtPositionPacket()); } virtual int getId() { return 17; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/EntityEventPacket.h b/Minecraft.World/Network/Packets/EntityEventPacket.h index 716be4e4f..93c66359a 100644 --- a/Minecraft.World/Network/Packets/EntityEventPacket.h +++ b/Minecraft.World/Network/Packets/EntityEventPacket.h @@ -18,7 +18,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new EntityEventPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new EntityEventPacket()); } virtual int getId() { return 38; } }; diff --git a/Minecraft.World/Network/Packets/ExplodePacket.h b/Minecraft.World/Network/Packets/ExplodePacket.h index 69b8ea073..26d6af4b9 100644 --- a/Minecraft.World/Network/Packets/ExplodePacket.h +++ b/Minecraft.World/Network/Packets/ExplodePacket.h @@ -32,6 +32,6 @@ public: float getKnockbackZ(); public: - static shared_ptr create() { return shared_ptr(new ExplodePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ExplodePacket()); } virtual int getId() { return 60; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/GameCommandPacket.h b/Minecraft.World/Network/Packets/GameCommandPacket.h index 08e8e89f9..c353622e0 100644 --- a/Minecraft.World/Network/Packets/GameCommandPacket.h +++ b/Minecraft.World/Network/Packets/GameCommandPacket.h @@ -21,6 +21,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new GameCommandPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new GameCommandPacket()); } virtual int getId() { return 167; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/GameEventPacket.h b/Minecraft.World/Network/Packets/GameEventPacket.h index 93ea911c0..8f54a91e9 100644 --- a/Minecraft.World/Network/Packets/GameEventPacket.h +++ b/Minecraft.World/Network/Packets/GameEventPacket.h @@ -40,6 +40,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new GameEventPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new GameEventPacket()); } virtual int getId() { return 70; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/GetInfoPacket.h b/Minecraft.World/Network/Packets/GetInfoPacket.h index 90688f3e0..cdeb51704 100644 --- a/Minecraft.World/Network/Packets/GetInfoPacket.h +++ b/Minecraft.World/Network/Packets/GetInfoPacket.h @@ -11,6 +11,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new GetInfoPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new GetInfoPacket()); } virtual int getId() { return 254; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/InteractPacket.h b/Minecraft.World/Network/Packets/InteractPacket.h index 0141038d7..97b40fa04 100644 --- a/Minecraft.World/Network/Packets/InteractPacket.h +++ b/Minecraft.World/Network/Packets/InteractPacket.h @@ -20,6 +20,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new InteractPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new InteractPacket()); } virtual int getId() { return 7; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/KeepAlivePacket.cpp b/Minecraft.World/Network/Packets/KeepAlivePacket.cpp index 8d12a415d..b71146d6b 100644 --- a/Minecraft.World/Network/Packets/KeepAlivePacket.cpp +++ b/Minecraft.World/Network/Packets/KeepAlivePacket.cpp @@ -41,7 +41,7 @@ bool KeepAlivePacket::canBeInvalidated() return true; } -bool KeepAlivePacket::isInvalidatedBy(shared_ptr packet) +bool KeepAlivePacket::isInvalidatedBy(std::shared_ptr packet) { return true; } diff --git a/Minecraft.World/Network/Packets/KeepAlivePacket.h b/Minecraft.World/Network/Packets/KeepAlivePacket.h index a44d87456..d05e76d4b 100644 --- a/Minecraft.World/Network/Packets/KeepAlivePacket.h +++ b/Minecraft.World/Network/Packets/KeepAlivePacket.h @@ -16,10 +16,10 @@ public: virtual void write(DataOutputStream *dos); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); virtual bool isAync(); public: - static shared_ptr create() { return shared_ptr(new KeepAlivePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new KeepAlivePacket()); } virtual int getId() { return 0; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/KickPlayerPacket.h b/Minecraft.World/Network/Packets/KickPlayerPacket.h index b9a6ce3e0..62dd0dd19 100644 --- a/Minecraft.World/Network/Packets/KickPlayerPacket.h +++ b/Minecraft.World/Network/Packets/KickPlayerPacket.h @@ -17,6 +17,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new KickPlayerPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new KickPlayerPacket()); } virtual int getId() { return 159; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/LevelEventPacket.h b/Minecraft.World/Network/Packets/LevelEventPacket.h index 6c2fdbaff..78da348a7 100644 --- a/Minecraft.World/Network/Packets/LevelEventPacket.h +++ b/Minecraft.World/Network/Packets/LevelEventPacket.h @@ -19,6 +19,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new LevelEventPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new LevelEventPacket()); } virtual int getId() { return 61; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/LevelSoundPacket.h b/Minecraft.World/Network/Packets/LevelSoundPacket.h index 403ac092b..4e6ede725 100644 --- a/Minecraft.World/Network/Packets/LevelSoundPacket.h +++ b/Minecraft.World/Network/Packets/LevelSoundPacket.h @@ -33,6 +33,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new LevelSoundPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new LevelSoundPacket()); } virtual int getId() { return 62; } }; diff --git a/Minecraft.World/Network/Packets/LoginPacket.h b/Minecraft.World/Network/Packets/LoginPacket.h index 090411358..682270455 100644 --- a/Minecraft.World/Network/Packets/LoginPacket.h +++ b/Minecraft.World/Network/Packets/LoginPacket.h @@ -40,6 +40,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new LoginPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new LoginPacket()); } virtual int getId() { return 1; } }; diff --git a/Minecraft.World/Network/Packets/MoveEntityPacket.cpp b/Minecraft.World/Network/Packets/MoveEntityPacket.cpp index c8a828756..7301b1e9f 100644 --- a/Minecraft.World/Network/Packets/MoveEntityPacket.cpp +++ b/Minecraft.World/Network/Packets/MoveEntityPacket.cpp @@ -58,9 +58,9 @@ bool MoveEntityPacket::canBeInvalidated() return true; } -bool MoveEntityPacket::isInvalidatedBy(shared_ptr packet) +bool MoveEntityPacket::isInvalidatedBy(std::shared_ptr packet) { - shared_ptr target = dynamic_pointer_cast(packet); + std::shared_ptr target = dynamic_pointer_cast(packet); return target != NULL && target->id == id; } diff --git a/Minecraft.World/Network/Packets/MoveEntityPacket.h b/Minecraft.World/Network/Packets/MoveEntityPacket.h index ab16ac3a4..7dbe0c29c 100644 --- a/Minecraft.World/Network/Packets/MoveEntityPacket.h +++ b/Minecraft.World/Network/Packets/MoveEntityPacket.h @@ -24,10 +24,10 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); public: - static shared_ptr create() { return shared_ptr(new MoveEntityPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new MoveEntityPacket()); } virtual int getId() { return 30; } }; @@ -42,7 +42,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new MoveEntityPacket::PosRot()); } + static std::shared_ptr create() { return std::shared_ptr(new MoveEntityPacket::PosRot()); } virtual int getId() { return 33; } }; @@ -57,7 +57,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new MoveEntityPacket::Pos()); } + static std::shared_ptr create() { return std::shared_ptr(new MoveEntityPacket::Pos()); } virtual int getId() { return 31; } }; @@ -72,7 +72,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new MoveEntityPacket::Rot()); } + static std::shared_ptr create() { return std::shared_ptr(new MoveEntityPacket::Rot()); } virtual int getId() { return 32; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/MoveEntityPacketSmall.cpp b/Minecraft.World/Network/Packets/MoveEntityPacketSmall.cpp index 6645b6fbd..120c73342 100644 --- a/Minecraft.World/Network/Packets/MoveEntityPacketSmall.cpp +++ b/Minecraft.World/Network/Packets/MoveEntityPacketSmall.cpp @@ -65,9 +65,9 @@ bool MoveEntityPacketSmall::canBeInvalidated() return true; } -bool MoveEntityPacketSmall::isInvalidatedBy(shared_ptr packet) +bool MoveEntityPacketSmall::isInvalidatedBy(std::shared_ptr packet) { - shared_ptr target = dynamic_pointer_cast(packet); + std::shared_ptr target = dynamic_pointer_cast(packet); return target != NULL && target->id == id; } diff --git a/Minecraft.World/Network/Packets/MoveEntityPacketSmall.h b/Minecraft.World/Network/Packets/MoveEntityPacketSmall.h index 4218f11b9..2fc54dd65 100644 --- a/Minecraft.World/Network/Packets/MoveEntityPacketSmall.h +++ b/Minecraft.World/Network/Packets/MoveEntityPacketSmall.h @@ -24,10 +24,10 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); public: - static shared_ptr create() { return shared_ptr(new MoveEntityPacketSmall()); } + static std::shared_ptr create() { return std::shared_ptr(new MoveEntityPacketSmall()); } virtual int getId() { return 162; } }; @@ -42,7 +42,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new MoveEntityPacketSmall::PosRot()); } + static std::shared_ptr create() { return std::shared_ptr(new MoveEntityPacketSmall::PosRot()); } virtual int getId() { return 165; } }; @@ -57,7 +57,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new MoveEntityPacketSmall::Pos()); } + static std::shared_ptr create() { return std::shared_ptr(new MoveEntityPacketSmall::Pos()); } virtual int getId() { return 163; } }; @@ -73,7 +73,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new MoveEntityPacketSmall::Rot()); } + static std::shared_ptr create() { return std::shared_ptr(new MoveEntityPacketSmall::Rot()); } virtual int getId() { return 164; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/MovePlayerPacket.cpp b/Minecraft.World/Network/Packets/MovePlayerPacket.cpp index 77cb32170..2300e9ae2 100644 --- a/Minecraft.World/Network/Packets/MovePlayerPacket.cpp +++ b/Minecraft.World/Network/Packets/MovePlayerPacket.cpp @@ -63,7 +63,7 @@ bool MovePlayerPacket::canBeInvalidated() return true; } -bool MovePlayerPacket::isInvalidatedBy(shared_ptr packet) +bool MovePlayerPacket::isInvalidatedBy(std::shared_ptr packet) { return true; } diff --git a/Minecraft.World/Network/Packets/MovePlayerPacket.h b/Minecraft.World/Network/Packets/MovePlayerPacket.h index 26ae83927..d91c0c377 100644 --- a/Minecraft.World/Network/Packets/MovePlayerPacket.h +++ b/Minecraft.World/Network/Packets/MovePlayerPacket.h @@ -24,10 +24,10 @@ public: virtual void write(DataOutputStream *dos); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); public: - static shared_ptr create() { return shared_ptr(new MovePlayerPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new MovePlayerPacket()); } virtual int getId() { return 10; } }; @@ -42,7 +42,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new MovePlayerPacket::PosRot()); } + static std::shared_ptr create() { return std::shared_ptr(new MovePlayerPacket::PosRot()); } virtual int getId() { return 13; } }; @@ -57,7 +57,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new MovePlayerPacket::Pos()); } + static std::shared_ptr create() { return std::shared_ptr(new MovePlayerPacket::Pos()); } virtual int getId() { return 11; } }; @@ -72,7 +72,7 @@ public: virtual void write(DataOutputStream *dos); virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new MovePlayerPacket::Rot()); } + static std::shared_ptr create() { return std::shared_ptr(new MovePlayerPacket::Rot()); } virtual int getId() { return 12; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/Packet.cpp b/Minecraft.World/Network/Packets/Packet.cpp index 5856f1560..9a1547b69 100644 --- a/Minecraft.World/Network/Packets/Packet.cpp +++ b/Minecraft.World/Network/Packets/Packet.cpp @@ -211,7 +211,7 @@ void Packet::map(int id, bool receiveOnClient, bool receiveOnServer, bool sendTo } // 4J Added to record data for outgoing packets -void Packet::recordOutgoingPacket(shared_ptr packet) +void Packet::recordOutgoingPacket(std::shared_ptr packet) { #ifndef _CONTENT_PACKAGE #if PACKET_ENABLE_STAT_TRACKING @@ -289,7 +289,7 @@ __int64 Packet::getIndexedStatValue(unsigned int samplePos, unsigned int rendera } -shared_ptr Packet::getPacket(int id) +std::shared_ptr Packet::getPacket(int id) { // 4J - removed try/catch // try @@ -330,7 +330,7 @@ byteArray Packet::readBytes(DataInputStream *datainputstream) } -bool Packet::canSendToAnyClient(shared_ptr packet) +bool Packet::canSendToAnyClient(std::shared_ptr packet) { int packetId = packet->getId(); @@ -349,7 +349,7 @@ unordered_map Packet::statistics = unordered_ma //int Packet::nextPrint = 0; -shared_ptr Packet::readPacket(DataInputStream *dis, bool isServer) // throws IOException TODO 4J JEV, should this declare a throws? +std::shared_ptr Packet::readPacket(DataInputStream *dis, bool isServer) // throws IOException TODO 4J JEV, should this declare a throws? { // N packet ID static int s_clientPktHistory[64]; @@ -360,7 +360,7 @@ shared_ptr Packet::readPacket(DataInputStream *dis, bool isServer) // th static bool s_serverDesyncLogged = false; int id = 0; - shared_ptr packet = nullptr; + std::shared_ptr packet = nullptr; // 4J - removed try/catch // try @@ -430,7 +430,7 @@ shared_ptr Packet::readPacket(DataInputStream *dis, bool isServer) // th return packet; } -void Packet::writePacket(shared_ptr packet, DataOutputStream *dos) // throws IOException TODO 4J JEV, should this declare a throws? +void Packet::writePacket(std::shared_ptr packet, DataOutputStream *dos) // throws IOException TODO 4J JEV, should this declare a throws? { //app.DebugPrintf("Writing packet %d\n", packet->getId()); dos->write(packet->getId()); @@ -548,7 +548,7 @@ bool Packet::canBeInvalidated() return false; } -bool Packet::isInvalidatedBy(shared_ptr packet) +bool Packet::isInvalidatedBy(std::shared_ptr packet) { return false; } @@ -559,16 +559,16 @@ bool Packet::isAync() } // 4J Stu - Brought these functions forward for enchanting/game rules -shared_ptr Packet::readItem(DataInputStream *dis) +std::shared_ptr Packet::readItem(DataInputStream *dis) { - shared_ptr item = nullptr; + std::shared_ptr item = nullptr; int id = dis->readShort(); if (id >= 0) { int count = dis->readByte(); int damage = dis->readShort(); - item = shared_ptr( new ItemInstance(id, count, damage) ); + item = std::shared_ptr( new ItemInstance(id, count, damage) ); // 4J Stu - Always read/write the tag //if (Item.items[id].canBeDepleted() || Item.items[id].shouldOverrideMultiplayerNBT()) { @@ -579,7 +579,7 @@ shared_ptr Packet::readItem(DataInputStream *dis) return item; } -void Packet::writeItem(shared_ptr item, DataOutputStream *dos) +void Packet::writeItem(std::shared_ptr item, DataOutputStream *dos) { if (item == NULL) { diff --git a/Minecraft.World/Network/Packets/Packet.h b/Minecraft.World/Network/Packets/Packet.h index 60410df39..1349e1c3e 100644 --- a/Minecraft.World/Network/Packets/Packet.h +++ b/Minecraft.World/Network/Packets/Packet.h @@ -10,7 +10,7 @@ class DataOutputStream; class Packet; -typedef shared_ptr (*packetCreateFn)(); +typedef std::shared_ptr (*packetCreateFn)(); class Packet { @@ -62,10 +62,10 @@ public: Packet(); - static shared_ptr getPacket(int id); + static std::shared_ptr getPacket(int id); // 4J Added - static bool canSendToAnyClient(shared_ptr packet); + static bool canSendToAnyClient(std::shared_ptr packet); static void writeBytes(DataOutputStream *dataoutputstream, byteArray bytes); static byteArray readBytes(DataInputStream *datainputstream); @@ -80,7 +80,7 @@ private: static vector renderableStats; static int renderPos; public: - static void recordOutgoingPacket(shared_ptr packet); + static void recordOutgoingPacket(std::shared_ptr packet); static void renderPacketStats(int id); static void renderAllPacketStats(); static void renderAllPacketStatsKey(); @@ -91,8 +91,8 @@ private : //static int nextPrint; public: - static shared_ptr readPacket(DataInputStream *dis, bool isServer); - static void writePacket(shared_ptr packet, DataOutputStream *dos); + static std::shared_ptr readPacket(DataInputStream *dis, bool isServer); + static void writePacket(std::shared_ptr packet, DataOutputStream *dos); static void writeUtf(const wstring& value, DataOutputStream *dos); static wstring readUtf(DataInputStream *dis, int maxLength); virtual void read(DataInputStream *dis) = 0; // throws IOException = 0; TODO 4J JEV, should this declare a throws? @@ -100,12 +100,12 @@ public: virtual void handle(PacketListener *listener) = 0; virtual int getEstimatedSize() = 0; virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); virtual bool isAync(); // 4J Stu - Brought these functions forward for enchanting/game rules - static shared_ptr readItem(DataInputStream *dis); - static void writeItem(shared_ptr item, DataOutputStream *dos); + static std::shared_ptr readItem(DataInputStream *dis); + static void writeItem(std::shared_ptr item, DataOutputStream *dos); static CompoundTag *readNbt(DataInputStream *dis); protected: diff --git a/Minecraft.World/Network/Packets/PacketListener.cpp b/Minecraft.World/Network/Packets/PacketListener.cpp index 604fbc1cb..ae307c5ea 100644 --- a/Minecraft.World/Network/Packets/PacketListener.cpp +++ b/Minecraft.World/Network/Packets/PacketListener.cpp @@ -2,11 +2,11 @@ #include "../../Headers/net.minecraft.network.packet.h" #include "PacketListener.h" -void PacketListener::handleBlockRegionUpdate(shared_ptr packet) +void PacketListener::handleBlockRegionUpdate(std::shared_ptr packet) { } -void PacketListener::onUnhandledPacket(shared_ptr packet) +void PacketListener::onUnhandledPacket(std::shared_ptr packet) { } @@ -14,371 +14,371 @@ void PacketListener::onDisconnect(DisconnectPacket::eDisconnectReason reason, vo { } -void PacketListener::handleDisconnect(shared_ptr packet) +void PacketListener::handleDisconnect(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleLogin(shared_ptr packet) +void PacketListener::handleLogin(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleMovePlayer(shared_ptr packet) +void PacketListener::handleMovePlayer(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleChunkTilesUpdate(shared_ptr packet) +void PacketListener::handleChunkTilesUpdate(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handlePlayerAction(shared_ptr packet) +void PacketListener::handlePlayerAction(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleTileUpdate(shared_ptr packet) +void PacketListener::handleTileUpdate(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleChunkVisibility(shared_ptr packet) +void PacketListener::handleChunkVisibility(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleAddPlayer(shared_ptr packet) +void PacketListener::handleAddPlayer(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleMoveEntity(shared_ptr packet) +void PacketListener::handleMoveEntity(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleMoveEntitySmall(shared_ptr packet) +void PacketListener::handleMoveEntitySmall(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleTeleportEntity(shared_ptr packet) +void PacketListener::handleTeleportEntity(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleUseItem(shared_ptr packet) +void PacketListener::handleUseItem(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleSetCarriedItem(shared_ptr packet) +void PacketListener::handleSetCarriedItem(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleRemoveEntity(shared_ptr packet) +void PacketListener::handleRemoveEntity(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleTakeItemEntity(shared_ptr packet) +void PacketListener::handleTakeItemEntity(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleChat(shared_ptr packet) +void PacketListener::handleChat(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleAddEntity(shared_ptr packet) +void PacketListener::handleAddEntity(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleAnimate(shared_ptr packet) +void PacketListener::handleAnimate(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handlePlayerCommand(shared_ptr packet) +void PacketListener::handlePlayerCommand(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handlePreLogin(shared_ptr packet) +void PacketListener::handlePreLogin(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleAddMob(shared_ptr packet) +void PacketListener::handleAddMob(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleSetTime(shared_ptr packet) +void PacketListener::handleSetTime(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleSetSpawn(shared_ptr packet) +void PacketListener::handleSetSpawn(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleSetEntityMotion(shared_ptr packet) +void PacketListener::handleSetEntityMotion(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleSetEntityData(shared_ptr packet) +void PacketListener::handleSetEntityData(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleRidePacket(shared_ptr packet) +void PacketListener::handleRidePacket(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleInteract(shared_ptr packet) +void PacketListener::handleInteract(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleEntityEvent(shared_ptr packet) +void PacketListener::handleEntityEvent(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleSetHealth(shared_ptr packet) +void PacketListener::handleSetHealth(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleRespawn(shared_ptr packet) +void PacketListener::handleRespawn(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleTexture(shared_ptr packet) +void PacketListener::handleTexture(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleTextureAndGeometry(shared_ptr packet) +void PacketListener::handleTextureAndGeometry(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleExplosion(shared_ptr packet) +void PacketListener::handleExplosion(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleContainerOpen(shared_ptr packet) +void PacketListener::handleContainerOpen(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleContainerClose(shared_ptr packet) +void PacketListener::handleContainerClose(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleContainerClick(shared_ptr packet) +void PacketListener::handleContainerClick(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleContainerSetSlot(shared_ptr packet) +void PacketListener::handleContainerSetSlot(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleContainerContent(shared_ptr packet) +void PacketListener::handleContainerContent(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleSignUpdate(shared_ptr packet) +void PacketListener::handleSignUpdate(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleContainerSetData(shared_ptr packet) +void PacketListener::handleContainerSetData(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleSetEquippedItem(shared_ptr packet) +void PacketListener::handleSetEquippedItem(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleContainerAck(shared_ptr packet) +void PacketListener::handleContainerAck(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleAddPainting(shared_ptr packet) +void PacketListener::handleAddPainting(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleTileEvent(shared_ptr packet) +void PacketListener::handleTileEvent(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleAwardStat(shared_ptr packet) +void PacketListener::handleAwardStat(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleEntityActionAtPosition(shared_ptr packet) +void PacketListener::handleEntityActionAtPosition(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handlePlayerInput(shared_ptr packet) +void PacketListener::handlePlayerInput(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleGameEvent(shared_ptr packet) +void PacketListener::handleGameEvent(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleAddGlobalEntity(shared_ptr packet) +void PacketListener::handleAddGlobalEntity(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleComplexItemData(shared_ptr packet) +void PacketListener::handleComplexItemData(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleLevelEvent(shared_ptr packet) +void PacketListener::handleLevelEvent(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } // 1.8.2 -void PacketListener::handleGetInfo(shared_ptr packet) +void PacketListener::handleGetInfo(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleUpdateMobEffect(shared_ptr packet) +void PacketListener::handleUpdateMobEffect(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleRemoveMobEffect(shared_ptr packet) +void PacketListener::handleRemoveMobEffect(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handlePlayerInfo(shared_ptr packet) +void PacketListener::handlePlayerInfo(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleKeepAlive(shared_ptr packet) +void PacketListener::handleKeepAlive(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleSetExperience(shared_ptr packet) +void PacketListener::handleSetExperience(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleSetCreativeModeSlot(shared_ptr packet) +void PacketListener::handleSetCreativeModeSlot(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleAddExperienceOrb(shared_ptr packet) +void PacketListener::handleAddExperienceOrb(std::shared_ptr packet) { onUnhandledPacket(packet); } // 1.0.1 -void PacketListener::handleContainerButtonClick(shared_ptr packet) +void PacketListener::handleContainerButtonClick(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleTileEntityData(shared_ptr tileEntityDataPacket) +void PacketListener::handleTileEntityData(std::shared_ptr tileEntityDataPacket) { onUnhandledPacket(tileEntityDataPacket); } // 1.1 -void PacketListener::handleCustomPayload(shared_ptr customPayloadPacket) +void PacketListener::handleCustomPayload(std::shared_ptr customPayloadPacket) { onUnhandledPacket(customPayloadPacket); } // 1.2.3 -void PacketListener::handleRotateMob(shared_ptr rotateMobPacket) +void PacketListener::handleRotateMob(std::shared_ptr rotateMobPacket) { onUnhandledPacket(rotateMobPacket); } // 1.3.2 -void PacketListener::handleClientProtocolPacket(shared_ptr packet) +void PacketListener::handleClientProtocolPacket(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleServerAuthData(shared_ptr packet) +void PacketListener::handleServerAuthData(std::shared_ptr packet) { onUnhandledPacket(packet); } -//void PacketListener::handleSharedKey(shared_ptr packet) +//void PacketListener::handleSharedKey(std::shared_ptr packet) //{ // onUnhandledPacket(packet); //} -void PacketListener::handlePlayerAbilities(shared_ptr playerAbilitiesPacket) +void PacketListener::handlePlayerAbilities(std::shared_ptr playerAbilitiesPacket) { onUnhandledPacket(playerAbilitiesPacket); } -void PacketListener::handleChatAutoComplete(shared_ptr packet) +void PacketListener::handleChatAutoComplete(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleClientInformation(shared_ptr packet) +void PacketListener::handleClientInformation(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleSoundEvent(shared_ptr packet) +void PacketListener::handleSoundEvent(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleTileDestruction(shared_ptr packet) +void PacketListener::handleTileDestruction(std::shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleClientCommand(shared_ptr packet) +void PacketListener::handleClientCommand(std::shared_ptr packet) { } -//void PacketListener::handleLevelChunks(shared_ptr packet) +//void PacketListener::handleLevelChunks(std::shared_ptr packet) //{ // onUnhandledPacket(packet); //} @@ -390,62 +390,62 @@ bool PacketListener::canHandleAsyncPackets() // 4J Added -void PacketListener::handleCraftItem(shared_ptr packet) +void PacketListener::handleCraftItem(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleTradeItem(shared_ptr packet) +void PacketListener::handleTradeItem(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleDebugOptions(shared_ptr packet) +void PacketListener::handleDebugOptions(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleServerSettingsChanged(shared_ptr packet) +void PacketListener::handleServerSettingsChanged(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleChunkVisibilityArea(shared_ptr packet) +void PacketListener::handleChunkVisibilityArea(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleUpdateProgress(shared_ptr packet) +void PacketListener::handleUpdateProgress(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleTextureChange(shared_ptr packet) +void PacketListener::handleTextureChange(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleTextureAndGeometryChange(shared_ptr packet) +void PacketListener::handleTextureAndGeometryChange(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleUpdateGameRuleProgressPacket(shared_ptr packet) +void PacketListener::handleUpdateGameRuleProgressPacket(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleKickPlayer(shared_ptr packet) +void PacketListener::handleKickPlayer(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleXZ(shared_ptr packet) +void PacketListener::handleXZ(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } -void PacketListener::handleGameCommand(shared_ptr packet) +void PacketListener::handleGameCommand(std::shared_ptr packet) { - onUnhandledPacket( (shared_ptr ) packet); + onUnhandledPacket( (std::shared_ptr ) packet); } diff --git a/Minecraft.World/Network/Packets/PacketListener.h b/Minecraft.World/Network/Packets/PacketListener.h index 93b146039..c336e9d22 100644 --- a/Minecraft.World/Network/Packets/PacketListener.h +++ b/Minecraft.World/Network/Packets/PacketListener.h @@ -107,105 +107,105 @@ class PacketListener { public: virtual bool isServerPacketListener() = 0; - virtual void handleBlockRegionUpdate(shared_ptr packet); - virtual void onUnhandledPacket(shared_ptr packet); + virtual void handleBlockRegionUpdate(std::shared_ptr packet); + virtual void onUnhandledPacket(std::shared_ptr packet); virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects); - virtual void handleDisconnect(shared_ptr packet); - virtual void handleLogin(shared_ptr packet); - virtual void handleMovePlayer(shared_ptr packet); - virtual void handleChunkTilesUpdate(shared_ptr packet); - virtual void handlePlayerAction(shared_ptr packet); - virtual void handleTileUpdate(shared_ptr packet); - virtual void handleChunkVisibility(shared_ptr packet); - virtual void handleAddPlayer(shared_ptr packet); - virtual void handleMoveEntity(shared_ptr packet); - virtual void handleMoveEntitySmall(shared_ptr packet); - virtual void handleTeleportEntity(shared_ptr packet); - virtual void handleUseItem(shared_ptr packet); - virtual void handleSetCarriedItem(shared_ptr packet); - virtual void handleRemoveEntity(shared_ptr packet); - virtual void handleTakeItemEntity(shared_ptr packet); - virtual void handleChat(shared_ptr packet); - virtual void handleAddEntity(shared_ptr packet); - virtual void handleAnimate(shared_ptr packet); - virtual void handlePlayerCommand(shared_ptr packet); - virtual void handlePreLogin(shared_ptr packet); - virtual void handleAddMob(shared_ptr packet); - virtual void handleSetTime(shared_ptr packet); - virtual void handleSetSpawn(shared_ptr packet); - virtual void handleSetEntityMotion(shared_ptr packet); - virtual void handleSetEntityData(shared_ptr packet); - virtual void handleRidePacket(shared_ptr packet); - virtual void handleInteract(shared_ptr packet); - virtual void handleEntityEvent(shared_ptr packet); - virtual void handleSetHealth(shared_ptr packet); - virtual void handleRespawn(shared_ptr packet); - virtual void handleExplosion(shared_ptr packet); - virtual void handleContainerOpen(shared_ptr packet); - virtual void handleContainerClose(shared_ptr packet); - virtual void handleContainerClick(shared_ptr packet); - virtual void handleContainerSetSlot(shared_ptr packet); - virtual void handleContainerContent(shared_ptr packet); - virtual void handleSignUpdate(shared_ptr packet); - virtual void handleContainerSetData(shared_ptr packet); - virtual void handleSetEquippedItem(shared_ptr packet); - virtual void handleContainerAck(shared_ptr packet); - virtual void handleAddPainting(shared_ptr packet); - virtual void handleTileEvent(shared_ptr packet); - virtual void handleAwardStat(shared_ptr packet); - virtual void handleEntityActionAtPosition(shared_ptr packet); - virtual void handlePlayerInput(shared_ptr packet); - virtual void handleGameEvent(shared_ptr packet); - virtual void handleAddGlobalEntity(shared_ptr packet); - virtual void handleComplexItemData(shared_ptr packet); - virtual void handleLevelEvent(shared_ptr packet); + virtual void handleDisconnect(std::shared_ptr packet); + virtual void handleLogin(std::shared_ptr packet); + virtual void handleMovePlayer(std::shared_ptr packet); + virtual void handleChunkTilesUpdate(std::shared_ptr packet); + virtual void handlePlayerAction(std::shared_ptr packet); + virtual void handleTileUpdate(std::shared_ptr packet); + virtual void handleChunkVisibility(std::shared_ptr packet); + virtual void handleAddPlayer(std::shared_ptr packet); + virtual void handleMoveEntity(std::shared_ptr packet); + virtual void handleMoveEntitySmall(std::shared_ptr packet); + virtual void handleTeleportEntity(std::shared_ptr packet); + virtual void handleUseItem(std::shared_ptr packet); + virtual void handleSetCarriedItem(std::shared_ptr packet); + virtual void handleRemoveEntity(std::shared_ptr packet); + virtual void handleTakeItemEntity(std::shared_ptr packet); + virtual void handleChat(std::shared_ptr packet); + virtual void handleAddEntity(std::shared_ptr packet); + virtual void handleAnimate(std::shared_ptr packet); + virtual void handlePlayerCommand(std::shared_ptr packet); + virtual void handlePreLogin(std::shared_ptr packet); + virtual void handleAddMob(std::shared_ptr packet); + virtual void handleSetTime(std::shared_ptr packet); + virtual void handleSetSpawn(std::shared_ptr packet); + virtual void handleSetEntityMotion(std::shared_ptr packet); + virtual void handleSetEntityData(std::shared_ptr packet); + virtual void handleRidePacket(std::shared_ptr packet); + virtual void handleInteract(std::shared_ptr packet); + virtual void handleEntityEvent(std::shared_ptr packet); + virtual void handleSetHealth(std::shared_ptr packet); + virtual void handleRespawn(std::shared_ptr packet); + virtual void handleExplosion(std::shared_ptr packet); + virtual void handleContainerOpen(std::shared_ptr packet); + virtual void handleContainerClose(std::shared_ptr packet); + virtual void handleContainerClick(std::shared_ptr packet); + virtual void handleContainerSetSlot(std::shared_ptr packet); + virtual void handleContainerContent(std::shared_ptr packet); + virtual void handleSignUpdate(std::shared_ptr packet); + virtual void handleContainerSetData(std::shared_ptr packet); + virtual void handleSetEquippedItem(std::shared_ptr packet); + virtual void handleContainerAck(std::shared_ptr packet); + virtual void handleAddPainting(std::shared_ptr packet); + virtual void handleTileEvent(std::shared_ptr packet); + virtual void handleAwardStat(std::shared_ptr packet); + virtual void handleEntityActionAtPosition(std::shared_ptr packet); + virtual void handlePlayerInput(std::shared_ptr packet); + virtual void handleGameEvent(std::shared_ptr packet); + virtual void handleAddGlobalEntity(std::shared_ptr packet); + virtual void handleComplexItemData(std::shared_ptr packet); + virtual void handleLevelEvent(std::shared_ptr packet); // 1.8.2 - virtual void handleGetInfo(shared_ptr packet); - virtual void handleUpdateMobEffect(shared_ptr packet); - virtual void handleRemoveMobEffect(shared_ptr packet); - virtual void handlePlayerInfo(shared_ptr packet); - virtual void handleKeepAlive(shared_ptr packet); - virtual void handleSetExperience(shared_ptr packet); - virtual void handleSetCreativeModeSlot(shared_ptr packet); - virtual void handleAddExperienceOrb(shared_ptr packet); + virtual void handleGetInfo(std::shared_ptr packet); + virtual void handleUpdateMobEffect(std::shared_ptr packet); + virtual void handleRemoveMobEffect(std::shared_ptr packet); + virtual void handlePlayerInfo(std::shared_ptr packet); + virtual void handleKeepAlive(std::shared_ptr packet); + virtual void handleSetExperience(std::shared_ptr packet); + virtual void handleSetCreativeModeSlot(std::shared_ptr packet); + virtual void handleAddExperienceOrb(std::shared_ptr packet); // 1.0.1 - virtual void handleContainerButtonClick(shared_ptr packet); - virtual void handleTileEntityData(shared_ptr tileEntityDataPacket); + virtual void handleContainerButtonClick(std::shared_ptr packet); + virtual void handleTileEntityData(std::shared_ptr tileEntityDataPacket); // 1.1s - virtual void handleCustomPayload(shared_ptr customPayloadPacket); + virtual void handleCustomPayload(std::shared_ptr customPayloadPacket); // 1.2.3 - virtual void handleRotateMob(shared_ptr rotateMobPacket); + virtual void handleRotateMob(std::shared_ptr rotateMobPacket); // 1.3.2 - virtual void handleClientProtocolPacket(shared_ptr packet); - virtual void handleServerAuthData(shared_ptr packet); - //virtual void handleSharedKey(shared_ptr packet); - virtual void handlePlayerAbilities(shared_ptr playerAbilitiesPacket); - virtual void handleChatAutoComplete(shared_ptr packet); - virtual void handleClientInformation(shared_ptr packet); - virtual void handleSoundEvent(shared_ptr packet); - virtual void handleTileDestruction(shared_ptr packet); - virtual void handleClientCommand(shared_ptr packet); - //virtual void handleLevelChunks(shared_ptr packet); + virtual void handleClientProtocolPacket(std::shared_ptr packet); + virtual void handleServerAuthData(std::shared_ptr packet); + //virtual void handleSharedKey(std::shared_ptr packet); + virtual void handlePlayerAbilities(std::shared_ptr playerAbilitiesPacket); + virtual void handleChatAutoComplete(std::shared_ptr packet); + virtual void handleClientInformation(std::shared_ptr packet); + virtual void handleSoundEvent(std::shared_ptr packet); + virtual void handleTileDestruction(std::shared_ptr packet); + virtual void handleClientCommand(std::shared_ptr packet); + //virtual void handleLevelChunks(std::shared_ptr packet); virtual bool canHandleAsyncPackets(); // 4J Added - virtual void handleCraftItem(shared_ptr packet); - virtual void handleTradeItem(shared_ptr packet); - virtual void handleDebugOptions(shared_ptr packet); - virtual void handleServerSettingsChanged(shared_ptr packet); - virtual void handleTexture(shared_ptr packet); - virtual void handleTextureAndGeometry(shared_ptr packet); - virtual void handleChunkVisibilityArea(shared_ptr packet); - virtual void handleUpdateProgress(shared_ptr packet); - virtual void handleTextureChange(shared_ptr packet); - virtual void handleTextureAndGeometryChange(shared_ptr packet); - virtual void handleUpdateGameRuleProgressPacket(shared_ptr packet); - virtual void handleKickPlayer(shared_ptr packet); - virtual void handleXZ(shared_ptr packet); - virtual void handleGameCommand(shared_ptr packet); + virtual void handleCraftItem(std::shared_ptr packet); + virtual void handleTradeItem(std::shared_ptr packet); + virtual void handleDebugOptions(std::shared_ptr packet); + virtual void handleServerSettingsChanged(std::shared_ptr packet); + virtual void handleTexture(std::shared_ptr packet); + virtual void handleTextureAndGeometry(std::shared_ptr packet); + virtual void handleChunkVisibilityArea(std::shared_ptr packet); + virtual void handleUpdateProgress(std::shared_ptr packet); + virtual void handleTextureChange(std::shared_ptr packet); + virtual void handleTextureAndGeometryChange(std::shared_ptr packet); + virtual void handleUpdateGameRuleProgressPacket(std::shared_ptr packet); + virtual void handleKickPlayer(std::shared_ptr packet); + virtual void handleXZ(std::shared_ptr packet); + virtual void handleGameCommand(std::shared_ptr packet); }; diff --git a/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.cpp b/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.cpp index 43bff16ac..dd3e33a3c 100644 --- a/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.cpp +++ b/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.cpp @@ -131,7 +131,7 @@ bool PlayerAbilitiesPacket::canBeInvalidated() return true; } -bool PlayerAbilitiesPacket::isInvalidatedBy(shared_ptr packet) +bool PlayerAbilitiesPacket::isInvalidatedBy(std::shared_ptr packet) { return true; } \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.h b/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.h index 21c1fdc2d..8a6e43a37 100644 --- a/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.h +++ b/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.h @@ -42,9 +42,9 @@ public: float getWalkingSpeed(); void setWalkingSpeed(float walkingSpeed); bool canBeInvalidated(); - bool isInvalidatedBy(shared_ptr packet); + bool isInvalidatedBy(std::shared_ptr packet); public: - static shared_ptr create() { return shared_ptr(new PlayerAbilitiesPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new PlayerAbilitiesPacket()); } virtual int getId() { return 202; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/PlayerActionPacket.h b/Minecraft.World/Network/Packets/PlayerActionPacket.h index 0228ebb43..35221628c 100644 --- a/Minecraft.World/Network/Packets/PlayerActionPacket.h +++ b/Minecraft.World/Network/Packets/PlayerActionPacket.h @@ -24,7 +24,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new PlayerActionPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new PlayerActionPacket()); } virtual int getId() { return 14; } }; diff --git a/Minecraft.World/Network/Packets/PlayerCommandPacket.cpp b/Minecraft.World/Network/Packets/PlayerCommandPacket.cpp index 0945a6196..8ab08451d 100644 --- a/Minecraft.World/Network/Packets/PlayerCommandPacket.cpp +++ b/Minecraft.World/Network/Packets/PlayerCommandPacket.cpp @@ -22,7 +22,7 @@ PlayerCommandPacket::PlayerCommandPacket() action = 0; } -PlayerCommandPacket::PlayerCommandPacket(shared_ptr e, int action) +PlayerCommandPacket::PlayerCommandPacket(std::shared_ptr e, int action) { id = e->entityId; this->action = action; diff --git a/Minecraft.World/Network/Packets/PlayerCommandPacket.h b/Minecraft.World/Network/Packets/PlayerCommandPacket.h index dd6c8cb15..5e5583581 100644 --- a/Minecraft.World/Network/Packets/PlayerCommandPacket.h +++ b/Minecraft.World/Network/Packets/PlayerCommandPacket.h @@ -25,13 +25,13 @@ public: int action; PlayerCommandPacket(); - PlayerCommandPacket(shared_ptr e, int action); + PlayerCommandPacket(std::shared_ptr e, int action); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new PlayerCommandPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new PlayerCommandPacket()); } virtual int getId() { return 19; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/PlayerInfoPacket.cpp b/Minecraft.World/Network/Packets/PlayerInfoPacket.cpp index 324893fb6..488759f26 100644 --- a/Minecraft.World/Network/Packets/PlayerInfoPacket.cpp +++ b/Minecraft.World/Network/Packets/PlayerInfoPacket.cpp @@ -27,7 +27,7 @@ PlayerInfoPacket::PlayerInfoPacket(BYTE networkSmallId, short playerColourIndex, m_entityId = -1; } -PlayerInfoPacket::PlayerInfoPacket(shared_ptr player) +PlayerInfoPacket::PlayerInfoPacket(std::shared_ptr player) { m_networkSmallId = 0; if(player->connection != NULL && player->connection->getNetworkPlayer() != NULL) m_networkSmallId = player->connection->getNetworkPlayer()->GetSmallId(); diff --git a/Minecraft.World/Network/Packets/PlayerInfoPacket.h b/Minecraft.World/Network/Packets/PlayerInfoPacket.h index 85e2ed648..f4ad972fa 100644 --- a/Minecraft.World/Network/Packets/PlayerInfoPacket.h +++ b/Minecraft.World/Network/Packets/PlayerInfoPacket.h @@ -19,7 +19,7 @@ class PlayerInfoPacket : public Packet, public enable_shared_from_this player); + PlayerInfoPacket(std::shared_ptr player); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); @@ -27,6 +27,6 @@ class PlayerInfoPacket : public Packet, public enable_shared_from_this create() { return shared_ptr(new PlayerInfoPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new PlayerInfoPacket()); } virtual int getId() { return 201; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/PlayerInputPacket.h b/Minecraft.World/Network/Packets/PlayerInputPacket.h index 8bc11d3ee..93bbf7977 100644 --- a/Minecraft.World/Network/Packets/PlayerInputPacket.h +++ b/Minecraft.World/Network/Packets/PlayerInputPacket.h @@ -31,6 +31,6 @@ public: bool isSneaking(); public: - static shared_ptr create() { return shared_ptr(new PlayerInputPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new PlayerInputPacket()); } virtual int getId() { return 27; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/PreLoginPacket.h b/Minecraft.World/Network/Packets/PreLoginPacket.h index 243f2f360..2d73d6300 100644 --- a/Minecraft.World/Network/Packets/PreLoginPacket.h +++ b/Minecraft.World/Network/Packets/PreLoginPacket.h @@ -34,6 +34,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new PreLoginPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new PreLoginPacket()); } virtual int getId() { return 2; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/RemoveEntitiesPacket.h b/Minecraft.World/Network/Packets/RemoveEntitiesPacket.h index c77a73410..7d9bd15f1 100644 --- a/Minecraft.World/Network/Packets/RemoveEntitiesPacket.h +++ b/Minecraft.World/Network/Packets/RemoveEntitiesPacket.h @@ -21,7 +21,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new RemoveEntitiesPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new RemoveEntitiesPacket()); } virtual int getId() { return 29; } }; diff --git a/Minecraft.World/Network/Packets/RemoveMobEffectPacket.h b/Minecraft.World/Network/Packets/RemoveMobEffectPacket.h index d69a4ed4a..ade1ed1b1 100644 --- a/Minecraft.World/Network/Packets/RemoveMobEffectPacket.h +++ b/Minecraft.World/Network/Packets/RemoveMobEffectPacket.h @@ -18,6 +18,6 @@ class RemoveMobEffectPacket : public Packet, public enable_shared_from_this create() { return shared_ptr(new RemoveMobEffectPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new RemoveMobEffectPacket()); } virtual int getId() { return 42; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/RespawnPacket.h b/Minecraft.World/Network/Packets/RespawnPacket.h index dc341ea17..fb9fb0946 100644 --- a/Minecraft.World/Network/Packets/RespawnPacket.h +++ b/Minecraft.World/Network/Packets/RespawnPacket.h @@ -29,6 +29,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new RespawnPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new RespawnPacket()); } virtual int getId() { return 9; } }; diff --git a/Minecraft.World/Network/Packets/RotateHeadPacket.cpp b/Minecraft.World/Network/Packets/RotateHeadPacket.cpp index 694e94a62..04606baa3 100644 --- a/Minecraft.World/Network/Packets/RotateHeadPacket.cpp +++ b/Minecraft.World/Network/Packets/RotateHeadPacket.cpp @@ -39,9 +39,9 @@ bool RotateHeadPacket::canBeInvalidated() return true; } -bool RotateHeadPacket::isInvalidatedBy(shared_ptr packet) +bool RotateHeadPacket::isInvalidatedBy(std::shared_ptr packet) { - shared_ptr target = dynamic_pointer_cast(packet); + std::shared_ptr target = dynamic_pointer_cast(packet); return target->id == id; } diff --git a/Minecraft.World/Network/Packets/RotateHeadPacket.h b/Minecraft.World/Network/Packets/RotateHeadPacket.h index d846902f4..8fffaf66d 100644 --- a/Minecraft.World/Network/Packets/RotateHeadPacket.h +++ b/Minecraft.World/Network/Packets/RotateHeadPacket.h @@ -18,10 +18,10 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); virtual bool isAync(); public: - static shared_ptr create() { return shared_ptr(new RotateHeadPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new RotateHeadPacket()); } virtual int getId() { return 35; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/ServerSettingsChangedPacket.h b/Minecraft.World/Network/Packets/ServerSettingsChangedPacket.h index e6ab73563..b929348fc 100644 --- a/Minecraft.World/Network/Packets/ServerSettingsChangedPacket.h +++ b/Minecraft.World/Network/Packets/ServerSettingsChangedPacket.h @@ -26,6 +26,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new ServerSettingsChangedPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new ServerSettingsChangedPacket()); } virtual int getId() { return 153; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SetCarriedItemPacket.cpp b/Minecraft.World/Network/Packets/SetCarriedItemPacket.cpp index ba77d7213..877928196 100644 --- a/Minecraft.World/Network/Packets/SetCarriedItemPacket.cpp +++ b/Minecraft.World/Network/Packets/SetCarriedItemPacket.cpp @@ -41,7 +41,7 @@ bool SetCarriedItemPacket::canBeInvalidated() return true; } -bool SetCarriedItemPacket::isInvalidatedBy(shared_ptr packet) +bool SetCarriedItemPacket::isInvalidatedBy(std::shared_ptr packet) { return true; } \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SetCarriedItemPacket.h b/Minecraft.World/Network/Packets/SetCarriedItemPacket.h index 06fb3c306..d9b6c94ae 100644 --- a/Minecraft.World/Network/Packets/SetCarriedItemPacket.h +++ b/Minecraft.World/Network/Packets/SetCarriedItemPacket.h @@ -16,9 +16,9 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); public: - static shared_ptr create() { return shared_ptr(new SetCarriedItemPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new SetCarriedItemPacket()); } virtual int getId() { return 16; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SetCreativeModeSlotPacket.cpp b/Minecraft.World/Network/Packets/SetCreativeModeSlotPacket.cpp index 08f010cf2..6e9247d0d 100644 --- a/Minecraft.World/Network/Packets/SetCreativeModeSlotPacket.cpp +++ b/Minecraft.World/Network/Packets/SetCreativeModeSlotPacket.cpp @@ -11,11 +11,11 @@ SetCreativeModeSlotPacket::SetCreativeModeSlotPacket() this->item = nullptr; } -SetCreativeModeSlotPacket::SetCreativeModeSlotPacket(int slotNum, shared_ptr item) +SetCreativeModeSlotPacket::SetCreativeModeSlotPacket(int slotNum, std::shared_ptr item) { this->slotNum = slotNum; // 4J - take copy of item as we want our packets to have full ownership of any referenced data - this->item = item ? item->copy() : shared_ptr(); + this->item = item ? item->copy() : std::shared_ptr(); } void SetCreativeModeSlotPacket::handle(PacketListener *listener) diff --git a/Minecraft.World/Network/Packets/SetCreativeModeSlotPacket.h b/Minecraft.World/Network/Packets/SetCreativeModeSlotPacket.h index 94ae7807f..ca46bf989 100644 --- a/Minecraft.World/Network/Packets/SetCreativeModeSlotPacket.h +++ b/Minecraft.World/Network/Packets/SetCreativeModeSlotPacket.h @@ -6,10 +6,10 @@ class SetCreativeModeSlotPacket : public Packet, public enable_shared_from_this< { public: int slotNum; - shared_ptr item; + std::shared_ptr item; SetCreativeModeSlotPacket(); - SetCreativeModeSlotPacket(int slotNum, shared_ptr item); + SetCreativeModeSlotPacket(int slotNum, std::shared_ptr item); virtual void handle(PacketListener *listener); virtual void read(DataInputStream *dis); @@ -18,6 +18,6 @@ class SetCreativeModeSlotPacket : public Packet, public enable_shared_from_this< public: - static shared_ptr create() { return shared_ptr(new SetCreativeModeSlotPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new SetCreativeModeSlotPacket()); } virtual int getId() { return 107; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SetEntityDataPacket.cpp b/Minecraft.World/Network/Packets/SetEntityDataPacket.cpp index d9e0e6873..4b8dbf019 100644 --- a/Minecraft.World/Network/Packets/SetEntityDataPacket.cpp +++ b/Minecraft.World/Network/Packets/SetEntityDataPacket.cpp @@ -18,7 +18,7 @@ SetEntityDataPacket::~SetEntityDataPacket() delete packedItems; } -SetEntityDataPacket::SetEntityDataPacket(int id, shared_ptr entityData, bool notJustDirty) +SetEntityDataPacket::SetEntityDataPacket(int id, std::shared_ptr entityData, bool notJustDirty) { this->id = id; if(notJustDirty) @@ -58,7 +58,7 @@ bool SetEntityDataPacket::isAync() return true; } -vector > *SetEntityDataPacket::getUnpackedData() +vector > *SetEntityDataPacket::getUnpackedData() { return packedItems; } diff --git a/Minecraft.World/Network/Packets/SetEntityDataPacket.h b/Minecraft.World/Network/Packets/SetEntityDataPacket.h index 0fc484a0d..a8fd8d4e0 100644 --- a/Minecraft.World/Network/Packets/SetEntityDataPacket.h +++ b/Minecraft.World/Network/Packets/SetEntityDataPacket.h @@ -10,12 +10,12 @@ public: int id; private: - vector > *packedItems; + vector > *packedItems; public: SetEntityDataPacket(); ~SetEntityDataPacket(); - SetEntityDataPacket(int id, shared_ptr, bool notJustDirty); + SetEntityDataPacket(int id, std::shared_ptr, bool notJustDirty); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); @@ -23,9 +23,9 @@ public: virtual int getEstimatedSize(); virtual bool isAync(); - vector > *getUnpackedData(); + vector > *getUnpackedData(); public: - static shared_ptr create() { return shared_ptr(new SetEntityDataPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new SetEntityDataPacket()); } virtual int getId() { return 40; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SetEntityMotionPacket.cpp b/Minecraft.World/Network/Packets/SetEntityMotionPacket.cpp index f88739e46..e371a32c5 100644 --- a/Minecraft.World/Network/Packets/SetEntityMotionPacket.cpp +++ b/Minecraft.World/Network/Packets/SetEntityMotionPacket.cpp @@ -37,7 +37,7 @@ SetEntityMotionPacket::SetEntityMotionPacket() _init(0, 0.0f, 0.0f, 0.0f); } -SetEntityMotionPacket::SetEntityMotionPacket(shared_ptr e) +SetEntityMotionPacket::SetEntityMotionPacket(std::shared_ptr e) { _init(e->entityId, e->xd, e->yd, e->zd); } @@ -106,8 +106,8 @@ bool SetEntityMotionPacket::canBeInvalidated() return true; } -bool SetEntityMotionPacket::isInvalidatedBy(shared_ptr packet) +bool SetEntityMotionPacket::isInvalidatedBy(std::shared_ptr packet) { - shared_ptr target = dynamic_pointer_cast(packet); + std::shared_ptr target = dynamic_pointer_cast(packet); return target->id == id; } diff --git a/Minecraft.World/Network/Packets/SetEntityMotionPacket.h b/Minecraft.World/Network/Packets/SetEntityMotionPacket.h index 00c019da9..ef9fefc56 100644 --- a/Minecraft.World/Network/Packets/SetEntityMotionPacket.h +++ b/Minecraft.World/Network/Packets/SetEntityMotionPacket.h @@ -15,7 +15,7 @@ private: public: SetEntityMotionPacket(); - SetEntityMotionPacket(shared_ptr e); + SetEntityMotionPacket(std::shared_ptr e); SetEntityMotionPacket(int id, double xd, double yd, double zd); virtual void read(DataInputStream *dis); @@ -23,9 +23,9 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); public: - static shared_ptr create() { return shared_ptr(new SetEntityMotionPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new SetEntityMotionPacket()); } virtual int getId() { return 28; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SetEquippedItemPacket.cpp b/Minecraft.World/Network/Packets/SetEquippedItemPacket.cpp index 9df423e65..08b458bb5 100644 --- a/Minecraft.World/Network/Packets/SetEquippedItemPacket.cpp +++ b/Minecraft.World/Network/Packets/SetEquippedItemPacket.cpp @@ -14,7 +14,7 @@ SetEquippedItemPacket::SetEquippedItemPacket() item = nullptr; } -SetEquippedItemPacket::SetEquippedItemPacket(int entity, int slot, shared_ptr item) +SetEquippedItemPacket::SetEquippedItemPacket(int entity, int slot, std::shared_ptr item) { this->entity = entity; this->slot = slot; @@ -52,7 +52,7 @@ int SetEquippedItemPacket::getEstimatedSize() } // 4J Stu - Brought forward from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game -shared_ptr SetEquippedItemPacket::getItem() +std::shared_ptr SetEquippedItemPacket::getItem() { return item; } @@ -62,8 +62,8 @@ bool SetEquippedItemPacket::canBeInvalidated() return true; } -bool SetEquippedItemPacket::isInvalidatedBy(shared_ptr packet) +bool SetEquippedItemPacket::isInvalidatedBy(std::shared_ptr packet) { - shared_ptr target = dynamic_pointer_cast(packet); + std::shared_ptr target = dynamic_pointer_cast(packet); return target->entity == entity && target->slot == slot; } \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SetEquippedItemPacket.h b/Minecraft.World/Network/Packets/SetEquippedItemPacket.h index def39120b..e957968b9 100644 --- a/Minecraft.World/Network/Packets/SetEquippedItemPacket.h +++ b/Minecraft.World/Network/Packets/SetEquippedItemPacket.h @@ -11,23 +11,23 @@ public: private: // 4J Stu - Brought forward from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game - shared_ptr item; + std::shared_ptr item; public: SetEquippedItemPacket(); - SetEquippedItemPacket(int entity, int slot, shared_ptr item); + SetEquippedItemPacket(int entity, int slot, std::shared_ptr item); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); // 4J Stu - Brought forward from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game - shared_ptr getItem(); + std::shared_ptr getItem(); public: - static shared_ptr create() { return shared_ptr(new SetEquippedItemPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new SetEquippedItemPacket()); } virtual int getId() { return 5; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SetExperiencePacket.cpp b/Minecraft.World/Network/Packets/SetExperiencePacket.cpp index 67bc7fcbd..95a8937c6 100644 --- a/Minecraft.World/Network/Packets/SetExperiencePacket.cpp +++ b/Minecraft.World/Network/Packets/SetExperiencePacket.cpp @@ -48,7 +48,7 @@ bool SetExperiencePacket::canBeInvalidated() return true; } -bool SetExperiencePacket::isInvalidatedBy(shared_ptr packet) +bool SetExperiencePacket::isInvalidatedBy(std::shared_ptr packet) { return true; } diff --git a/Minecraft.World/Network/Packets/SetExperiencePacket.h b/Minecraft.World/Network/Packets/SetExperiencePacket.h index 499b7efdf..c8aff620f 100644 --- a/Minecraft.World/Network/Packets/SetExperiencePacket.h +++ b/Minecraft.World/Network/Packets/SetExperiencePacket.h @@ -17,10 +17,10 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); virtual bool isAync(); public: - static shared_ptr create() { return shared_ptr(new SetExperiencePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new SetExperiencePacket()); } virtual int getId() { return 43; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SetHealthPacket.cpp b/Minecraft.World/Network/Packets/SetHealthPacket.cpp index 9152b2c96..a737afe2c 100644 --- a/Minecraft.World/Network/Packets/SetHealthPacket.cpp +++ b/Minecraft.World/Network/Packets/SetHealthPacket.cpp @@ -60,7 +60,7 @@ bool SetHealthPacket::canBeInvalidated() return true; } -bool SetHealthPacket::isInvalidatedBy(shared_ptr packet) +bool SetHealthPacket::isInvalidatedBy(std::shared_ptr packet) { return true; } diff --git a/Minecraft.World/Network/Packets/SetHealthPacket.h b/Minecraft.World/Network/Packets/SetHealthPacket.h index de8f4cb97..0f74075bf 100644 --- a/Minecraft.World/Network/Packets/SetHealthPacket.h +++ b/Minecraft.World/Network/Packets/SetHealthPacket.h @@ -21,10 +21,10 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); public: - static shared_ptr create() { return shared_ptr(new SetHealthPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new SetHealthPacket()); } virtual int getId() { return 8; } }; diff --git a/Minecraft.World/Network/Packets/SetRidingPacket.cpp b/Minecraft.World/Network/Packets/SetRidingPacket.cpp index e26ce4263..836ff4203 100644 --- a/Minecraft.World/Network/Packets/SetRidingPacket.cpp +++ b/Minecraft.World/Network/Packets/SetRidingPacket.cpp @@ -13,7 +13,7 @@ SetRidingPacket::SetRidingPacket() riddenId = -1; } -SetRidingPacket::SetRidingPacket(shared_ptr rider, shared_ptr riding) +SetRidingPacket::SetRidingPacket(std::shared_ptr rider, std::shared_ptr riding) { this->riderId = rider->entityId; this->riddenId = riding != NULL ? riding->entityId : -1; @@ -46,8 +46,8 @@ bool SetRidingPacket::canBeInvalidated() return true; } -bool SetRidingPacket::isInvalidatedBy(shared_ptr packet) +bool SetRidingPacket::isInvalidatedBy(std::shared_ptr packet) { - shared_ptr target = dynamic_pointer_cast(packet); + std::shared_ptr target = dynamic_pointer_cast(packet); return target->riderId == riderId; } diff --git a/Minecraft.World/Network/Packets/SetRidingPacket.h b/Minecraft.World/Network/Packets/SetRidingPacket.h index 60c3ac431..049b9d136 100644 --- a/Minecraft.World/Network/Packets/SetRidingPacket.h +++ b/Minecraft.World/Network/Packets/SetRidingPacket.h @@ -9,17 +9,17 @@ public: int riderId, riddenId; SetRidingPacket(); - SetRidingPacket(shared_ptr rider, shared_ptr riding); + SetRidingPacket(std::shared_ptr rider, std::shared_ptr riding); virtual int getEstimatedSize(); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); virtual void handle(PacketListener *listener); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); public: - static shared_ptr create() { return shared_ptr(new SetRidingPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new SetRidingPacket()); } virtual int getId() { return 39; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SetSpawnPositionPacket.cpp b/Minecraft.World/Network/Packets/SetSpawnPositionPacket.cpp index ae30c4eed..7d3317434 100644 --- a/Minecraft.World/Network/Packets/SetSpawnPositionPacket.cpp +++ b/Minecraft.World/Network/Packets/SetSpawnPositionPacket.cpp @@ -49,7 +49,7 @@ bool SetSpawnPositionPacket::canBeInvalidated() return true; } -bool SetSpawnPositionPacket::isInvalidatedBy(shared_ptr packet) +bool SetSpawnPositionPacket::isInvalidatedBy(std::shared_ptr packet) { return true; } diff --git a/Minecraft.World/Network/Packets/SetSpawnPositionPacket.h b/Minecraft.World/Network/Packets/SetSpawnPositionPacket.h index 3ba66af87..e9e5c7cdc 100644 --- a/Minecraft.World/Network/Packets/SetSpawnPositionPacket.h +++ b/Minecraft.World/Network/Packets/SetSpawnPositionPacket.h @@ -16,10 +16,10 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); virtual bool isAync(); public: - static shared_ptr create() { return shared_ptr(new SetSpawnPositionPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new SetSpawnPositionPacket()); } virtual int getId() { return 6; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SetTimePacket.cpp b/Minecraft.World/Network/Packets/SetTimePacket.cpp index f0f5b1c37..5443b353c 100644 --- a/Minecraft.World/Network/Packets/SetTimePacket.cpp +++ b/Minecraft.World/Network/Packets/SetTimePacket.cpp @@ -41,7 +41,7 @@ bool SetTimePacket::canBeInvalidated() return true; } -bool SetTimePacket::isInvalidatedBy(shared_ptr packet) +bool SetTimePacket::isInvalidatedBy(std::shared_ptr packet) { return true; } diff --git a/Minecraft.World/Network/Packets/SetTimePacket.h b/Minecraft.World/Network/Packets/SetTimePacket.h index 5b658a0b1..17921bc5b 100644 --- a/Minecraft.World/Network/Packets/SetTimePacket.h +++ b/Minecraft.World/Network/Packets/SetTimePacket.h @@ -16,10 +16,10 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); virtual bool isAync(); public: - static shared_ptr create() { return shared_ptr(new SetTimePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new SetTimePacket()); } virtual int getId() { return 4; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SignUpdatePacket.h b/Minecraft.World/Network/Packets/SignUpdatePacket.h index 80cc29681..e3284ab1f 100644 --- a/Minecraft.World/Network/Packets/SignUpdatePacket.h +++ b/Minecraft.World/Network/Packets/SignUpdatePacket.h @@ -21,6 +21,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new SignUpdatePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new SignUpdatePacket()); } virtual int getId() { return 130; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TakeItemEntityPacket.h b/Minecraft.World/Network/Packets/TakeItemEntityPacket.h index 7c4b45fe9..da7856966 100644 --- a/Minecraft.World/Network/Packets/TakeItemEntityPacket.h +++ b/Minecraft.World/Network/Packets/TakeItemEntityPacket.h @@ -17,6 +17,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new TakeItemEntityPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new TakeItemEntityPacket()); } virtual int getId() { return 22; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TeleportEntityPacket.cpp b/Minecraft.World/Network/Packets/TeleportEntityPacket.cpp index 7af6dc25d..009f98928 100644 --- a/Minecraft.World/Network/Packets/TeleportEntityPacket.cpp +++ b/Minecraft.World/Network/Packets/TeleportEntityPacket.cpp @@ -17,7 +17,7 @@ TeleportEntityPacket::TeleportEntityPacket() xRot = 0; } -TeleportEntityPacket::TeleportEntityPacket(shared_ptr e) +TeleportEntityPacket::TeleportEntityPacket(std::shared_ptr e) { id = e->entityId; x = Mth::floor(e->x * 32); @@ -84,8 +84,8 @@ bool TeleportEntityPacket::canBeInvalidated() return true; } -bool TeleportEntityPacket::isInvalidatedBy(shared_ptr packet) +bool TeleportEntityPacket::isInvalidatedBy(std::shared_ptr packet) { - shared_ptr target = dynamic_pointer_cast(packet); + std::shared_ptr target = dynamic_pointer_cast(packet); return target->id == id; } \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TeleportEntityPacket.h b/Minecraft.World/Network/Packets/TeleportEntityPacket.h index 8ceca4fa3..bb2efebd1 100644 --- a/Minecraft.World/Network/Packets/TeleportEntityPacket.h +++ b/Minecraft.World/Network/Packets/TeleportEntityPacket.h @@ -11,7 +11,7 @@ public: uint8_t yRot, xRot; TeleportEntityPacket(); - TeleportEntityPacket(shared_ptr e); + TeleportEntityPacket(std::shared_ptr e); TeleportEntityPacket(int id, int x, int y, int z, uint8_t yRot, uint8_t xRot); virtual void read(DataInputStream *dis); @@ -19,9 +19,9 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); public: - static shared_ptr create() { return shared_ptr(new TeleportEntityPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new TeleportEntityPacket()); } virtual int getId() { return 34; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp index 1083b4e0f..a2ebf9b49 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp +++ b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp @@ -15,7 +15,7 @@ TextureAndGeometryChangePacket::TextureAndGeometryChangePacket() dwSkinID = 0; } -TextureAndGeometryChangePacket::TextureAndGeometryChangePacket(shared_ptr e, const wstring &path) +TextureAndGeometryChangePacket::TextureAndGeometryChangePacket(std::shared_ptr e, const wstring &path) { id = e->entityId; this->path = path; diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h index dabe78fae..e13b547e8 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h +++ b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h @@ -12,7 +12,7 @@ public: DWORD dwSkinID; TextureAndGeometryChangePacket(); - TextureAndGeometryChangePacket(shared_ptr e, const wstring &path); + TextureAndGeometryChangePacket(std::shared_ptr e, const wstring &path); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); @@ -20,6 +20,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new TextureAndGeometryChangePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new TextureAndGeometryChangePacket()); } virtual int getId() { return 161; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.h b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.h index 52a18ff93..e5ac02705 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.h +++ b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.h @@ -30,6 +30,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new TextureAndGeometryPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new TextureAndGeometryPacket()); } virtual int getId() { return 160; } }; diff --git a/Minecraft.World/Network/Packets/TextureChangePacket.cpp b/Minecraft.World/Network/Packets/TextureChangePacket.cpp index a75dd307d..649d25fd7 100644 --- a/Minecraft.World/Network/Packets/TextureChangePacket.cpp +++ b/Minecraft.World/Network/Packets/TextureChangePacket.cpp @@ -14,7 +14,7 @@ TextureChangePacket::TextureChangePacket() path = L""; } -TextureChangePacket::TextureChangePacket(shared_ptr e, ETextureChangeType action, const wstring &path) +TextureChangePacket::TextureChangePacket(std::shared_ptr e, ETextureChangeType action, const wstring &path) { id = e->entityId; this->action = action; diff --git a/Minecraft.World/Network/Packets/TextureChangePacket.h b/Minecraft.World/Network/Packets/TextureChangePacket.h index 959fc4feb..7d99b3b32 100644 --- a/Minecraft.World/Network/Packets/TextureChangePacket.h +++ b/Minecraft.World/Network/Packets/TextureChangePacket.h @@ -17,7 +17,7 @@ public: wstring path; TextureChangePacket(); - TextureChangePacket(shared_ptr e, ETextureChangeType action, const wstring &path); + TextureChangePacket(std::shared_ptr e, ETextureChangeType action, const wstring &path); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); @@ -25,6 +25,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new TextureChangePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new TextureChangePacket()); } virtual int getId() { return 157; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TexturePacket.h b/Minecraft.World/Network/Packets/TexturePacket.h index c2dce25f5..6f8b36bc1 100644 --- a/Minecraft.World/Network/Packets/TexturePacket.h +++ b/Minecraft.World/Network/Packets/TexturePacket.h @@ -20,6 +20,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new TexturePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new TexturePacket()); } virtual int getId() { return 154; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TileDestructionPacket.cpp b/Minecraft.World/Network/Packets/TileDestructionPacket.cpp index b85ccf6dc..80dce738d 100644 --- a/Minecraft.World/Network/Packets/TileDestructionPacket.cpp +++ b/Minecraft.World/Network/Packets/TileDestructionPacket.cpp @@ -78,8 +78,8 @@ bool TileDestructionPacket::canBeInvalidated() return true; } -bool TileDestructionPacket::isInvalidatedBy(shared_ptr packet) +bool TileDestructionPacket::isInvalidatedBy(std::shared_ptr packet) { - shared_ptr target = dynamic_pointer_cast(packet); + std::shared_ptr target = dynamic_pointer_cast(packet); return target->id == id; } \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TileDestructionPacket.h b/Minecraft.World/Network/Packets/TileDestructionPacket.h index 20cd7db99..394ffaa11 100644 --- a/Minecraft.World/Network/Packets/TileDestructionPacket.h +++ b/Minecraft.World/Network/Packets/TileDestructionPacket.h @@ -27,9 +27,9 @@ public: int getState(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); public: - static shared_ptr create() { return shared_ptr(new TileDestructionPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new TileDestructionPacket()); } virtual int getId() { return 55; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TileEntityDataPacket.h b/Minecraft.World/Network/Packets/TileEntityDataPacket.h index 2ee998f39..522392edf 100644 --- a/Minecraft.World/Network/Packets/TileEntityDataPacket.h +++ b/Minecraft.World/Network/Packets/TileEntityDataPacket.h @@ -31,6 +31,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new TileEntityDataPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new TileEntityDataPacket()); } virtual int getId() { return 132; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TileEventPacket.h b/Minecraft.World/Network/Packets/TileEventPacket.h index ca2685fae..b1d60bad8 100644 --- a/Minecraft.World/Network/Packets/TileEventPacket.h +++ b/Minecraft.World/Network/Packets/TileEventPacket.h @@ -17,6 +17,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new TileEventPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new TileEventPacket()); } virtual int getId() { return 54; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TileUpdatePacket.h b/Minecraft.World/Network/Packets/TileUpdatePacket.h index fe69c7639..4ed1a9c80 100644 --- a/Minecraft.World/Network/Packets/TileUpdatePacket.h +++ b/Minecraft.World/Network/Packets/TileUpdatePacket.h @@ -18,6 +18,6 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new TileUpdatePacket()); } + static std::shared_ptr create() { return std::shared_ptr(new TileUpdatePacket()); } virtual int getId() { return 53; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TradeItemPacket.h b/Minecraft.World/Network/Packets/TradeItemPacket.h index 4dfa7bffd..9923f96e3 100644 --- a/Minecraft.World/Network/Packets/TradeItemPacket.h +++ b/Minecraft.World/Network/Packets/TradeItemPacket.h @@ -25,7 +25,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new TradeItemPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new TradeItemPacket()); } virtual int getId() { return 151; } }; diff --git a/Minecraft.World/Network/Packets/UpdateGameRuleProgressPacket.h b/Minecraft.World/Network/Packets/UpdateGameRuleProgressPacket.h index b3384fa12..65df6dfe6 100644 --- a/Minecraft.World/Network/Packets/UpdateGameRuleProgressPacket.h +++ b/Minecraft.World/Network/Packets/UpdateGameRuleProgressPacket.h @@ -21,6 +21,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new UpdateGameRuleProgressPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new UpdateGameRuleProgressPacket()); } virtual int getId() { return 158; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/UpdateMobEffectPacket.cpp b/Minecraft.World/Network/Packets/UpdateMobEffectPacket.cpp index 4dc12d440..fbfb8e107 100644 --- a/Minecraft.World/Network/Packets/UpdateMobEffectPacket.cpp +++ b/Minecraft.World/Network/Packets/UpdateMobEffectPacket.cpp @@ -53,8 +53,8 @@ bool UpdateMobEffectPacket::canBeInvalidated() return true; } -bool UpdateMobEffectPacket::isInvalidatedBy(shared_ptr packet) +bool UpdateMobEffectPacket::isInvalidatedBy(std::shared_ptr packet) { - shared_ptr target = dynamic_pointer_cast(packet); + std::shared_ptr target = dynamic_pointer_cast(packet); return target->entityId == entityId && target->effectId == effectId; } \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/UpdateMobEffectPacket.h b/Minecraft.World/Network/Packets/UpdateMobEffectPacket.h index d17d1be47..a69d32b23 100644 --- a/Minecraft.World/Network/Packets/UpdateMobEffectPacket.h +++ b/Minecraft.World/Network/Packets/UpdateMobEffectPacket.h @@ -20,9 +20,9 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); + virtual bool isInvalidatedBy(std::shared_ptr packet); public: - static shared_ptr create() { return shared_ptr(new UpdateMobEffectPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new UpdateMobEffectPacket()); } virtual int getId() { return 41; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/UpdateProgressPacket.h b/Minecraft.World/Network/Packets/UpdateProgressPacket.h index beca65097..edfaef961 100644 --- a/Minecraft.World/Network/Packets/UpdateProgressPacket.h +++ b/Minecraft.World/Network/Packets/UpdateProgressPacket.h @@ -20,6 +20,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new UpdateProgressPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new UpdateProgressPacket()); } virtual int getId() { return 156; } }; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/UseItemPacket.cpp b/Minecraft.World/Network/Packets/UseItemPacket.cpp index 2bc1bcb2d..ef5690222 100644 --- a/Minecraft.World/Network/Packets/UseItemPacket.cpp +++ b/Minecraft.World/Network/Packets/UseItemPacket.cpp @@ -23,14 +23,14 @@ UseItemPacket::UseItemPacket() clickZ = 0.0f; } -UseItemPacket::UseItemPacket(int x, int y, int z, int face, shared_ptr item, float clickX, float clickY, float clickZ) +UseItemPacket::UseItemPacket(int x, int y, int z, int face, std::shared_ptr item, float clickX, float clickY, float clickZ) { this->x = x; this->y = y; this->z = z; this->face = face; // 4J - take copy of item as we want our packets to have full ownership of any referenced data - this->item = item ? item->copy() : shared_ptr(); + this->item = item ? item->copy() : std::shared_ptr(); this->clickX = clickX; this->clickY = clickY; this->clickZ = clickZ; @@ -91,7 +91,7 @@ int UseItemPacket::getFace() return face; } -shared_ptr UseItemPacket::getItem() +std::shared_ptr UseItemPacket::getItem() { return item; } diff --git a/Minecraft.World/Network/Packets/UseItemPacket.h b/Minecraft.World/Network/Packets/UseItemPacket.h index 44e20457c..2619ce94e 100644 --- a/Minecraft.World/Network/Packets/UseItemPacket.h +++ b/Minecraft.World/Network/Packets/UseItemPacket.h @@ -8,12 +8,12 @@ class UseItemPacket : public Packet, public enable_shared_from_this item; + std::shared_ptr item; float clickX, clickY, clickZ; public: UseItemPacket(); - UseItemPacket(int x, int y, int z, int face, shared_ptr item, float clickX, float clickY, float clickZ); + UseItemPacket(int x, int y, int z, int face, std::shared_ptr item, float clickX, float clickY, float clickZ); ~UseItemPacket(); virtual void read(DataInputStream *dis); @@ -25,12 +25,12 @@ public: int getY(); int getZ(); int getFace(); - shared_ptr getItem(); + std::shared_ptr getItem(); float getClickX(); float getClickY(); float getClickZ(); public: - static shared_ptr create() { return shared_ptr(new UseItemPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new UseItemPacket()); } virtual int getId() { return 15; } }; diff --git a/Minecraft.World/Network/Packets/XZPacket.h b/Minecraft.World/Network/Packets/XZPacket.h index 0c4115e07..4154084f2 100644 --- a/Minecraft.World/Network/Packets/XZPacket.h +++ b/Minecraft.World/Network/Packets/XZPacket.h @@ -25,6 +25,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return shared_ptr(new XZPacket()); } + static std::shared_ptr create() { return std::shared_ptr(new XZPacket()); } virtual int getId() { return 166; } }; \ No newline at end of file diff --git a/Minecraft.World/Player/FoodData.cpp b/Minecraft.World/Player/FoodData.cpp index 5137ad4cb..ff430c1f5 100644 --- a/Minecraft.World/Player/FoodData.cpp +++ b/Minecraft.World/Player/FoodData.cpp @@ -29,7 +29,7 @@ void FoodData::eat(FoodItem *item) eat(item->getNutrition(), item->getSaturationModifier()); } -void FoodData::tick(shared_ptr player) +void FoodData::tick(std::shared_ptr player) { int difficulty = player->level->difficulty; diff --git a/Minecraft.World/Player/FoodData.h b/Minecraft.World/Player/FoodData.h index 3416a44a8..9d847454b 100644 --- a/Minecraft.World/Player/FoodData.h +++ b/Minecraft.World/Player/FoodData.h @@ -19,7 +19,7 @@ public: void eat(int food, float saturationModifier); void eat(FoodItem *item); - void tick(shared_ptr player); + void tick(std::shared_ptr player); void readAdditionalSaveData(CompoundTag *entityTag); void addAdditonalSaveData(CompoundTag *entityTag); int getFoodLevel(); diff --git a/Minecraft.World/Player/Player.cpp b/Minecraft.World/Player/Player.cpp index 6389addc0..4c998d7fa 100644 --- a/Minecraft.World/Player/Player.cpp +++ b/Minecraft.World/Player/Player.cpp @@ -45,7 +45,7 @@ void Player::_init() { - inventory = shared_ptr( new Inventory( this ) ); + inventory = std::shared_ptr( new Inventory( this ) ); userType = 0; score = 0; @@ -117,7 +117,7 @@ void Player::_init() m_ePlayerNameValidState=ePlayerNameValid_NotSet; #endif - enderChestInventory = shared_ptr(new PlayerEnderChestContainer()); + enderChestInventory = std::shared_ptr(new PlayerEnderChestContainer()); m_bAwardedOnARail=false; } @@ -187,7 +187,7 @@ void Player::defineSynchedData() entityData->define(DATA_PLAYER_RUNNING_ID, (uint8_t) 0); } -shared_ptr Player::getUseItem() +std::shared_ptr Player::getUseItem() { return useItem; } @@ -246,7 +246,7 @@ void Player::tick() { if (useItem != NULL) { - shared_ptr item = inventory->getSelected(); + std::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) // 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) @@ -368,73 +368,73 @@ void Player::tick() #if 0 #ifdef _WINDOWS64 // Drop some items so we have them in inventory to play with - this->drop( shared_ptr( new ItemInstance(Tile::recordPlayer) ) ); - this->drop( shared_ptr( new ItemInstance(Item::map) ) ); - this->drop( shared_ptr( new ItemInstance(Item::record_01) ) ); - this->drop( shared_ptr( new ItemInstance(Item::record_02) ) ); - this->drop( shared_ptr(new ItemInstance( Item::pickAxe_diamond, 1 )) ); + this->drop( std::shared_ptr( new ItemInstance(Tile::recordPlayer) ) ); + this->drop( std::shared_ptr( new ItemInstance(Item::map) ) ); + this->drop( std::shared_ptr( new ItemInstance(Item::record_01) ) ); + this->drop( std::shared_ptr( new ItemInstance(Item::record_02) ) ); + this->drop( std::shared_ptr(new ItemInstance( Item::pickAxe_diamond, 1 )) ); #endif #ifdef __PS3__ // #ifdef _DEBUG // // Drop some items so we have them in inventory to play with - // this->drop( shared_ptr( new ItemInstance(Tile::recordPlayer) ) ); - // this->drop( shared_ptr( new ItemInstance(Item::map) ) ); - // this->drop( shared_ptr( new ItemInstance(Item::record_01) ) ); - // this->drop( shared_ptr( new ItemInstance(Item::record_02) ) ); - // this->drop( shared_ptr(new ItemInstance( Item::pickAxe_diamond, 1 )) ); + // this->drop( std::shared_ptr( new ItemInstance(Tile::recordPlayer) ) ); + // this->drop( std::shared_ptr( new ItemInstance(Item::map) ) ); + // this->drop( std::shared_ptr( new ItemInstance(Item::record_01) ) ); + // this->drop( std::shared_ptr( new ItemInstance(Item::record_02) ) ); + // this->drop( std::shared_ptr(new ItemInstance( Item::pickAxe_diamond, 1 )) ); // #endif #endif #ifdef _DURANGO // Drop some items so we have them in inventory to play with - this->drop( shared_ptr( new ItemInstance(Tile::recordPlayer) ) ); - this->drop( shared_ptr( new ItemInstance(Item::map) ) ); - this->drop( shared_ptr( new ItemInstance(Item::record_01) ) ); - this->drop( shared_ptr( new ItemInstance(Item::record_02) ) ); - this->drop( shared_ptr(new ItemInstance( Item::pickAxe_diamond, 1 )) ); + this->drop( std::shared_ptr( new ItemInstance(Tile::recordPlayer) ) ); + this->drop( std::shared_ptr( new ItemInstance(Item::map) ) ); + this->drop( std::shared_ptr( new ItemInstance(Item::record_01) ) ); + this->drop( std::shared_ptr( new ItemInstance(Item::record_02) ) ); + this->drop( std::shared_ptr(new ItemInstance( Item::pickAxe_diamond, 1 )) ); #endif #endif // 4J-PB - Throw items out at the start of the level //this->drop( new ItemInstance( Item::pickAxe_diamond, 1 ) ); //this->drop( new ItemInstance( Tile::workBench, 1 ) ); //this->drop( new ItemInstance( Tile::treeTrunk, 8 ) ); - //this->drop( shared_ptr( new ItemInstance( Item::milk, 3 ) ) ); - //this->drop( shared_ptr( new ItemInstance( Item::sugar, 2 ) ) ); + //this->drop( std::shared_ptr( new ItemInstance( Item::milk, 3 ) ) ); + //this->drop( std::shared_ptr( new ItemInstance( Item::sugar, 2 ) ) ); //this->drop( new ItemInstance( Tile::stoneBrick, 8 ) ); - //this->drop( shared_ptr( new ItemInstance( Item::wheat, 3 ) ) ); - //this->drop( shared_ptr( new ItemInstance( Item::egg, 1 ) ) ); + //this->drop( std::shared_ptr( new ItemInstance( Item::wheat, 3 ) ) ); + //this->drop( std::shared_ptr( new ItemInstance( Item::egg, 1 ) ) ); //this->drop( new ItemInstance( Item::bow, 1 ) ); //this->drop( new ItemInstance( Item::arrow, 10 ) ); - //this->drop( shared_ptr( new ItemInstance( Item::saddle, 10 ) ) ); - //this->drop( shared_ptr( new ItemInstance( Tile::fence, 64 ) ) ); - //this->drop( shared_ptr( new ItemInstance( Tile::fence, 64 ) ) ); - //this->drop( shared_ptr( new ItemInstance( Tile::fence, 64 ) ) ); + //this->drop( std::shared_ptr( new ItemInstance( Item::saddle, 10 ) ) ); + //this->drop( std::shared_ptr( new ItemInstance( Tile::fence, 64 ) ) ); + //this->drop( std::shared_ptr( new ItemInstance( Tile::fence, 64 ) ) ); + //this->drop( std::shared_ptr( new ItemInstance( Tile::fence, 64 ) ) ); - //shared_ptr mob = dynamic_pointer_cast(Pig::_class->newInstance( level )); + //std::shared_ptr mob = dynamic_pointer_cast(Pig::_class->newInstance( level )); //mob->moveTo(x+1, y, z+1, level->random->nextFloat() * 360, 0); //level->addEntity(mob); // 4J : WESTY : Spawn some wolves to befriend! /* - shared_ptr mob1 = dynamic_pointer_cast(Wolf::_class->newInstance( level )); + std::shared_ptr mob1 = dynamic_pointer_cast(Wolf::_class->newInstance( level )); mob1->moveTo(x+1, y, z+1, level->random->nextFloat() * 360, 0); level->addEntity(mob1); - shared_ptr mob2 = dynamic_pointer_cast(Wolf::_class->newInstance( level )); + std::shared_ptr mob2 = dynamic_pointer_cast(Wolf::_class->newInstance( level )); mob2->moveTo(x+2, y, z+1, level->random->nextFloat() * 360, 0); level->addEntity(mob2); - shared_ptr mob3 = dynamic_pointer_cast(Wolf::_class->newInstance( level )); + std::shared_ptr mob3 = dynamic_pointer_cast(Wolf::_class->newInstance( level )); mob3->moveTo(x+1, y, z+2, level->random->nextFloat() * 360, 0); level->addEntity(mob3); - shared_ptr mob4 = dynamic_pointer_cast(Wolf::_class->newInstance( level )); + std::shared_ptr mob4 = dynamic_pointer_cast(Wolf::_class->newInstance( level )); mob4->moveTo(x+3, y, z+1, level->random->nextFloat() * 360, 0); level->addEntity(mob4); - shared_ptr mob5 = dynamic_pointer_cast(Wolf::_class->newInstance( level )); + std::shared_ptr mob5 = dynamic_pointer_cast(Wolf::_class->newInstance( level )); mob5->moveTo(x+1, y, z+3, level->random->nextFloat() * 360, 0); level->addEntity(mob5); */ @@ -456,9 +456,9 @@ void Player::tick() static bool madeTrack = false; if( !madeTrack ) { - this->drop( shared_ptr( new ItemInstance( Item::minecart, 1 ) ) ); - this->drop( shared_ptr( new ItemInstance( Tile::goldenRail, 10 ) ) ); - this->drop( shared_ptr( new ItemInstance( Tile::lever, 10 ) ) ); + this->drop( std::shared_ptr( new ItemInstance( Item::minecart, 1 ) ) ); + this->drop( std::shared_ptr( new ItemInstance( Tile::goldenRail, 10 ) ) ); + this->drop( std::shared_ptr( new ItemInstance( Tile::lever, 10 ) ) ); level->setTime( 0 ); int poweredCount = 0; @@ -524,7 +524,7 @@ void Player::tick() //End 4J sTU } -void Player::spawnEatParticles(shared_ptr useItem, int count) +void Player::spawnEatParticles(std::shared_ptr useItem, int count) { if (useItem->getUseAnimation() == UseAnim_drink) { @@ -559,7 +559,7 @@ void Player::completeUsingItem() spawnEatParticles(useItem, 16); int oldCount = useItem->count; - shared_ptr itemInstance = useItem->useTimeDepleted(level, dynamic_pointer_cast(shared_from_this())); + std::shared_ptr itemInstance = useItem->useTimeDepleted(level, dynamic_pointer_cast(shared_from_this())); if (itemInstance != useItem || (itemInstance != NULL && itemInstance->count != oldCount)) { inventory->items[inventory->selected] = itemInstance; @@ -595,7 +595,7 @@ void Player::closeContainer() containerMenu = inventoryMenu; } -void Player::ride(shared_ptr e) +void Player::ride(std::shared_ptr e) { if (riding != NULL && e == NULL) { @@ -944,7 +944,7 @@ void Player::rideTick() //xRot = preXRot; //yRot = preYRot; - shared_ptr pig = dynamic_pointer_cast(riding); + std::shared_ptr pig = dynamic_pointer_cast(riding); yBodyRot = pig->yBodyRot; while (yBodyRot - yBodyRotO < -180) @@ -1038,13 +1038,13 @@ void Player::aiStep() if (getHealth() > 0) { - vector > *entities = level->getEntities(shared_from_this(), bb->grow(1, 0, 1)); + vector > *entities = level->getEntities(shared_from_this(), bb->grow(1, 0, 1)); if (entities != NULL) { AUTO_VAR(itEnd, entities->end()); for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { - shared_ptr e = *it; //entities->at(i); + std::shared_ptr e = *it; //entities->at(i); if (!e->removed) { touch(e); @@ -1055,7 +1055,7 @@ void Player::aiStep() } -void Player::touch(shared_ptr entity) +void Player::touch(std::shared_ptr entity) { entity->playerTouch( dynamic_pointer_cast( shared_from_this() ) ); } @@ -1063,7 +1063,7 @@ void Player::touch(shared_ptr entity) // 4J - Removed 1.0.1 //bool Player::addResource(int resource) //{ -// return inventory->add(shared_ptr( new ItemInstance(resource, 1, 0) ) ); +// return inventory->add(std::shared_ptr( new ItemInstance(resource, 1, 0) ) ); //} int Player::getScore() @@ -1081,7 +1081,7 @@ void Player::die(DamageSource *source) // 4J - TODO need to use a xuid if ( app.isXuidNotch( m_xuid ) ) { - drop(shared_ptr( new ItemInstance(Item::apple, 1) ), true); + drop(std::shared_ptr( new ItemInstance(Item::apple, 1) ), true); } inventory->dropAll(); @@ -1097,7 +1097,7 @@ void Player::die(DamageSource *source) this->heightOffset = 0.1f; } -void Player::awardKillScore(shared_ptr victim, int score) +void Player::awardKillScore(std::shared_ptr victim, int score) { this->score += score; } @@ -1126,21 +1126,21 @@ bool Player::isCreativeModeAllowed() return true; } -shared_ptr Player::drop() +std::shared_ptr Player::drop() { return drop(inventory->removeItem(inventory->selected, 1), false); } -shared_ptr Player::drop(shared_ptr item) +std::shared_ptr Player::drop(std::shared_ptr item) { return drop(item, false); } -shared_ptr Player::drop(shared_ptr item, bool randomly) +std::shared_ptr Player::drop(std::shared_ptr item, bool randomly) { if (item == NULL) return nullptr; - shared_ptr thrownItem = shared_ptr( new ItemEntity(level, x, y - 0.3f + getHeadHeight(), z, item) ); + std::shared_ptr thrownItem = std::shared_ptr( new ItemEntity(level, x, y - 0.3f + getHeadHeight(), z, item) ); thrownItem->throwTime = 20 * 2; thrownItem->setThrower(getName()); @@ -1176,7 +1176,7 @@ shared_ptr Player::drop(shared_ptr item, bool randomly } -void Player::reallyDrop(shared_ptr thrownItem) +void Player::reallyDrop(std::shared_ptr thrownItem) { level->addEntity(thrownItem); } @@ -1291,7 +1291,7 @@ Pos *Player::getRespawnPosition(Level *level, CompoundTag *entityTag) return level->getSharedSpawnPos(); } -bool Player::openContainer(shared_ptr container) +bool Player::openContainer(std::shared_ptr container) { return true; } @@ -1311,7 +1311,7 @@ bool Player::startCrafting(int x, int y, int z) return true; } -void Player::take(shared_ptr e, int orgCount) +void Player::take(std::shared_ptr e, int orgCount) { } @@ -1350,7 +1350,7 @@ bool Player::hurt(DamageSource *source, int dmg) if (dmg == 0) return false; - shared_ptr attacker = source->getEntity(); + std::shared_ptr attacker = source->getEntity(); if ( dynamic_pointer_cast( attacker ) != NULL ) { if ((dynamic_pointer_cast(attacker))->owner != NULL) @@ -1396,7 +1396,7 @@ bool Player::isPlayerVersusPlayer() return false; } -void Player::directAllTameWolvesOnTarget(shared_ptr target, bool skipSitting) +void Player::directAllTameWolvesOnTarget(std::shared_ptr target, bool skipSitting) { // filter un-attackable mobs @@ -1407,7 +1407,7 @@ void Player::directAllTameWolvesOnTarget(shared_ptr target, bool skipSittin // never target wolves that has this player as owner if (dynamic_pointer_cast(target) != NULL) { - shared_ptr wolfTarget = dynamic_pointer_cast(target); + std::shared_ptr wolfTarget = dynamic_pointer_cast(target); if (wolfTarget->isTame() && m_UUID.compare( wolfTarget->getOwnerUUID() ) == 0 ) { return; @@ -1421,11 +1421,11 @@ void Player::directAllTameWolvesOnTarget(shared_ptr target, bool skipSittin // TODO: Optimize this? Most of the time players wont have pets: - vector > *nearbyWolves = level->getEntitiesOfClass(typeid(Wolf), AABB::newTemp(x, y, z, x + 1, y + 1, z + 1)->grow(16, 4, 16)); + vector > *nearbyWolves = level->getEntitiesOfClass(typeid(Wolf), AABB::newTemp(x, y, z, x + 1, y + 1, z + 1)->grow(16, 4, 16)); AUTO_VAR(itEnd, nearbyWolves->end()); for (AUTO_VAR(it, nearbyWolves->begin()); it != itEnd; it++) { - shared_ptr wolf = dynamic_pointer_cast(*it);; + std::shared_ptr wolf = dynamic_pointer_cast(*it);; if (wolf->isTame() && wolf->getAttackTarget() == NULL && m_UUID.compare( wolf->getOwnerUUID() ) == 0) { if (!skipSitting || !wolf->isSitting()) @@ -1475,26 +1475,26 @@ void Player::actuallyHurt(DamageSource *source, int dmg) } -bool Player::openFurnace(shared_ptr container) +bool Player::openFurnace(std::shared_ptr container) { return true; } -bool Player::openTrap(shared_ptr container) +bool Player::openTrap(std::shared_ptr container) { return true; } -void Player::openTextEdit(shared_ptr sign) +void Player::openTextEdit(std::shared_ptr sign) { } -bool Player::openBrewingStand(shared_ptr brewingStand) +bool Player::openBrewingStand(std::shared_ptr brewingStand) { return true; } -bool Player::openTrading(shared_ptr traderTarget) +bool Player::openTrading(std::shared_ptr traderTarget) { return true; } @@ -1504,14 +1504,14 @@ bool Player::openTrading(shared_ptr traderTarget) * * @param itemInstance */ -void Player::openItemInstanceGui(shared_ptr itemInstance) +void Player::openItemInstanceGui(std::shared_ptr itemInstance) { } -bool Player::interact(shared_ptr entity) +bool Player::interact(std::shared_ptr entity) { if (entity->interact( dynamic_pointer_cast( shared_from_this() ) )) return true; - shared_ptr item = getSelectedItem(); + std::shared_ptr item = getSelectedItem(); if (item != NULL && dynamic_pointer_cast( entity ) != NULL) { // 4J - PC Comments @@ -1534,7 +1534,7 @@ bool Player::interact(shared_ptr entity) return false; } -shared_ptr Player::getSelectedItem() +std::shared_ptr Player::getSelectedItem() { return inventory->getSelected(); } @@ -1558,7 +1558,7 @@ void Player::swing() } } -void Player::attack(shared_ptr entity) +void Player::attack(std::shared_ptr entity) { if (!entity->isAttackable()) { @@ -1578,7 +1578,7 @@ void Player::attack(shared_ptr entity) int knockback = 0; int magicBoost = 0; - shared_ptr mob = dynamic_pointer_cast(entity); + std::shared_ptr mob = dynamic_pointer_cast(entity); if (mob != NULL) { magicBoost = EnchantmentHelper::getDamageBonus(inventory, mob); @@ -1636,14 +1636,14 @@ void Player::attack(shared_ptr entity) } setLastHurtMob(entity); - shared_ptr mob = dynamic_pointer_cast(entity); + std::shared_ptr mob = dynamic_pointer_cast(entity); if (mob) { ThornsEnchantment::doThornsAfterAttack(shared_from_this(), mob, random); } } - shared_ptr item = getSelectedItem(); + std::shared_ptr item = getSelectedItem(); if (item != NULL && dynamic_pointer_cast( entity ) != NULL) { item->hurtEnemy(dynamic_pointer_cast(entity), dynamic_pointer_cast( shared_from_this() ) ); @@ -1673,11 +1673,11 @@ void Player::attack(shared_ptr entity) } } -void Player::crit(shared_ptr entity) +void Player::crit(std::shared_ptr entity) { } -void Player::magicCrit(shared_ptr entity) +void Player::magicCrit(std::shared_ptr entity) { } @@ -1687,7 +1687,7 @@ void Player::respawn() } -void Player::animateRespawn(shared_ptr player, Level *level) +void Player::animateRespawn(std::shared_ptr player, Level *level) { for (int i = 0; i < 45; i++) @@ -1757,7 +1757,7 @@ Player::BedSleepingResult Player::startSleepInBed(int x, int y, int z, bool bTes double hRange = 8; double vRange = 5; - vector > *monsters = level->getEntitiesOfClass(typeid(Monster), AABB::newTemp(x - hRange, y - vRange, z - hRange, x + hRange, y + vRange, z + hRange)); + vector > *monsters = level->getEntitiesOfClass(typeid(Monster), AABB::newTemp(x - hRange, y - vRange, z - hRange, x + hRange, y + vRange, z + hRange)); if (!monsters->empty()) { return NOT_SAFE; @@ -2233,7 +2233,7 @@ void Player::causeFallDamage(float distance) } -void Player::killed(shared_ptr mob) +void Player::killed(std::shared_ptr mob) { // 4J-PB - added the lavaslime enemy - fix for #64007 - TU7: Code: Achievements: TCR#073: Killing Magma Cubes doesn't unlock "Monster Hunter" Achievement. if( dynamic_pointer_cast( mob ) != NULL || mob->GetType() == eTYPE_GHAST || mob->GetType() == eTYPE_SLIME || mob->GetType() == eTYPE_LAVASLIME || mob->GetType() == eTYPE_ENDERDRAGON) @@ -2283,7 +2283,7 @@ void Player::killed(shared_ptr mob) } } -Icon *Player::getItemInHandIcon(shared_ptr item, int layer) +Icon *Player::getItemInHandIcon(std::shared_ptr item, int layer) { Icon *icon = Mob::getItemInHandIcon(item, layer); if (item->id == Item::fishingRod->id && fishing != NULL) @@ -2313,7 +2313,7 @@ Icon *Player::getItemInHandIcon(shared_ptr item, int layer) return icon; } -shared_ptr Player::getArmor(int pos) +std::shared_ptr Player::getArmor(int pos) { return inventory->getArmor(pos); } @@ -2414,7 +2414,7 @@ bool Player::isHurt() return getHealth() > 0 && getHealth() < getMaxHealth(); } -void Player::startUsingItem(shared_ptr instance, int duration) +void Player::startUsingItem(std::shared_ptr instance, int duration) { if (instance == useItem) return; useItem = instance; @@ -2439,7 +2439,7 @@ bool Player::mayBuild(int x, int y, int z) return abilities.mayBuild; } -int Player::getExperienceReward(shared_ptr killedBy) +int Player::getExperienceReward(std::shared_ptr killedBy) { int reward = experienceLevel * 7; if (reward > 100) @@ -2464,7 +2464,7 @@ void Player::changeDimension(int i) { } -void Player::restoreFrom(shared_ptr oldPlayer, bool restoreAll) +void Player::restoreFrom(std::shared_ptr oldPlayer, bool restoreAll) { if(restoreAll) { @@ -2515,17 +2515,17 @@ wstring Player::getDisplayName() //Language getLanguage() { return Language.getInstance(); } //String localize(String key, Object... args) { return getLanguage().getElement(key, args); } -shared_ptr Player::getEnderChestInventory() +std::shared_ptr Player::getEnderChestInventory() { return enderChestInventory; } -shared_ptr Player::getCarriedItem() +std::shared_ptr Player::getCarriedItem() { return inventory->getSelected(); } -bool Player::isInvisibleTo(shared_ptr player) +bool Player::isInvisibleTo(std::shared_ptr player) { return isInvisible(); } @@ -2566,7 +2566,7 @@ int Player::hash_fnct(const std::shared_ptr k) #endif // __PS3__ } -bool Player::eq_test(const shared_ptr x, const shared_ptr y) +bool Player::eq_test(const std::shared_ptr x, const std::shared_ptr y) { // TODO 4J Stu - Should we just be using the pointers and comparing them for equality? return x->name.compare( y->name ) == 0; // 4J Stu - Names are completely unique? @@ -2722,7 +2722,7 @@ bool Player::isAllowedToUse(Tile *tile) return allowed; } -bool Player::isAllowedToUse(shared_ptr item) +bool Player::isAllowedToUse(std::shared_ptr item) { bool allowed = true; if(item != NULL && app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) @@ -2766,7 +2766,7 @@ bool Player::isAllowedToUse(shared_ptr item) return allowed; } -bool Player::isAllowedToInteract(shared_ptr target) +bool Player::isAllowedToInteract(std::shared_ptr target) { bool allowed = true; if(app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) @@ -2775,7 +2775,7 @@ bool Player::isAllowedToInteract(shared_ptr target) { if (getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CanUseContainers) == 0) { - shared_ptr minecart = dynamic_pointer_cast( target ); + std::shared_ptr minecart = dynamic_pointer_cast( target ); if (minecart->type == Minecart::CHEST) allowed = false; } @@ -2831,7 +2831,7 @@ bool Player::isAllowedToAttackAnimals() return allowed; } -bool Player::isAllowedToHurtEntity(shared_ptr target) +bool Player::isAllowedToHurtEntity(std::shared_ptr target) { bool allowed = true; diff --git a/Minecraft.World/Player/Player.h b/Minecraft.World/Player/Player.h index ccb6df441..087f78e9b 100644 --- a/Minecraft.World/Player/Player.h +++ b/Minecraft.World/Player/Player.h @@ -50,10 +50,10 @@ private: static const int DATA_PLAYER_RUNNING_ID = 17; public: - shared_ptr inventory; + std::shared_ptr inventory; private: - shared_ptr enderChestInventory; + std::shared_ptr enderChestInventory; public: AbstractContainerMenu *inventoryMenu; @@ -124,7 +124,7 @@ public: // 4J Stu - Made protected so that we can access it from MultiPlayerLocalPlayer protected: - shared_ptr useItem; + std::shared_ptr useItem; int useItemDuration; protected: @@ -146,7 +146,7 @@ protected: virtual void defineSynchedData(); public: - shared_ptr getUseItem(); + std::shared_ptr getUseItem(); int getUseItemDuration(); bool isUsingItem(); int getTicksUsingItem(); void releaseUsingItem(); @@ -156,7 +156,7 @@ public: virtual void tick(); protected: - void spawnEatParticles(shared_ptr useItem, int count); + void spawnEatParticles(std::shared_ptr useItem, int count); virtual void completeUsingItem(); public: @@ -167,7 +167,7 @@ protected: virtual void closeContainer(); public: - virtual void ride(shared_ptr e); + virtual void ride(std::shared_ptr e); void prepareCustomTextures(); virtual void rideTick(); virtual void resetPos(); @@ -182,13 +182,13 @@ public: virtual void aiStep(); private: - virtual void touch(shared_ptr entity); + virtual void touch(std::shared_ptr entity); public: //bool addResource(int resource); // 4J - Removed 1.0.1 int getScore(); virtual void die(DamageSource *source); - void awardKillScore(shared_ptr victim, int score); + void awardKillScore(std::shared_ptr victim, int score); protected: virtual int decreaseAirSupply(int currentSupply); @@ -196,12 +196,12 @@ protected: public: virtual bool isShootable(); bool isCreativeModeAllowed(); - virtual shared_ptr drop(); - shared_ptr drop(shared_ptr item); - shared_ptr drop(shared_ptr item, bool randomly); + virtual std::shared_ptr drop(); + std::shared_ptr drop(std::shared_ptr item); + std::shared_ptr drop(std::shared_ptr item, bool randomly); protected: - virtual void reallyDrop(shared_ptr thrownItem); + virtual void reallyDrop(std::shared_ptr thrownItem); public: float getDestroySpeed(Tile *tile); @@ -209,11 +209,11 @@ public: virtual void readAdditionalSaveData(CompoundTag *entityTag); virtual void addAdditonalSaveData(CompoundTag *entityTag); static Pos *getRespawnPosition(Level *level, CompoundTag *entityTag); - virtual bool openContainer(shared_ptr container); // 4J - added bool return + virtual bool openContainer(std::shared_ptr container); // 4J - added bool return virtual bool startEnchanting(int x, int y, int z); // 4J - added bool return virtual bool startRepairing(int x, int y, int z); // 4J - added bool return virtual bool startCrafting(int x, int y, int z); // 4J - added boo return - virtual void take(shared_ptr e, int orgCount); + virtual void take(std::shared_ptr e, int orgCount); virtual float getHeadHeight(); // 4J-PB - added to keep the code happy with the change to make the third person view per player @@ -224,14 +224,14 @@ protected: virtual void setDefaultHeadHeight(); public: - shared_ptr fishing; + std::shared_ptr fishing; virtual bool hurt(DamageSource *source, int dmg); protected: virtual int getDamageAfterMagicAbsorb(DamageSource *damageSource, int damage); virtual bool isPlayerVersusPlayer(); - void directAllTameWolvesOnTarget(shared_ptr target, bool skipSitting); + void directAllTameWolvesOnTarget(std::shared_ptr target, bool skipSitting); virtual void hurtArmor(int damage); public: @@ -244,24 +244,24 @@ protected: public: using Entity::interact; - virtual bool openFurnace(shared_ptr container); // 4J - added bool return - virtual bool openTrap(shared_ptr container); // 4J - added bool return - virtual void openTextEdit(shared_ptr sign); - virtual bool openBrewingStand(shared_ptr brewingStand); // 4J - added bool return - virtual bool openTrading(shared_ptr traderTarget); // 4J - added bool return - virtual void openItemInstanceGui(shared_ptr itemInstance); - virtual bool interact(shared_ptr entity); - virtual shared_ptr getSelectedItem(); + virtual bool openFurnace(std::shared_ptr container); // 4J - added bool return + virtual bool openTrap(std::shared_ptr container); // 4J - added bool return + virtual void openTextEdit(std::shared_ptr sign); + virtual bool openBrewingStand(std::shared_ptr brewingStand); // 4J - added bool return + virtual bool openTrading(std::shared_ptr traderTarget); // 4J - added bool return + virtual void openItemInstanceGui(std::shared_ptr itemInstance); + virtual bool interact(std::shared_ptr entity); + virtual std::shared_ptr getSelectedItem(); void removeSelectedItem(); virtual double getRidingHeight(); virtual void swing(); - virtual void attack(shared_ptr entity); - virtual void crit(shared_ptr entity); - virtual void magicCrit(shared_ptr entity); + virtual void attack(std::shared_ptr entity); + virtual void crit(std::shared_ptr entity); + virtual void magicCrit(std::shared_ptr entity); virtual void respawn(); protected: - static void animateRespawn(shared_ptr player, Level *level); + static void animateRespawn(std::shared_ptr player, Level *level); public: Slot *getInventorySlot(int slotId); @@ -336,9 +336,9 @@ protected: virtual void causeFallDamage(float distance); public: - virtual void killed(shared_ptr mob); - virtual Icon *getItemInHandIcon(shared_ptr item, int layer); - virtual shared_ptr getArmor(int pos); + virtual void killed(std::shared_ptr mob); + virtual Icon *getItemInHandIcon(std::shared_ptr item, int layer); + virtual std::shared_ptr getArmor(int pos); virtual void handleInsidePortal(); void increaseXp(int i); @@ -353,18 +353,18 @@ public: FoodData *getFoodData(); bool canEat(bool magicalItem); bool isHurt(); - virtual void startUsingItem(shared_ptr instance, int duration); + virtual void startUsingItem(std::shared_ptr instance, int duration); bool mayBuild(int x, int y, int z); protected: - virtual int getExperienceReward(shared_ptr killedBy); + virtual int getExperienceReward(std::shared_ptr killedBy); virtual bool isAlwaysExperienceDropper(); public: virtual wstring getAName(); virtual void changeDimension(int i); - virtual void restoreFrom(shared_ptr oldPlayer, bool restoreAll); + virtual void restoreFrom(std::shared_ptr oldPlayer, bool restoreAll); protected: bool makeStepSound(); @@ -378,19 +378,19 @@ public: //Language getLanguage() { return Language.getInstance(); } //String localize(String key, Object... args) { return getLanguage().getElement(key, args); } - shared_ptr getEnderChestInventory(); + std::shared_ptr getEnderChestInventory(); public: - virtual shared_ptr getCarriedItem(); + virtual std::shared_ptr getCarriedItem(); - virtual bool isInvisibleTo(shared_ptr player); + virtual bool isInvisibleTo(std::shared_ptr player); - static int hash_fnct(const shared_ptr k); - static bool eq_test(const shared_ptr x, const shared_ptr y); + static int hash_fnct(const std::shared_ptr k); + static bool eq_test(const std::shared_ptr x, const std::shared_ptr y); // 4J Stu - Added to allow callback to tutorial to stay within Minecraft.Client // Overidden in LocalPlayer - virtual void onCrafted(shared_ptr item) {} + virtual void onCrafted(std::shared_ptr item) {} // 4J Overriding this so that we can have some different default skins virtual int getTexture(); // 4J changed from wstring to int @@ -493,12 +493,12 @@ public: static void setPlayerGamePrivilege(unsigned int &uiGamePrivileges, EPlayerGamePrivileges privilege, unsigned int value); bool isAllowedToUse(Tile *tile); - bool isAllowedToUse(shared_ptr item); - bool isAllowedToInteract(shared_ptr target); + bool isAllowedToUse(std::shared_ptr item); + bool isAllowedToInteract(std::shared_ptr target); bool isAllowedToMine(); bool isAllowedToAttackPlayers(); bool isAllowedToAttackAnimals(); - bool isAllowedToHurtEntity(shared_ptr target); + bool isAllowedToHurtEntity(std::shared_ptr target); bool isAllowedToFly(); bool isAllowedToIgnoreExhaustion(); bool isAllowedToTeleport(); @@ -513,7 +513,7 @@ public: public: // 4J Stu - Added hooks for the game rules - virtual void handleCollectItem(shared_ptr item) {} + virtual void handleCollectItem(std::shared_ptr item) {} vector *GetAdditionalModelParts(); void SetAdditionalModelParts(vector *ppAdditionalModelParts); @@ -541,10 +541,10 @@ private: struct PlayerKeyHash { - int operator() (const shared_ptr k) const { return Player::hash_fnct (k); } + int operator() (const std::shared_ptr k) const { return Player::hash_fnct (k); } }; struct PlayerKeyEq { - bool operator() (const shared_ptr x, const shared_ptr y) const { return Player::eq_test (x, y); } + bool operator() (const std::shared_ptr x, const std::shared_ptr y) const { return Player::eq_test (x, y); } }; diff --git a/Minecraft.World/Player/PlayerEnderChestContainer.cpp b/Minecraft.World/Player/PlayerEnderChestContainer.cpp index 98ca78371..60d698773 100644 --- a/Minecraft.World/Player/PlayerEnderChestContainer.cpp +++ b/Minecraft.World/Player/PlayerEnderChestContainer.cpp @@ -7,7 +7,7 @@ PlayerEnderChestContainer::PlayerEnderChestContainer() : SimpleContainer(IDS_TIL activeChest = nullptr; } -void PlayerEnderChestContainer::setActiveChest(shared_ptr activeChest) +void PlayerEnderChestContainer::setActiveChest(std::shared_ptr activeChest) { this->activeChest = activeChest; } @@ -31,7 +31,7 @@ ListTag *PlayerEnderChestContainer::createTag() ListTag *items = new ListTag(L"EnderItems"); for (int i = 0; i < getContainerSize(); i++) { - shared_ptr item = getItem(i); + std::shared_ptr item = getItem(i); if (item != NULL) { CompoundTag *tag = new CompoundTag(); @@ -43,7 +43,7 @@ ListTag *PlayerEnderChestContainer::createTag() return items; } -bool PlayerEnderChestContainer::stillValid(shared_ptr player) +bool PlayerEnderChestContainer::stillValid(std::shared_ptr player) { if (activeChest != NULL && !activeChest->stillValid(player)) { diff --git a/Minecraft.World/Player/PlayerEnderChestContainer.h b/Minecraft.World/Player/PlayerEnderChestContainer.h index 69f3987c5..bd57344d1 100644 --- a/Minecraft.World/Player/PlayerEnderChestContainer.h +++ b/Minecraft.World/Player/PlayerEnderChestContainer.h @@ -7,15 +7,15 @@ class EnderChestTileEntity; class PlayerEnderChestContainer : public SimpleContainer { private: - shared_ptr activeChest; + std::shared_ptr activeChest; public: PlayerEnderChestContainer(); - void setActiveChest(shared_ptr activeChest); + void setActiveChest(std::shared_ptr activeChest); void setItemsByTag(ListTag *enderItemsList); ListTag *createTag(); - bool stillValid(shared_ptr player); + bool stillValid(std::shared_ptr player); void startOpen(); void stopOpen(); }; \ No newline at end of file diff --git a/Minecraft.World/Recipes/ArmorDyeRecipe.cpp b/Minecraft.World/Recipes/ArmorDyeRecipe.cpp index a43764317..eba1684fc 100644 --- a/Minecraft.World/Recipes/ArmorDyeRecipe.cpp +++ b/Minecraft.World/Recipes/ArmorDyeRecipe.cpp @@ -5,14 +5,14 @@ #include "../Headers/net.minecraft.world.item.crafting.h" #include "ArmorDyeRecipe.h" -bool ArmorDyeRecipe::matches(shared_ptr craftSlots, Level *level) +bool ArmorDyeRecipe::matches(std::shared_ptr craftSlots, Level *level) { - shared_ptr target = nullptr; - vector > dyes; + std::shared_ptr target = nullptr; + vector > dyes; for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { - shared_ptr item = craftSlots->getItem(slot); + std::shared_ptr item = craftSlots->getItem(slot); if (item == NULL) continue; ArmorItem *armor = dynamic_cast(item->getItem()); @@ -40,9 +40,9 @@ bool ArmorDyeRecipe::matches(shared_ptr craftSlots, Level *le return target != NULL && !dyes.empty(); } -shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptr craftSlots) +std::shared_ptr ArmorDyeRecipe::assembleDyedArmor(std::shared_ptr craftSlots) { - shared_ptr target = nullptr; + std::shared_ptr target = nullptr; int colorTotals[3]; colorTotals[0] = 0; colorTotals[1] = 0; @@ -55,7 +55,7 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptrgetContainerSize(); slot++) { - shared_ptr item = craftSlots->getItem(slot); + std::shared_ptr item = craftSlots->getItem(slot); if (item == NULL) continue; armor = dynamic_cast(item->getItem()); @@ -128,7 +128,7 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptr ArmorDyeRecipe::assemble(shared_ptr craftSlots) +std::shared_ptr ArmorDyeRecipe::assemble(std::shared_ptr craftSlots) { return ArmorDyeRecipe::assembleDyedArmor(craftSlots); } diff --git a/Minecraft.World/Recipes/ArmorDyeRecipe.h b/Minecraft.World/Recipes/ArmorDyeRecipe.h index b983ba7b2..9825be650 100644 --- a/Minecraft.World/Recipes/ArmorDyeRecipe.h +++ b/Minecraft.World/Recipes/ArmorDyeRecipe.h @@ -5,11 +5,11 @@ class ArmorDyeRecipe : public Recipy { public: - bool matches(shared_ptr craftSlots, Level *level); + bool matches(std::shared_ptr craftSlots, Level *level); // 4J Stu - Made static as we use this in a different way from the Java (but needs to be a different name otherwise Orbis compiler complains - static shared_ptr assembleDyedArmor(shared_ptr craftSlots); - shared_ptr assemble(shared_ptr craftSlots); + static std::shared_ptr assembleDyedArmor(std::shared_ptr craftSlots); + std::shared_ptr assemble(std::shared_ptr craftSlots); int size(); const ItemInstance *getResultItem(); diff --git a/Minecraft.World/Recipes/Recipes.cpp b/Minecraft.World/Recipes/Recipes.cpp index f2659aaba..c152f8bf6 100644 --- a/Minecraft.World/Recipes/Recipes.cpp +++ b/Minecraft.World/Recipes/Recipes.cpp @@ -1146,14 +1146,14 @@ void Recipes::addShapelessRecipy(ItemInstance *result,... ) recipies->push_back(new ShapelessRecipy(result, ingredients, group)); } -shared_ptr Recipes::getItemFor(shared_ptr craftSlots, Level *level) +std::shared_ptr Recipes::getItemFor(std::shared_ptr craftSlots, Level *level) { int count = 0; - shared_ptr first = nullptr; - shared_ptr second = nullptr; + std::shared_ptr first = nullptr; + std::shared_ptr second = nullptr; for (int i = 0; i < craftSlots->getContainerSize(); i++) { - shared_ptr item = craftSlots->getItem(i); + std::shared_ptr item = craftSlots->getItem(i); if (item != NULL) { if (count == 0) first = item; @@ -1170,7 +1170,7 @@ shared_ptr Recipes::getItemFor(shared_ptr craft int remaining = (remaining1 + remaining2) + item->getMaxDamage() * 5 / 100; int resultDamage = item->getMaxDamage() - remaining; if (resultDamage < 0) resultDamage = 0; - return shared_ptr( new ItemInstance(first->id, 1, resultDamage) ); + return std::shared_ptr( new ItemInstance(first->id, 1, resultDamage) ); } AUTO_VAR(itEnd, recipies->end()); @@ -1188,7 +1188,7 @@ vector *Recipes::getRecipies() } // 4J-PB - added to deal with Xb0x 'crafting' -shared_ptr Recipes::getItemForRecipe(Recipy *r) +std::shared_ptr Recipes::getItemForRecipe(Recipy *r) { return r->assemble(nullptr); } diff --git a/Minecraft.World/Recipes/Recipes.h b/Minecraft.World/Recipes/Recipes.h index c5d091e1b..023a73b81 100644 --- a/Minecraft.World/Recipes/Recipes.h +++ b/Minecraft.World/Recipes/Recipes.h @@ -89,11 +89,11 @@ public: ShapedRecipy *addShapedRecipy(ItemInstance *, ... ); void addShapelessRecipy(ItemInstance *result,... ); - shared_ptr getItemFor(shared_ptr craftSlots, Level *level); + std::shared_ptr getItemFor(std::shared_ptr craftSlots, Level *level); vector *getRecipies(); // 4J-PB - Added all below for new Xbox 'crafting' - shared_ptr getItemForRecipe(Recipy *r); + std::shared_ptr getItemForRecipe(Recipy *r); Recipy::INGREDIENTS_REQUIRED *getRecipeIngredientsArray(); private: diff --git a/Minecraft.World/Recipes/Recipy.h b/Minecraft.World/Recipes/Recipy.h index 83682053f..fd5865052 100644 --- a/Minecraft.World/Recipes/Recipy.h +++ b/Minecraft.World/Recipes/Recipy.h @@ -42,8 +42,8 @@ public: } INGREDIENTS_REQUIRED; ~Recipy() {} - virtual bool matches(shared_ptr craftSlots, Level *level) = 0; - virtual shared_ptr assemble(shared_ptr craftSlots) = 0; + virtual bool matches(std::shared_ptr craftSlots, Level *level) = 0; + virtual std::shared_ptr assemble(std::shared_ptr craftSlots) = 0; virtual int size() = 0; virtual const ItemInstance *getResultItem() = 0; virtual const int getGroup() = 0; diff --git a/Minecraft.World/Recipes/ShapedRecipy.cpp b/Minecraft.World/Recipes/ShapedRecipy.cpp index 120265d92..7ed9919a6 100644 --- a/Minecraft.World/Recipes/ShapedRecipy.cpp +++ b/Minecraft.World/Recipes/ShapedRecipy.cpp @@ -33,7 +33,7 @@ const ItemInstance *ShapedRecipy::getResultItem() return result; } -bool ShapedRecipy::matches(shared_ptr craftSlots, Level *level) +bool ShapedRecipy::matches(std::shared_ptr craftSlots, Level *level) { for (int xOffs = 0; xOffs <= (3 - width); xOffs++) { @@ -46,7 +46,7 @@ bool ShapedRecipy::matches(shared_ptr craftSlots, Level *leve return false; } -bool ShapedRecipy::matches(shared_ptr craftSlots, int xOffs, int yOffs, bool xFlip) +bool ShapedRecipy::matches(std::shared_ptr craftSlots, int xOffs, int yOffs, bool xFlip) { for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { @@ -58,7 +58,7 @@ bool ShapedRecipy::matches(shared_ptr craftSlots, int xOffs, if (xFlip) expected = recipeItems[(width - xs - 1) + ys * width]; else expected = recipeItems[xs + ys * width]; } - shared_ptr item = craftSlots->getItem(x, y); + std::shared_ptr item = craftSlots->getItem(x, y); if (item == NULL && expected == NULL) { continue; @@ -80,15 +80,15 @@ bool ShapedRecipy::matches(shared_ptr craftSlots, int xOffs, return true; } -shared_ptr ShapedRecipy::assemble(shared_ptr craftSlots) +std::shared_ptr ShapedRecipy::assemble(std::shared_ptr craftSlots) { - shared_ptr result = getResultItem()->copy(); + std::shared_ptr result = getResultItem()->copy(); if (_keepTag && craftSlots != NULL) { for (int i = 0; i < craftSlots->getContainerSize(); i++) { - shared_ptr item = craftSlots->getItem(i); + std::shared_ptr item = craftSlots->getItem(i); if (item != NULL && item->hasTag()) { diff --git a/Minecraft.World/Recipes/ShapedRecipy.h b/Minecraft.World/Recipes/ShapedRecipy.h index 56cae3fd7..55497379c 100644 --- a/Minecraft.World/Recipes/ShapedRecipy.h +++ b/Minecraft.World/Recipes/ShapedRecipy.h @@ -15,13 +15,13 @@ public: virtual const ItemInstance *getResultItem(); virtual const int getGroup(); - virtual bool matches(shared_ptr craftSlots, Level *level); + virtual bool matches(std::shared_ptr craftSlots, Level *level); private: - bool matches(shared_ptr craftSlots, int xOffs, int yOffs, bool xFlip); + bool matches(std::shared_ptr craftSlots, int xOffs, int yOffs, bool xFlip); public: - virtual shared_ptr assemble(shared_ptr craftSlots); + virtual std::shared_ptr assemble(std::shared_ptr craftSlots); virtual int size(); ShapedRecipy *keepTag(); diff --git a/Minecraft.World/Recipes/ShapelessRecipy.cpp b/Minecraft.World/Recipes/ShapelessRecipy.cpp index af8d6491c..3b737f5a4 100644 --- a/Minecraft.World/Recipes/ShapelessRecipy.cpp +++ b/Minecraft.World/Recipes/ShapelessRecipy.cpp @@ -29,7 +29,7 @@ const ItemInstance *ShapelessRecipy::getResultItem() return result; } -bool ShapelessRecipy::matches(shared_ptr craftSlots, Level *level) +bool ShapelessRecipy::matches(std::shared_ptr craftSlots, Level *level) { vector tempList = *ingredients; @@ -37,7 +37,7 @@ bool ShapelessRecipy::matches(shared_ptr craftSlots, Level *l { for (int x = 0; x < 3; x++) { - shared_ptr item = craftSlots->getItem(x, y); + std::shared_ptr item = craftSlots->getItem(x, y); if (item != NULL) { @@ -67,7 +67,7 @@ bool ShapelessRecipy::matches(shared_ptr craftSlots, Level *l return tempList.empty(); } -shared_ptr ShapelessRecipy::assemble(shared_ptr craftSlots) +std::shared_ptr ShapelessRecipy::assemble(std::shared_ptr craftSlots) { return result->copy(); } diff --git a/Minecraft.World/Recipes/ShapelessRecipy.h b/Minecraft.World/Recipes/ShapelessRecipy.h index 5f7f60765..f9bb555e3 100644 --- a/Minecraft.World/Recipes/ShapelessRecipy.h +++ b/Minecraft.World/Recipes/ShapelessRecipy.h @@ -12,8 +12,8 @@ public: virtual const ItemInstance *getResultItem(); virtual const int getGroup(); - virtual bool matches(shared_ptr craftSlots, Level *level); - virtual shared_ptr assemble(shared_ptr craftSlots); + virtual bool matches(std::shared_ptr craftSlots, Level *level); + virtual std::shared_ptr assemble(std::shared_ptr craftSlots); virtual int size(); // 4J-PB - to return the items required to make a recipe diff --git a/Minecraft.World/Stats/Achievement.cpp b/Minecraft.World/Stats/Achievement.cpp index 2114c4f26..514f9276f 100644 --- a/Minecraft.World/Stats/Achievement.cpp +++ b/Minecraft.World/Stats/Achievement.cpp @@ -25,7 +25,7 @@ Achievement::Achievement(int id, const wstring& name, int x, int y, Tile *icon, { } -Achievement::Achievement(int id, const wstring& name, int x, int y, shared_ptr icon, Achievement *requires) +Achievement::Achievement(int id, const wstring& name, int x, int y, std::shared_ptr icon, Achievement *requires) : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon(icon), x(x), y(y), requires(requires) { } diff --git a/Minecraft.World/Stats/Achievement.h b/Minecraft.World/Stats/Achievement.h index b39c44b31..057147372 100644 --- a/Minecraft.World/Stats/Achievement.h +++ b/Minecraft.World/Stats/Achievement.h @@ -16,7 +16,7 @@ private: DescFormatter *descFormatter; public: - const shared_ptr icon; + const std::shared_ptr icon; private: bool isGoldenVar; @@ -25,7 +25,7 @@ private: public: Achievement(int id, const wstring& name, int x, int y, Item *icon, Achievement *requires); Achievement(int id, const wstring& name, int x, int y, Tile *icon, Achievement *requires); - Achievement(int id, const wstring& name, int x, int y, shared_ptr icon, Achievement *requires); + Achievement(int id, const wstring& name, int x, int y, std::shared_ptr icon, Achievement *requires); Achievement *setAwardLocallyOnly(); Achievement *setGolden(); diff --git a/Minecraft.World/Stats/DurangoStats.cpp b/Minecraft.World/Stats/DurangoStats.cpp index 67be03e6c..9f4cba22f 100644 --- a/Minecraft.World/Stats/DurangoStats.cpp +++ b/Minecraft.World/Stats/DurangoStats.cpp @@ -102,7 +102,7 @@ int DsItemEvent::mergeIds(int itemId) } } -void DsItemEvent::handleParamBlob(shared_ptr player, byteArray paramBlob) +void DsItemEvent::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { if (paramBlob.length == sizeof(Param)) { @@ -205,7 +205,7 @@ byteArray DsItemEvent::createParamBlob(eAcquisitionMethod eMethod, int itemId, i DsMobKilled::DsMobKilled(int id, const wstring &name) : Stat(id,name) {} -void DsMobKilled::handleParamBlob(shared_ptr player, byteArray paramBlob) +void DsMobKilled::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { if (paramBlob.length == sizeof(Param)) { @@ -262,7 +262,7 @@ void DsMobKilled::handleParamBlob(shared_ptr player, byteArray para } } -byteArray DsMobKilled::createParamBlob(shared_ptr player, shared_ptr mob, DamageSource *dmgSrc) +byteArray DsMobKilled::createParamBlob(std::shared_ptr player, std::shared_ptr mob, DamageSource *dmgSrc) { // 4J-JEV: Get the id we use for Durango Server Stats. int mob_networking_id; @@ -298,7 +298,7 @@ byteArray DsMobKilled::createParamBlob(shared_ptr player, shared_ptr item = player->getCarriedItem(); + std::shared_ptr item = player->getCarriedItem(); byteArray output; Param param = { DsMobKilled::MELEE, @@ -323,7 +323,7 @@ string DsMobInteract::nameInteract[] = { DsMobInteract::DsMobInteract(int id, const wstring &name) : Stat(id,name) {} -void DsMobInteract::handleParamBlob(shared_ptr player, byteArray paramBlob) +void DsMobInteract::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { if (paramBlob.length == sizeof(Param)) { @@ -378,7 +378,7 @@ DsTravel::DsTravel(int id, const wstring &name) : Stat(id,name) ZeroMemory(¶m_cache, sizeof(unsigned int)*eMethod_MAX*MAX_LOCAL_PLAYERS); } -void DsTravel::handleParamBlob(shared_ptr player, byteArray paramBlob) +void DsTravel::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { if (paramBlob.length == sizeof(Param)) { @@ -416,7 +416,7 @@ int DsTravel::cache(int iPad, Param ¶m) return 0; } -void DsTravel::flush(shared_ptr player) +void DsTravel::flush(std::shared_ptr player) { int iPad = player->GetXboxPad(); for (int i = 0; i < eMethod_MAX; i++) @@ -429,7 +429,7 @@ void DsTravel::flush(shared_ptr player) } } -void DsTravel::write(shared_ptr player, eMethod method, int distance) +void DsTravel::write(std::shared_ptr player, eMethod method, int distance) { if (player == nullptr) return; @@ -477,7 +477,7 @@ void DsTravel::write(shared_ptr player, eMethod method, int distanc DsItemUsed::DsItemUsed(int id, const wstring &name) : Stat(id,name) {} -void DsItemUsed::handleParamBlob(shared_ptr player, byteArray paramBlob) +void DsItemUsed::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { if (paramBlob.length == sizeof(Param)) { @@ -520,7 +520,7 @@ byteArray DsItemUsed::createParamBlob(int itemId, int aux, int count, int health DsAchievement::DsAchievement(int id, const wstring &name) : Stat(id,name) {} -void DsAchievement::handleParamBlob(shared_ptr player, byteArray paramBlob) +void DsAchievement::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { if (paramBlob.length == sizeof(SmallParam)) { @@ -616,7 +616,7 @@ byteArray DsAchievement::createLargeParamBlob(eAward award, int count) DsChangedDimension::DsChangedDimension(int id, const wstring &name) : Stat(id,name) {} -void DsChangedDimension::handleParamBlob(shared_ptr player, byteArray paramBlob) +void DsChangedDimension::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { if (paramBlob.length == sizeof(Param)) { @@ -644,7 +644,7 @@ byteArray DsChangedDimension::createParamBlob(int fromDimId, int toDimId) DsEnteredBiome::DsEnteredBiome(int id, const wstring &name) : Stat(id,name) {} -void DsEnteredBiome::handleParamBlob(shared_ptr player, byteArray paramBlob) +void DsEnteredBiome::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { if (paramBlob.length == sizeof(Param)) { @@ -953,7 +953,7 @@ byteArray DurangoStats::getParam_itemsCrafted(int id, int aux, int count) return DsItemEvent::createParamBlob(DsItemEvent::eAcquisitionMethod_Crafted, id, aux, count); } -byteArray DurangoStats::getParam_itemsUsed(shared_ptr player, shared_ptr itm) +byteArray DurangoStats::getParam_itemsUsed(std::shared_ptr player, std::shared_ptr itm) { return DsItemUsed::createParamBlob( itm->getItem()->id, itm->getAuxValue(), itm->GetCount(), @@ -966,7 +966,7 @@ byteArray DurangoStats::getParam_itemsBought(int id, int aux, int count) return DsItemEvent::createParamBlob(DsItemEvent::eAcquisitionMethod_Bought, id, aux, count); } -byteArray DurangoStats::getParam_mobKill(shared_ptr player, shared_ptr mob, DamageSource *dmgSrc) +byteArray DurangoStats::getParam_mobKill(std::shared_ptr player, std::shared_ptr mob, DamageSource *dmgSrc) { return DsMobKilled::createParamBlob(player,mob,dmgSrc); } @@ -1114,7 +1114,7 @@ LPCWSTR DurangoStats::getMultiplayerCorrelationId() return ((DurangoStats*)GenericStats::getInstance())->multiplayerCorrelationId->Data(); } -LPCWSTR DurangoStats::getUserId(shared_ptr player) +LPCWSTR DurangoStats::getUserId(std::shared_ptr player) { return getUserId(player->GetXboxPad()); } @@ -1128,7 +1128,7 @@ LPCWSTR DurangoStats::getUserId(int iPad) return cache.c_str(); } -void DurangoStats::playerSessionStart(PlayerUID uid, shared_ptr plr) +void DurangoStats::playerSessionStart(PlayerUID uid, std::shared_ptr plr) { if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) { @@ -1155,7 +1155,7 @@ void DurangoStats::playerSessionStart(PlayerUID uid, shared_ptr plr) void DurangoStats::playerSessionStart(int iPad) { - PlayerUID puid; shared_ptr plr; + PlayerUID puid; std::shared_ptr plr; ProfileManager.GetXUID(iPad, &puid, true); plr = Minecraft::GetInstance()->localplayers[iPad]; playerSessionStart(puid,plr); @@ -1163,7 +1163,7 @@ void DurangoStats::playerSessionStart(int iPad) void DurangoStats::playerSessionPause(int iPad) { - shared_ptr plr = Minecraft::GetInstance()->localplayers[iPad]; + std::shared_ptr plr = Minecraft::GetInstance()->localplayers[iPad]; if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) { PlayerUID puid; @@ -1186,7 +1186,7 @@ void DurangoStats::playerSessionPause(int iPad) void DurangoStats::playerSessionResume(int iPad) { - shared_ptr plr = Minecraft::GetInstance()->localplayers[iPad]; + std::shared_ptr plr = Minecraft::GetInstance()->localplayers[iPad]; if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) { PlayerUID puid; @@ -1213,7 +1213,7 @@ void DurangoStats::playerSessionResume(int iPad) void DurangoStats::playerSessionEnd(int iPad) { - shared_ptr plr = Minecraft::GetInstance()->localplayers[iPad]; + std::shared_ptr plr = Minecraft::GetInstance()->localplayers[iPad]; if (plr != NULL) { DurangoStats::getInstance()->travel->flush(plr); diff --git a/Minecraft.World/Stats/DurangoStats.h b/Minecraft.World/Stats/DurangoStats.h index 1b2f7723c..bea8c2d91 100644 --- a/Minecraft.World/Stats/DurangoStats.h +++ b/Minecraft.World/Stats/DurangoStats.h @@ -44,7 +44,7 @@ public: bool onLeaderboard(ELeaderboardId leaderboard, eAcquisitionMethod methodId, Param *param); int mergeIds(int itemId); - virtual void handleParamBlob(shared_ptr plr, byteArray param); + virtual void handleParamBlob(std::shared_ptr plr, byteArray param); static byteArray createParamBlob(eAcquisitionMethod methodId, int itemId, int itemAux, int itemCount); }; @@ -59,8 +59,8 @@ public: DsMobKilled(int id, const wstring &name); typedef struct { bool isRanged; int mobType, weaponId, distance, damage; } Param; - virtual void handleParamBlob(shared_ptr plr, byteArray param); - static byteArray createParamBlob(shared_ptr plr, shared_ptr mob, DamageSource *dmgSrc); + virtual void handleParamBlob(std::shared_ptr plr, byteArray param); + static byteArray createParamBlob(std::shared_ptr plr, std::shared_ptr mob, DamageSource *dmgSrc); }; class DsMobInteract : public Stat @@ -82,7 +82,7 @@ public: DsMobInteract(int id, const wstring &name); typedef struct { int interactionType, mobId; } Param; - virtual void handleParamBlob(shared_ptr plr, byteArray param); + virtual void handleParamBlob(std::shared_ptr plr, byteArray param); static byteArray createParamBlob(eInteract interactionId, int entityId); }; @@ -110,15 +110,15 @@ public: DsTravel(int id, const wstring &name); typedef struct { eMethod method; int distance; } Param; - virtual void handleParamBlob(shared_ptr plr, byteArray paramBlob); + virtual void handleParamBlob(std::shared_ptr plr, byteArray paramBlob); static byteArray createParamBlob(eMethod method, int distance); - void flush(shared_ptr plr); + void flush(std::shared_ptr plr); protected: unsigned int param_cache[MAX_LOCAL_PLAYERS][eMethod_MAX]; int cache(int iPad, Param ¶m); - void write(shared_ptr plr, eMethod method, int distance); + void write(std::shared_ptr plr, eMethod method, int distance); }; class DsItemUsed : public Stat @@ -126,7 +126,7 @@ class DsItemUsed : public Stat public: DsItemUsed(int id, const wstring &name); typedef struct { int itemId, aux, count, health, hunger; } Param; - virtual void handleParamBlob(shared_ptr plr, byteArray paramBlob); + virtual void handleParamBlob(std::shared_ptr plr, byteArray paramBlob); static byteArray createParamBlob(int itemId, int aux, int count, int health, int hunger); }; @@ -135,7 +135,7 @@ class DsAchievement : public Stat public: DsAchievement(int id, const wstring &name); - virtual void handleParamBlob(shared_ptr plr, byteArray paramBlob); + virtual void handleParamBlob(std::shared_ptr plr, byteArray paramBlob); typedef struct { eAward award; } SmallParam; static byteArray createSmallParamBlob(eAward id); @@ -149,7 +149,7 @@ class DsChangedDimension : public Stat public: DsChangedDimension(int id, const wstring &name); typedef struct { int fromDimId, toDimId; } Param; - virtual void handleParamBlob(shared_ptr plr, byteArray paramBlob); + virtual void handleParamBlob(std::shared_ptr plr, byteArray paramBlob); static byteArray createParamBlob(int fromDimId, int toDimId); }; @@ -158,7 +158,7 @@ class DsEnteredBiome : public Stat public: DsEnteredBiome(int id, const wstring &name); typedef struct { int biomeId; } Param; - virtual void handleParamBlob(shared_ptr plr, byteArray paramBlob); + virtual void handleParamBlob(std::shared_ptr plr, byteArray paramBlob); static byteArray createParamBlob(int biomeId); }; @@ -261,10 +261,10 @@ protected: virtual byteArray getParam_blocksMined(int blockId, int data, int count); virtual byteArray getParam_itemsCollected(int id, int aux, int count); virtual byteArray getParam_itemsCrafted(int id, int aux, int count); - virtual byteArray getParam_itemsUsed(shared_ptr plr, shared_ptr itm); + virtual byteArray getParam_itemsUsed(std::shared_ptr plr, std::shared_ptr itm); virtual byteArray getParam_itemsBought(int id, int aux, int count); - virtual byteArray getParam_mobKill(shared_ptr plr, shared_ptr mob, DamageSource *dmgSrc); + virtual byteArray getParam_mobKill(std::shared_ptr plr, std::shared_ptr mob, DamageSource *dmgSrc); virtual byteArray getParam_breedEntity(eINSTANCEOF entityId); virtual byteArray getParam_tamedEntity(eINSTANCEOF entityId); @@ -300,10 +300,10 @@ public: static void setMultiplayerCorrelationId(Platform::String^ mpcId); static LPCWSTR getMultiplayerCorrelationId(); - static LPCWSTR getUserId(shared_ptr plr); + static LPCWSTR getUserId(std::shared_ptr plr); static LPCWSTR getUserId(int iPad); - static void playerSessionStart(PlayerUID,shared_ptr); + static void playerSessionStart(PlayerUID,std::shared_ptr); static void playerSessionStart(int iPad); static void playerSessionPause(int iPad); static void playerSessionResume(int iPad); diff --git a/Minecraft.World/Stats/GenericStats.cpp b/Minecraft.World/Stats/GenericStats.cpp index d0f223dfe..02fcf182c 100644 --- a/Minecraft.World/Stats/GenericStats.cpp +++ b/Minecraft.World/Stats/GenericStats.cpp @@ -666,7 +666,7 @@ byteArray GenericStats::getParam_itemsSmelted(int id, int aux, int count) return this->getParam_itemsCrafted(id,aux,count); } -byteArray GenericStats::getParam_itemsUsed(shared_ptr plr, shared_ptr itm) +byteArray GenericStats::getParam_itemsUsed(std::shared_ptr plr, std::shared_ptr itm) { return getParam_noArgs(); // Really just a count on most platforms. } @@ -676,7 +676,7 @@ byteArray GenericStats::getParam_itemsBought(int id, int aux, int count) return getParam_noArgs(); } -byteArray GenericStats::getParam_mobKill(shared_ptr plr, shared_ptr mob, DamageSource *dmgSrc) +byteArray GenericStats::getParam_mobKill(std::shared_ptr plr, std::shared_ptr mob, DamageSource *dmgSrc) { return getParam_noArgs(); // Really just a count on most platforms. } @@ -833,7 +833,7 @@ byteArray GenericStats::param_itemsSmelted(int id, int aux, int count) return instance->getParam_itemsSmelted(id,aux,count); } -byteArray GenericStats::param_itemsUsed(shared_ptr plr, shared_ptr itm) +byteArray GenericStats::param_itemsUsed(std::shared_ptr plr, std::shared_ptr itm) { if ( (plr != NULL) && (itm != NULL) ) return instance->getParam_itemsUsed(plr, itm); else return instance->getParam_noArgs(); @@ -844,7 +844,7 @@ byteArray GenericStats::param_itemsBought(int id, int aux, int count) return instance->getParam_itemsBought(id,aux,count); } -byteArray GenericStats::param_mobKill(shared_ptr plr, shared_ptr mob, DamageSource *dmgSrc) +byteArray GenericStats::param_mobKill(std::shared_ptr plr, std::shared_ptr mob, DamageSource *dmgSrc) { if ( (plr != NULL) && (mob != NULL) ) return instance->getParam_mobKill(plr, mob, dmgSrc); else return instance->getParam_noArgs(); diff --git a/Minecraft.World/Stats/GenericStats.h b/Minecraft.World/Stats/GenericStats.h index 914477916..ae0ce682c 100644 --- a/Minecraft.World/Stats/GenericStats.h +++ b/Minecraft.World/Stats/GenericStats.h @@ -159,10 +159,10 @@ public: static byteArray param_itemsCollected(int id, int aux, int count); static byteArray param_itemsCrafted(int id, int aux, int count); static byteArray param_itemsSmelted(int id, int aux, int cound); - static byteArray param_itemsUsed(shared_ptr plr, shared_ptr itm); + static byteArray param_itemsUsed(std::shared_ptr plr, std::shared_ptr itm); static byteArray param_itemsBought(int id, int aux, int count); - static byteArray param_mobKill(shared_ptr plr, shared_ptr mob, DamageSource *dmgSrc); + static byteArray param_mobKill(std::shared_ptr plr, std::shared_ptr mob, DamageSource *dmgSrc); static byteArray param_breedEntity(eINSTANCEOF mobType); static byteArray param_tamedEntity(eINSTANCEOF mobType); @@ -318,10 +318,10 @@ protected: virtual byteArray getParam_itemsCollected(int id, int aux, int count); virtual byteArray getParam_itemsCrafted(int id, int aux, int count); virtual byteArray getParam_itemsSmelted(int id, int aux, int count); - virtual byteArray getParam_itemsUsed(shared_ptr plr, shared_ptr itm); + virtual byteArray getParam_itemsUsed(std::shared_ptr plr, std::shared_ptr itm); virtual byteArray getParam_itemsBought(int id, int aux, int count); - virtual byteArray getParam_mobKill(shared_ptr plr, shared_ptr mob, DamageSource *dmgSrc); + virtual byteArray getParam_mobKill(std::shared_ptr plr, std::shared_ptr mob, DamageSource *dmgSrc); virtual byteArray getParam_breedEntity(eINSTANCEOF entityId); virtual byteArray getParam_tamedEntity(eINSTANCEOF entityId); diff --git a/Minecraft.World/Stats/Stat.h b/Minecraft.World/Stats/Stat.h index 3c2ab071d..c9751d1c4 100644 --- a/Minecraft.World/Stats/Stat.h +++ b/Minecraft.World/Stats/Stat.h @@ -57,5 +57,5 @@ public: public: // 4J-JEV, for Durango stats - virtual void handleParamBlob(shared_ptr plr, byteArray param) { app.DebugPrintf("'Stat.h', Unhandled AwardStat blob.\n"); return; } + virtual void handleParamBlob(std::shared_ptr plr, byteArray param) { app.DebugPrintf("'Stat.h', Unhandled AwardStat blob.\n"); return; } }; diff --git a/Minecraft.World/Util/ArrayWithLength.h b/Minecraft.World/Util/ArrayWithLength.h index b91fd618a..5ac619a5d 100644 --- a/Minecraft.World/Util/ArrayWithLength.h +++ b/Minecraft.World/Util/ArrayWithLength.h @@ -105,11 +105,11 @@ typedef arrayWithLength LevelArray; typedef arrayWithLength LevelRendererArray; typedef arrayWithLength WeighedRandomItemArray; typedef arrayWithLength WeighedTreasureArray; -typedef arrayWithLength< shared_ptr > LayerArray; +typedef arrayWithLength< std::shared_ptr > LayerArray; //typedef arrayWithLength CubeArray; typedef arrayWithLength ModelPartArray; typedef arrayWithLength EnchantmentArray; typedef arrayWithLength ClipChunkArray; #include "../Items/ItemInstance.h" -typedef arrayWithLength > ItemInstanceArray; +typedef arrayWithLength > ItemInstanceArray; diff --git a/Minecraft.World/Util/DamageSource.cpp b/Minecraft.World/Util/DamageSource.cpp index a7057beaf..4a7454a76 100644 --- a/Minecraft.World/Util/DamageSource.cpp +++ b/Minecraft.World/Util/DamageSource.cpp @@ -24,22 +24,22 @@ DamageSource *DamageSource::wither = (new DamageSource(ChatPacket::e_ChatDeathWi DamageSource *DamageSource::anvil = (new DamageSource(ChatPacket::e_ChatDeathAnvil)); DamageSource *DamageSource::fallingBlock = (new DamageSource(ChatPacket::e_ChatDeathFallingBlock)); -DamageSource *DamageSource::mobAttack(shared_ptr mob) +DamageSource *DamageSource::mobAttack(std::shared_ptr mob) { return new EntityDamageSource(ChatPacket::e_ChatDeathMob, mob); } -DamageSource *DamageSource::playerAttack(shared_ptr player) +DamageSource *DamageSource::playerAttack(std::shared_ptr player) { return new EntityDamageSource(ChatPacket::e_ChatDeathPlayer, player); } -DamageSource *DamageSource::arrow(shared_ptr arrow, shared_ptr owner) +DamageSource *DamageSource::arrow(std::shared_ptr arrow, std::shared_ptr owner) { return (new IndirectEntityDamageSource(ChatPacket::e_ChatDeathArrow, arrow, owner))->setProjectile(); } -DamageSource *DamageSource::fireball(shared_ptr fireball, shared_ptr owner) +DamageSource *DamageSource::fireball(std::shared_ptr fireball, std::shared_ptr owner) { if (owner == NULL) { @@ -48,17 +48,17 @@ DamageSource *DamageSource::fireball(shared_ptr fireball, shared_ptrsetIsFire()->setProjectile(); } -DamageSource *DamageSource::thrown(shared_ptr entity, shared_ptr owner) +DamageSource *DamageSource::thrown(std::shared_ptr entity, std::shared_ptr owner) { return (new IndirectEntityDamageSource(ChatPacket::e_ChatDeathThrown, entity, owner))->setProjectile(); } -DamageSource *DamageSource::indirectMagic(shared_ptr entity, shared_ptr owner) +DamageSource *DamageSource::indirectMagic(std::shared_ptr entity, std::shared_ptr owner) { return (new IndirectEntityDamageSource(ChatPacket::e_ChatDeathIndirectMagic, entity, owner) )->bypassArmor()->setMagic();; } -DamageSource *DamageSource::thorns(shared_ptr source) +DamageSource *DamageSource::thorns(std::shared_ptr source) { return (new EntityDamageSource(ChatPacket::e_ChatDeathThorns, source))->setMagic(); } @@ -106,14 +106,14 @@ DamageSource::DamageSource(ChatPacket::EChatPacketMessage msgId) m_msgId = msgId; } -shared_ptr DamageSource::getDirectEntity() +std::shared_ptr DamageSource::getDirectEntity() { return getEntity(); } -shared_ptr DamageSource::getEntity() +std::shared_ptr DamageSource::getEntity() { - return shared_ptr(); + return std::shared_ptr(); } DamageSource *DamageSource::bypassArmor() @@ -158,15 +158,15 @@ DamageSource *DamageSource::setMagic() return this; } -//wstring DamageSource::getLocalizedDeathMessage(shared_ptr player) +//wstring DamageSource::getLocalizedDeathMessage(std::shared_ptr player) //{ // return L"death." + msgId + player->name; // //return I18n.get(L"death." + msgId, player.name); //} -shared_ptr DamageSource::getDeathMessagePacket(shared_ptr player) +std::shared_ptr DamageSource::getDeathMessagePacket(std::shared_ptr player) { - return shared_ptr( new ChatPacket(player->name, m_msgId ) ); + return std::shared_ptr( new ChatPacket(player->name, m_msgId ) ); } bool DamageSource::isFire() diff --git a/Minecraft.World/Util/DamageSource.h b/Minecraft.World/Util/DamageSource.h index 9d84efbf9..9047c2396 100644 --- a/Minecraft.World/Util/DamageSource.h +++ b/Minecraft.World/Util/DamageSource.h @@ -30,13 +30,13 @@ public: static DamageSource *anvil; static DamageSource *fallingBlock; - static DamageSource *mobAttack(shared_ptr mob); - static DamageSource *playerAttack(shared_ptr player); - static DamageSource *arrow(shared_ptr arrow, shared_ptr owner); - static DamageSource *fireball(shared_ptr fireball, shared_ptr owner); - static DamageSource *thrown(shared_ptr entity, shared_ptr owner); - static DamageSource *indirectMagic(shared_ptr entity, shared_ptr owner); - static DamageSource *thorns(shared_ptr source); + static DamageSource *mobAttack(std::shared_ptr mob); + static DamageSource *playerAttack(std::shared_ptr player); + static DamageSource *arrow(std::shared_ptr arrow, std::shared_ptr owner); + static DamageSource *fireball(std::shared_ptr fireball, std::shared_ptr owner); + static DamageSource *thrown(std::shared_ptr entity, std::shared_ptr owner); + static DamageSource *indirectMagic(std::shared_ptr entity, std::shared_ptr owner); + static DamageSource *thorns(std::shared_ptr source); private: bool _bypassArmor; @@ -66,8 +66,8 @@ protected: public: virtual ~DamageSource() {} - virtual shared_ptr getDirectEntity(); - virtual shared_ptr getEntity(); + virtual std::shared_ptr getDirectEntity(); + virtual std::shared_ptr getEntity(); protected: DamageSource *bypassArmor(); @@ -82,8 +82,8 @@ public: DamageSource *setMagic(); // 4J Stu - Made return a packet - //virtual wstring getLocalizedDeathMessage(shared_ptr player); - virtual shared_ptr getDeathMessagePacket(shared_ptr player); + //virtual wstring getLocalizedDeathMessage(std::shared_ptr player); + virtual std::shared_ptr getDeathMessagePacket(std::shared_ptr player); bool isFire(); ChatPacket::EChatPacketMessage getMsgId(); // 4J Stu - Used to return String diff --git a/Minecraft.World/Util/DelayedRelease.cpp b/Minecraft.World/Util/DelayedRelease.cpp index 955f0fc74..f88d5c9cd 100644 --- a/Minecraft.World/Util/DelayedRelease.cpp +++ b/Minecraft.World/Util/DelayedRelease.cpp @@ -4,7 +4,7 @@ -DelayedRelease::DelayedRelease(Level *level, shared_ptr toRelease, int delay) : Entity(level) +DelayedRelease::DelayedRelease(Level *level, std::shared_ptr toRelease, int delay) : Entity(level) { moveTo(toRelease->x, toRelease->y, toRelease->z, 0, 0); this->toRelease = toRelease; diff --git a/Minecraft.World/Util/DelayedRelease.h b/Minecraft.World/Util/DelayedRelease.h index 315b4ed91..b3579fa57 100644 --- a/Minecraft.World/Util/DelayedRelease.h +++ b/Minecraft.World/Util/DelayedRelease.h @@ -10,11 +10,11 @@ public: virtual eINSTANCEOF GetType() { return eTYPE_DELAYEDRELEASE; } private: - shared_ptr toRelease; + std::shared_ptr toRelease; int delay; public: - DelayedRelease(Level *level, shared_ptr toRelease, int delay); + DelayedRelease(Level *level, std::shared_ptr toRelease, int delay); protected: virtual bool makeStepSound(); diff --git a/Minecraft.World/Util/HashExtension.h b/Minecraft.World/Util/HashExtension.h index 7ec9a9091..85eec19ae 100644 --- a/Minecraft.World/Util/HashExtension.h +++ b/Minecraft.World/Util/HashExtension.h @@ -7,10 +7,10 @@ namespace std { template - class hash< shared_ptr > + class hash< std::shared_ptr > { public: - size_t operator()(const shared_ptr& key) const + size_t operator()(const std::shared_ptr& key) const { return (size_t)key.get(); } diff --git a/Minecraft.World/Util/HitResult.cpp b/Minecraft.World/Util/HitResult.cpp index c23307ecb..1dd3166f1 100644 --- a/Minecraft.World/Util/HitResult.cpp +++ b/Minecraft.World/Util/HitResult.cpp @@ -15,7 +15,7 @@ HitResult::HitResult(int x, int y, int z, int f, Vec3 *pos) this->entity = nullptr; } -HitResult::HitResult(shared_ptr entity) +HitResult::HitResult(std::shared_ptr entity) { this->type = ENTITY; this->entity = entity; @@ -24,7 +24,7 @@ HitResult::HitResult(shared_ptr entity) x = y = z = f = 0; } -double HitResult::distanceTo(shared_ptr e) +double HitResult::distanceTo(std::shared_ptr e) { double xd = pos->x - e->x; double yd = pos->y - e->y; diff --git a/Minecraft.World/Util/HitResult.h b/Minecraft.World/Util/HitResult.h index efcfa75aa..7721a0ff9 100644 --- a/Minecraft.World/Util/HitResult.h +++ b/Minecraft.World/Util/HitResult.h @@ -12,11 +12,11 @@ public: Type type; int x, y, z, f; Vec3 *pos; - shared_ptr entity; + std::shared_ptr entity; HitResult(int x, int y, int z, int f, Vec3 *pos); - HitResult(shared_ptr entity); + HitResult(std::shared_ptr entity); - double distanceTo(shared_ptr e); + double distanceTo(std::shared_ptr e); }; \ No newline at end of file diff --git a/Minecraft.World/Util/WeighedTreasure.cpp b/Minecraft.World/Util/WeighedTreasure.cpp index 58ad56dad..1c96ace5a 100644 --- a/Minecraft.World/Util/WeighedTreasure.cpp +++ b/Minecraft.World/Util/WeighedTreasure.cpp @@ -6,19 +6,19 @@ WeighedTreasure::WeighedTreasure(int itemId, int auxValue, int minCount, int maxCount, int weight) : WeighedRandomItem(weight) { - this->item = shared_ptr( new ItemInstance(itemId, 1, auxValue) ); + this->item = std::shared_ptr( new ItemInstance(itemId, 1, auxValue) ); this->minCount = minCount; this->maxCount = maxCount; } -WeighedTreasure::WeighedTreasure(shared_ptr item, int minCount, int maxCount, int weight) : WeighedRandomItem(weight) +WeighedTreasure::WeighedTreasure(std::shared_ptr item, int minCount, int maxCount, int weight) : WeighedRandomItem(weight) { this->item = item; this->minCount = minCount; this->maxCount = maxCount; } -void WeighedTreasure::addChestItems(Random *random, WeighedTreasureArray items, shared_ptr dest, int numRolls) +void WeighedTreasure::addChestItems(Random *random, WeighedTreasureArray items, std::shared_ptr dest, int numRolls) { for (int r = 0; r < numRolls; r++) { @@ -27,7 +27,7 @@ void WeighedTreasure::addChestItems(Random *random, WeighedTreasureArray items, int count = treasure->minCount + random->nextInt(treasure->maxCount - treasure->minCount + 1); if (treasure->item->getMaxStackSize() >= count) { - shared_ptr copy = treasure->item->copy(); + std::shared_ptr copy = treasure->item->copy(); copy->count = count; dest->setItem(random->nextInt(dest->getContainerSize()), copy); } @@ -36,7 +36,7 @@ void WeighedTreasure::addChestItems(Random *random, WeighedTreasureArray items, // use multiple slots for (int c = 0; c < count; c++) { - shared_ptr copy = treasure->item->copy(); + std::shared_ptr copy = treasure->item->copy(); copy->count = 1; dest->setItem(random->nextInt(dest->getContainerSize()), copy); } @@ -44,7 +44,7 @@ void WeighedTreasure::addChestItems(Random *random, WeighedTreasureArray items, } } -void WeighedTreasure::addDispenserItems(Random *random, WeighedTreasureArray items, shared_ptr dest, int numRolls) +void WeighedTreasure::addDispenserItems(Random *random, WeighedTreasureArray items, std::shared_ptr dest, int numRolls) { for (int r = 0; r < numRolls; r++) { @@ -53,7 +53,7 @@ void WeighedTreasure::addDispenserItems(Random *random, WeighedTreasureArray ite int count = treasure->minCount + random->nextInt(treasure->maxCount - treasure->minCount + 1); if (treasure->item->getMaxStackSize() >= count) { - shared_ptr copy = treasure->item->copy(); + std::shared_ptr copy = treasure->item->copy(); copy->count = count; dest->setItem(random->nextInt(dest->getContainerSize()), copy); } @@ -62,7 +62,7 @@ void WeighedTreasure::addDispenserItems(Random *random, WeighedTreasureArray ite // use multiple slots for (int c = 0; c < count; c++) { - shared_ptr copy = treasure->item->copy(); + std::shared_ptr copy = treasure->item->copy(); copy->count = 1; dest->setItem(random->nextInt(dest->getContainerSize()), copy); } diff --git a/Minecraft.World/Util/WeighedTreasure.h b/Minecraft.World/Util/WeighedTreasure.h index a37bc6ae4..7b0ecd4c2 100644 --- a/Minecraft.World/Util/WeighedTreasure.h +++ b/Minecraft.World/Util/WeighedTreasure.h @@ -5,15 +5,15 @@ class WeighedTreasure : public WeighedRandomItem { private: - shared_ptr item; + std::shared_ptr item; int minCount; int maxCount; public: WeighedTreasure(int itemId, int auxValue, int minCount, int maxCount, int weight); - WeighedTreasure(shared_ptr item, int minCount, int maxCount, int weight); + WeighedTreasure(std::shared_ptr item, int minCount, int maxCount, int weight); - static void addChestItems(Random *random, WeighedTreasureArray items, shared_ptr dest, int numRolls); - static void addDispenserItems(Random *random, WeighedTreasureArray items, shared_ptr dest, int numRolls); + static void addChestItems(Random *random, WeighedTreasureArray items, std::shared_ptr dest, int numRolls); + static void addDispenserItems(Random *random, WeighedTreasureArray items, std::shared_ptr dest, int numRolls); static WeighedTreasureArray addToTreasure(WeighedTreasureArray items, WeighedTreasure *extra); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Biomes/BiomeSource.h b/Minecraft.World/WorldGen/Biomes/BiomeSource.h index a378b1222..43a7e21bf 100644 --- a/Minecraft.World/WorldGen/Biomes/BiomeSource.h +++ b/Minecraft.World/WorldGen/Biomes/BiomeSource.h @@ -13,8 +13,8 @@ class LevelType; class BiomeSource { private: - shared_ptr layer; - shared_ptr zoomedLayer; + std::shared_ptr layer; + std::shared_ptr zoomedLayer; public: static const int CACHE_DIAMETER = 256; diff --git a/Minecraft.World/WorldGen/Features/BonusChestFeature.cpp b/Minecraft.World/WorldGen/Features/BonusChestFeature.cpp index ff0919e77..11e3f18bb 100644 --- a/Minecraft.World/WorldGen/Features/BonusChestFeature.cpp +++ b/Minecraft.World/WorldGen/Features/BonusChestFeature.cpp @@ -58,7 +58,7 @@ bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z, if (force || ( level->isEmptyTile(x2, y2, z2) && level->isTopSolidBlocking(x2, y2 - 1, z2))) { level->setTile(x2, y2, z2, Tile::chest_Id); - shared_ptr chest = dynamic_pointer_cast(level->getTileEntity(x2, y2, z2)); + std::shared_ptr chest = dynamic_pointer_cast(level->getTileEntity(x2, y2, z2)); if (chest != NULL) { WeighedTreasure::addChestItems(random, treasureList, chest, numRolls); diff --git a/Minecraft.World/WorldGen/Features/HouseFeature.cpp b/Minecraft.World/WorldGen/Features/HouseFeature.cpp index 1666959c3..c13a1ac58 100644 --- a/Minecraft.World/WorldGen/Features/HouseFeature.cpp +++ b/Minecraft.World/WorldGen/Features/HouseFeature.cpp @@ -184,7 +184,7 @@ bool HouseFeature::place(Level *level, Random *random, int x, int y, int z) } } - shared_ptr(pz) = shared_ptr(new PigZombie(level)); + std::shared_ptr(pz) = std::shared_ptr(new PigZombie(level)); pz->moveTo(x0 + w / 2.0 + 0.5, y0 + 0.5, z0 + d / 2.0 + 0.5, 0, 0); level->addEntity(pz); diff --git a/Minecraft.World/WorldGen/Features/MonsterRoomFeature.cpp b/Minecraft.World/WorldGen/Features/MonsterRoomFeature.cpp index 0b4fe3e93..3204b7adf 100644 --- a/Minecraft.World/WorldGen/Features/MonsterRoomFeature.cpp +++ b/Minecraft.World/WorldGen/Features/MonsterRoomFeature.cpp @@ -84,12 +84,12 @@ bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z if (count != 1) continue; level->setTile(xc, yc, zc, Tile::chest_Id); - shared_ptr chest = dynamic_pointer_cast( level->getTileEntity(xc, yc, zc) ); + std::shared_ptr chest = dynamic_pointer_cast( level->getTileEntity(xc, yc, zc) ); if (chest != NULL ) { for (int j = 0; j < 8; j++) { - shared_ptr item = randomItem(random); + std::shared_ptr item = randomItem(random); if (item != NULL) chest->setItem(random->nextInt(chest->getContainerSize()), item); } } @@ -100,7 +100,7 @@ bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z level->setTile(x, y, z, Tile::mobSpawner_Id); - shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); + std::shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); if( entity != NULL ) { entity->setEntityId(randomEntityId(random)); @@ -110,23 +110,23 @@ bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z } -shared_ptr MonsterRoomFeature::randomItem(Random *random) +std::shared_ptr MonsterRoomFeature::randomItem(Random *random) { int type = random->nextInt(12); - if (type == 0) return shared_ptr( new ItemInstance(Item::saddle) ); - if (type == 1) return shared_ptr( new ItemInstance(Item::ironIngot, random->nextInt(4) + 1) ); - if (type == 2) return shared_ptr( new ItemInstance(Item::bread) ); - if (type == 3) return shared_ptr( new ItemInstance(Item::wheat, random->nextInt(4) + 1) ); - if (type == 4) return shared_ptr( new ItemInstance(Item::sulphur, random->nextInt(4) + 1) ); - if (type == 5) return shared_ptr( new ItemInstance(Item::string, random->nextInt(4) + 1) ); - if (type == 6) return shared_ptr( new ItemInstance(Item::bucket_empty) ); - if (type == 7 && random->nextInt(100) == 0) return shared_ptr( new ItemInstance(Item::apple_gold) ); - if (type == 8 && random->nextInt(2) == 0) return shared_ptr( new ItemInstance(Item::redStone, random->nextInt(4) + 1) ); - if (type == 9 && random->nextInt(10) == 0) return shared_ptr( new ItemInstance( Item::items[Item::record_01->id + random->nextInt(2)]) ); - if (type == 10) return shared_ptr( new ItemInstance(Item::dye_powder, 1, DyePowderItem::BROWN) ); + if (type == 0) return std::shared_ptr( new ItemInstance(Item::saddle) ); + if (type == 1) return std::shared_ptr( new ItemInstance(Item::ironIngot, random->nextInt(4) + 1) ); + if (type == 2) return std::shared_ptr( new ItemInstance(Item::bread) ); + if (type == 3) return std::shared_ptr( new ItemInstance(Item::wheat, random->nextInt(4) + 1) ); + if (type == 4) return std::shared_ptr( new ItemInstance(Item::sulphur, random->nextInt(4) + 1) ); + if (type == 5) return std::shared_ptr( new ItemInstance(Item::string, random->nextInt(4) + 1) ); + if (type == 6) return std::shared_ptr( new ItemInstance(Item::bucket_empty) ); + if (type == 7 && random->nextInt(100) == 0) return std::shared_ptr( new ItemInstance(Item::apple_gold) ); + if (type == 8 && random->nextInt(2) == 0) return std::shared_ptr( new ItemInstance(Item::redStone, random->nextInt(4) + 1) ); + if (type == 9 && random->nextInt(10) == 0) return std::shared_ptr( new ItemInstance( Item::items[Item::record_01->id + random->nextInt(2)]) ); + if (type == 10) return std::shared_ptr( new ItemInstance(Item::dye_powder, 1, DyePowderItem::BROWN) ); if (type == 11) return Item::enchantedBook->createForRandomLoot(random); - return shared_ptr(); + return std::shared_ptr(); } wstring MonsterRoomFeature::randomEntityId(Random *random) diff --git a/Minecraft.World/WorldGen/Features/MonsterRoomFeature.h b/Minecraft.World/WorldGen/Features/MonsterRoomFeature.h index b2649bffb..add5e413d 100644 --- a/Minecraft.World/WorldGen/Features/MonsterRoomFeature.h +++ b/Minecraft.World/WorldGen/Features/MonsterRoomFeature.h @@ -11,6 +11,6 @@ public: virtual bool place(Level *level, Random *random, int x, int y, int z); private: - shared_ptr randomItem(Random *random); + std::shared_ptr randomItem(Random *random); wstring randomEntityId(Random *random); }; diff --git a/Minecraft.World/WorldGen/Features/SpikeFeature.cpp b/Minecraft.World/WorldGen/Features/SpikeFeature.cpp index b28313ba5..33a0fc32a 100644 --- a/Minecraft.World/WorldGen/Features/SpikeFeature.cpp +++ b/Minecraft.World/WorldGen/Features/SpikeFeature.cpp @@ -50,7 +50,7 @@ bool SpikeFeature::place(Level *level, Random *random, int x, int y, int z) } else break; } - shared_ptr enderCrystal = shared_ptr(new EnderCrystal(level)); + std::shared_ptr enderCrystal = std::shared_ptr(new EnderCrystal(level)); enderCrystal->moveTo(x + 0.5f, y + hh, z + 0.5f, random->nextFloat() * 360, 0); level->addEntity(enderCrystal); level->setTile(x, y + hh, z, Tile::unbreakable_Id); @@ -168,7 +168,7 @@ bool SpikeFeature::placeWithIndex(Level *level, Random *random, int x, int y, in } } - shared_ptr enderCrystal = shared_ptr(new EnderCrystal(level)); + std::shared_ptr enderCrystal = std::shared_ptr(new EnderCrystal(level)); enderCrystal->moveTo(x + 0.5f, y + hh, z + 0.5f, random->nextFloat() * 360, 0); level->addEntity(enderCrystal); placeBlock(level, x, y + hh, z, Tile::unbreakable_Id, 0); diff --git a/Minecraft.World/WorldGen/Layers/AddIslandLayer.cpp b/Minecraft.World/WorldGen/Layers/AddIslandLayer.cpp index ea6b1f6bd..b011a2689 100644 --- a/Minecraft.World/WorldGen/Layers/AddIslandLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/AddIslandLayer.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" #include "../../Headers/net.minecraft.world.level.biome.h" -AddIslandLayer::AddIslandLayer(__int64 seedMixup, shared_ptrparent) : Layer(seedMixup) +AddIslandLayer::AddIslandLayer(__int64 seedMixup, std::shared_ptrparent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/AddIslandLayer.h b/Minecraft.World/WorldGen/Layers/AddIslandLayer.h index e7c9384b7..3ad55f3aa 100644 --- a/Minecraft.World/WorldGen/Layers/AddIslandLayer.h +++ b/Minecraft.World/WorldGen/Layers/AddIslandLayer.h @@ -5,7 +5,7 @@ class AddIslandLayer : public Layer { public: - AddIslandLayer(__int64 seedMixup, shared_ptrparent); + AddIslandLayer(__int64 seedMixup, std::shared_ptrparent); intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/AddMushroomIslandLayer.cpp b/Minecraft.World/WorldGen/Layers/AddMushroomIslandLayer.cpp index 23707dc0c..bf3055c82 100644 --- a/Minecraft.World/WorldGen/Layers/AddMushroomIslandLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/AddMushroomIslandLayer.cpp @@ -3,7 +3,7 @@ #include "../../Headers/net.minecraft.world.level.biome.h" -AddMushroomIslandLayer::AddMushroomIslandLayer(__int64 seedMixup, shared_ptr parent) : Layer(seedMixup) +AddMushroomIslandLayer::AddMushroomIslandLayer(__int64 seedMixup, std::shared_ptr parent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/AddMushroomIslandLayer.h b/Minecraft.World/WorldGen/Layers/AddMushroomIslandLayer.h index acda9fa77..eecad4103 100644 --- a/Minecraft.World/WorldGen/Layers/AddMushroomIslandLayer.h +++ b/Minecraft.World/WorldGen/Layers/AddMushroomIslandLayer.h @@ -4,6 +4,6 @@ class AddMushroomIslandLayer : public Layer { public: - AddMushroomIslandLayer(__int64 seedMixup, shared_ptr parent); + AddMushroomIslandLayer(__int64 seedMixup, std::shared_ptr parent); virtual intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/AddSnowLayer.cpp b/Minecraft.World/WorldGen/Layers/AddSnowLayer.cpp index 7c363cd5e..fe14e87c1 100644 --- a/Minecraft.World/WorldGen/Layers/AddSnowLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/AddSnowLayer.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" #include "../../Headers/net.minecraft.world.level.biome.h" -AddSnowLayer::AddSnowLayer(__int64 seedMixup, shared_ptr parent) : Layer(seedMixup) +AddSnowLayer::AddSnowLayer(__int64 seedMixup, std::shared_ptr parent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/AddSnowLayer.h b/Minecraft.World/WorldGen/Layers/AddSnowLayer.h index ede7a2267..45101266b 100644 --- a/Minecraft.World/WorldGen/Layers/AddSnowLayer.h +++ b/Minecraft.World/WorldGen/Layers/AddSnowLayer.h @@ -4,6 +4,6 @@ class AddSnowLayer : public Layer { public: - AddSnowLayer(__int64 seedMixup, shared_ptr parent); + AddSnowLayer(__int64 seedMixup, std::shared_ptr parent); virtual intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/BiomeInitLayer.cpp b/Minecraft.World/WorldGen/Layers/BiomeInitLayer.cpp index 3ed2782bf..190cb9028 100644 --- a/Minecraft.World/WorldGen/Layers/BiomeInitLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/BiomeInitLayer.cpp @@ -4,7 +4,7 @@ #include "../../Headers/net.minecraft.world.level.h" #include "BiomeInitLayer.h" -BiomeInitLayer::BiomeInitLayer(__int64 seed, shared_ptrparent, LevelType *levelType) : Layer(seed) +BiomeInitLayer::BiomeInitLayer(__int64 seed, std::shared_ptrparent, LevelType *levelType) : Layer(seed) { this->parent = parent; diff --git a/Minecraft.World/WorldGen/Layers/BiomeInitLayer.h b/Minecraft.World/WorldGen/Layers/BiomeInitLayer.h index e645a3790..f85d1e949 100644 --- a/Minecraft.World/WorldGen/Layers/BiomeInitLayer.h +++ b/Minecraft.World/WorldGen/Layers/BiomeInitLayer.h @@ -10,7 +10,7 @@ private: BiomeArray startBiomes; public: - BiomeInitLayer(__int64 seed, shared_ptr parent, LevelType *levelType); + BiomeInitLayer(__int64 seed, std::shared_ptr parent, LevelType *levelType); virtual ~BiomeInitLayer(); intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/DownfallLayer.cpp b/Minecraft.World/WorldGen/Layers/DownfallLayer.cpp index eed5b3b8f..5cff1e81f 100644 --- a/Minecraft.World/WorldGen/Layers/DownfallLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/DownfallLayer.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.biome.h" #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" -DownfallLayer::DownfallLayer(shared_ptrparent) : Layer(0) +DownfallLayer::DownfallLayer(std::shared_ptrparent) : Layer(0) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/DownfallLayer.h b/Minecraft.World/WorldGen/Layers/DownfallLayer.h index e708253c4..ed191b175 100644 --- a/Minecraft.World/WorldGen/Layers/DownfallLayer.h +++ b/Minecraft.World/WorldGen/Layers/DownfallLayer.h @@ -5,6 +5,6 @@ class DownfallLayer : public Layer { public: - DownfallLayer(shared_ptrparent); + DownfallLayer(std::shared_ptrparent); intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/DownfallMixerLayer.cpp b/Minecraft.World/WorldGen/Layers/DownfallMixerLayer.cpp index e276a126b..5b282221b 100644 --- a/Minecraft.World/WorldGen/Layers/DownfallMixerLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/DownfallMixerLayer.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.biome.h" #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" -DownfallMixerLayer::DownfallMixerLayer(shared_ptrdownfall, shared_ptrparent, int layer) : Layer(0) +DownfallMixerLayer::DownfallMixerLayer(std::shared_ptrdownfall, std::shared_ptrparent, int layer) : Layer(0) { this->parent = parent; this->downfall = downfall; diff --git a/Minecraft.World/WorldGen/Layers/DownfallMixerLayer.h b/Minecraft.World/WorldGen/Layers/DownfallMixerLayer.h index 58e6151d8..c0149dce3 100644 --- a/Minecraft.World/WorldGen/Layers/DownfallMixerLayer.h +++ b/Minecraft.World/WorldGen/Layers/DownfallMixerLayer.h @@ -5,10 +5,10 @@ class DownfallMixerLayer : public Layer { private: - shared_ptr downfall; + std::shared_ptr downfall; int layer; public: - DownfallMixerLayer(shared_ptr downfall, shared_ptr parent, int layer); + DownfallMixerLayer(std::shared_ptr downfall, std::shared_ptr parent, int layer); intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/FuzzyZoomLayer.cpp b/Minecraft.World/WorldGen/Layers/FuzzyZoomLayer.cpp index 0df38fbee..dd6233a74 100644 --- a/Minecraft.World/WorldGen/Layers/FuzzyZoomLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/FuzzyZoomLayer.cpp @@ -2,7 +2,7 @@ #include "../../Build/System.h" #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" -FuzzyZoomLayer::FuzzyZoomLayer(__int64 seedMixup, shared_ptrparent) : Layer(seedMixup) +FuzzyZoomLayer::FuzzyZoomLayer(__int64 seedMixup, std::shared_ptrparent) : Layer(seedMixup) { this->parent = parent; } @@ -61,12 +61,12 @@ int FuzzyZoomLayer::random(int a, int b, int c, int d) return d; } -shared_ptrFuzzyZoomLayer::zoom(__int64 seed, shared_ptrsup, int count) +std::shared_ptrFuzzyZoomLayer::zoom(__int64 seed, std::shared_ptrsup, int count) { - shared_ptr result = sup; + std::shared_ptr result = sup; for (int i = 0; i < count; i++) { - result = shared_ptr(new FuzzyZoomLayer(seed + i, result)); + result = std::shared_ptr(new FuzzyZoomLayer(seed + i, result)); } return result; } \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/FuzzyZoomLayer.h b/Minecraft.World/WorldGen/Layers/FuzzyZoomLayer.h index bc8f5e489..06d03be40 100644 --- a/Minecraft.World/WorldGen/Layers/FuzzyZoomLayer.h +++ b/Minecraft.World/WorldGen/Layers/FuzzyZoomLayer.h @@ -5,7 +5,7 @@ class FuzzyZoomLayer : public Layer { public: - FuzzyZoomLayer(__int64 seedMixup, shared_ptrparent); + FuzzyZoomLayer(__int64 seedMixup, std::shared_ptrparent); intArray getArea(int xo, int yo, int w, int h); protected: @@ -13,5 +13,5 @@ protected: int random(int a, int b, int c, int d); public: - static shared_ptrzoom(__int64 seed, shared_ptrsup, int count); + static std::shared_ptrzoom(__int64 seed, std::shared_ptrsup, int count); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/GrowMushroomIslandLayer.cpp b/Minecraft.World/WorldGen/Layers/GrowMushroomIslandLayer.cpp index 451010cee..cb1f96cff 100644 --- a/Minecraft.World/WorldGen/Layers/GrowMushroomIslandLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/GrowMushroomIslandLayer.cpp @@ -3,7 +3,7 @@ #include "../../Headers/net.minecraft.world.level.biome.h" -GrowMushroomIslandLayer::GrowMushroomIslandLayer(__int64 seedMixup, shared_ptr parent) : Layer(seedMixup) +GrowMushroomIslandLayer::GrowMushroomIslandLayer(__int64 seedMixup, std::shared_ptr parent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/GrowMushroomIslandLayer.h b/Minecraft.World/WorldGen/Layers/GrowMushroomIslandLayer.h index 3bca4d5c7..874e28947 100644 --- a/Minecraft.World/WorldGen/Layers/GrowMushroomIslandLayer.h +++ b/Minecraft.World/WorldGen/Layers/GrowMushroomIslandLayer.h @@ -4,6 +4,6 @@ class GrowMushroomIslandLayer : public Layer { public: - GrowMushroomIslandLayer(__int64 seedMixup, shared_ptr parent); + GrowMushroomIslandLayer(__int64 seedMixup, std::shared_ptr parent); virtual intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/Layer.cpp b/Minecraft.World/WorldGen/Layers/Layer.cpp index 5c7a7f660..5140af1de 100644 --- a/Minecraft.World/WorldGen/Layers/Layer.cpp +++ b/Minecraft.World/WorldGen/Layers/Layer.cpp @@ -21,17 +21,17 @@ LayerArray Layer::getDefaultLayers(__int64 seed, LevelType *levelType) // 4J - Some changes moved here from 1.2.3. Temperature & downfall layers are no longer created & returned, and a debug layer is isn't. // For reference with regard to future merging, things NOT brought forward from the 1.2.3 version are new layer types that we // don't have yet (shores, swamprivers, region hills etc.) - shared_ptrislandLayer = shared_ptr(new IslandLayer(1)); - islandLayer = shared_ptr(new FuzzyZoomLayer(2000, islandLayer)); - islandLayer = shared_ptr(new AddIslandLayer(1, islandLayer)); - islandLayer = shared_ptr(new ZoomLayer(2001, islandLayer)); - islandLayer = shared_ptr(new AddIslandLayer(2, islandLayer)); - islandLayer = shared_ptr(new AddSnowLayer(2, islandLayer)); - islandLayer = shared_ptr(new ZoomLayer(2002, islandLayer)); - islandLayer = shared_ptr(new AddIslandLayer(3, islandLayer)); - islandLayer = shared_ptr(new ZoomLayer(2003, islandLayer)); - islandLayer = shared_ptr(new AddIslandLayer(4, islandLayer)); -// islandLayer = shared_ptr(new AddMushroomIslandLayer(5, islandLayer)); // 4J - old position of mushroom island layer + std::shared_ptrislandLayer = std::shared_ptr(new IslandLayer(1)); + islandLayer = std::shared_ptr(new FuzzyZoomLayer(2000, islandLayer)); + islandLayer = std::shared_ptr(new AddIslandLayer(1, islandLayer)); + islandLayer = std::shared_ptr(new ZoomLayer(2001, islandLayer)); + islandLayer = std::shared_ptr(new AddIslandLayer(2, islandLayer)); + islandLayer = std::shared_ptr(new AddSnowLayer(2, islandLayer)); + islandLayer = std::shared_ptr(new ZoomLayer(2002, islandLayer)); + islandLayer = std::shared_ptr(new AddIslandLayer(3, islandLayer)); + islandLayer = std::shared_ptr(new ZoomLayer(2003, islandLayer)); + islandLayer = std::shared_ptr(new AddIslandLayer(4, islandLayer)); +// islandLayer = std::shared_ptr(new AddMushroomIslandLayer(5, islandLayer)); // 4J - old position of mushroom island layer int zoomLevel = 4; if (levelType == LevelType::lvl_largeBiomes) @@ -39,32 +39,32 @@ LayerArray Layer::getDefaultLayers(__int64 seed, LevelType *levelType) zoomLevel = 6; } - shared_ptr riverLayer = islandLayer; + std::shared_ptr riverLayer = islandLayer; riverLayer = ZoomLayer::zoom(1000, riverLayer, 0); - riverLayer = shared_ptr(new RiverInitLayer(100, riverLayer)); + riverLayer = std::shared_ptr(new RiverInitLayer(100, riverLayer)); riverLayer = ZoomLayer::zoom(1000, riverLayer, zoomLevel + 2); - riverLayer = shared_ptr(new RiverLayer(1, riverLayer)); - riverLayer = shared_ptr(new SmoothLayer(1000, riverLayer)); + riverLayer = std::shared_ptr(new RiverLayer(1, riverLayer)); + riverLayer = std::shared_ptr(new SmoothLayer(1000, riverLayer)); - shared_ptr biomeLayer = islandLayer; + std::shared_ptr biomeLayer = islandLayer; biomeLayer = ZoomLayer::zoom(1000, biomeLayer, 0); - biomeLayer = shared_ptr(new BiomeInitLayer(200, biomeLayer, levelType)); + biomeLayer = std::shared_ptr(new BiomeInitLayer(200, biomeLayer, levelType)); biomeLayer = ZoomLayer::zoom(1000, biomeLayer, 2); - biomeLayer = shared_ptr(new RegionHillsLayer(1000, biomeLayer)); + biomeLayer = std::shared_ptr(new RegionHillsLayer(1000, biomeLayer)); for (int i = 0; i < zoomLevel; i++) { - biomeLayer = shared_ptr(new ZoomLayer(1000 + i, biomeLayer)); + biomeLayer = std::shared_ptr(new ZoomLayer(1000 + i, biomeLayer)); - if (i == 0) biomeLayer = shared_ptr(new AddIslandLayer(3, biomeLayer)); + if (i == 0) biomeLayer = std::shared_ptr(new AddIslandLayer(3, biomeLayer)); if (i == 0) { // 4J - moved mushroom islands to here. This skips 3 zooms that the old location of the add was, making them about 1/8 of the original size. Adding // them at this scale actually lets us place them near enough other land, if we add them at the same scale as java then they have to be too far out to see for // the scale of our maps - biomeLayer = shared_ptr(new AddMushroomIslandLayer(5, biomeLayer)); + biomeLayer = std::shared_ptr(new AddMushroomIslandLayer(5, biomeLayer)); } if (i == 1 ) @@ -72,30 +72,30 @@ LayerArray Layer::getDefaultLayers(__int64 seed, LevelType *levelType) // 4J - now expand mushroom islands up again. This does a simple region grow to add a new mushroom island element when any of the neighbours are also mushroom islands. // This helps make the islands into nice compact shapes of the type that are actually likely to be able to make an island out of the sea in a small space. Also // helps the shore layer from doing too much damage in shrinking the islands we are making - biomeLayer = shared_ptr(new GrowMushroomIslandLayer(5, biomeLayer)); + biomeLayer = std::shared_ptr(new GrowMushroomIslandLayer(5, biomeLayer)); // Note - this reduces the size of mushroom islands by turning their edges into shores. We are doing this at i == 1 rather than i == 0 as the original does - biomeLayer = shared_ptr(new ShoreLayer(1000, biomeLayer)); + biomeLayer = std::shared_ptr(new ShoreLayer(1000, biomeLayer)); - biomeLayer = shared_ptr(new SwampRiversLayer(1000, biomeLayer)); + biomeLayer = std::shared_ptr(new SwampRiversLayer(1000, biomeLayer)); } } - biomeLayer = shared_ptr(new SmoothLayer(1000, biomeLayer)); + biomeLayer = std::shared_ptr(new SmoothLayer(1000, biomeLayer)); - biomeLayer = shared_ptr(new RiverMixerLayer(100, biomeLayer, riverLayer)); + biomeLayer = std::shared_ptr(new RiverMixerLayer(100, biomeLayer, riverLayer)); #ifndef _CONTENT_PACKAGE #ifdef _BIOME_OVERRIDE if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<(new BiomeOverrideLayer(1)); + biomeLayer = std::shared_ptr(new BiomeOverrideLayer(1)); } #endif #endif - shared_ptr debugLayer = biomeLayer; + std::shared_ptr debugLayer = biomeLayer; - shared_ptrzoomedLayer = shared_ptr(new VoronoiZoom(10, biomeLayer)); + std::shared_ptrzoomedLayer = std::shared_ptr(new VoronoiZoom(10, biomeLayer)); biomeLayer->init(seed); zoomedLayer->init(seed); diff --git a/Minecraft.World/WorldGen/Layers/Layer.h b/Minecraft.World/WorldGen/Layers/Layer.h index 5055bbb9f..3afe13acc 100644 --- a/Minecraft.World/WorldGen/Layers/Layer.h +++ b/Minecraft.World/WorldGen/Layers/Layer.h @@ -14,7 +14,7 @@ private: __int64 seed; protected: - shared_ptrparent; + std::shared_ptrparent; private: __int64 rval; diff --git a/Minecraft.World/WorldGen/Layers/RegionHillsLayer.cpp b/Minecraft.World/WorldGen/Layers/RegionHillsLayer.cpp index efa1279b8..cfabf921b 100644 --- a/Minecraft.World/WorldGen/Layers/RegionHillsLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/RegionHillsLayer.cpp @@ -3,7 +3,7 @@ #include "../../Util/IntCache.h" #include "RegionHillsLayer.h" -RegionHillsLayer::RegionHillsLayer(__int64 seed, shared_ptr parent) : Layer(seed) +RegionHillsLayer::RegionHillsLayer(__int64 seed, std::shared_ptr parent) : Layer(seed) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/RegionHillsLayer.h b/Minecraft.World/WorldGen/Layers/RegionHillsLayer.h index 30d7eced1..1492857fb 100644 --- a/Minecraft.World/WorldGen/Layers/RegionHillsLayer.h +++ b/Minecraft.World/WorldGen/Layers/RegionHillsLayer.h @@ -5,7 +5,7 @@ class RegionHillsLayer : public Layer { public: - RegionHillsLayer(__int64 seed, shared_ptr parent); + RegionHillsLayer(__int64 seed, std::shared_ptr parent); intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/RiverInitLayer.cpp b/Minecraft.World/WorldGen/Layers/RiverInitLayer.cpp index 76659cd1e..8e7da816a 100644 --- a/Minecraft.World/WorldGen/Layers/RiverInitLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/RiverInitLayer.cpp @@ -1,7 +1,7 @@ #include "../../Build/stdafx.h" #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" -RiverInitLayer::RiverInitLayer(__int64 seed, shared_ptrparent) : Layer(seed) +RiverInitLayer::RiverInitLayer(__int64 seed, std::shared_ptrparent) : Layer(seed) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/RiverInitLayer.h b/Minecraft.World/WorldGen/Layers/RiverInitLayer.h index 6deb50e9b..ef543d7c5 100644 --- a/Minecraft.World/WorldGen/Layers/RiverInitLayer.h +++ b/Minecraft.World/WorldGen/Layers/RiverInitLayer.h @@ -5,7 +5,7 @@ class RiverInitLayer : public Layer { public: - RiverInitLayer(__int64 seed, shared_ptrparent); + RiverInitLayer(__int64 seed, std::shared_ptrparent); intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/RiverLayer.cpp b/Minecraft.World/WorldGen/Layers/RiverLayer.cpp index 57b284c4a..88a6ca067 100644 --- a/Minecraft.World/WorldGen/Layers/RiverLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/RiverLayer.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.biome.h" #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" -RiverLayer::RiverLayer(__int64 seedMixup, shared_ptrparent) : Layer(seedMixup) +RiverLayer::RiverLayer(__int64 seedMixup, std::shared_ptrparent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/RiverLayer.h b/Minecraft.World/WorldGen/Layers/RiverLayer.h index 657ac07c3..839f05555 100644 --- a/Minecraft.World/WorldGen/Layers/RiverLayer.h +++ b/Minecraft.World/WorldGen/Layers/RiverLayer.h @@ -5,6 +5,6 @@ class RiverLayer : public Layer { public: - RiverLayer(__int64 seedMixup, shared_ptrparent); + RiverLayer(__int64 seedMixup, std::shared_ptrparent); intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/RiverMixerLayer.cpp b/Minecraft.World/WorldGen/Layers/RiverMixerLayer.cpp index e1cd99bff..5b59f7c0a 100644 --- a/Minecraft.World/WorldGen/Layers/RiverMixerLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/RiverMixerLayer.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.biome.h" #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" -RiverMixerLayer::RiverMixerLayer(__int64 seed, shared_ptrbiomes, shared_ptrrivers) : Layer(seed) +RiverMixerLayer::RiverMixerLayer(__int64 seed, std::shared_ptrbiomes, std::shared_ptrrivers) : Layer(seed) { this->biomes = biomes; this->rivers = rivers; diff --git a/Minecraft.World/WorldGen/Layers/RiverMixerLayer.h b/Minecraft.World/WorldGen/Layers/RiverMixerLayer.h index eec516103..338f83b0b 100644 --- a/Minecraft.World/WorldGen/Layers/RiverMixerLayer.h +++ b/Minecraft.World/WorldGen/Layers/RiverMixerLayer.h @@ -5,11 +5,11 @@ class RiverMixerLayer : public Layer { private: - shared_ptrbiomes; - shared_ptrrivers; + std::shared_ptrbiomes; + std::shared_ptrrivers; public: - RiverMixerLayer(__int64 seed, shared_ptrbiomes, shared_ptrrivers); + RiverMixerLayer(__int64 seed, std::shared_ptrbiomes, std::shared_ptrrivers); virtual void init(__int64 seed); virtual intArray getArea(int xo, int yo, int w, int h); diff --git a/Minecraft.World/WorldGen/Layers/ShoreLayer.cpp b/Minecraft.World/WorldGen/Layers/ShoreLayer.cpp index 6340fcc89..91469caba 100644 --- a/Minecraft.World/WorldGen/Layers/ShoreLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/ShoreLayer.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" #include "../../Headers/net.minecraft.world.level.biome.h" -ShoreLayer::ShoreLayer(__int64 seed, shared_ptr parent) : Layer(seed) +ShoreLayer::ShoreLayer(__int64 seed, std::shared_ptr parent) : Layer(seed) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/ShoreLayer.h b/Minecraft.World/WorldGen/Layers/ShoreLayer.h index 96aea1521..3728d66f2 100644 --- a/Minecraft.World/WorldGen/Layers/ShoreLayer.h +++ b/Minecraft.World/WorldGen/Layers/ShoreLayer.h @@ -4,6 +4,6 @@ class ShoreLayer : public Layer { public: - ShoreLayer(__int64 seed, shared_ptr parent); + ShoreLayer(__int64 seed, std::shared_ptr parent); virtual intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/SmoothLayer.cpp b/Minecraft.World/WorldGen/Layers/SmoothLayer.cpp index d74e52543..7d90cc2b2 100644 --- a/Minecraft.World/WorldGen/Layers/SmoothLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/SmoothLayer.cpp @@ -1,7 +1,7 @@ #include "../../Build/stdafx.h" #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" -SmoothLayer::SmoothLayer(__int64 seedMixup, shared_ptrparent) : Layer(seedMixup) +SmoothLayer::SmoothLayer(__int64 seedMixup, std::shared_ptrparent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/SmoothLayer.h b/Minecraft.World/WorldGen/Layers/SmoothLayer.h index eec3f19ef..3eee6e170 100644 --- a/Minecraft.World/WorldGen/Layers/SmoothLayer.h +++ b/Minecraft.World/WorldGen/Layers/SmoothLayer.h @@ -5,7 +5,7 @@ class SmoothLayer : public Layer { public: - SmoothLayer(__int64 seedMixup, shared_ptrparent); + SmoothLayer(__int64 seedMixup, std::shared_ptrparent); virtual intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/SmoothZoomLayer.cpp b/Minecraft.World/WorldGen/Layers/SmoothZoomLayer.cpp index cd8bbd4d7..67b80f2bc 100644 --- a/Minecraft.World/WorldGen/Layers/SmoothZoomLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/SmoothZoomLayer.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" #include "../../Build/System.h" -SmoothZoomLayer::SmoothZoomLayer(__int64 seedMixup, shared_ptrparent) : Layer(seedMixup) +SmoothZoomLayer::SmoothZoomLayer(__int64 seedMixup, std::shared_ptrparent) : Layer(seedMixup) { this->parent = parent; } @@ -50,12 +50,12 @@ intArray SmoothZoomLayer::getArea(int xo, int yo, int w, int h) return result; } -shared_ptrSmoothZoomLayer::zoom(__int64 seed, shared_ptrsup, int count) +std::shared_ptrSmoothZoomLayer::zoom(__int64 seed, std::shared_ptrsup, int count) { - shared_ptrresult = sup; + std::shared_ptrresult = sup; for (int i = 0; i < count; i++) { - result = shared_ptr(new SmoothZoomLayer(seed + i, result)); + result = std::shared_ptr(new SmoothZoomLayer(seed + i, result)); } return result; } \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/SmoothZoomLayer.h b/Minecraft.World/WorldGen/Layers/SmoothZoomLayer.h index b2ac4e785..9aae06f1e 100644 --- a/Minecraft.World/WorldGen/Layers/SmoothZoomLayer.h +++ b/Minecraft.World/WorldGen/Layers/SmoothZoomLayer.h @@ -5,8 +5,8 @@ class SmoothZoomLayer : public Layer { public: - SmoothZoomLayer(__int64 seedMixup, shared_ptrparent); + SmoothZoomLayer(__int64 seedMixup, std::shared_ptrparent); virtual intArray getArea(int xo, int yo, int w, int h); - static shared_ptrzoom(__int64 seed, shared_ptrsup, int count); + static std::shared_ptrzoom(__int64 seed, std::shared_ptrsup, int count); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/SwampRiversLayer.cpp b/Minecraft.World/WorldGen/Layers/SwampRiversLayer.cpp index 1bc03fa3c..8cad1b1c0 100644 --- a/Minecraft.World/WorldGen/Layers/SwampRiversLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/SwampRiversLayer.cpp @@ -3,7 +3,7 @@ #include "../../Util/IntCache.h" #include "SwampRiversLayer.h" -SwampRiversLayer::SwampRiversLayer(__int64 seed, shared_ptr parent) : Layer(seed) +SwampRiversLayer::SwampRiversLayer(__int64 seed, std::shared_ptr parent) : Layer(seed) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/SwampRiversLayer.h b/Minecraft.World/WorldGen/Layers/SwampRiversLayer.h index f724ad82b..37ba49f46 100644 --- a/Minecraft.World/WorldGen/Layers/SwampRiversLayer.h +++ b/Minecraft.World/WorldGen/Layers/SwampRiversLayer.h @@ -5,7 +5,7 @@ class SwampRiversLayer : public Layer { public: - SwampRiversLayer(__int64 seed, shared_ptr parent); + SwampRiversLayer(__int64 seed, std::shared_ptr parent); intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/TemperatureLayer.cpp b/Minecraft.World/WorldGen/Layers/TemperatureLayer.cpp index f260e6b98..ab0e69bcf 100644 --- a/Minecraft.World/WorldGen/Layers/TemperatureLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/TemperatureLayer.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.biome.h" #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" -TemperatureLayer::TemperatureLayer(shared_ptr parent) : Layer(0) +TemperatureLayer::TemperatureLayer(std::shared_ptr parent) : Layer(0) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/TemperatureLayer.h b/Minecraft.World/WorldGen/Layers/TemperatureLayer.h index 34791caaf..0da464021 100644 --- a/Minecraft.World/WorldGen/Layers/TemperatureLayer.h +++ b/Minecraft.World/WorldGen/Layers/TemperatureLayer.h @@ -5,7 +5,7 @@ class TemperatureLayer : public Layer { public: - TemperatureLayer(shared_ptr parent); + TemperatureLayer(std::shared_ptr parent); virtual intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/TemperatureMixerLayer.cpp b/Minecraft.World/WorldGen/Layers/TemperatureMixerLayer.cpp index 05d98c834..4f2df091e 100644 --- a/Minecraft.World/WorldGen/Layers/TemperatureMixerLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/TemperatureMixerLayer.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.biome.h" #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" -TemperatureMixerLayer::TemperatureMixerLayer(shared_ptrtemp, shared_ptrparent, int layer) : Layer(0) +TemperatureMixerLayer::TemperatureMixerLayer(std::shared_ptrtemp, std::shared_ptrparent, int layer) : Layer(0) { this->parent = parent; this->temp = temp; diff --git a/Minecraft.World/WorldGen/Layers/TemperatureMixerLayer.h b/Minecraft.World/WorldGen/Layers/TemperatureMixerLayer.h index 3b3f56e04..0e7abf937 100644 --- a/Minecraft.World/WorldGen/Layers/TemperatureMixerLayer.h +++ b/Minecraft.World/WorldGen/Layers/TemperatureMixerLayer.h @@ -5,11 +5,11 @@ class TemperatureMixerLayer : public Layer { private: - shared_ptrtemp; + std::shared_ptrtemp; int layer; public: - TemperatureMixerLayer(shared_ptrtemp, shared_ptrparent, int layer); + TemperatureMixerLayer(std::shared_ptrtemp, std::shared_ptrparent, int layer); virtual intArray getArea(int xo, int yo, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/VoronoiZoom.cpp b/Minecraft.World/WorldGen/Layers/VoronoiZoom.cpp index e29f99602..dee597315 100644 --- a/Minecraft.World/WorldGen/Layers/VoronoiZoom.cpp +++ b/Minecraft.World/WorldGen/Layers/VoronoiZoom.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" #include "../../Build/System.h" -VoronoiZoom::VoronoiZoom(__int64 seedMixup, shared_ptrparent) : Layer(seedMixup) +VoronoiZoom::VoronoiZoom(__int64 seedMixup, std::shared_ptrparent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/WorldGen/Layers/VoronoiZoom.h b/Minecraft.World/WorldGen/Layers/VoronoiZoom.h index c0738c90e..25087ad38 100644 --- a/Minecraft.World/WorldGen/Layers/VoronoiZoom.h +++ b/Minecraft.World/WorldGen/Layers/VoronoiZoom.h @@ -5,7 +5,7 @@ class VoronoiZoom : public Layer { public: - VoronoiZoom(__int64 seedMixup, shared_ptrparent); + VoronoiZoom(__int64 seedMixup, std::shared_ptrparent); virtual intArray getArea(int xo, int yo, int w, int h); diff --git a/Minecraft.World/WorldGen/Layers/ZoomLayer.cpp b/Minecraft.World/WorldGen/Layers/ZoomLayer.cpp index e327118f7..0e492570d 100644 --- a/Minecraft.World/WorldGen/Layers/ZoomLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/ZoomLayer.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" #include "../../Build/System.h" -ZoomLayer::ZoomLayer(__int64 seedMixup, shared_ptrparent) : Layer(seedMixup) +ZoomLayer::ZoomLayer(__int64 seedMixup, std::shared_ptrparent) : Layer(seedMixup) { this->parent = parent; } @@ -81,12 +81,12 @@ int ZoomLayer::random(int a, int b, int c, int d) return d; } -shared_ptrZoomLayer::zoom(__int64 seed, shared_ptr sup, int count) +std::shared_ptrZoomLayer::zoom(__int64 seed, std::shared_ptr sup, int count) { - shared_ptrresult = sup; + std::shared_ptrresult = sup; for (int i = 0; i < count; i++) { - result = shared_ptr(new ZoomLayer(seed + i, result)); + result = std::shared_ptr(new ZoomLayer(seed + i, result)); } return result; } \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Layers/ZoomLayer.h b/Minecraft.World/WorldGen/Layers/ZoomLayer.h index f865f0886..345e6fb66 100644 --- a/Minecraft.World/WorldGen/Layers/ZoomLayer.h +++ b/Minecraft.World/WorldGen/Layers/ZoomLayer.h @@ -5,7 +5,7 @@ class ZoomLayer : public Layer { public: - ZoomLayer(__int64 seedMixup, shared_ptr parent); + ZoomLayer(__int64 seedMixup, std::shared_ptr parent); virtual intArray getArea(int xo, int yo, int w, int h); @@ -14,5 +14,5 @@ protected: int random(int a, int b, int c, int d); public: - static shared_ptr zoom(__int64 seed, shared_ptrsup, int count); + static std::shared_ptr zoom(__int64 seed, std::shared_ptrsup, int count); }; \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp b/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp index 420ab318b..af3953740 100644 --- a/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp +++ b/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp @@ -440,7 +440,7 @@ bool MineShaftPieces::MineShaftCorridor::postProcess(Level *level, Random *rando { hasPlacedSpider = true; level->setTile(x, y, newZ, Tile::mobSpawner_Id); - shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, newZ) ); + std::shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, newZ) ); if (entity != NULL) entity->setEntityId(L"CaveSpider"); } } diff --git a/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp b/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp index b5b42f782..5d69f2b2f 100644 --- a/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp +++ b/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp @@ -757,7 +757,7 @@ bool NetherBridgePieces::MonsterThrone::postProcess(Level *level, Random *random { hasPlacedMobSpawner = true; level->setTile(x, y, z, Tile::mobSpawner_Id); - shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); + std::shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); if (entity != NULL) entity->setEntityId(L"Blaze"); } } diff --git a/Minecraft.World/WorldGen/Structures/StrongholdPieces.cpp b/Minecraft.World/WorldGen/Structures/StrongholdPieces.cpp index 8132b253e..960bc23c9 100644 --- a/Minecraft.World/WorldGen/Structures/StrongholdPieces.cpp +++ b/Minecraft.World/WorldGen/Structures/StrongholdPieces.cpp @@ -1473,7 +1473,7 @@ bool StrongholdPieces::PortalRoom::postProcess(Level *level, Random *random, Bou hasPlacedMobSpawner = true; level->setTile(x, y, z, Tile::mobSpawner_Id); - shared_ptr entity = dynamic_pointer_cast(level->getTileEntity(x, y, z)); + std::shared_ptr entity = dynamic_pointer_cast(level->getTileEntity(x, y, z)); if (entity != NULL) entity->setEntityId(L"Silverfish"); } } diff --git a/Minecraft.World/WorldGen/Structures/StructurePiece.cpp b/Minecraft.World/WorldGen/Structures/StructurePiece.cpp index d669801b6..1ce9d2430 100644 --- a/Minecraft.World/WorldGen/Structures/StructurePiece.cpp +++ b/Minecraft.World/WorldGen/Structures/StructurePiece.cpp @@ -781,7 +781,7 @@ bool StructurePiece::createChest( Level* level, BoundingBox* chunkBB, Random* ra if ( level->getTile( worldX, worldY, worldZ ) != Tile::chest->id ) { level->setTile( worldX, worldY, worldZ, Tile::chest->id ); - shared_ptr chest = dynamic_pointer_cast(level->getTileEntity( worldX, worldY, worldZ )); + std::shared_ptr chest = dynamic_pointer_cast(level->getTileEntity( worldX, worldY, worldZ )); if ( chest != NULL ) WeighedTreasure::addChestItems( random, treasure, chest, numRolls ); return true; } @@ -800,7 +800,7 @@ bool StructurePiece::createDispenser(Level *level, BoundingBox *chunkBB, Random if (level->getTile(worldX, worldY, worldZ) != Tile::dispenser_Id) { level->setTileAndData(worldX, worldY, worldZ, Tile::dispenser_Id, getOrientationData(Tile::dispenser_Id, facing)); - shared_ptr dispenser = dynamic_pointer_cast(level->getTileEntity(worldX, worldY, worldZ)); + std::shared_ptr dispenser = dynamic_pointer_cast(level->getTileEntity(worldX, worldY, worldZ)); if (dispenser != NULL) WeighedTreasure::addDispenserItems(random, items, dispenser, numRolls); return true; } diff --git a/Minecraft.World/WorldGen/Structures/TheEndBiomeDecorator.cpp b/Minecraft.World/WorldGen/Structures/TheEndBiomeDecorator.cpp index 7d80f39eb..cc7d26411 100644 --- a/Minecraft.World/WorldGen/Structures/TheEndBiomeDecorator.cpp +++ b/Minecraft.World/WorldGen/Structures/TheEndBiomeDecorator.cpp @@ -58,7 +58,7 @@ void TheEndBiomeDecorator::decorate() } if (xo == 0 && zo == 0) { - shared_ptr enderDragon = shared_ptr(new EnderDragon(level)); + std::shared_ptr enderDragon = std::shared_ptr(new EnderDragon(level)); enderDragon->moveTo(0, 128, 0, random->nextFloat() * 360, 0); level->addEntity(enderDragon); } diff --git a/Minecraft.World/WorldGen/Structures/Village.cpp b/Minecraft.World/WorldGen/Structures/Village.cpp index fdd9303fc..61f34606e 100644 --- a/Minecraft.World/WorldGen/Structures/Village.cpp +++ b/Minecraft.World/WorldGen/Structures/Village.cpp @@ -8,7 +8,7 @@ #include "../../Util/BasicTypeContainers.h" #include "Village.h" -Village::Aggressor::Aggressor(shared_ptr mob, int timeStamp) +Village::Aggressor::Aggressor(std::shared_ptr mob, int timeStamp) { this->mob = mob; this->timeStamp = timeStamp; @@ -71,7 +71,7 @@ void Village::tick(int tick) Vec3 *spawnPos = findRandomSpawnPos(center->x, center->y, center->z, 2, 4, 2); if (spawnPos != NULL) { - shared_ptr vg = shared_ptr( new VillagerGolem(level) ); + std::shared_ptr vg = std::shared_ptr( new VillagerGolem(level) ); vg->setPos(spawnPos->x, spawnPos->y, spawnPos->z); level->addEntity(vg); ++golemCount; @@ -123,14 +123,14 @@ bool Village::canSpawnAt(int x, int y, int z, int sx, int sy, int sz) void Village::countGolem() { // Fix - let bots report themselves? - vector > *golems = level->getEntitiesOfClass(typeid(VillagerGolem), AABB::newTemp(center->x - radius, center->y - 4, center->z - radius, center->x + radius, center->y + 4, center->z + radius)); + vector > *golems = level->getEntitiesOfClass(typeid(VillagerGolem), AABB::newTemp(center->x - radius, center->y - 4, center->z - radius, center->x + radius, center->y + 4, center->z + radius)); golemCount = golems->size(); delete golems; } void Village::countPopulation() { - vector > *villagers = level->getEntitiesOfClass(typeid(Villager), AABB::newTemp(center->x - radius, center->y - 4, center->z - radius, center->x + radius, center->y + 4, center->z + radius)); + vector > *villagers = level->getEntitiesOfClass(typeid(Villager), AABB::newTemp(center->x - radius, center->y - 4, center->z - radius, center->x + radius, center->y + 4, center->z + radius)); populationSize = villagers->size(); delete villagers; @@ -171,19 +171,19 @@ bool Village::isInside(int xx, int yy, int zz) return center->distSqr(xx, yy, zz) < radius * radius; } -vector > *Village::getDoorInfos() +vector > *Village::getDoorInfos() { return &doorInfos; } -shared_ptr Village::getClosestDoorInfo(int x, int y, int z) +std::shared_ptr Village::getClosestDoorInfo(int x, int y, int z) { - shared_ptr closest = nullptr; + std::shared_ptr closest = nullptr; int closestDistSqr = Integer::MAX_VALUE; //for (DoorInfo dm : doorInfos) for(AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) { - shared_ptr dm = *it; + std::shared_ptr dm = *it; int distSqr = dm->distanceToSqr(x, y, z); if (distSqr < closestDistSqr) { @@ -194,14 +194,14 @@ shared_ptr Village::getClosestDoorInfo(int x, int y, int z) return closest; } -shared_ptrVillage::getBestDoorInfo(int x, int y, int z) +std::shared_ptrVillage::getBestDoorInfo(int x, int y, int z) { - shared_ptr closest = nullptr; + std::shared_ptr closest = nullptr; int closestDist = Integer::MAX_VALUE; //for (DoorInfo dm : doorInfos) for(AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) { - shared_ptrdm = *it; + std::shared_ptrdm = *it; int distSqr = dm->distanceToSqr(x, y, z); if (distSqr > 16 * 16) distSqr *= 1000; @@ -221,19 +221,19 @@ bool Village::hasDoorInfo(int x, int y, int z) return getDoorInfo(x, y, z) != NULL; } -shared_ptrVillage::getDoorInfo(int x, int y, int z) +std::shared_ptrVillage::getDoorInfo(int x, int y, int z) { if (center->distSqr(x, y, z) > radius * radius) return nullptr; //for (DoorInfo di : doorInfos) for(AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) { - shared_ptr di = *it; + std::shared_ptr di = *it; if (di->x == x && di->z == z && abs(di->y - y) <= 1) return di; } return nullptr; } -void Village::addDoorInfo(shared_ptr di) +void Village::addDoorInfo(std::shared_ptr di) { doorInfos.push_back(di); accCenter->x += di->x; @@ -248,7 +248,7 @@ bool Village::canRemove() return doorInfos.empty(); } -void Village::addAggressor(shared_ptr mob) +void Village::addAggressor(std::shared_ptr mob) { //for (Aggressor a : aggressors) for(AUTO_VAR(it, aggressors.begin()); it != aggressors.end(); ++it) @@ -263,7 +263,7 @@ void Village::addAggressor(shared_ptr mob) aggressors.push_back(new Aggressor(mob, _tick)); } -shared_ptr Village::getClosestAggressor(shared_ptr from) +std::shared_ptr Village::getClosestAggressor(std::shared_ptr from) { double closestSqr = Double::MAX_VALUE; Aggressor *closest = NULL; @@ -279,10 +279,10 @@ shared_ptr Village::getClosestAggressor(shared_ptr from) return closest != NULL ? closest->mob : nullptr; } -shared_ptr Village::getClosestBadStandingPlayer(shared_ptr from) // 4J Stu - Should be LivingEntity when we add that +std::shared_ptr Village::getClosestBadStandingPlayer(std::shared_ptr from) // 4J Stu - Should be LivingEntity when we add that { double closestSqr = Double::MAX_VALUE; - shared_ptr closest = nullptr; + std::shared_ptr closest = nullptr; //for (String player : playerStanding.keySet()) for(AUTO_VAR(it,playerStanding.begin()); it != playerStanding.end(); ++it) @@ -290,7 +290,7 @@ shared_ptr Village::getClosestBadStandingPlayer(shared_ptr from) // wstring player = it->first; if (isVeryBadStanding(player)) { - shared_ptr mob = level->getPlayerByName(player); + std::shared_ptr mob = level->getPlayerByName(player); if (mob != NULL) { double distSqr = mob->distanceToSqr(from); @@ -330,7 +330,7 @@ void Village::updateDoors() //for (Iterator it = doorInfos.iterator(); it.hasNext();) for(AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end();) { - shared_ptr dm = *it; //it.next(); + std::shared_ptr dm = *it; //it.next(); if (resetBookings) dm->resetBookingCount(); if (!isDoor(dm->x, dm->y, dm->z) || abs(_tick - dm->timeStamp) > 1200) { @@ -373,7 +373,7 @@ void Village::calcInfo() //for (DoorInfo dm : doorInfos) for(AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) { - shared_ptr dm = *it; + std::shared_ptr dm = *it; maxRadiusSqr = max(dm->distanceToSqr(center->x, center->y, center->z), maxRadiusSqr); } int doorDist= Villages::MaxDoorDist; // Take into local int for PS4 as max takes a reference to the const int there and then needs the value to exist for the linker @@ -433,7 +433,7 @@ void Village::readAdditionalSaveData(CompoundTag *tag) { CompoundTag *dTag = doorTags->get(i); - shared_ptr door = shared_ptr(new DoorInfo(dTag->getInt(L"X"), dTag->getInt(L"Y"), dTag->getInt(L"Z"), dTag->getInt(L"IDX"), dTag->getInt(L"IDZ"), dTag->getInt(L"TS"))); + std::shared_ptr door = std::shared_ptr(new DoorInfo(dTag->getInt(L"X"), dTag->getInt(L"Y"), dTag->getInt(L"Z"), dTag->getInt(L"IDX"), dTag->getInt(L"IDZ"), dTag->getInt(L"TS"))); doorInfos.push_back(door); } @@ -464,7 +464,7 @@ void Village::addAdditonalSaveData(CompoundTag *tag) //for (DoorInfo dm : doorInfos) for(AUTO_VAR(it,doorInfos.begin()); it != doorInfos.end(); ++it) { - shared_ptr dm = *it; + std::shared_ptr dm = *it; CompoundTag *doorTag = new CompoundTag(L"Door"); doorTag->putInt(L"X", dm->x); doorTag->putInt(L"Y", dm->y); diff --git a/Minecraft.World/WorldGen/Structures/Village.h b/Minecraft.World/WorldGen/Structures/Village.h index 07858ef98..27839d4ed 100644 --- a/Minecraft.World/WorldGen/Structures/Village.h +++ b/Minecraft.World/WorldGen/Structures/Village.h @@ -4,7 +4,7 @@ class Village { private: Level *level; - vector > doorInfos; + vector > doorInfos; Pos *accCenter; Pos *center; @@ -19,10 +19,10 @@ private: class Aggressor { public: - shared_ptr mob; + std::shared_ptr mob; int timeStamp; - Aggressor(shared_ptr mob, int timeStamp); + Aggressor(std::shared_ptr mob, int timeStamp); }; vector aggressors; @@ -50,16 +50,16 @@ public: int getStableAge(); int getPopulationSize(); bool isInside(int xx, int yy, int zz); - vector > *getDoorInfos(); - shared_ptr getClosestDoorInfo(int x, int y, int z); - shared_ptr getBestDoorInfo(int x, int y, int z); + vector > *getDoorInfos(); + std::shared_ptr getClosestDoorInfo(int x, int y, int z); + std::shared_ptr getBestDoorInfo(int x, int y, int z); bool hasDoorInfo(int x, int y, int z); - shared_ptr getDoorInfo(int x, int y, int z); - void addDoorInfo(shared_ptr di); + std::shared_ptr getDoorInfo(int x, int y, int z); + void addDoorInfo(std::shared_ptr di); bool canRemove(); - void addAggressor(shared_ptr mob); - shared_ptr getClosestAggressor(shared_ptr from); - shared_ptr getClosestBadStandingPlayer(shared_ptr from); // 4J Stu - Should be LivingEntity when we add that + void addAggressor(std::shared_ptr mob); + std::shared_ptr getClosestAggressor(std::shared_ptr from); + std::shared_ptr getClosestBadStandingPlayer(std::shared_ptr from); // 4J Stu - Should be LivingEntity when we add that private: void updateAggressors(); diff --git a/Minecraft.World/WorldGen/Structures/VillagePieces.cpp b/Minecraft.World/WorldGen/Structures/VillagePieces.cpp index 664468b72..5eb4e2a4a 100644 --- a/Minecraft.World/WorldGen/Structures/VillagePieces.cpp +++ b/Minecraft.World/WorldGen/Structures/VillagePieces.cpp @@ -347,7 +347,7 @@ void VillagePieces::VillagePiece::spawnVillagers(Level *level, BoundingBox *chun { spawnedVillagerCount++; - shared_ptr villager = shared_ptr(new Villager(level, getVillagerProfession(i))); + std::shared_ptr villager = std::shared_ptr(new Villager(level, getVillagerProfession(i))); villager->moveTo(worldX + 0.5, worldY, worldZ + 0.5, 0, 0); level->addEntity(villager); } diff --git a/Minecraft.World/WorldGen/Structures/Villages.cpp b/Minecraft.World/WorldGen/Structures/Villages.cpp index f1bdda1aa..30038072f 100644 --- a/Minecraft.World/WorldGen/Structures/Villages.cpp +++ b/Minecraft.World/WorldGen/Structures/Villages.cpp @@ -32,7 +32,7 @@ void Villages::setLevel(Level *level) //for (Village village : villages) for(AUTO_VAR(it, villages.begin()); it != villages.end(); ++it) { - shared_ptr village = *it; + std::shared_ptr village = *it; village->setLevel(level); } } @@ -49,7 +49,7 @@ void Villages::tick() //for (Village village : villages) for(AUTO_VAR(it, villages.begin()); it != villages.end(); ++it) { - shared_ptr village = *it; + std::shared_ptr village = *it; village->tick(_tick); } removeVillages(); @@ -67,7 +67,7 @@ void Villages::removeVillages() //for (Iterator it = villages.iterator(); it.hasNext();) for(AUTO_VAR(it, villages.begin()); it != villages.end(); ) { - shared_ptr village = *it; //it.next(); + std::shared_ptr village = *it; //it.next(); if (village->canRemove()) { it = villages.erase(it); @@ -81,19 +81,19 @@ void Villages::removeVillages() } } -vector > *Villages::getVillages() +vector > *Villages::getVillages() { return &villages; } -shared_ptr Villages::getClosestVillage(int x, int y, int z, int maxDist) +std::shared_ptr Villages::getClosestVillage(int x, int y, int z, int maxDist) { - shared_ptr closest = nullptr; + std::shared_ptr closest = nullptr; float closestDistSqr = Float::MAX_VALUE; //for (Village village : villages) for(AUTO_VAR(it, villages.begin()); it != villages.end(); ++it) { - shared_ptr village = *it; + std::shared_ptr village = *it; float distSqr = village->getCenter()->distSqr(x, y, z); if (distSqr >= closestDistSqr) continue; @@ -121,13 +121,13 @@ void Villages::cluster() //for (int i = 0; i < unclustered.size(); ++i) for(AUTO_VAR(it, unclustered.begin()); it != unclustered.end(); ++it) { - shared_ptr di = *it; //unclustered.get(i); + std::shared_ptr di = *it; //unclustered.get(i); bool found = false; //for (Village village : villages) for(AUTO_VAR(itV, villages.begin()); itV != villages.end(); ++itV) { - shared_ptr village = *itV; + std::shared_ptr village = *itV; int dist = (int) village->getCenter()->distSqr(di->x, di->y, di->z); int radius = MaxDoorDist + village->getRadius(); if (dist > radius * radius) continue; @@ -138,7 +138,7 @@ void Villages::cluster() if (found) continue; // create new Village - shared_ptr village = shared_ptr(new Village(level)); + std::shared_ptr village = std::shared_ptr(new Village(level)); village->addDoorInfo(di); villages.push_back(village); setDirty(); @@ -157,7 +157,7 @@ void Villages::addDoorInfos(Pos *pos) { if (isDoor(xx, yy, zz)) { - shared_ptr currentDoor = getDoorInfo(xx, yy, zz); + std::shared_ptr currentDoor = getDoorInfo(xx, yy, zz); if (currentDoor == NULL) createDoorInfo(xx, yy, zz); else currentDoor->timeStamp = _tick; } @@ -166,19 +166,19 @@ void Villages::addDoorInfos(Pos *pos) } } -shared_ptr Villages::getDoorInfo(int x, int y, int z) +std::shared_ptr Villages::getDoorInfo(int x, int y, int z) { //for (DoorInfo di : unclustered) for(AUTO_VAR(it,unclustered.begin()); it != unclustered.end(); ++it) { - shared_ptr di = *it; + std::shared_ptr di = *it; if (di->x == x && di->z == z && abs(di->y - y) <= 1) return di; } //for (Village v : villages) for(AUTO_VAR(it,villages.begin()); it != villages.end(); ++it) { - shared_ptr v = *it; - shared_ptr di = v->getDoorInfo(x, y, z); + std::shared_ptr v = *it; + std::shared_ptr di = v->getDoorInfo(x, y, z); if (di != NULL) return di; } return nullptr; @@ -194,7 +194,7 @@ void Villages::createDoorInfo(int x, int y, int z) if (level->canSeeSky(x + i, y, z)) canSeeX--; for (int i = 1; i <= 5; ++i) if (level->canSeeSky(x + i, y, z)) canSeeX++; - if (canSeeX != 0) unclustered.push_back(shared_ptr(new DoorInfo(x, y, z, canSeeX > 0 ? -2 : 2, 0, _tick))); + if (canSeeX != 0) unclustered.push_back(std::shared_ptr(new DoorInfo(x, y, z, canSeeX > 0 ? -2 : 2, 0, _tick))); } else { @@ -203,7 +203,7 @@ void Villages::createDoorInfo(int x, int y, int z) if (level->canSeeSky(x, y, z + i)) canSeeZ--; for (int i = 1; i <= 5; ++i) if (level->canSeeSky(x, y, z + i)) canSeeZ++; - if (canSeeZ != 0) unclustered.push_back(shared_ptr(new DoorInfo(x, y, z, 0, canSeeZ > 0 ? -2 : 2, _tick))); + if (canSeeZ != 0) unclustered.push_back(std::shared_ptr(new DoorInfo(x, y, z, 0, canSeeZ > 0 ? -2 : 2, _tick))); } } @@ -231,7 +231,7 @@ void Villages::load(CompoundTag *tag) for (int i = 0; i < villageTags->size(); i++) { CompoundTag *compoundTag = villageTags->get(i); - shared_ptr village = shared_ptr(new Village()); + std::shared_ptr village = std::shared_ptr(new Village()); village->readAdditionalSaveData(compoundTag); villages.push_back(village); } @@ -244,7 +244,7 @@ void Villages::save(CompoundTag *tag) //for (Village village : villages) for(AUTO_VAR(it, villages.begin()); it != villages.end(); ++it) { - shared_ptr village = *it; + std::shared_ptr village = *it; CompoundTag *villageTag = new CompoundTag(L"Village"); village->addAdditonalSaveData(villageTag); villageTags->add(villageTag); diff --git a/Minecraft.World/WorldGen/Structures/Villages.h b/Minecraft.World/WorldGen/Structures/Villages.h index 2582c3c7f..6e8b0ddeb 100644 --- a/Minecraft.World/WorldGen/Structures/Villages.h +++ b/Minecraft.World/WorldGen/Structures/Villages.h @@ -12,8 +12,8 @@ public: private: Level *level; deque queries; - vector > unclustered; - vector > villages; + vector > unclustered; + vector > villages; int _tick; public: @@ -29,14 +29,14 @@ private: void removeVillages(); public: - vector > *getVillages(); - shared_ptr getClosestVillage(int x, int y, int z, int maxDist); + vector > *getVillages(); + std::shared_ptr getClosestVillage(int x, int y, int z, int maxDist); private: void processNextQuery(); void cluster(); void addDoorInfos(Pos *pos); - shared_ptrgetDoorInfo(int x, int y, int z); + std::shared_ptrgetDoorInfo(int x, int y, int z); void createDoorInfo(int x, int y, int z); bool hasQuery(int x, int y, int z); bool isDoor(int x, int y, int z); diff --git a/scripts/llvm_native.txt b/scripts/llvm_native.txt new file mode 100644 index 000000000..786f3d2bd --- /dev/null +++ b/scripts/llvm_native.txt @@ -0,0 +1,5 @@ +[binaries] +c = 'clang' +cpp = 'clang++' +c_ld = 'lld' +cpp_ld = 'lld' \ No newline at end of file From ecf7fc7f61f729532a1b175833e9570099dd383f Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 6 Mar 2026 11:29:36 -0600 Subject: [PATCH 02/24] refactor: unglob `std::unordered_map` --- Minecraft.Client/GameState/Settings.h | 2 +- Minecraft.Client/GameState/StatsCounter.cpp | 4 +- Minecraft.Client/GameState/StatsCounter.h | 4 +- Minecraft.Client/GameState/StatsSyncer.h | 22 +++++------ Minecraft.Client/Level/MultiPlayerLevel.h | 2 +- Minecraft.Client/Level/ServerLevel.h | 2 +- Minecraft.Client/MinecraftServer.cpp | 2 +- Minecraft.Client/MinecraftServer.h | 2 +- Minecraft.Client/Network/PlayerChunkMap.h | 2 +- Minecraft.Client/Network/PlayerConnection.h | 2 +- .../Platform/Durango/ApplicationView.cpp | 2 +- .../Platform/Durango/Durango_App.cpp | 4 +- .../Platform/Durango/Durango_Minecraft.cpp | 2 +- .../Durango/Network/DQRNetworkManager.h | 2 +- .../Durango/Sentient/DurangoTelemetry.h | 2 +- .../Platform/Linux/Linux_Minecraft.cpp | 2 +- .../Platform/Orbis/4JLibs/inc/4J_Storage.h | 2 +- Minecraft.Client/Platform/Orbis/Orbis_App.cpp | 4 +- Minecraft.Client/Platform/Orbis/Orbis_App.h | 4 +- .../Platform/Orbis/Orbis_Minecraft.cpp | 2 +- .../PS3/Network/SQRNetworkManager_PS3.h | 2 +- .../Platform/PS3/Network/SonyVoiceChat.cpp | 2 +- .../Platform/PS3/Network/SonyVoiceChat.h | 2 +- .../Platform/PS3/PS3Extras/Ps3Types.h | 10 ++--- Minecraft.Client/Platform/PS3/PS3_App.h | 2 +- .../Platform/PS3/PS3_Minecraft.cpp | 2 +- .../Platform/PS3/Xbox_Minecraft.cpp | 2 +- .../Platform/PSVita/4JLibs/inc/4J_Storage.h | 2 +- Minecraft.Client/Platform/PSVita/PSVita_App.h | 4 +- .../Windows64/Windows64_Minecraft.cpp | 2 +- .../Platform/Xbox/Font/XUI_FontData.cpp | 2 +- .../Platform/Xbox/Font/XUI_FontData.h | 2 +- .../Platform/Xbox/Font/XUI_FontRenderer.h | 2 +- .../Platform/Xbox/Xbox_Minecraft.cpp | 2 +- Minecraft.Client/Player/EntityTracker.h | 2 +- Minecraft.Client/Player/ServerPlayer.cpp | 2 +- .../EntityRenderers/EntityRenderDispatcher.h | 2 +- .../EntityRenderers/MobSpawnerRenderer.h | 2 +- .../TileEntityRenderDispatcher.h | 2 +- .../Rendering/EntityRenderers/TileRenderer.h | 2 +- Minecraft.Client/Rendering/LevelRenderer.cpp | 2 +- Minecraft.Client/Rendering/LevelRenderer.h | 4 +- Minecraft.Client/Rendering/Models/Model.h | 2 +- .../Textures/Packs/TexturePackRepository.h | 2 +- .../Stitching/PreStitchedTextureMap.cpp | 2 +- .../Stitching/PreStitchedTextureMap.h | 2 +- .../Textures/Stitching/TextureMap.cpp | 6 +-- .../Textures/Stitching/TextureMap.h | 2 +- Minecraft.Client/Textures/TextureManager.h | 4 +- Minecraft.Client/Textures/Textures.cpp | 10 ++--- Minecraft.Client/Textures/Textures.h | 10 ++--- Minecraft.Client/Utils/ArchiveFile.h | 2 +- Minecraft.Client/Utils/MemoryTracker.cpp | 2 +- Minecraft.Client/Utils/MemoryTracker.h | 2 +- Minecraft.Client/Utils/StringTable.cpp | 2 +- Minecraft.Client/Utils/StringTable.h | 2 +- Minecraft.Client/Utils/WstringLookup.h | 2 +- Minecraft.World/AI/Navigation/PathFinder.cpp | 2 +- Minecraft.World/AI/Navigation/PathFinder.h | 2 +- Minecraft.World/Blocks/MobSpawner.cpp | 2 +- Minecraft.World/Blocks/MobSpawner.h | 2 +- Minecraft.World/Blocks/NotGateTile.cpp | 2 +- Minecraft.World/Blocks/NotGateTile.h | 2 +- .../Blocks/TileEntities/PotionBrewing.cpp | 2 +- .../Blocks/TileEntities/PotionBrewing.h | 4 +- .../Blocks/TileEntities/TileEntity.cpp | 4 +- .../Blocks/TileEntities/TileEntity.h | 4 +- Minecraft.World/Commands/CommandDispatcher.h | 4 +- Minecraft.World/Containers/MenuBackup.cpp | 6 +-- Minecraft.World/Containers/MenuBackup.h | 2 +- Minecraft.World/Containers/RepairMenu.cpp | 4 +- .../Enchantments/EnchantmentHelper.cpp | 16 ++++---- .../Enchantments/EnchantmentHelper.h | 6 +-- Minecraft.World/Entities/Mob.cpp | 6 +-- Minecraft.World/Entities/Mobs/Villager.cpp | 4 +- Minecraft.World/Entities/Mobs/Villager.h | 4 +- Minecraft.World/Entities/SyncedEntityData.h | 2 +- .../IO/Files/ConsoleSaveFileSplit.h | 2 +- Minecraft.World/IO/NBT/CompoundTag.h | 8 ++-- Minecraft.World/Items/PotionItem.h | 2 +- Minecraft.World/Level/Explosion.h | 2 +- Minecraft.World/Level/LevelChunk.cpp | 2 +- Minecraft.World/Level/LevelChunk.h | 2 +- .../Level/Storage/DirectoryLevelStorage.h | 8 ++-- Minecraft.World/Level/Storage/EntityIO.cpp | 38 +++++++++---------- Minecraft.World/Level/Storage/EntityIO.h | 14 +++---- .../Level/Storage/MapItemSavedData.cpp | 6 +-- .../Level/Storage/MapItemSavedData.h | 4 +- .../Level/Storage/McRegionChunkStorage.h | 2 +- .../Level/Storage/OldChunkStorage.cpp | 4 +- .../Level/Storage/RegionFileCache.h | 2 +- .../Level/Storage/SavedDataStorage.cpp | 6 +-- .../Level/Storage/SavedDataStorage.h | 4 +- .../Level/Storage/ZonedChunkStorage.cpp | 6 +-- .../Level/Storage/ZonedChunkStorage.h | 2 +- Minecraft.World/Network/Packets/Packet.cpp | 8 ++-- Minecraft.World/Network/Packets/Packet.h | 6 +-- Minecraft.World/Recipes/FurnaceRecipes.cpp | 2 +- Minecraft.World/Recipes/FurnaceRecipes.h | 6 +-- Minecraft.World/Recipes/Recipes.cpp | 2 +- Minecraft.World/Recipes/Recipes.h | 2 +- Minecraft.World/Stats/Stats.cpp | 2 +- Minecraft.World/Stats/Stats.h | 2 +- Minecraft.World/WorldGen/Biomes/BiomeCache.h | 2 +- .../WorldGen/Features/StructureFeature.h | 2 +- Minecraft.World/WorldGen/Structures/Village.h | 2 +- 106 files changed, 204 insertions(+), 204 deletions(-) diff --git a/Minecraft.Client/GameState/Settings.h b/Minecraft.Client/GameState/Settings.h index b6a2c0181..68a4fa8bd 100644 --- a/Minecraft.Client/GameState/Settings.h +++ b/Minecraft.Client/GameState/Settings.h @@ -7,7 +7,7 @@ class Settings // public static Logger logger = Logger.getLogger("Minecraft"); // private Properties properties = new Properties(); private: - unordered_map properties; // 4J - TODO was Properties type, will need to implement something we can serialise/deserialise too + std::unordered_map properties; // 4J - TODO was Properties type, will need to implement something we can serialise/deserialise too //File *file; public: diff --git a/Minecraft.Client/GameState/StatsCounter.cpp b/Minecraft.Client/GameState/StatsCounter.cpp index df944f326..e36db9b1c 100644 --- a/Minecraft.Client/GameState/StatsCounter.cpp +++ b/Minecraft.Client/GameState/StatsCounter.cpp @@ -22,7 +22,7 @@ Stat** StatsCounter::LARGE_STATS[] = { &Stats::timePlayed }; -unordered_map StatsCounter::statBoards; +std::unordered_map StatsCounter::statBoards; StatsCounter::StatsCounter() { @@ -64,7 +64,7 @@ void StatsCounter::award(Stat* stat, unsigned int difficulty, unsigned int count requiresSave = true; //If this stat is on a leaderboard, mark that leaderboard as needing updated - unordered_map::iterator leaderboardEntry = statBoards.find(stat); + std::unordered_map::iterator leaderboardEntry = statBoards.find(stat); if( leaderboardEntry != statBoards.end() ) { app.DebugPrintf("[StatsCounter] award(): %X\n", leaderboardEntry->second << difficulty); diff --git a/Minecraft.Client/GameState/StatsCounter.h b/Minecraft.Client/GameState/StatsCounter.h index e292ccf27..d3e74b23a 100644 --- a/Minecraft.Client/GameState/StatsCounter.h +++ b/Minecraft.Client/GameState/StatsCounter.h @@ -28,7 +28,7 @@ private: } }; - typedef unordered_map StatsMap; + typedef std::unordered_map StatsMap; //static const int STAT_DATA_OFFSET = 32; static const int LARGE_STATS_COUNT = 8; @@ -69,7 +69,7 @@ private: int saveCounter; int modifiedBoards; - static unordered_map statBoards; + static std::unordered_map statBoards; int flushCounter; public: diff --git a/Minecraft.Client/GameState/StatsSyncer.h b/Minecraft.Client/GameState/StatsSyncer.h index 843505bf6..b3c9d0424 100644 --- a/Minecraft.Client/GameState/StatsSyncer.h +++ b/Minecraft.Client/GameState/StatsSyncer.h @@ -14,8 +14,8 @@ private: volatile bool busy; - volatile unordered_map *serverStats; - volatile unordered_map *failedSentStats; + volatile std::unordered_map *serverStats; + volatile std::unordered_map *failedSentStats; StatsCounter *statsCounter; File *unsentFile, *lastServerFile; @@ -29,18 +29,18 @@ public: StatsSyncher(User *user, StatsCounter *statsCounter, File *dir); private: void attemptRename(File *dir, const wstring& name, File *to); - unordered_map *loadStatsFromDisk(File *file, File *tmp, File *old); - unordered_map *loadStatsFromDisk(File *file); - void doSend(unordered_map *stats); - void doSave(unordered_map *stats, File *file, File *tmp, File *old); + std::unordered_map *loadStatsFromDisk(File *file, File *tmp, File *old); + std::unordered_map *loadStatsFromDisk(File *file); + void doSend(std::unordered_map *stats); + void doSave(std::unordered_map *stats, File *file, File *tmp, File *old); protected: - unordered_map *doGetStats(); + std::unordered_map *doGetStats(); public: void getStatsFromServer(); - void saveUnsent(unordered_map *stats); - void sendUnsent(unordered_map *stats, unordered_map *fullStats); - void forceSendUnsent(unordered_map *stats); - void forceSaveUnsent(unordered_map *stats); + void saveUnsent(std::unordered_map *stats); + void sendUnsent(std::unordered_map *stats, std::unordered_map *fullStats); + void forceSendUnsent(std::unordered_map *stats); + void forceSaveUnsent(std::unordered_map *stats); bool maySave(); bool maySend(); void tick(); diff --git a/Minecraft.Client/Level/MultiPlayerLevel.h b/Minecraft.Client/Level/MultiPlayerLevel.h index 5d0c8b4a1..bd84b0c48 100644 --- a/Minecraft.Client/Level/MultiPlayerLevel.h +++ b/Minecraft.Client/Level/MultiPlayerLevel.h @@ -54,7 +54,7 @@ public: void setChunkVisible(int x, int z, bool visible); private: - unordered_map, IntKeyHash2, IntKeyEq> entitiesById; // 4J - was IntHashMap + std::unordered_map, IntKeyHash2, IntKeyEq> entitiesById; // 4J - was IntHashMap unordered_set > forced; unordered_set > reEntries; diff --git a/Minecraft.Client/Level/ServerLevel.h b/Minecraft.Client/Level/ServerLevel.h index 81ca5f475..c4dd4f5ec 100644 --- a/Minecraft.Client/Level/ServerLevel.h +++ b/Minecraft.Client/Level/ServerLevel.h @@ -90,7 +90,7 @@ public: private: void saveLevelData(); - typedef unordered_map , IntKeyHash2, IntKeyEq> intEntityMap; + typedef std::unordered_map , IntKeyHash2, IntKeyEq> intEntityMap; intEntityMap entitiesById; // 4J - was IntHashMap, using same hashing function as this uses protected: virtual void entityAdded(std::shared_ptr e); diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 06a3151a7..50a4763b9 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -64,7 +64,7 @@ int MinecraftServer::s_slowQueuePlayerIndex = 0; int MinecraftServer::s_slowQueueLastTime = 0; bool MinecraftServer::s_slowQueuePacketSent = false; -unordered_map MinecraftServer::ironTimers; +std::unordered_map MinecraftServer::ironTimers; MinecraftServer::MinecraftServer() { diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index 992bb7942..7bbd01dbf 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -64,7 +64,7 @@ public: static const int TICK_STATS_SPAN = SharedConstants::TICKS_PER_SECOND * 5; // static Logger logger = Logger.getLogger("Minecraft"); - static unordered_map ironTimers; + static std::unordered_map ironTimers; private: static const int DEFAULT_MINECRAFT_PORT = 25565; diff --git a/Minecraft.Client/Network/PlayerChunkMap.h b/Minecraft.Client/Network/PlayerChunkMap.h index 17dd95a10..2b7f9a767 100644 --- a/Minecraft.Client/Network/PlayerChunkMap.h +++ b/Minecraft.Client/Network/PlayerChunkMap.h @@ -66,7 +66,7 @@ public: vector > players; void flagEntitiesToBeRemoved(unsigned int *flags, bool *removedFound); // 4J added private: - unordered_map<__int64,PlayerChunk *,LongKeyHash,LongKeyEq> chunks; // 4J - was LongHashMap + std::unordered_map<__int64,PlayerChunk *,LongKeyHash,LongKeyEq> chunks; // 4J - was LongHashMap vector changedChunks; vector addRequests; // 4J added void tickAddRequests(std::shared_ptr player); // 4J added diff --git a/Minecraft.Client/Network/PlayerConnection.h b/Minecraft.Client/Network/PlayerConnection.h index daa8926d6..bc3c376aa 100644 --- a/Minecraft.Client/Network/PlayerConnection.h +++ b/Minecraft.Client/Network/PlayerConnection.h @@ -78,7 +78,7 @@ public: virtual void handleContainerClose(std::shared_ptr packet); private: - unordered_map expectedAcks; + std::unordered_map expectedAcks; public: // 4J Stu - Handlers only valid in debug mode diff --git a/Minecraft.Client/Platform/Durango/ApplicationView.cpp b/Minecraft.Client/Platform/Durango/ApplicationView.cpp index 073d7ba90..2442abb91 100644 --- a/Minecraft.Client/Platform/Durango/ApplicationView.cpp +++ b/Minecraft.Client/Platform/Durango/ApplicationView.cpp @@ -27,7 +27,7 @@ XALLOC_ATTRIBUTES ExpandAllocAttributes( _In_ LONGLONG dwAttributes ) } SIZE_T totalTracked = 0; -unordered_map tracker; +std::unordered_map tracker; static volatile bool memDump = false; static volatile bool memReset = false; static bool memDumpInit = false; diff --git a/Minecraft.Client/Platform/Durango/Durango_App.cpp b/Minecraft.Client/Platform/Durango/Durango_App.cpp index aa81ef0b0..d4105be5d 100644 --- a/Minecraft.Client/Platform/Durango/Durango_App.cpp +++ b/Minecraft.Client/Platform/Durango/Durango_App.cpp @@ -169,7 +169,7 @@ void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType) int CConsoleMinecraftApp::LoadLocalDLCImages() { - unordered_map *pDLCInfoA=app.GetDLCInfo(); + std::unordered_map *pDLCInfoA=app.GetDLCInfo(); // 4J-PB - Any local graphic files for the Minecraft Store? for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) { @@ -183,7 +183,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImages() void CConsoleMinecraftApp::FreeLocalDLCImages() { // 4J-PB - Any local graphic files for the Minecraft Store? - unordered_map *pDLCInfoA=app.GetDLCInfo(); + std::unordered_map *pDLCInfoA=app.GetDLCInfo(); for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) { diff --git a/Minecraft.Client/Platform/Durango/Durango_Minecraft.cpp b/Minecraft.Client/Platform/Durango/Durango_Minecraft.cpp index cdebb44a3..f3e4888f3 100644 --- a/Minecraft.Client/Platform/Durango/Durango_Minecraft.cpp +++ b/Minecraft.Client/Platform/Durango/Durango_Minecraft.cpp @@ -984,7 +984,7 @@ void oldWinMainTick() #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h index 9daa7322a..dc4929852 100644 --- a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h +++ b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h @@ -397,7 +397,7 @@ private: bool m_notifyForFullParty; - unordered_map m_sessionAddressToConnectionInfoMapHost; // For host - there may be more than one remote session attached to this listening session + std::unordered_map m_sessionAddressToConnectionInfoMapHost; // For host - there may be more than one remote session attached to this listening session unsigned int m_sessionAddressFromSmallId[256]; // For host - for mapping back from small Id, to session address unsigned char m_channelFromSmallId[256]; // For host and client, for mapping back from small Id, to channel DQRConnectionInfo m_connectionInfoClient; // For client diff --git a/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.h b/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.h index 57421e991..c4e6b23aa 100644 --- a/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.h +++ b/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.h @@ -9,7 +9,7 @@ class CDurangoTelemetryManager : public CTelemetryManager public: static GUID ZERO_GUID; - unordered_map m_multiplayerRoundStartTimes; + std::unordered_map m_multiplayerRoundStartTimes; CDurangoTelemetryManager(); diff --git a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp index d5b2a669f..cb4fd70c1 100644 --- a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp @@ -1038,7 +1038,7 @@ void FreeRichPresenceStrings() #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Storage.h index d4d845dfa..f586df2cb 100644 --- a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Storage.h @@ -405,7 +405,7 @@ public: void SetDLCProductCode(const char* szProductCode); void SetProductUpgradeKey(const char* szKey); bool CheckForTrialUpgradeKey(void( *Func)(LPVOID, bool),LPVOID lpParam); - void SetDLCInfoMap(unordered_map* pSONYDLCMap); + void SetDLCInfoMap(std::unordered_map* pSONYDLCMap); }; extern C4JStorage StorageManager; diff --git a/Minecraft.Client/Platform/Orbis/Orbis_App.cpp b/Minecraft.Client/Platform/Orbis/Orbis_App.cpp index 0b3e29495..731803892 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_App.cpp +++ b/Minecraft.Client/Platform/Orbis/Orbis_App.cpp @@ -288,7 +288,7 @@ int CConsoleMinecraftApp::GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameI int CConsoleMinecraftApp::LoadLocalDLCImages() { // 4J-PB - Any local graphic files for the Minecraft Store? - unordered_map*pDLCInfoA=app.GetSonyDLCMap(); + std::unordered_map*pDLCInfoA=app.GetSonyDLCMap(); for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) { SONYDLC * pDLCInfo=(*it).second; @@ -301,7 +301,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImages() void CConsoleMinecraftApp::FreeLocalDLCImages() { // 4J-PB - Any local graphic files for the Minecraft Store? - unordered_map*pDLCInfoA=app.GetSonyDLCMap(); + std::unordered_map*pDLCInfoA=app.GetSonyDLCMap(); for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) { SONYDLC * pDLCInfo=(*it).second; diff --git a/Minecraft.Client/Platform/Orbis/Orbis_App.h b/Minecraft.Client/Platform/Orbis/Orbis_App.h index 6c0bac012..69ea7dfbc 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_App.h +++ b/Minecraft.Client/Platform/Orbis/Orbis_App.h @@ -161,7 +161,7 @@ public: bool DLCAlreadyPurchased(char *pchTitle); char *GetSkuIDFromProductList(); void GetDLCSkuIDFromProductList(char *,char *); - unordered_map* GetSonyDLCMap() { return &m_SONYDLCMap; } + std::unordered_map* GetSonyDLCMap() { return &m_SONYDLCMap; } static void CommerceInitCallback(LPVOID lpParam,int err); static void CommerceGetCategoriesCallback(LPVOID lpParam,int err); static void CommerceGetProductListCallback(LPVOID lpParam,int err); @@ -210,7 +210,7 @@ private: // SonyCommerce::ProductInfoDetailed m_ProductInfoDetailed; PRODUCTCODES ProductCodes; - unordered_map m_SONYDLCMap; + std::unordered_map m_SONYDLCMap; bool m_bVoiceChatAndUGCRestricted; diff --git a/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp b/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp index 9c8cf469c..814533725 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp +++ b/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp @@ -1509,7 +1509,7 @@ void FreeRichPresenceStrings() #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/PS3/Network/SQRNetworkManager_PS3.h b/Minecraft.Client/Platform/PS3/Network/SQRNetworkManager_PS3.h index 0e17d249f..53edbe27d 100644 --- a/Minecraft.Client/Platform/PS3/Network/SQRNetworkManager_PS3.h +++ b/Minecraft.Client/Platform/PS3/Network/SQRNetworkManager_PS3.h @@ -205,7 +205,7 @@ private: unsigned int m_searchResultCount; // Rudp management and local players - unordered_map m_RudpCtxToPlayerMap; + std::unordered_map m_RudpCtxToPlayerMap; bool CreateRudpConnections(SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId peerMemberId, int playerMask, SceNpMatching2RoomMemberId playersPeerMemberId); SQRNetworkPlayer *GetPlayerFromRudpCtx(int rudpCtx); SQRNetworkPlayer *GetPlayerFromRoomMemberAndLocalIdx(int roomMember, int localIdx); diff --git a/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.cpp b/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.cpp index 27011ac06..93cc0d5b3 100644 --- a/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.cpp +++ b/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.cpp @@ -37,7 +37,7 @@ bool SonyVoiceChat::sm_bEnabled = true; uint8_t SonyVoiceChat::sm_micStatus = CELL_AVC2_MIC_STATUS_UNKNOWN; bool SonyVoiceChat::sm_bLoaded = false; bool SonyVoiceChat::sm_bUnloading = false; -unordered_map SonyVoiceChat::sm_bTalkingMap; +std::unordered_map SonyVoiceChat::sm_bTalkingMap; bool SonyVoiceChat::sm_bCanStart = false; bool SonyVoiceChat::sm_isChatRestricted = false; int SonyVoiceChat::sm_currentBitrate = 28000; diff --git a/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.h b/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.h index ae68b55d1..e07d109f1 100644 --- a/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.h +++ b/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.h @@ -117,7 +117,7 @@ private: static uint8_t sm_micStatus; static bool sm_bLoaded; static bool sm_bUnloading; - static unordered_map sm_bTalkingMap; + static std::unordered_map sm_bTalkingMap; static bool sm_bCanStart; // set to true on init, false on disconnect, used to see if we should start after a re-enable static bool sm_isChatRestricted; // true if the parental controls have been set on the main users account static int sm_currentBitrate; diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Types.h b/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Types.h index ccdacff9b..241651364 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Types.h +++ b/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Types.h @@ -10,7 +10,7 @@ #include #include #include -#include "boost_1_53_0/boost/tr1/unordered_map.hpp" +#include "boost_1_53_0/boost/tr1/std::unordered_map.hpp" #include "boost_1_53_0/boost/tr1/unordered_set.hpp" #include "boost_1_53_0/boost/pool/pool_alloc.hpp" #include @@ -29,18 +29,18 @@ using std::tr1::std::shared_ptr; using std::tr1::static_pointer_cast; using std::tr1::swap; using std::tr1::weak_ptr; -using std::tr1::unordered_map; +using std::tr1::std::unordered_map; using std::tr1::unordered_set; using boost::hash; -// user the pool_allocator for all unordered_set and unordered_map instances +// user the pool_allocator for all unordered_set and std::unordered_map instances // template < class T, class H = hash, class P = std::equal_to, class A = boost::pool_allocator > // class unordered_set : public std::tr1::unordered_set // {}; // // template , class P = std::equal_to, class A = boost::pool_allocator > > -// class unordered_map : public std::tr1::unordered_map +// class std::unordered_map : public std::tr1::std::unordered_map // {}; @@ -50,7 +50,7 @@ using boost::hash; // {}; // // template , class P = std::equal_to, class A = C4JPoolAllocator > > -// class unordered_map : public std::tr1::unordered_map +// class std::unordered_map : public std::tr1::std::unordered_map // {}; diff --git a/Minecraft.Client/Platform/PS3/PS3_App.h b/Minecraft.Client/Platform/PS3/PS3_App.h index bfd699700..1498faf0b 100644 --- a/Minecraft.Client/Platform/PS3/PS3_App.h +++ b/Minecraft.Client/Platform/PS3/PS3_App.h @@ -202,7 +202,7 @@ private: // SonyCommerce::ProductInfoDetailed m_ProductInfoDetailed; PRODUCTCODES ProductCodes; - unordered_map m_SONYDLCMap; + std::unordered_map m_SONYDLCMap; bool m_bVoiceChatAndUGCRestricted; diff --git a/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp b/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp index 956c038e9..b3c9856a2 100644 --- a/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp +++ b/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp @@ -1388,7 +1388,7 @@ void FreeRichPresenceStrings() #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/PS3/Xbox_Minecraft.cpp b/Minecraft.Client/Platform/PS3/Xbox_Minecraft.cpp index d46389a06..600e7468c 100644 --- a/Minecraft.Client/Platform/PS3/Xbox_Minecraft.cpp +++ b/Minecraft.Client/Platform/PS3/Xbox_Minecraft.cpp @@ -1003,7 +1003,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h index ecd4dbc3b..552c247d4 100644 --- a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h @@ -381,7 +381,7 @@ public: void SetDLCProductCode(const char* szProductCode); void SetProductUpgradeKey(const char* szKey); bool CheckForTrialUpgradeKey(void( *Func)(LPVOID, bool),LPVOID lpParam); - void SetDLCInfoMap(unordered_map* pSONYDLCMap); + void SetDLCInfoMap(std::unordered_map* pSONYDLCMap); void EntitlementsCallback(bool bFoundEntitlements); }; diff --git a/Minecraft.Client/Platform/PSVita/PSVita_App.h b/Minecraft.Client/Platform/PSVita/PSVita_App.h index 29612614b..83253f738 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_App.h +++ b/Minecraft.Client/Platform/PSVita/PSVita_App.h @@ -159,7 +159,7 @@ public: bool DLCAlreadyPurchased(char *pchTitle); char *GetSkuIDFromProductList(); void GetDLCSkuIDFromProductList(char *,char *); - unordered_map* GetSonyDLCMap() { return &m_SONYDLCMap; } + std::unordered_map* GetSonyDLCMap() { return &m_SONYDLCMap; } static void CommerceInitCallback(LPVOID lpParam,int err); static void CommerceGetCategoriesCallback(LPVOID lpParam,int err); static void CommerceGetProductListCallback(LPVOID lpParam,int err); @@ -230,7 +230,7 @@ private: // SonyCommerce::ProductInfoDetailed m_ProductInfoDetailed; PRODUCTCODES ProductCodes; - unordered_map m_SONYDLCMap; + std::unordered_map m_SONYDLCMap; bool m_bVoiceChatAndUGCRestricted; diff --git a/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp index 75c36cbce..f50047929 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp @@ -1168,7 +1168,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.cpp b/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.cpp index fd2cf1175..dc95f4968 100644 --- a/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.cpp +++ b/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.cpp @@ -321,7 +321,7 @@ HRESULT XUI_FontData::Create( int iFontTexture, const VOID* pFontData ) for( unsigned short i = 0; i < m_cMaxGlyph + 1; ++i ) { if( translatorTable[i] == 0 ) continue; - m_TranslatorMap.insert( unordered_map::value_type(i, translatorTable[i]) ); + m_TranslatorMap.insert( std::unordered_map::value_type(i, translatorTable[i]) ); } pData += ATGCALCFONTFILEHEADERSIZE( m_cMaxGlyph + 1 ); diff --git a/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.h b/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.h index f094db171..1268ac0bd 100644 --- a/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.h +++ b/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.h @@ -106,7 +106,7 @@ public: int m_iFontTexture; private: - unordered_map m_TranslatorMap; + std::unordered_map m_TranslatorMap; CharMetrics *m_characterMetrics; diff --git a/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.h b/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.h index cffe2ed1a..5f3e80494 100644 --- a/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.h +++ b/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.h @@ -24,7 +24,7 @@ protected: // The XUI_Font is a temporary instance that is around as long as XUI needs it, but does the actual rendering // These can be chained - unordered_map m_loadedFonts[eFontData_MAX]; + std::unordered_map m_loadedFonts[eFontData_MAX]; public: XUI_FontRenderer(); diff --git a/Minecraft.Client/Platform/Xbox/Xbox_Minecraft.cpp b/Minecraft.Client/Platform/Xbox/Xbox_Minecraft.cpp index c59e677f7..6ac986975 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_Minecraft.cpp +++ b/Minecraft.Client/Platform/Xbox/Xbox_Minecraft.cpp @@ -888,7 +888,7 @@ void SetRenderAndSamplerStates(IDirect3DDevice9 *pDevice,DWORD *RenderStateA,DWO #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Player/EntityTracker.h b/Minecraft.Client/Player/EntityTracker.h index b35b5efef..57ca99be0 100644 --- a/Minecraft.Client/Player/EntityTracker.h +++ b/Minecraft.Client/Player/EntityTracker.h @@ -14,7 +14,7 @@ class EntityTracker private: ServerLevel *level; unordered_set > entities; - unordered_map , IntKeyHash2, IntKeyEq> entityMap; // was IntHashMap + std::unordered_map , IntKeyHash2, IntKeyEq> entityMap; // was IntHashMap int maxRange; public: diff --git a/Minecraft.Client/Player/ServerPlayer.cpp b/Minecraft.Client/Player/ServerPlayer.cpp index 26949313b..7e4bcaf6a 100644 --- a/Minecraft.Client/Player/ServerPlayer.cpp +++ b/Minecraft.Client/Player/ServerPlayer.cpp @@ -369,7 +369,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) okToSend = true; MinecraftServer::s_slowQueuePacketSent = true; -// static unordered_map mapLastTime; +// static std::unordered_map mapLastTime; // __int64 thisTime = System::currentTimeMillis(); // __int64 lastTime = mapLastTime[connection->getNetworkPlayer()->GetUID().toString()]; // app.DebugPrintf(" - OK to send (%d ms since last)\n", thisTime - lastTime); diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h index f68c43695..eb443cee7 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h @@ -10,7 +10,7 @@ class EntityRenderDispatcher public: static void staticCtor(); // 4J added private: - typedef unordered_map classToRendererMap; + typedef std::unordered_map classToRendererMap; classToRendererMap renderers; // 4J - was: // Map, EntityRenderer> renderers = new HashMap, EntityRenderer>(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h index c8b392adf..c367e9b03 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h @@ -5,7 +5,7 @@ using namespace std; class MobSpawnerRenderer : public TileEntityRenderer { private: - unordered_map > models; + std::unordered_map > models; public: virtual void render(std::shared_ptr _spawner, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.h b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.h index f8412860e..01eaa3652 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.h @@ -12,7 +12,7 @@ public: static void staticCtor(); // 4J added private: - typedef unordered_map classToTileRendererMap; + typedef std::unordered_map classToTileRendererMap; classToTileRendererMap renderers; public: diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h index ec369939c..34f926a7e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h @@ -46,7 +46,7 @@ class TileRenderer bool smoothShapeLighting; Minecraft *minecraft; ///////////////////////////////////////// Data caching - unordered_map getLightColorCount; + std::unordered_map getLightColorCount; int xMin, yMin, zMin; int xMin2, yMin2, zMin2; int getLightColor( Tile *tt, LevelSource *level, int x, int y, int z); diff --git a/Minecraft.Client/Rendering/LevelRenderer.cpp b/Minecraft.Client/Rendering/LevelRenderer.cpp index 0db005a01..759d17d73 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.cpp +++ b/Minecraft.Client/Rendering/LevelRenderer.cpp @@ -3212,7 +3212,7 @@ void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, int progres if (entry == NULL || entry->getX() != x || entry->getY() != y || entry->getZ() != z) { entry = new BlockDestructionProgress(id, x, y, z); - destroyingBlocks.insert( unordered_map::value_type(id, entry) ); + destroyingBlocks.insert( std::unordered_map::value_type(id, entry) ); } entry->setProgress(progress); diff --git a/Minecraft.Client/Rendering/LevelRenderer.h b/Minecraft.Client/Rendering/LevelRenderer.h index 780e13b7a..b456752e3 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.h +++ b/Minecraft.Client/Rendering/LevelRenderer.h @@ -120,7 +120,7 @@ public: void destroyTileProgress(int id, int x, int y, int z, int progress); void registerTextures(IconRegister *iconRegister); - typedef unordered_map >, IntKeyHash, IntKeyEq> rteMap; + typedef std::unordered_map >, IntKeyHash, IntKeyEq> rteMap; private: // debug @@ -160,7 +160,7 @@ private: static const int RENDERLISTS_LENGTH = 4; // 4J - added OffsettedRenderList renderLists[RENDERLISTS_LENGTH]; - unordered_map destroyingBlocks; + std::unordered_map destroyingBlocks; Icon **breakingTextures; public: diff --git a/Minecraft.Client/Rendering/Models/Model.h b/Minecraft.Client/Rendering/Models/Model.h index 2762d9124..bb474e98c 100644 --- a/Minecraft.Client/Rendering/Models/Model.h +++ b/Minecraft.Client/Rendering/Models/Model.h @@ -14,7 +14,7 @@ public: bool riding; vector cubes; bool young; - unordered_map mappedTexOffs; + std::unordered_map mappedTexOffs; int texWidth; int texHeight; diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.h b/Minecraft.Client/Textures/Packs/TexturePackRepository.h index 2b66df43b..922b440de 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.h +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.h @@ -21,7 +21,7 @@ private: vector *texturePacks; vector m_texturePacksToDelete; - unordered_map cacheById; + std::unordered_map cacheById; TexturePack *selected; TexturePack *lastSelected; diff --git a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp index 68ad93421..cc024b19a 100644 --- a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp @@ -70,7 +70,7 @@ void PreStitchedTextureMap::stitch() } // Collection bucket for multiple frames per texture - unordered_map * > textures; // = new HashMap>(); + std::unordered_map * > textures; // = new HashMap>(); Stitcher *stitcher = TextureManager::getInstance()->createStitcher(name); diff --git a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h index 6e6ea0870..aab22ffab 100644 --- a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h +++ b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h @@ -23,7 +23,7 @@ private: bool m_mipMap; - typedef unordered_map stringIconMap; + typedef std::unordered_map stringIconMap; stringIconMap texturesByName; // = new HashMap(); BufferedImage *missingTexture; // = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); StitchedTexture *missingPosition; diff --git a/Minecraft.Client/Textures/Stitching/TextureMap.cpp b/Minecraft.Client/Textures/Stitching/TextureMap.cpp index 2a7c6c59c..8277da0ec 100644 --- a/Minecraft.Client/Textures/Stitching/TextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/TextureMap.cpp @@ -58,7 +58,7 @@ void TextureMap::stitch() } // Collection bucket for multiple frames per texture - unordered_map * > textures; // = new HashMap>(); + std::unordered_map * > textures; // = new HashMap>(); Stitcher *stitcher = TextureManager::getInstance()->createStitcher(name); @@ -76,7 +76,7 @@ void TextureMap::stitch() stitcher->addTexture(missingHolder); vector *missingVec = new vector(); missingVec->push_back(missingTex); - textures.insert( unordered_map * >::value_type( missingHolder, missingVec )); + textures.insert( std::unordered_map * >::value_type( missingHolder, missingVec )); // Extract frames from textures and add them to the stitchers //for (final String name : texturesToRegister.keySet()) @@ -98,7 +98,7 @@ void TextureMap::stitch() stitcher->addTexture(holder); // Store frames - textures.insert( unordered_map * >::value_type( holder, frames ) ); + textures.insert( std::unordered_map * >::value_type( holder, frames ) ); } // Stitch! diff --git a/Minecraft.Client/Textures/Stitching/TextureMap.h b/Minecraft.Client/Textures/Stitching/TextureMap.h index 99de21477..173dd15e1 100644 --- a/Minecraft.Client/Textures/Stitching/TextureMap.h +++ b/Minecraft.Client/Textures/Stitching/TextureMap.h @@ -21,7 +21,7 @@ private: bool m_mipMap; - typedef unordered_map stringStitchedTextureMap; + typedef std::unordered_map stringStitchedTextureMap; stringStitchedTextureMap texturesByName; // = new HashMap(); BufferedImage *missingTexture; // = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); StitchedTexture *missingPosition; diff --git a/Minecraft.Client/Textures/TextureManager.h b/Minecraft.Client/Textures/TextureManager.h index b1d71d2db..f62209cb6 100644 --- a/Minecraft.Client/Textures/TextureManager.h +++ b/Minecraft.Client/Textures/TextureManager.h @@ -10,8 +10,8 @@ private: static TextureManager *instance; int nextID; - typedef unordered_map stringIntMap; - typedef unordered_map intTextureMap; + typedef std::unordered_map stringIntMap; + typedef std::unordered_map intTextureMap; intTextureMap idToTextureMap; stringIntMap stringToIDMap; diff --git a/Minecraft.Client/Textures/Textures.cpp b/Minecraft.Client/Textures/Textures.cpp index 47ad7c5bb..5d146a518 100644 --- a/Minecraft.Client/Textures/Textures.cpp +++ b/Minecraft.Client/Textures/Textures.cpp @@ -1139,27 +1139,27 @@ void Textures::reloadAll() #if 0 AUTO_VAR(itEndLI, loadedImages.end() ); - for(unordered_map::iterator it = loadedImages.begin(); it != itEndLI; it++ ) + for(std::unordered_map::iterator it = loadedImages.begin(); it != itEndLI; it++ ) { BufferedImage *image = it->second; loadTexture(image, it->first); } AUTO_VAR(itEndHT, httpTextures.end()); - for(unordered_map::iterator it = httpTextures.begin(); it != itEndHT; it++ ) + for(std::unordered_map::iterator it = httpTextures.begin(); it != itEndHT; it++ ) { it->second->isLoaded = false; } AUTO_VAR(itEndMT, memTextures.end()); - for(unordered_map::iterator it = memTextures.begin(); it != itEndMT; it++ ) + for(std::unordered_map::iterator it = memTextures.begin(); it != itEndMT; it++ ) { it->second->isLoaded = false; } AUTO_VAR(itEndIM, idMap.end()); - for( unordered_map::iterator it = idMap.begin(); it != itEndIM; it++ ) + for( std::unordered_map::iterator it = idMap.begin(); it != itEndIM; it++ ) { wstring name = it->first; @@ -1180,7 +1180,7 @@ void Textures::reloadAll() delete image; } AUTO_VAR(itEndPM, pixelsMap.end()); - for( unordered_map::iterator it = pixelsMap.begin(); it != itEndPM; it++ ) + for( std::unordered_map::iterator it = pixelsMap.begin(); it != itEndPM; it++ ) { wstring name = it->first; BufferedImage *image = readImage(skin->getResource(name)); diff --git a/Minecraft.Client/Textures/Textures.h b/Minecraft.Client/Textures/Textures.h index e032f4d97..afd0564f4 100644 --- a/Minecraft.Client/Textures/Textures.h +++ b/Minecraft.Client/Textures/Textures.h @@ -208,14 +208,14 @@ private: static const wchar_t *preLoaded[TN_COUNT]; static int preLoadedIdx[TN_COUNT]; - unordered_map idMap; - unordered_map pixelsMap; - unordered_map loadedImages; + std::unordered_map idMap; + std::unordered_map pixelsMap; + std::unordered_map loadedImages; //IntBuffer *pixels; // 4J - removed so we don't have a permanent buffer kicking round using up 1MB - unordered_map httpTextures; + std::unordered_map httpTextures; // 4J-PB - Added for GTS textures - unordered_map memTextures; + std::unordered_map memTextures; Options *options; private: diff --git a/Minecraft.Client/Utils/ArchiveFile.h b/Minecraft.Client/Utils/ArchiveFile.h index db20484c0..f67c25b99 100644 --- a/Minecraft.Client/Utils/ArchiveFile.h +++ b/Minecraft.Client/Utils/ArchiveFile.h @@ -23,7 +23,7 @@ protected: } MetaData, *PMetaData; - unordered_map m_index; + std::unordered_map m_index; public: void _readHeader(DataInputStream *dis); diff --git a/Minecraft.Client/Utils/MemoryTracker.cpp b/Minecraft.Client/Utils/MemoryTracker.cpp index 581198708..9300586b9 100644 --- a/Minecraft.Client/Utils/MemoryTracker.cpp +++ b/Minecraft.Client/Utils/MemoryTracker.cpp @@ -4,7 +4,7 @@ #include "../../Minecraft.World/IO/Streams/ByteBuffer.h" #include "../../Minecraft.World/IO/Streams/FloatBuffer.h" -unordered_map MemoryTracker::GL_LIST_IDS; +std::unordered_map MemoryTracker::GL_LIST_IDS; vector MemoryTracker::TEXTURE_IDS; int MemoryTracker::genLists(int count) diff --git a/Minecraft.Client/Utils/MemoryTracker.h b/Minecraft.Client/Utils/MemoryTracker.h index 9567fac9d..c3dc337f3 100644 --- a/Minecraft.Client/Utils/MemoryTracker.h +++ b/Minecraft.Client/Utils/MemoryTracker.h @@ -12,7 +12,7 @@ using namespace std; class MemoryTracker { private: - static unordered_map GL_LIST_IDS; + static std::unordered_map GL_LIST_IDS; static vector TEXTURE_IDS; public: diff --git a/Minecraft.Client/Utils/StringTable.cpp b/Minecraft.Client/Utils/StringTable.cpp index 7473ac7a2..68764957a 100644 --- a/Minecraft.Client/Utils/StringTable.cpp +++ b/Minecraft.Client/Utils/StringTable.cpp @@ -87,7 +87,7 @@ StringTable::StringTable(PBYTE pbData, DWORD dwSize) wstring stringId = dis2.readUTF(); wstring stringValue = dis2.readUTF(); - m_stringsMap.insert( unordered_map::value_type(stringId, stringValue) ); + m_stringsMap.insert( std::unordered_map::value_type(stringId, stringValue) ); } } else diff --git a/Minecraft.Client/Utils/StringTable.h b/Minecraft.Client/Utils/StringTable.h index 9e27d65ce..5cb379b99 100644 --- a/Minecraft.Client/Utils/StringTable.h +++ b/Minecraft.Client/Utils/StringTable.h @@ -15,7 +15,7 @@ class StringTable private: bool isStatic; - unordered_map m_stringsMap; + std::unordered_map m_stringsMap; vector m_stringsVec; byteArray src; diff --git a/Minecraft.Client/Utils/WstringLookup.h b/Minecraft.Client/Utils/WstringLookup.h index 50501020f..45f92dc52 100644 --- a/Minecraft.Client/Utils/WstringLookup.h +++ b/Minecraft.Client/Utils/WstringLookup.h @@ -6,7 +6,7 @@ class WstringLookup { private: UINT numIDs; - unordered_map str2int; + std::unordered_map str2int; vector int2str; public: diff --git a/Minecraft.World/AI/Navigation/PathFinder.cpp b/Minecraft.World/AI/Navigation/PathFinder.cpp index 16de2fb84..a91d36570 100644 --- a/Minecraft.World/AI/Navigation/PathFinder.cpp +++ b/Minecraft.World/AI/Navigation/PathFinder.cpp @@ -193,7 +193,7 @@ Node *PathFinder::getNode(Entity *entity, int x, int y, int z, Node *size, int j MemSect(54); node = new Node(x, y, z); MemSect(0); - nodes.insert( unordered_map::value_type(i, node) ); + nodes.insert( std::unordered_map::value_type(i, node) ); } else { diff --git a/Minecraft.World/AI/Navigation/PathFinder.h b/Minecraft.World/AI/Navigation/PathFinder.h index fea2810ba..119e8afa0 100644 --- a/Minecraft.World/AI/Navigation/PathFinder.h +++ b/Minecraft.World/AI/Navigation/PathFinder.h @@ -12,7 +12,7 @@ private: BinaryHeap openSet; // 4J Jev, was a IntHashMap, thought this was close enough. - unordered_map nodes; + std::unordered_map nodes; NodeArray *neighbors; diff --git a/Minecraft.World/Blocks/MobSpawner.cpp b/Minecraft.World/Blocks/MobSpawner.cpp index fd199aafe..36e7e248f 100644 --- a/Minecraft.World/Blocks/MobSpawner.cpp +++ b/Minecraft.World/Blocks/MobSpawner.cpp @@ -36,7 +36,7 @@ TilePos MobSpawner::getRandomPosWithin(Level *level, int cx, int cz) // AP - See CustomMap.h for an explanation of this CustomMap MobSpawner::chunksToPoll; #else - unordered_map MobSpawner::chunksToPoll; + std::unordered_map MobSpawner::chunksToPoll; #endif const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFriendlies) diff --git a/Minecraft.World/Blocks/MobSpawner.h b/Minecraft.World/Blocks/MobSpawner.h index 173e03852..a46ba1618 100644 --- a/Minecraft.World/Blocks/MobSpawner.h +++ b/Minecraft.World/Blocks/MobSpawner.h @@ -22,7 +22,7 @@ private: // AP - See CustomMap.h for an explanation of this static CustomMap chunksToPoll; #else - static unordered_map chunksToPoll; + static std::unordered_map chunksToPoll; #endif public: diff --git a/Minecraft.World/Blocks/NotGateTile.cpp b/Minecraft.World/Blocks/NotGateTile.cpp index ab6f3bc7e..6e535195d 100644 --- a/Minecraft.World/Blocks/NotGateTile.cpp +++ b/Minecraft.World/Blocks/NotGateTile.cpp @@ -4,7 +4,7 @@ #include "../Util/SoundTypes.h" #include "../Headers/net.minecraft.world.h" -unordered_map *> NotGateTile::recentToggles = unordered_map *>(); +std::unordered_map *> NotGateTile::recentToggles = std::unordered_map *>(); // 4J - added, to tie in with other changes brought forward from 1.3.2 to associate toggles with a level. In addition to what the java // version does, we are also removing any references to levels that we are storing when they hit their dtor. diff --git a/Minecraft.World/Blocks/NotGateTile.h b/Minecraft.World/Blocks/NotGateTile.h index 52dd4a2e5..12d46f704 100644 --- a/Minecraft.World/Blocks/NotGateTile.h +++ b/Minecraft.World/Blocks/NotGateTile.h @@ -31,7 +31,7 @@ public: }; private: - static unordered_map *> recentToggles; // 4J - brought forward change from 1.3.2 + static std::unordered_map *> recentToggles; // 4J - brought forward change from 1.3.2 public: static void removeLevelReferences(Level *level); // 4J added private: diff --git a/Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp b/Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp index 411ab8156..b72ee7fb1 100644 --- a/Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp +++ b/Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp @@ -98,7 +98,7 @@ const wstring PotionBrewing::MOD_GUNPOWDER = L""; // gunpowder makes them throwa PotionBrewing::intStringMap PotionBrewing::potionEffectDuration; PotionBrewing::intStringMap PotionBrewing::potionEffectAmplifier; -unordered_map PotionBrewing::cachedColors; +std::unordered_map PotionBrewing::cachedColors; void PotionBrewing::staticCtor() { diff --git a/Minecraft.World/Blocks/TileEntities/PotionBrewing.h b/Minecraft.World/Blocks/TileEntities/PotionBrewing.h index 686792939..6f0197e6b 100644 --- a/Minecraft.World/Blocks/TileEntities/PotionBrewing.h +++ b/Minecraft.World/Blocks/TileEntities/PotionBrewing.h @@ -29,7 +29,7 @@ public: static const wstring MOD_GOLDENCARROT; private: - typedef unordered_map intStringMap; + typedef std::unordered_map intStringMap; static intStringMap potionEffectDuration; static intStringMap potionEffectAmplifier; @@ -57,7 +57,7 @@ public: static int getColorValue(vector *effects); private: - static unordered_map cachedColors; + static std::unordered_map cachedColors; public: static int getColorValue(int brew, bool includeDisabledEffects); diff --git a/Minecraft.World/Blocks/TileEntities/TileEntity.cpp b/Minecraft.World/Blocks/TileEntities/TileEntity.cpp index 1fd4a81ce..7e01678c4 100644 --- a/Minecraft.World/Blocks/TileEntities/TileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/TileEntity.cpp @@ -8,8 +8,8 @@ -TileEntity::idToCreateMapType TileEntity::idCreateMap = unordered_map(); -TileEntity::classToIdMapType TileEntity::classIdMap = unordered_map(); +TileEntity::idToCreateMapType TileEntity::idCreateMap = std::unordered_map(); +TileEntity::classToIdMapType TileEntity::classIdMap = std::unordered_map(); void TileEntity::staticCtor() { diff --git a/Minecraft.World/Blocks/TileEntities/TileEntity.h b/Minecraft.World/Blocks/TileEntities/TileEntity.h index 6106b3f92..4833f2910 100644 --- a/Minecraft.World/Blocks/TileEntities/TileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/TileEntity.h @@ -16,8 +16,8 @@ public: static void staticCtor(); virtual eINSTANCEOF GetType() { return eTYPE_TILEENTITY; } private: - typedef unordered_map idToCreateMapType; - typedef unordered_map classToIdMapType; + typedef std::unordered_map idToCreateMapType; + typedef std::unordered_map classToIdMapType; static idToCreateMapType idCreateMap; static classToIdMapType classIdMap; static void setId(tileEntityCreateFn createFn, eINSTANCEOF clas, wstring id); diff --git a/Minecraft.World/Commands/CommandDispatcher.h b/Minecraft.World/Commands/CommandDispatcher.h index cfc4486a1..2a706fbff 100644 --- a/Minecraft.World/Commands/CommandDispatcher.h +++ b/Minecraft.World/Commands/CommandDispatcher.h @@ -7,9 +7,9 @@ class CommandDispatcher { private: #ifdef __ORBIS__ - unordered_map> commandsById; + std::unordered_map> commandsById; #else - unordered_map commandsById; + std::unordered_map commandsById; #endif unordered_set commands; diff --git a/Minecraft.World/Containers/MenuBackup.cpp b/Minecraft.World/Containers/MenuBackup.cpp index 2655e0930..7ba8133b2 100644 --- a/Minecraft.World/Containers/MenuBackup.cpp +++ b/Minecraft.World/Containers/MenuBackup.cpp @@ -7,7 +7,7 @@ MenuBackup::MenuBackup(std::shared_ptr inventory, AbstractContainerMenu *menu) { - backups = new unordered_map(); + backups = new std::unordered_map(); this->inventory = inventory; this->menu = menu; @@ -21,7 +21,7 @@ void MenuBackup::save(short changeUid) { (*backup)[i + 1] = ItemInstance::clone(menu->slots->at(i)->getItem()); } - // TODO Is unordered_map use correct? + // TODO Is std::unordered_map use correct? // Was backups.put(changeUid, backup); (*backups)[changeUid] = backup; } @@ -29,7 +29,7 @@ void MenuBackup::save(short changeUid) // Cannot use delete as function name as it is a reserved keyword void MenuBackup::deleteBackup(short changeUid) { - // TODO Is the unordered_map use correct? + // TODO Is the std::unordered_map use correct? // 4J Was backups.remove(changeUid); backups->erase(changeUid); } diff --git a/Minecraft.World/Containers/MenuBackup.h b/Minecraft.World/Containers/MenuBackup.h index 27df45dad..b29453a63 100644 --- a/Minecraft.World/Containers/MenuBackup.h +++ b/Minecraft.World/Containers/MenuBackup.h @@ -6,7 +6,7 @@ class Inventory; class MenuBackup { private: - unordered_map *backups; + std::unordered_map *backups; std::shared_ptr inventory; AbstractContainerMenu *menu; diff --git a/Minecraft.World/Containers/RepairMenu.cpp b/Minecraft.World/Containers/RepairMenu.cpp index 3ef1b563e..7f9120a99 100644 --- a/Minecraft.World/Containers/RepairMenu.cpp +++ b/Minecraft.World/Containers/RepairMenu.cpp @@ -65,7 +65,7 @@ void RepairMenu::createResult() { std::shared_ptr result = input->copy(); std::shared_ptr addition = repairSlots->getItem(ADDITIONAL_SLOT); - unordered_map *enchantments = EnchantmentHelper::getEnchantments(result); + std::unordered_map *enchantments = EnchantmentHelper::getEnchantments(result); bool usingBook = false; tax += input->getBaseRepairCost() + (addition == NULL ? 0 : addition->getBaseRepairCost()); @@ -132,7 +132,7 @@ void RepairMenu::createResult() } } - unordered_map *additionalEnchantments = EnchantmentHelper::getEnchantments(addition); + std::unordered_map *additionalEnchantments = EnchantmentHelper::getEnchantments(addition); for(AUTO_VAR(it, additionalEnchantments->begin()); it != additionalEnchantments->end(); ++it) { diff --git a/Minecraft.World/Enchantments/EnchantmentHelper.cpp b/Minecraft.World/Enchantments/EnchantmentHelper.cpp index f37cba337..8f172e429 100644 --- a/Minecraft.World/Enchantments/EnchantmentHelper.cpp +++ b/Minecraft.World/Enchantments/EnchantmentHelper.cpp @@ -33,9 +33,9 @@ int EnchantmentHelper::getEnchantmentLevel(int enchantmentId, std::shared_ptr *EnchantmentHelper::getEnchantments(std::shared_ptr item) +std::unordered_map *EnchantmentHelper::getEnchantments(std::shared_ptr item) { - unordered_map *result = new unordered_map(); + std::unordered_map *result = new std::unordered_map(); ListTag *list = item->id == Item::enchantedBook_Id ? Item::enchantedBook->getEnchantments(item) : item->getEnchantmentTags(); if (list != NULL) @@ -45,14 +45,14 @@ unordered_map *EnchantmentHelper::getEnchantments(std::shared_ptrget(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_ID); int level = list->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL); - result->insert( unordered_map::value_type(type, level)); + result->insert( std::unordered_map::value_type(type, level)); } } return result; } -void EnchantmentHelper::setEnchantments(unordered_map *enchantments, std::shared_ptr item) +void EnchantmentHelper::setEnchantments(std::unordered_map *enchantments, std::shared_ptr item) { ListTag *list = new ListTag(); @@ -357,7 +357,7 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand vector *results = NULL; - unordered_map *availableEnchantments = getAvailableEnchantmentResults(realValue, itemInstance); + std::unordered_map *availableEnchantments = getAvailableEnchantmentResults(realValue, itemInstance); if (availableEnchantments != NULL && !availableEnchantments->empty()) { vector values; @@ -433,10 +433,10 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand return results; } -unordered_map *EnchantmentHelper::getAvailableEnchantmentResults(int value, std::shared_ptr itemInstance) +std::unordered_map *EnchantmentHelper::getAvailableEnchantmentResults(int value, std::shared_ptr itemInstance) { Item *item = itemInstance->getItem(); - unordered_map *results = NULL; + std::unordered_map *results = NULL; bool isBook = itemInstance->id == Item::book_Id; @@ -461,7 +461,7 @@ unordered_map *EnchantmentHelper::getAvailableEnchan { if (results == NULL) { - results = new unordered_map(); + results = new std::unordered_map(); } AUTO_VAR(it, results->find(e->id)); if(it != results->end()) diff --git a/Minecraft.World/Enchantments/EnchantmentHelper.h b/Minecraft.World/Enchantments/EnchantmentHelper.h index 382017bcb..46b73c718 100644 --- a/Minecraft.World/Enchantments/EnchantmentHelper.h +++ b/Minecraft.World/Enchantments/EnchantmentHelper.h @@ -13,8 +13,8 @@ private: public: static int getEnchantmentLevel(int enchantmentId, std::shared_ptr piece); - static unordered_map *getEnchantments(std::shared_ptr item); - static void setEnchantments(unordered_map *enchantments, std::shared_ptr item); + static std::unordered_map *getEnchantments(std::shared_ptr item); + static void setEnchantments(std::unordered_map *enchantments, std::shared_ptr item); static int getEnchantmentLevel(int enchantmentId, ItemInstanceArray inventory); @@ -106,5 +106,5 @@ public: * @return */ static vector *selectEnchantment(Random *random, std::shared_ptr itemInstance, int enchantmentCost); - static unordered_map *getAvailableEnchantmentResults(int value, std::shared_ptr itemInstance); + static std::unordered_map *getAvailableEnchantmentResults(int value, std::shared_ptr itemInstance); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/Mob.cpp b/Minecraft.World/Entities/Mob.cpp index 1d635cf9a..9d708b7d7 100644 --- a/Minecraft.World/Entities/Mob.cpp +++ b/Minecraft.World/Entities/Mob.cpp @@ -1125,7 +1125,7 @@ void Mob::readAdditionalSaveData(CompoundTag *tag) int amplifier = effectTag->getByte(L"Amplifier"); int duration = effectTag->getInt(L"Duration"); - activeEffects.insert( unordered_map::value_type( id, new MobEffectInstance(id, duration, amplifier) ) ); + activeEffects.insert( std::unordered_map::value_type( id, new MobEffectInstance(id, duration, amplifier) ) ); } } } @@ -1783,7 +1783,7 @@ void Mob::addEffect(MobEffectInstance *newEffect) } else { - activeEffects.insert( unordered_map::value_type( newEffect->getId(), newEffect ) ); + activeEffects.insert( std::unordered_map::value_type( newEffect->getId(), newEffect ) ); onEffectAdded(newEffect); } } @@ -1804,7 +1804,7 @@ void Mob::addEffectNoUpdate(MobEffectInstance *newEffect) } else { - activeEffects.insert( unordered_map::value_type( newEffect->getId(), newEffect ) ); + activeEffects.insert( std::unordered_map::value_type( newEffect->getId(), newEffect ) ); } } diff --git a/Minecraft.World/Entities/Mobs/Villager.cpp b/Minecraft.World/Entities/Mobs/Villager.cpp index b86a64f24..457efce57 100644 --- a/Minecraft.World/Entities/Mobs/Villager.cpp +++ b/Minecraft.World/Entities/Mobs/Villager.cpp @@ -16,8 +16,8 @@ #include "../../../Minecraft.Client/Textures/Textures.h" #include "Villager.h" -unordered_map > Villager::MIN_MAX_VALUES; -unordered_map > Villager::MIN_MAX_PRICES; +std::unordered_map > Villager::MIN_MAX_VALUES; +std::unordered_map > Villager::MIN_MAX_PRICES; void Villager::_init(int profession) { diff --git a/Minecraft.World/Entities/Mobs/Villager.h b/Minecraft.World/Entities/Mobs/Villager.h index e4550f3ef..ae18ecfbb 100644 --- a/Minecraft.World/Entities/Mobs/Villager.h +++ b/Minecraft.World/Entities/Mobs/Villager.h @@ -109,8 +109,8 @@ public: void overrideOffers(MerchantRecipeList *recipeList); private: - static unordered_map > MIN_MAX_VALUES; - static unordered_map > MIN_MAX_PRICES; + static std::unordered_map > MIN_MAX_VALUES; + static std::unordered_map > MIN_MAX_PRICES; public: static void staticCtor(); diff --git a/Minecraft.World/Entities/SyncedEntityData.h b/Minecraft.World/Entities/SyncedEntityData.h index 666a8432e..404441b80 100644 --- a/Minecraft.World/Entities/SyncedEntityData.h +++ b/Minecraft.World/Entities/SyncedEntityData.h @@ -71,7 +71,7 @@ private: // the id value must fit in the remaining bits static const int MAX_ID_VALUE = ~TYPE_MASK & 0xff; - unordered_map > itemsById; + std::unordered_map > itemsById; bool m_isDirty; public: diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h index 0b2017a2e..a35a5838b 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h @@ -48,7 +48,7 @@ private: bool dirty; int64_t lastWritten; }; - unordered_map regionFiles; + std::unordered_map regionFiles; vector writeHistory; int64_t m_lastTickTime; diff --git a/Minecraft.World/IO/NBT/CompoundTag.h b/Minecraft.World/IO/NBT/CompoundTag.h index e4e67ce18..244de5179 100644 --- a/Minecraft.World/IO/NBT/CompoundTag.h +++ b/Minecraft.World/IO/NBT/CompoundTag.h @@ -14,7 +14,7 @@ class CompoundTag : public Tag { private: - unordered_map tags; + std::unordered_map tags; public: CompoundTag() : Tag(L"") {} @@ -23,7 +23,7 @@ public: void write(DataOutput *dos) { AUTO_VAR(itEnd, tags.end()); - for( unordered_map::iterator it = tags.begin(); it != itEnd; it++ ) + for( std::unordered_map::iterator it = tags.begin(); it != itEnd; it++ ) { Tag::writeNamedTag(it->second, dos); } @@ -48,7 +48,7 @@ public: vector *ret = new vector; AUTO_VAR(itEnd, tags.end()); - for( unordered_map::iterator it = tags.begin(); it != itEnd; it++ ) + for( std::unordered_map::iterator it = tags.begin(); it != itEnd; it++ ) { ret->push_back(it->second); } @@ -229,7 +229,7 @@ public: strcat( newPrefix, " "); AUTO_VAR(itEnd, tags.end()); - for( unordered_map::iterator it = tags.begin(); it != itEnd; it++ ) + for( std::unordered_map::iterator it = tags.begin(); it != itEnd; it++ ) { it->second->print(newPrefix, out); } diff --git a/Minecraft.World/Items/PotionItem.h b/Minecraft.World/Items/PotionItem.h index 0d5dd1817..02f39e974 100644 --- a/Minecraft.World/Items/PotionItem.h +++ b/Minecraft.World/Items/PotionItem.h @@ -15,7 +15,7 @@ public: static const wstring CONTENTS_ICON; private: - unordered_map *> cachedMobEffects; + std::unordered_map *> cachedMobEffects; Icon *iconThrowable; Icon *iconDrinkable; diff --git a/Minecraft.World/Level/Explosion.h b/Minecraft.World/Level/Explosion.h index 602126fa4..b15ce6b99 100644 --- a/Minecraft.World/Level/Explosion.h +++ b/Minecraft.World/Level/Explosion.h @@ -25,7 +25,7 @@ public: unordered_set toBlow; private: - typedef unordered_map, Vec3 * , PlayerKeyHash, PlayerKeyEq> playerVec3Map; + typedef std::unordered_map, Vec3 * , PlayerKeyHash, PlayerKeyEq> playerVec3Map; playerVec3Map hitPlayers; public: diff --git a/Minecraft.World/Level/LevelChunk.cpp b/Minecraft.World/Level/LevelChunk.cpp index 8497ef6f9..3bce22d96 100644 --- a/Minecraft.World/Level/LevelChunk.cpp +++ b/Minecraft.World/Level/LevelChunk.cpp @@ -1529,7 +1529,7 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter ListTag *tileEntityTags = new ListTag(); AUTO_VAR(itEnd,tileEntities.end()); - for( unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = tileEntities.begin(); + for( std::unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = tileEntities.begin(); it != itEnd; it++) { std::shared_ptr te = it->second; diff --git a/Minecraft.World/Level/LevelChunk.h b/Minecraft.World/Level/LevelChunk.h index 9ac4f25ed..fa8db6627 100644 --- a/Minecraft.World/Level/LevelChunk.h +++ b/Minecraft.World/Level/LevelChunk.h @@ -100,7 +100,7 @@ private: bool hasGapsToCheck; public: - unordered_map, TilePosKeyHash, TilePosKeyEq> tileEntities; + std::unordered_map, TilePosKeyHash, TilePosKeyEq> tileEntities; vector > **entityBlocks; static const int sTerrainPopulatedFromHere = 2; diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorage.h b/Minecraft.World/Level/Storage/DirectoryLevelStorage.h index 01d95d9ad..74d7f829d 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorage.h +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorage.h @@ -75,7 +75,7 @@ private: { friend class DirectoryLevelStorage; private: - unordered_map<__int64, short> m_mappings; + std::unordered_map<__int64, short> m_mappings; public: void addMapping(int id, int centreX, int centreZ, int dimension, int scale); @@ -84,9 +84,9 @@ private: void readMappings(DataInputStream *dis); }; #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO) - unordered_map m_playerMappings; + std::unordered_map m_playerMappings; #else - unordered_map m_playerMappings; + std::unordered_map m_playerMappings; #endif byteArray m_usedMappings; #else @@ -95,7 +95,7 @@ private: #endif bool m_bHasLoadedMapDataMappings; - unordered_map m_cachedSaveData; + std::unordered_map m_cachedSaveData; vector m_mapFilesToDelete; // Temp list of files that couldn't be deleted immediately due to saving being disabled protected: diff --git a/Minecraft.World/Level/Storage/EntityIO.cpp b/Minecraft.World/Level/Storage/EntityIO.cpp index 2d3f054db..1ae6226c1 100644 --- a/Minecraft.World/Level/Storage/EntityIO.cpp +++ b/Minecraft.World/Level/Storage/EntityIO.cpp @@ -14,29 +14,29 @@ #include "../../Headers/com.mojang.nbt.h" #include "EntityIO.h" -unordered_map *EntityIO::idCreateMap = new unordered_map; -unordered_map *EntityIO::classIdMap = new unordered_map; -unordered_map *EntityIO::numCreateMap = new unordered_map; -unordered_map *EntityIO::numClassMap = new unordered_map; -unordered_map *EntityIO::classNumMap = new unordered_map; -unordered_map *EntityIO::idNumMap = new unordered_map; -unordered_map EntityIO::idsSpawnableInCreative; +std::unordered_map *EntityIO::idCreateMap = new std::unordered_map; +std::unordered_map *EntityIO::classIdMap = new std::unordered_map; +std::unordered_map *EntityIO::numCreateMap = new std::unordered_map; +std::unordered_map *EntityIO::numClassMap = new std::unordered_map; +std::unordered_map *EntityIO::classNumMap = new std::unordered_map; +std::unordered_map *EntityIO::idNumMap = new std::unordered_map; +std::unordered_map EntityIO::idsSpawnableInCreative; void EntityIO::setId(entityCreateFn createFn, eINSTANCEOF clas, const wstring &id, int idNum) { - idCreateMap->insert( unordered_map::value_type(id, createFn) ); - classIdMap->insert( unordered_map::value_type(clas,id ) ); - numCreateMap->insert( unordered_map::value_type(idNum, createFn) ); - numClassMap->insert( unordered_map::value_type(idNum, clas) ); - classNumMap->insert( unordered_map::value_type(clas, idNum) ); - idNumMap->insert( unordered_map::value_type(id, idNum) ); + idCreateMap->insert( std::unordered_map::value_type(id, createFn) ); + classIdMap->insert( std::unordered_map::value_type(clas,id ) ); + numCreateMap->insert( std::unordered_map::value_type(idNum, createFn) ); + numClassMap->insert( std::unordered_map::value_type(idNum, clas) ); + classNumMap->insert( std::unordered_map::value_type(clas, idNum) ); + idNumMap->insert( std::unordered_map::value_type(id, idNum) ); } void EntityIO::setId(entityCreateFn createFn, eINSTANCEOF clas, const wstring &id, int idNum, eMinecraftColour color1, eMinecraftColour color2, int nameId) { setId(createFn, clas, id, idNum); - idsSpawnableInCreative.insert( unordered_map::value_type( idNum, new SpawnableMobInfo(idNum, color1, color2, nameId) ) ); + idsSpawnableInCreative.insert( std::unordered_map::value_type( idNum, new SpawnableMobInfo(idNum, color1, color2, nameId) ) ); } void EntityIO::staticCtor() @@ -161,7 +161,7 @@ std::shared_ptr EntityIO::newByEnumType(eINSTANCEOF eType, Level *level) { std::shared_ptr entity; - unordered_map::iterator it = classNumMap->find( eType ); + std::unordered_map::iterator it = classNumMap->find( eType ); if( it != classNumMap->end() ) { AUTO_VAR(it2, numCreateMap->find(it->second)); @@ -177,13 +177,13 @@ std::shared_ptr EntityIO::newByEnumType(eINSTANCEOF eType, Level *level) int EntityIO::getId(std::shared_ptr entity) { - unordered_map::iterator it = classNumMap->find( entity->GetType() ); + std::unordered_map::iterator it = classNumMap->find( entity->GetType() ); return (*it).second; } wstring EntityIO::getEncodeId(std::shared_ptr entity) { - unordered_map::iterator it = classIdMap->find( entity->GetType() ); + std::unordered_map::iterator it = classIdMap->find( entity->GetType() ); if( it != classIdMap->end() ) return (*it).second; else @@ -212,7 +212,7 @@ wstring EntityIO::getEncodeId(int entityIoValue) AUTO_VAR(it, numClassMap->find(entityIoValue)); if(it != numClassMap->end() ) { - unordered_map::iterator classIdIt = classIdMap->find( it->second ); + std::unordered_map::iterator classIdIt = classIdMap->find( it->second ); if( classIdIt != classIdMap->end() ) return (*classIdIt).second; else @@ -257,7 +257,7 @@ eINSTANCEOF EntityIO::getClass(int id) int EntityIO::eTypeToIoid(eINSTANCEOF eType) { - unordered_map::iterator it = classNumMap->find( eType ); + std::unordered_map::iterator it = classNumMap->find( eType ); if( it != classNumMap->end() ) return it->second; return -1; diff --git a/Minecraft.World/Level/Storage/EntityIO.h b/Minecraft.World/Level/Storage/EntityIO.h index 644a90191..b5e87b5e2 100644 --- a/Minecraft.World/Level/Storage/EntityIO.h +++ b/Minecraft.World/Level/Storage/EntityIO.h @@ -28,15 +28,15 @@ public: }; private: - static unordered_map *idCreateMap; - static unordered_map *classIdMap; - static unordered_map *numCreateMap; - static unordered_map *numClassMap; - static unordered_map *classNumMap; - static unordered_map *idNumMap; + static std::unordered_map *idCreateMap; + static std::unordered_map *classIdMap; + static std::unordered_map *numCreateMap; + static std::unordered_map *numClassMap; + static std::unordered_map *classNumMap; + static std::unordered_map *idNumMap; public: - static unordered_map idsSpawnableInCreative; + static std::unordered_map idsSpawnableInCreative; private: static void setId(entityCreateFn createFn, eINSTANCEOF clas, const wstring &id, int idNum); diff --git a/Minecraft.World/Level/Storage/MapItemSavedData.cpp b/Minecraft.World/Level/Storage/MapItemSavedData.cpp index f9cf0672b..03d320c51 100644 --- a/Minecraft.World/Level/Storage/MapItemSavedData.cpp +++ b/Minecraft.World/Level/Storage/MapItemSavedData.cpp @@ -309,7 +309,7 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr player, std::shared } #endif //decorations.push_back(new MapDecoration(4, x, y, 0)); - nonPlayerDecorations.insert( unordered_map::value_type( END_PORTAL_DECORATION_KEY, new MapDecoration(4, x, y, 0, END_PORTAL_DECORATION_KEY, true) ) ); + nonPlayerDecorations.insert( std::unordered_map::value_type( END_PORTAL_DECORATION_KEY, new MapDecoration(4, x, y, 0, END_PORTAL_DECORATION_KEY, true) ) ); } else if ( currentPortalDecoration != nonPlayerDecorations.end() && !atLeastOnePlayerInTheEnd ) { @@ -346,7 +346,7 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr player, std::shared } #endif //decorations.push_back(new MapDecoration(7, x, y, 0)); - nonPlayerDecorations.insert( unordered_map::value_type( item->getFrame()->entityId, new MapDecoration(12, x, y, rot, item->getFrame()->entityId, true) ) ); + nonPlayerDecorations.insert( std::unordered_map::value_type( item->getFrame()->entityId, new MapDecoration(12, x, y, rot, item->getFrame()->entityId, true) ) ); } } @@ -380,7 +380,7 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr player, std::shared } #endif //decorations.push_back(new MapDecoration(7, x, y, 0)); - nonPlayerDecorations.insert( unordered_map::value_type( ent->entityId, new MapDecoration(4, x, y, rot, ent->entityId, true) ) ); + nonPlayerDecorations.insert( std::unordered_map::value_type( ent->entityId, new MapDecoration(4, x, y, rot, ent->entityId, true) ) ); } #endif diff --git a/Minecraft.World/Level/Storage/MapItemSavedData.h b/Minecraft.World/Level/Storage/MapItemSavedData.h index dfd6f4894..45dc5dddc 100644 --- a/Minecraft.World/Level/Storage/MapItemSavedData.h +++ b/Minecraft.World/Level/Storage/MapItemSavedData.h @@ -56,7 +56,7 @@ public: vector > carriedBy; private: - typedef unordered_map , std::shared_ptr , PlayerKeyHash, PlayerKeyEq> playerHoldingPlayerMapType; + typedef std::unordered_map , std::shared_ptr , PlayerKeyHash, PlayerKeyEq> playerHoldingPlayerMapType; playerHoldingPlayerMapType carriedByPlayers; public: @@ -64,7 +64,7 @@ public: private: // 4J Stu added - unordered_map nonPlayerDecorations; + std::unordered_map nonPlayerDecorations; static const int END_PORTAL_DECORATION_KEY; diff --git a/Minecraft.World/Level/Storage/McRegionChunkStorage.h b/Minecraft.World/Level/Storage/McRegionChunkStorage.h index 1a783fa67..e63bc3957 100644 --- a/Minecraft.World/Level/Storage/McRegionChunkStorage.h +++ b/Minecraft.World/Level/Storage/McRegionChunkStorage.h @@ -16,7 +16,7 @@ private: ConsoleSaveFile *m_saveFile; static CRITICAL_SECTION cs_memory; - unordered_map<__int64, byteArray> m_entityData; + std::unordered_map<__int64, byteArray> m_entityData; static std::deque s_chunkDataQueue; static int s_runningThreadCount; diff --git a/Minecraft.World/Level/Storage/OldChunkStorage.cpp b/Minecraft.World/Level/Storage/OldChunkStorage.cpp index a531183a4..5d49c7ddd 100644 --- a/Minecraft.World/Level/Storage/OldChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/OldChunkStorage.cpp @@ -268,7 +268,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, DataOutputStream *dos) ListTag *tileEntityTags = new ListTag(); AUTO_VAR(itEnd, lc->tileEntities.end()); - for( unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); + for( std::unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); it != itEnd; it++) { std::shared_ptr te = it->second; @@ -357,7 +357,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, CompoundTag *tag) ListTag *tileEntityTags = new ListTag(); AUTO_VAR(itEnd, lc->tileEntities.end()); - for( unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); + for( std::unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); it != itEnd; it++) { std::shared_ptr te = it->second; diff --git a/Minecraft.World/Level/Storage/RegionFileCache.h b/Minecraft.World/Level/Storage/RegionFileCache.h index b9f8e7291..abad6b060 100644 --- a/Minecraft.World/Level/Storage/RegionFileCache.h +++ b/Minecraft.World/Level/Storage/RegionFileCache.h @@ -9,7 +9,7 @@ class RegionFileCache private: static const int MAX_CACHE_SIZE = 256; - unordered_map cache; + std::unordered_map cache; static RegionFileCache s_defaultCache; diff --git a/Minecraft.World/Level/Storage/SavedDataStorage.cpp b/Minecraft.World/Level/Storage/SavedDataStorage.cpp index 14437c385..e52d058e6 100644 --- a/Minecraft.World/Level/Storage/SavedDataStorage.cpp +++ b/Minecraft.World/Level/Storage/SavedDataStorage.cpp @@ -11,9 +11,9 @@ SavedDataStorage::SavedDataStorage(LevelStorage *levelStorage) { /* - cache = new unordered_map >; + cache = new std::unordered_map >; savedDatas = new vector >; - usedAuxIds = new unordered_map; + usedAuxIds = new std::unordered_map; */ this->levelStorage = levelStorage; @@ -59,7 +59,7 @@ std::shared_ptr SavedDataStorage::get(const type_info& clazz, const w if (data != NULL) { - cache.insert( unordered_map >::value_type( id , data ) ); + cache.insert( std::unordered_map >::value_type( id , data ) ); savedDatas.push_back(data); } return data; diff --git a/Minecraft.World/Level/Storage/SavedDataStorage.h b/Minecraft.World/Level/Storage/SavedDataStorage.h index d18ebcc60..16128040e 100644 --- a/Minecraft.World/Level/Storage/SavedDataStorage.h +++ b/Minecraft.World/Level/Storage/SavedDataStorage.h @@ -9,12 +9,12 @@ class SavedDataStorage private: LevelStorage *levelStorage; - typedef unordered_map > cacheMapType; + typedef std::unordered_map > cacheMapType; cacheMapType cache; vector > savedDatas; - typedef unordered_map uaiMapType; + typedef std::unordered_map uaiMapType; uaiMapType usedAuxIds; public: diff --git a/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp b/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp index ea2ec909c..4adadbb7f 100644 --- a/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp @@ -150,7 +150,7 @@ void ZonedChunkStorage::tick() vector<__int64> toClose; AUTO_VAR(itEndZF, zoneFiles.end()); - for( unordered_map<__int64, ZoneFile *>::iterator it = zoneFiles.begin(); it != itEndZF; it++ ) + for( std::unordered_map<__int64, ZoneFile *>::iterator it = zoneFiles.begin(); it != itEndZF; it++ ) { ZoneFile *zoneFile = it->second; if (tickCount - zoneFile->lastUse > 20 * 60) @@ -181,7 +181,7 @@ void ZonedChunkStorage::tick() void ZonedChunkStorage::flush() { AUTO_VAR(itEnd, zoneFiles.end()); - for( unordered_map<__int64, ZoneFile *>::iterator it = zoneFiles.begin(); it != itEnd; it++ ) + for( std::unordered_map<__int64, ZoneFile *>::iterator it = zoneFiles.begin(); it != itEnd; it++ ) { ZoneFile *zoneFile = it->second; // 4J - removed try/catch @@ -250,7 +250,7 @@ void ZonedChunkStorage::saveEntities(Level *level, LevelChunk *lc) LeaveCriticalSection(&lc->m_csEntities); #endif - for( unordered_map , TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); + for( std::unordered_map , TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); it != lc->tileEntities.end(); it++) { std::shared_ptr te = it->second; diff --git a/Minecraft.World/Level/Storage/ZonedChunkStorage.h b/Minecraft.World/Level/Storage/ZonedChunkStorage.h index 4722e4016..f93181674 100644 --- a/Minecraft.World/Level/Storage/ZonedChunkStorage.h +++ b/Minecraft.World/Level/Storage/ZonedChunkStorage.h @@ -30,7 +30,7 @@ public: File dir; private: - unordered_map<__int64, ZoneFile *> zoneFiles; + std::unordered_map<__int64, ZoneFile *> zoneFiles; __int64 tickCount; public: diff --git a/Minecraft.World/Network/Packets/Packet.cpp b/Minecraft.World/Network/Packets/Packet.cpp index 9a1547b69..74da9b782 100644 --- a/Minecraft.World/Network/Packets/Packet.cpp +++ b/Minecraft.World/Network/Packets/Packet.cpp @@ -163,14 +163,14 @@ Packet::Packet() : createTime( System::currentTimeMillis() ) shouldDelay = false; } -unordered_map Packet::idToCreateMap; +std::unordered_map Packet::idToCreateMap; unordered_set Packet::clientReceivedPackets = unordered_set(); unordered_set Packet::serverReceivedPackets = unordered_set(); unordered_set Packet::sendToAnyClientPackets = unordered_set(); // 4J Added -unordered_map Packet::outgoingStatistics = unordered_map(); +std::unordered_map Packet::outgoingStatistics = std::unordered_map(); vector Packet::renderableStats = vector(); int Packet::renderPos = 0; @@ -182,7 +182,7 @@ void Packet::map(int id, bool receiveOnClient, bool receiveOnServer, bool sendTo if (classToIdMap.count(clazz) > 0) throw new IllegalArgumentException(L"Duplicate packet class:"); // TODO + clazz); #endif - idToCreateMap.insert( unordered_map::value_type(id, createFn) ); + idToCreateMap.insert( std::unordered_map::value_type(id, createFn) ); #ifndef _CONTENT_PACKAGE #if PACKET_ENABLE_STAT_TRACKING @@ -345,7 +345,7 @@ return id; } */ -unordered_map Packet::statistics = unordered_map(); +std::unordered_map Packet::statistics = std::unordered_map(); //int Packet::nextPrint = 0; diff --git a/Minecraft.World/Network/Packets/Packet.h b/Minecraft.World/Network/Packets/Packet.h index 1349e1c3e..d4bd38525 100644 --- a/Minecraft.World/Network/Packets/Packet.h +++ b/Minecraft.World/Network/Packets/Packet.h @@ -47,7 +47,7 @@ public: static void staticCtor(); public: - static unordered_map idToCreateMap; // IntHashMap in 1.8.2 ... needed? // Made public in 1.0.1 + static std::unordered_map idToCreateMap; // IntHashMap in 1.8.2 ... needed? // Made public in 1.0.1 static unordered_set clientReceivedPackets; static unordered_set serverReceivedPackets; @@ -76,7 +76,7 @@ public: private: // 4J Added to track stats for packets that are going out via QNet - static unordered_map outgoingStatistics; // IntHashMap in 1.8.2 ... needed? + static std::unordered_map outgoingStatistics; // IntHashMap in 1.8.2 ... needed? static vector renderableStats; static int renderPos; public: @@ -87,7 +87,7 @@ public: static __int64 getIndexedStatValue(unsigned int samplePos, unsigned int renderableId); private : - static unordered_map statistics; + static std::unordered_map statistics; //static int nextPrint; public: diff --git a/Minecraft.World/Recipes/FurnaceRecipes.cpp b/Minecraft.World/Recipes/FurnaceRecipes.cpp index 04d1a5199..2f90e9182 100644 --- a/Minecraft.World/Recipes/FurnaceRecipes.cpp +++ b/Minecraft.World/Recipes/FurnaceRecipes.cpp @@ -66,7 +66,7 @@ ItemInstance *FurnaceRecipes::getResult(int itemId) return NULL; } -unordered_map *FurnaceRecipes::getRecipies() +std::unordered_map *FurnaceRecipes::getRecipies() { return &recipies; } diff --git a/Minecraft.World/Recipes/FurnaceRecipes.h b/Minecraft.World/Recipes/FurnaceRecipes.h index 168831c08..710c3511d 100644 --- a/Minecraft.World/Recipes/FurnaceRecipes.h +++ b/Minecraft.World/Recipes/FurnaceRecipes.h @@ -11,8 +11,8 @@ public: private: //Map recipies = new HashMap(); - unordered_map recipies; - unordered_map recipeValue; + std::unordered_map recipies; + std::unordered_map recipeValue; public: static FurnaceRecipes *getInstance(); @@ -24,7 +24,7 @@ public: void addFurnaceRecipy(int itemId, ItemInstance *result, float value); bool isFurnaceItem(int itemId); ItemInstance *getResult(int itemId); - unordered_map *getRecipies(); + std::unordered_map *getRecipies(); float getRecipeValue(int itemId); }; diff --git a/Minecraft.World/Recipes/Recipes.cpp b/Minecraft.World/Recipes/Recipes.cpp index c152f8bf6..2c96ddbb5 100644 --- a/Minecraft.World/Recipes/Recipes.cpp +++ b/Minecraft.World/Recipes/Recipes.cpp @@ -942,7 +942,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) int iCount; ItemInstance **ids = NULL; - myMap *mappings = new unordered_map(); + myMap *mappings = new std::unordered_map(); va_start(vl,result); // 4J-PB - second argument is a list of the types diff --git a/Minecraft.World/Recipes/Recipes.h b/Minecraft.World/Recipes/Recipes.h index 023a73b81..e6aadcef2 100644 --- a/Minecraft.World/Recipes/Recipes.h +++ b/Minecraft.World/Recipes/Recipes.h @@ -32,7 +32,7 @@ class ToolRecipies; class WeaponRecipies; class ShapedRecipy; -typedef unordered_map myMap; +typedef std::unordered_map myMap; #define ADD_OBJECT(a,b) a.push_back(new Object(b)) diff --git a/Minecraft.World/Stats/Stats.cpp b/Minecraft.World/Stats/Stats.cpp index 36996a423..87a35731b 100644 --- a/Minecraft.World/Stats/Stats.cpp +++ b/Minecraft.World/Stats/Stats.cpp @@ -15,7 +15,7 @@ const int Stats::ITEMS_COLLECTED_OFFSET = 0x1010000; const int Stats::ITEMS_CRAFTED_OFFSET = 0x1020000; const int Stats::ADDITIONAL_STATS_OFFSET = 0x5010000; // Needs to be higher than Achievements::ACHIEVEMENT_OFFSET = 0x500000; -unordered_map* Stats::statsById = new unordered_map; +std::unordered_map* Stats::statsById = new std::unordered_map; vector *Stats::all = new vector; vector *Stats::generalStats = new vector; diff --git a/Minecraft.World/Stats/Stats.h b/Minecraft.World/Stats/Stats.h index efbeb1ea0..49055a17e 100644 --- a/Minecraft.World/Stats/Stats.h +++ b/Minecraft.World/Stats/Stats.h @@ -16,7 +16,7 @@ private: static const int ADDITIONAL_STATS_OFFSET; protected: - static unordered_map* statsById; + static std::unordered_map* statsById; public: static vector *all; diff --git a/Minecraft.World/WorldGen/Biomes/BiomeCache.h b/Minecraft.World/WorldGen/Biomes/BiomeCache.h index 999102e03..b8faf8ae6 100644 --- a/Minecraft.World/WorldGen/Biomes/BiomeCache.h +++ b/Minecraft.World/WorldGen/Biomes/BiomeCache.h @@ -32,7 +32,7 @@ public: }; private: - unordered_map<__int64,Block *,LongKeyHash,LongKeyEq> cached; // 4J - was LongHashMap + std::unordered_map<__int64,Block *,LongKeyHash,LongKeyEq> cached; // 4J - was LongHashMap vector all; // was ArrayList public: diff --git a/Minecraft.World/WorldGen/Features/StructureFeature.h b/Minecraft.World/WorldGen/Features/StructureFeature.h index 642e6aad6..b52489ec9 100644 --- a/Minecraft.World/WorldGen/Features/StructureFeature.h +++ b/Minecraft.World/WorldGen/Features/StructureFeature.h @@ -16,7 +16,7 @@ public: }; protected: - unordered_map<__int64, StructureStart *> cachedStructures; + std::unordered_map<__int64, StructureStart *> cachedStructures; public: ~StructureFeature(); diff --git a/Minecraft.World/WorldGen/Structures/Village.h b/Minecraft.World/WorldGen/Structures/Village.h index 27839d4ed..2ab17f4bb 100644 --- a/Minecraft.World/WorldGen/Structures/Village.h +++ b/Minecraft.World/WorldGen/Structures/Village.h @@ -14,7 +14,7 @@ private: int populationSize; int noBreedTimer; - unordered_map playerStanding; + std::unordered_map playerStanding; class Aggressor { From cdc08700e4948db451555f5fb261ec7aaeeacf12 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 6 Mar 2026 11:50:22 -0600 Subject: [PATCH 03/24] refactor: unglob `std::wstring` --- .gitignore | 2 + 4J.Profile/4J_Profile.cpp | 2 +- 4J.Profile/4J_Profile.h | 2 +- 4J.Storage/4J_Storage.h | 2 +- Minecraft.Client/Build/Extrax64Stubs.cpp | 2 +- Minecraft.Client/Build/stubs.h | 4 +- Minecraft.Client/ClientConstants.cpp | 2 +- Minecraft.Client/ClientConstants.h | 2 +- Minecraft.Client/GameState/DemoMode.cpp | 2 +- Minecraft.Client/GameState/Options.cpp | 44 ++++++------- Minecraft.Client/GameState/Options.h | 28 ++++---- Minecraft.Client/GameState/Settings.cpp | 8 +-- Minecraft.Client/GameState/Settings.h | 10 +-- Minecraft.Client/GameState/StatsSyncer.h | 2 +- Minecraft.Client/Input/ConsoleInput.cpp | 2 +- Minecraft.Client/Input/ConsoleInput.h | 4 +- Minecraft.Client/Input/ConsoleInputSource.h | 6 +- Minecraft.Client/Input/KeyMapping.cpp | 2 +- Minecraft.Client/Input/KeyMapping.h | 4 +- Minecraft.Client/Level/DemoLevel.cpp | 2 +- Minecraft.Client/Level/DemoLevel.h | 2 +- Minecraft.Client/Level/DerivedServerLevel.cpp | 2 +- Minecraft.Client/Level/DerivedServerLevel.h | 2 +- Minecraft.Client/Level/ServerLevel.cpp | 2 +- Minecraft.Client/Level/ServerLevel.h | 2 +- .../Level/ServerLevelListener.cpp | 4 +- Minecraft.Client/Level/ServerLevelListener.h | 4 +- Minecraft.Client/Minecraft.cpp | 52 +++++++-------- Minecraft.Client/Minecraft.h | 52 +++++++-------- Minecraft.Client/MinecraftServer.cpp | 28 ++++---- Minecraft.Client/MinecraftServer.h | 28 ++++---- Minecraft.Client/Network/ClientConnection.cpp | 20 +++--- Minecraft.Client/Network/ClientConnection.h | 6 +- .../Network/MultiPlayerChunkCache.cpp | 4 +- .../Network/MultiPlayerChunkCache.h | 4 +- .../Network/PendingConnection.cpp | 4 +- Minecraft.Client/Network/PendingConnection.h | 8 +-- Minecraft.Client/Network/PlayerConnection.cpp | 20 +++--- Minecraft.Client/Network/PlayerConnection.h | 14 ++-- Minecraft.Client/Network/PlayerInfo.h | 4 +- Minecraft.Client/Network/PlayerList.cpp | 22 +++---- Minecraft.Client/Network/PlayerList.h | 20 +++--- Minecraft.Client/Network/ServerChunkCache.cpp | 4 +- Minecraft.Client/Network/ServerChunkCache.h | 4 +- .../Network/ServerCommandDispatcher.cpp | 2 +- .../Network/ServerCommandDispatcher.h | 2 +- Minecraft.Client/Network/ServerConnection.cpp | 6 +- Minecraft.Client/Network/ServerConnection.h | 8 +-- Minecraft.Client/Network/ServerInterface.h | 32 +++++----- .../Platform/Durango/4JLibs/inc/4J_Storage.h | 2 +- .../Platform/Durango/Durango_App.cpp | 6 +- .../DurangoLeaderboardManager.cpp | 8 +-- .../Leaderboards/DurangoLeaderboardManager.h | 10 +-- .../Leaderboards/DurangoStatsDebugger.cpp | 28 ++++---- .../Leaderboards/DurangoStatsDebugger.h | 14 ++-- .../Durango/Network/DQRNetworkManager.cpp | 14 ++-- .../Durango/Network/DQRNetworkManager.h | 30 ++++----- .../DQRNetworkManager_FriendSessions.cpp | 2 +- .../Durango/Network/DQRNetworkPlayer.cpp | 4 +- .../Durango/Network/NetworkPlayerDurango.cpp | 2 +- .../Durango/Network/NetworkPlayerDurango.h | 2 +- .../Network/PlatformNetworkManagerDurango.cpp | 6 +- .../Network/PlatformNetworkManagerDurango.h | 6 +- .../Durango/Sentient/DurangoTelemetry.cpp | 4 +- .../Durango/Sentient/DurangoTelemetry.h | 4 +- Minecraft.Client/Platform/Linux/Linux_App.cpp | 2 +- .../Platform/Linux/Linux_Minecraft.cpp | 4 +- .../Platform/Orbis/4JLibs/inc/4J_Profile.h | 2 +- .../Platform/Orbis/4JLibs/inc/4J_Storage.h | 2 +- .../Leaderboards/OrbisLeaderboardManager.cpp | 4 +- Minecraft.Client/Platform/Orbis/Orbis_App.cpp | 10 +-- Minecraft.Client/Platform/Orbis/Orbis_App.h | 4 +- .../Platform/Orbis/Orbis_Minecraft.cpp | 8 +-- .../Platform/Orbis/Orbis_PlayerUID.cpp | 8 +-- .../Platform/PS3/4JLibs/inc/4J_Profile.h | 2 +- .../Leaderboards/PS3LeaderboardManager.cpp | 4 +- Minecraft.Client/Platform/PS3/PS3_App.cpp | 10 +-- Minecraft.Client/Platform/PS3/PS3_App.h | 2 +- .../Platform/PS3/PS3_Minecraft.cpp | 4 +- .../Platform/PS3/PS3_PlayerUID.cpp | 8 +-- .../ChunkUpdate/HugeMushroomTile_SPU.h | 4 +- .../PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/LeafTile_SPU.cpp | 2 +- .../SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp | 8 +-- .../SPU_Tasks/ChunkUpdate/TallGrass_SPU.cpp | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp | 6 +- .../PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h | 4 +- .../Platform/PSVita/4JLibs/inc/4J_Profile.h | 2 +- .../Platform/PSVita/4JLibs/inc/4J_Storage.h | 2 +- .../Leaderboards/PSVitaLeaderboardManager.cpp | 4 +- .../Platform/PSVita/PSVita_App.cpp | 8 +-- Minecraft.Client/Platform/PSVita/PSVita_App.h | 4 +- .../Platform/PSVita/PSVita_PlayerUID.cpp | 8 +-- .../Windows64/4JLibs/inc/4J_Profile.h | 2 +- .../Windows64/4JLibs/inc/4J_Storage.h | 2 +- .../Platform/Windows64/Windows64_App.cpp | 2 +- .../Platform/Xbox/4JLibs/inc/4J_Storage.h | 2 +- .../Platform/Xbox/Audio/SoundEngine.cpp | 14 ++-- .../Platform/Xbox/Audio/SoundEngine.h | 10 +-- .../Platform/Xbox/Font/XUI_Font.h | 6 +- .../Platform/Xbox/Font/XUI_FontRenderer.cpp | 4 +- .../Network/PlatformNetworkManagerXbox.cpp | 10 +-- .../Xbox/Network/PlatformNetworkManagerXbox.h | 4 +- .../Platform/Xbox/Social/SocialManager.cpp | 2 +- .../Platform/Xbox/Xbox_UIController.cpp | 2 +- .../Platform/Xbox/Xbox_UIController.h | 2 +- Minecraft.Client/Player/LocalPlayer.cpp | 2 +- Minecraft.Client/Player/LocalPlayer.h | 2 +- .../Player/MultiPlayerLocalPlayer.cpp | 2 +- .../Player/MultiPlayerLocalPlayer.h | 2 +- Minecraft.Client/Player/RemotePlayer.cpp | 2 +- Minecraft.Client/Player/RemotePlayer.h | 2 +- Minecraft.Client/Player/ServerPlayer.cpp | 8 +-- Minecraft.Client/Player/ServerPlayer.h | 4 +- Minecraft.Client/Player/User.cpp | 2 +- Minecraft.Client/Player/User.h | 8 +-- Minecraft.Client/Rendering/Cube.cpp | 2 +- Minecraft.Client/Rendering/Cube.h | 4 +- .../EntityRenderers/EntityRenderer.cpp | 6 +- .../EntityRenderers/EntityRenderer.h | 6 +- .../EntityRenderers/HumanoidMobRenderer.cpp | 2 +- .../EntityRenderers/ItemRenderer.cpp | 4 +- .../Rendering/EntityRenderers/ItemRenderer.h | 2 +- .../Rendering/EntityRenderers/MobRenderer.cpp | 4 +- .../Rendering/EntityRenderers/MobRenderer.h | 2 +- .../EntityRenderers/MobSpawnerRenderer.h | 2 +- .../EntityRenderers/PlayerRenderer.cpp | 6 +- .../EntityRenderers/PlayerRenderer.h | 2 +- .../EntityRenderers/ProgressRenderer.cpp | 6 +- .../EntityRenderers/ProgressRenderer.h | 6 +- .../EntityRenderers/SignRenderer.cpp | 2 +- .../EntityRenderers/SkullTileRenderer.cpp | 4 +- .../EntityRenderers/SkullTileRenderer.h | 2 +- .../EntityRenderers/TileEntityRenderer.cpp | 2 +- .../EntityRenderers/TileEntityRenderer.h | 4 +- Minecraft.Client/Rendering/LevelRenderer.cpp | 8 +-- Minecraft.Client/Rendering/LevelRenderer.h | 6 +- Minecraft.Client/Rendering/Models/Model.cpp | 4 +- Minecraft.Client/Rendering/Models/Model.h | 6 +- .../Rendering/Models/ModelPart.cpp | 6 +- Minecraft.Client/Rendering/Models/ModelPart.h | 8 +-- .../Rendering/Particles/Particle.cpp | 2 +- .../Rendering/Particles/Particle.h | 2 +- .../Rendering/Particles/ParticleEngine.cpp | 2 +- .../Rendering/Particles/ParticleEngine.h | 2 +- Minecraft.Client/Textures/BufferedImage.cpp | 22 +++---- Minecraft.Client/Textures/BufferedImage.h | 4 +- Minecraft.Client/Textures/HttpTexture.cpp | 2 +- Minecraft.Client/Textures/HttpTexture.h | 2 +- Minecraft.Client/Textures/MemTexture.cpp | 2 +- Minecraft.Client/Textures/MemTexture.h | 2 +- .../Textures/Packs/AbstractTexturePack.cpp | 32 +++++----- .../Textures/Packs/AbstractTexturePack.h | 40 ++++++------ .../Textures/Packs/DLCTexturePack.cpp | 36 +++++------ .../Textures/Packs/DLCTexturePack.h | 18 +++--- .../Textures/Packs/DefaultTexturePack.cpp | 10 +-- .../Textures/Packs/DefaultTexturePack.h | 6 +- .../Textures/Packs/FileTexturePack.cpp | 4 +- .../Textures/Packs/FileTexturePack.h | 4 +- .../Textures/Packs/FolderTexturePack.cpp | 12 ++-- .../Textures/Packs/FolderTexturePack.h | 8 +-- .../Textures/Packs/TexturePack.cpp | 8 +-- Minecraft.Client/Textures/Packs/TexturePack.h | 22 +++---- .../Textures/Packs/TexturePackRepository.cpp | 12 ++-- .../Textures/Packs/TexturePackRepository.h | 8 +-- .../Stitching/PreStitchedTextureMap.cpp | 54 ++++++++-------- .../Stitching/PreStitchedTextureMap.h | 18 +++--- .../Textures/Stitching/StitchSlot.cpp | 2 +- .../Textures/Stitching/StitchSlot.h | 2 +- .../Textures/Stitching/StitchedTexture.cpp | 14 ++-- .../Textures/Stitching/StitchedTexture.h | 10 +-- .../Textures/Stitching/Stitcher.cpp | 6 +- .../Textures/Stitching/Stitcher.h | 8 +-- .../Textures/Stitching/TextureMap.cpp | 16 ++--- .../Textures/Stitching/TextureMap.h | 16 ++--- Minecraft.Client/Textures/Texture.cpp | 16 ++--- Minecraft.Client/Textures/Texture.h | 18 +++--- Minecraft.Client/Textures/TextureHolder.cpp | 2 +- Minecraft.Client/Textures/TextureHolder.h | 2 +- Minecraft.Client/Textures/TextureManager.cpp | 26 ++++---- Minecraft.Client/Textures/TextureManager.h | 20 +++--- Minecraft.Client/Textures/Textures.cpp | 62 +++++++++--------- Minecraft.Client/Textures/Textures.h | 42 ++++++------ Minecraft.Client/UI/Button.cpp | 6 +- Minecraft.Client/UI/Button.h | 8 +-- Minecraft.Client/UI/EditBox.cpp | 8 +-- Minecraft.Client/UI/EditBox.h | 8 +-- Minecraft.Client/UI/Font.cpp | 48 +++++++------- Minecraft.Client/UI/Font.h | 30 ++++----- Minecraft.Client/UI/Gui.cpp | 18 +++--- Minecraft.Client/UI/Gui.h | 12 ++-- Minecraft.Client/UI/GuiComponent.cpp | 4 +- Minecraft.Client/UI/GuiComponent.h | 4 +- Minecraft.Client/UI/GuiMessage.cpp | 2 +- Minecraft.Client/UI/GuiMessage.h | 4 +- Minecraft.Client/UI/Screen.cpp | 4 +- Minecraft.Client/UI/Screen.h | 4 +- .../UI/Screens/AbstractContainerScreen.cpp | 2 +- .../UI/Screens/AchievementPopup.cpp | 6 +- .../UI/Screens/AchievementPopup.h | 4 +- .../UI/Screens/AchievementScreen.cpp | 6 +- Minecraft.Client/UI/Screens/ChatScreen.cpp | 6 +- Minecraft.Client/UI/Screens/ChatScreen.h | 4 +- Minecraft.Client/UI/Screens/ConfirmScreen.cpp | 4 +- Minecraft.Client/UI/Screens/ConfirmScreen.h | 12 ++-- Minecraft.Client/UI/Screens/ConnectScreen.cpp | 2 +- Minecraft.Client/UI/Screens/ConnectScreen.h | 2 +- Minecraft.Client/UI/Screens/ControlsScreen.h | 2 +- .../UI/Screens/CreateWorldScreen.cpp | 8 +-- .../UI/Screens/CreateWorldScreen.h | 4 +- .../UI/Screens/DisconnectedScreen.cpp | 2 +- .../UI/Screens/DisconnectedScreen.h | 4 +- Minecraft.Client/UI/Screens/ErrorScreen.cpp | 2 +- Minecraft.Client/UI/Screens/ErrorScreen.h | 4 +- .../UI/Screens/InBedChatScreen.cpp | 2 +- .../UI/Screens/JoinMultiplayerScreen.cpp | 14 ++-- .../UI/Screens/JoinMultiplayerScreen.h | 2 +- .../UI/Screens/NameEntryScreen.cpp | 6 +- Minecraft.Client/UI/Screens/NameEntryScreen.h | 8 +-- Minecraft.Client/UI/Screens/OptionsScreen.h | 2 +- .../UI/Screens/RenameWorldScreen.cpp | 4 +- .../UI/Screens/RenameWorldScreen.h | 4 +- .../UI/Screens/SelectWorldScreen.cpp | 24 +++---- .../UI/Screens/SelectWorldScreen.h | 10 +-- Minecraft.Client/UI/Screens/StatsScreen.cpp | 14 ++-- Minecraft.Client/UI/Screens/StatsScreen.h | 8 +-- .../UI/Screens/TextEditScreen.cpp | 6 +- Minecraft.Client/UI/Screens/TextEditScreen.h | 4 +- Minecraft.Client/UI/Screens/TitleScreen.cpp | 4 +- Minecraft.Client/UI/Screens/TitleScreen.h | 2 +- .../UI/Screens/VideoSettingsScreen.h | 2 +- Minecraft.Client/UI/SimpleIcon.cpp | 2 +- Minecraft.Client/UI/SimpleIcon.h | 2 +- Minecraft.Client/UI/SlideButton.cpp | 2 +- Minecraft.Client/UI/SlideButton.h | 2 +- Minecraft.Client/UI/SmallButton.cpp | 6 +- Minecraft.Client/UI/SmallButton.h | 6 +- Minecraft.Client/Utils/ArchiveFile.cpp | 12 ++-- Minecraft.Client/Utils/ArchiveFile.h | 12 ++-- Minecraft.Client/Utils/StringTable.cpp | 20 +++--- Minecraft.Client/Utils/StringTable.h | 8 +-- Minecraft.Client/Utils/WstringLookup.cpp | 14 ++-- Minecraft.Client/Utils/WstringLookup.h | 10 +-- Minecraft.World/AI/Navigation/Node.cpp | 2 +- Minecraft.World/AI/Navigation/Node.h | 2 +- Minecraft.World/Blocks/AnvilTile.cpp | 2 +- Minecraft.World/Blocks/AnvilTile.h | 2 +- Minecraft.World/Blocks/BrewingStandTile.cpp | 2 +- Minecraft.World/Blocks/BrewingStandTile.h | 2 +- Minecraft.World/Blocks/CauldronTile.cpp | 6 +- Minecraft.World/Blocks/CauldronTile.h | 6 +- Minecraft.World/Blocks/CocoaTile.cpp | 2 +- Minecraft.World/Blocks/CocoaTile.h | 2 +- Minecraft.World/Blocks/DoorTile.cpp | 2 +- Minecraft.World/Blocks/DoorTile.h | 2 +- .../Blocks/EnchantmentTableTile.cpp | 6 +- Minecraft.World/Blocks/EnchantmentTableTile.h | 6 +- Minecraft.World/Blocks/FenceTile.cpp | 2 +- Minecraft.World/Blocks/FenceTile.h | 4 +- Minecraft.World/Blocks/FireTile.cpp | 4 +- Minecraft.World/Blocks/FireTile.h | 4 +- .../Blocks/HalfTransparentTile.cpp | 2 +- Minecraft.World/Blocks/HalfTransparentTile.h | 4 +- Minecraft.World/Blocks/HugeMushroomTile.cpp | 6 +- Minecraft.World/Blocks/HugeMushroomTile.h | 6 +- Minecraft.World/Blocks/LeafTile.cpp | 2 +- Minecraft.World/Blocks/LeafTile.h | 2 +- Minecraft.World/Blocks/LiquidTile.cpp | 10 +-- Minecraft.World/Blocks/LiquidTile.h | 10 +-- Minecraft.World/Blocks/MelonTile.cpp | 4 +- Minecraft.World/Blocks/MelonTile.h | 4 +- Minecraft.World/Blocks/MushroomPlantTile.cpp | 2 +- Minecraft.World/Blocks/MushroomPlantTile.h | 4 +- Minecraft.World/Blocks/NetherStalkTile.cpp | 2 +- Minecraft.World/Blocks/NetherStalkTile.h | 2 +- Minecraft.World/Blocks/PistonBaseTile.cpp | 12 ++-- Minecraft.World/Blocks/PistonBaseTile.h | 12 ++-- Minecraft.World/Blocks/PressurePlateTile.cpp | 2 +- Minecraft.World/Blocks/PressurePlateTile.h | 4 +- Minecraft.World/Blocks/PumpkinTile.cpp | 4 +- Minecraft.World/Blocks/PumpkinTile.h | 4 +- Minecraft.World/Blocks/QuartzBlockTile.cpp | 10 +-- Minecraft.World/Blocks/QuartzBlockTile.h | 10 +-- Minecraft.World/Blocks/RedStoneDustTile.cpp | 10 +-- Minecraft.World/Blocks/RedStoneDustTile.h | 10 +-- Minecraft.World/Blocks/SandStoneTile.cpp | 6 +- Minecraft.World/Blocks/SandStoneTile.h | 6 +- Minecraft.World/Blocks/SaplingPlantTile.cpp | 2 +- Minecraft.World/Blocks/SaplingPlantTile.h | 2 +- Minecraft.World/Blocks/SkullTile.cpp | 2 +- Minecraft.World/Blocks/SkullTile.h | 2 +- .../Blocks/SmoothStoneBrickTile.cpp | 2 +- Minecraft.World/Blocks/SmoothStoneBrickTile.h | 2 +- Minecraft.World/Blocks/StemTile.cpp | 2 +- Minecraft.World/Blocks/StemTile.h | 2 +- Minecraft.World/Blocks/TallGrassPlantTile.cpp | 2 +- Minecraft.World/Blocks/TallGrassPlantTile.h | 2 +- .../Blocks/TheEndPortalFrameTile.cpp | 2 +- .../Blocks/TheEndPortalFrameTile.h | 2 +- Minecraft.World/Blocks/ThinFenceTile.cpp | 2 +- Minecraft.World/Blocks/ThinFenceTile.h | 6 +- Minecraft.World/Blocks/Tile.cpp | 12 ++-- Minecraft.World/Blocks/Tile.h | 20 +++--- .../TileEntities/MobSpawnerTileEntity.cpp | 4 +- .../TileEntities/MobSpawnerTileEntity.h | 6 +- .../Blocks/TileEntities/PotionBrewing.cpp | 64 +++++++++---------- .../Blocks/TileEntities/PotionBrewing.h | 34 +++++----- .../Blocks/TileEntities/SignTileEntity.cpp | 4 +- .../Blocks/TileEntities/SignTileEntity.h | 8 +-- .../Blocks/TileEntities/SkullTileEntity.cpp | 4 +- .../Blocks/TileEntities/SkullTileEntity.h | 6 +- .../Blocks/TileEntities/TileEntity.cpp | 6 +- .../Blocks/TileEntities/TileEntity.h | 6 +- Minecraft.World/Blocks/TreeTile.cpp | 2 +- Minecraft.World/Blocks/TreeTile.h | 2 +- Minecraft.World/Blocks/WoodTile.cpp | 2 +- Minecraft.World/Blocks/WoodTile.h | 2 +- Minecraft.World/Commands/AdminLogCommand.h | 2 +- Minecraft.World/Commands/Command.cpp | 4 +- Minecraft.World/Commands/Command.h | 4 +- Minecraft.World/Commands/CommandSender.h | 2 +- Minecraft.World/Commands/GameModeCommand.cpp | 2 +- Minecraft.World/Commands/GameModeCommand.h | 2 +- Minecraft.World/Commands/GiveItemCommand.cpp | 4 +- Minecraft.World/Commands/GiveItemCommand.h | 2 +- Minecraft.World/Containers/Inventory.cpp | 2 +- Minecraft.World/Containers/RepairMenu.cpp | 2 +- Minecraft.World/Containers/RepairMenu.h | 4 +- Minecraft.World/Enchantments/Enchantment.cpp | 4 +- Minecraft.World/Enchantments/Enchantment.h | 4 +- Minecraft.World/Entities/BossMobPart.cpp | 2 +- Minecraft.World/Entities/BossMobPart.h | 4 +- Minecraft.World/Entities/Entity.cpp | 10 +-- Minecraft.World/Entities/Entity.h | 10 +-- .../Entities/EntityDamageSource.cpp | 6 +- Minecraft.World/Entities/EntityDamageSource.h | 4 +- .../Entities/IndirectEntityDamageSource.cpp | 6 +- .../Entities/IndirectEntityDamageSource.h | 4 +- Minecraft.World/Entities/ItemEntity.cpp | 6 +- Minecraft.World/Entities/ItemEntity.h | 8 +-- Minecraft.World/Entities/Mob.h | 8 +-- Minecraft.World/Entities/MobEffect.cpp | 2 +- Minecraft.World/Entities/MobEffect.h | 2 +- .../Entities/MobEffectInstance.cpp | 6 +- Minecraft.World/Entities/MobEffectInstance.h | 2 +- Minecraft.World/Entities/Mobs/Boat.cpp | 2 +- Minecraft.World/Entities/Mobs/Boat.h | 2 +- Minecraft.World/Entities/Mobs/Ocelot.cpp | 2 +- Minecraft.World/Entities/Mobs/Ocelot.h | 2 +- Minecraft.World/Entities/Mobs/Painting.cpp | 4 +- Minecraft.World/Entities/Mobs/Painting.h | 6 +- Minecraft.World/Entities/Mobs/Villager.h | 2 +- Minecraft.World/Entities/Mobs/Wolf.cpp | 2 +- Minecraft.World/Entities/Mobs/Wolf.h | 4 +- Minecraft.World/Entities/SyncedEntityData.cpp | 12 ++-- Minecraft.World/Entities/SyncedEntityData.h | 14 ++-- Minecraft.World/Entities/TamableAnimal.cpp | 8 +-- Minecraft.World/Entities/TamableAnimal.h | 4 +- Minecraft.World/IO/Files/ConsoleSaveFile.h | 8 +-- .../IO/Files/ConsoleSaveFileConverter.cpp | 8 +-- .../IO/Files/ConsoleSaveFileOriginal.cpp | 22 +++---- .../IO/Files/ConsoleSaveFileOriginal.h | 12 ++-- .../IO/Files/ConsoleSaveFileSplit.cpp | 36 +++++------ .../IO/Files/ConsoleSaveFileSplit.h | 18 +++--- Minecraft.World/IO/Files/ConsoleSavePath.h | 8 +-- Minecraft.World/IO/Files/File.cpp | 30 ++++----- Minecraft.World/IO/Files/File.h | 16 ++--- Minecraft.World/IO/Files/FileHeader.cpp | 16 ++--- Minecraft.World/IO/Files/FileHeader.h | 10 +-- Minecraft.World/IO/Files/FilenameFilter.h | 2 +- Minecraft.World/IO/NBT/ByteArrayTag.h | 8 +-- Minecraft.World/IO/NBT/ByteTag.h | 8 +-- Minecraft.World/IO/NBT/CompoundTag.h | 24 +++---- Minecraft.World/IO/NBT/DoubleTag.h | 8 +-- Minecraft.World/IO/NBT/EndTag.h | 4 +- Minecraft.World/IO/NBT/FloatTag.h | 8 +-- Minecraft.World/IO/NBT/IntArrayTag.h | 8 +-- Minecraft.World/IO/NBT/IntTag.h | 8 +-- Minecraft.World/IO/NBT/ListTag.h | 6 +- Minecraft.World/IO/NBT/LongTag.h | 8 +-- Minecraft.World/IO/NBT/ShortTag.h | 8 +-- Minecraft.World/IO/NBT/StringTag.h | 8 +-- Minecraft.World/IO/NBT/Tag.cpp | 12 ++-- Minecraft.World/IO/NBT/Tag.h | 12 ++-- Minecraft.World/IO/Streams/BufferedReader.cpp | 4 +- Minecraft.World/IO/Streams/BufferedReader.h | 2 +- Minecraft.World/IO/Streams/DataInput.h | 2 +- .../IO/Streams/DataInputStream.cpp | 4 +- Minecraft.World/IO/Streams/DataInputStream.h | 2 +- Minecraft.World/IO/Streams/DataOutput.h | 4 +- .../IO/Streams/DataOutputStream.cpp | 4 +- Minecraft.World/IO/Streams/DataOutputStream.h | 4 +- Minecraft.World/IO/Streams/InputStream.cpp | 2 +- Minecraft.World/IO/Streams/InputStream.h | 2 +- Minecraft.World/Items/ArmorItem.cpp | 4 +- Minecraft.World/Items/ArmorItem.h | 4 +- Minecraft.World/Items/BowItem.cpp | 2 +- Minecraft.World/Items/BowItem.h | 2 +- Minecraft.World/Items/ClockItem.cpp | 4 +- Minecraft.World/Items/ClockItem.h | 2 +- Minecraft.World/Items/CompassItem.cpp | 4 +- Minecraft.World/Items/CompassItem.h | 2 +- Minecraft.World/Items/DyePowderItem.cpp | 2 +- Minecraft.World/Items/DyePowderItem.h | 2 +- Minecraft.World/Items/EnchantedBookItem.cpp | 6 +- Minecraft.World/Items/EnchantedBookItem.h | 4 +- Minecraft.World/Items/FishingRodItem.cpp | 2 +- Minecraft.World/Items/FishingRodItem.h | 2 +- Minecraft.World/Items/Item.cpp | 14 ++-- Minecraft.World/Items/Item.h | 16 ++--- Minecraft.World/Items/ItemInstance.cpp | 24 +++---- Minecraft.World/Items/ItemInstance.h | 12 ++-- Minecraft.World/Items/MapItem.cpp | 10 +-- Minecraft.World/Items/MonsterPlacerItem.cpp | 4 +- Minecraft.World/Items/MonsterPlacerItem.h | 2 +- Minecraft.World/Items/PotionItem.cpp | 20 +++--- Minecraft.World/Items/PotionItem.h | 12 ++-- Minecraft.World/Items/RecordingItem.cpp | 4 +- Minecraft.World/Items/RecordingItem.h | 4 +- Minecraft.World/Items/TileItems/SkullItem.cpp | 6 +- Minecraft.World/Items/TileItems/SkullItem.h | 4 +- Minecraft.World/Items/TileItems/TileItem.cpp | 2 +- Minecraft.World/Level/ChunkPos.cpp | 2 +- Minecraft.World/Level/ChunkPos.h | 2 +- Minecraft.World/Level/ChunkSource.h | 4 +- Minecraft.World/Level/CustomLevelSource.cpp | 8 +-- Minecraft.World/Level/CustomLevelSource.h | 4 +- Minecraft.World/Level/DerivedLevelData.cpp | 4 +- Minecraft.World/Level/DerivedLevelData.h | 4 +- Minecraft.World/Level/Events/LevelListener.h | 6 +- Minecraft.World/Level/Level.cpp | 34 +++++----- Minecraft.World/Level/Level.h | 30 ++++----- .../Level/LevelConflictException.cpp | 2 +- .../Level/LevelConflictException.h | 2 +- Minecraft.World/Level/LevelData.cpp | 8 +-- Minecraft.World/Level/LevelData.h | 8 +-- Minecraft.World/Level/RandomLevelSource.cpp | 4 +- Minecraft.World/Level/RandomLevelSource.h | 4 +- .../Level/Storage/DirectoryLevelStorage.cpp | 32 +++++----- .../Level/Storage/DirectoryLevelStorage.h | 14 ++-- .../Storage/DirectoryLevelStorageSource.cpp | 24 +++---- .../Storage/DirectoryLevelStorageSource.h | 18 +++--- Minecraft.World/Level/Storage/EntityIO.cpp | 30 ++++----- Minecraft.World/Level/Storage/EntityIO.h | 20 +++--- .../Level/Storage/LevelSettings.cpp | 6 +- Minecraft.World/Level/Storage/LevelSettings.h | 8 +-- .../Level/Storage/LevelStorage.cpp | 4 +- Minecraft.World/Level/Storage/LevelStorage.h | 8 +-- .../Storage/LevelStorageProfilerDecorator.cpp | 4 +- .../Storage/LevelStorageProfilerDecorator.h | 4 +- .../Level/Storage/LevelStorageSource.h | 18 +++--- .../Level/Storage/LevelSummary.cpp | 6 +- Minecraft.World/Level/Storage/LevelSummary.h | 10 +-- Minecraft.World/Level/Storage/LevelType.cpp | 12 ++-- Minecraft.World/Level/Storage/LevelType.h | 14 ++-- .../Level/Storage/MapItemSavedData.cpp | 2 +- .../Level/Storage/MapItemSavedData.h | 2 +- .../Level/Storage/McRegionChunkStorage.cpp | 6 +- .../Level/Storage/McRegionChunkStorage.h | 4 +- .../Level/Storage/McRegionLevelStorage.cpp | 2 +- .../Level/Storage/McRegionLevelStorage.h | 2 +- .../Storage/McRegionLevelStorageSource.cpp | 16 ++--- .../Storage/McRegionLevelStorageSource.h | 12 ++-- .../Level/Storage/MemoryLevelStorage.cpp | 6 +- .../Level/Storage/MemoryLevelStorage.h | 4 +- .../Storage/MemoryLevelStorageSource.cpp | 18 +++--- .../Level/Storage/MemoryLevelStorageSource.h | 18 +++--- .../Level/Storage/MockedLevelStorage.cpp | 6 +- .../Level/Storage/MockedLevelStorage.h | 4 +- .../Level/Storage/OldChunkStorage.cpp | 6 +- .../Level/Storage/ReadOnlyChunkCache.cpp | 4 +- .../Level/Storage/ReadOnlyChunkCache.h | 4 +- .../Level/Storage/RegionFileCache.cpp | 14 ++-- .../Level/Storage/RegionFileCache.h | 16 ++--- Minecraft.World/Level/Storage/SavedData.cpp | 2 +- Minecraft.World/Level/Storage/SavedData.h | 4 +- .../Level/Storage/SavedDataStorage.cpp | 14 ++-- .../Level/Storage/SavedDataStorage.h | 10 +-- .../Level/Storage/ZonedChunkStorage.cpp | 6 +- Minecraft.World/Network/Connection.cpp | 6 +- Minecraft.World/Network/Connection.h | 2 +- .../Network/Packets/AddPaintingPacket.h | 2 +- .../Network/Packets/AddPlayerPacket.h | 2 +- .../Network/Packets/ChatPacket.cpp | 2 +- Minecraft.World/Network/Packets/ChatPacket.h | 4 +- .../Network/Packets/CustomPayloadPacket.cpp | 18 +++--- .../Network/Packets/CustomPayloadPacket.h | 20 +++--- .../Network/Packets/LoginPacket.cpp | 6 +- Minecraft.World/Network/Packets/LoginPacket.h | 6 +- Minecraft.World/Network/Packets/Packet.cpp | 18 +++--- Minecraft.World/Network/Packets/Packet.h | 6 +- .../Network/Packets/PlayerAbilitiesPacket.cpp | 2 +- .../Network/Packets/PlayerAbilitiesPacket.h | 2 +- .../Network/Packets/PlayerInfoPacket.h | 4 +- .../Network/Packets/PreLoginPacket.cpp | 4 +- .../Network/Packets/PreLoginPacket.h | 6 +- .../Network/Packets/RespawnPacket.cpp | 2 +- .../Network/Packets/SignUpdatePacket.cpp | 2 +- .../Network/Packets/SignUpdatePacket.h | 4 +- .../TextureAndGeometryChangePacket.cpp | 4 +- .../Packets/TextureAndGeometryChangePacket.h | 4 +- .../Packets/TextureAndGeometryPacket.cpp | 12 ++-- .../Packets/TextureAndGeometryPacket.h | 8 +-- .../Network/Packets/TextureChangePacket.cpp | 2 +- .../Network/Packets/TextureChangePacket.h | 4 +- .../Network/Packets/TexturePacket.cpp | 2 +- .../Network/Packets/TexturePacket.h | 4 +- .../Packets/UpdateGameRuleProgressPacket.cpp | 2 +- .../Packets/UpdateGameRuleProgressPacket.h | 4 +- Minecraft.World/Player/Player.cpp | 30 ++++----- Minecraft.World/Player/Player.h | 26 ++++---- Minecraft.World/Recipes/ArmorRecipes.cpp | 2 +- Minecraft.World/Recipes/ArmorRecipes.h | 2 +- Minecraft.World/Recipes/Recipes.cpp | 10 +-- Minecraft.World/Recipes/ToolRecipes.cpp | 2 +- Minecraft.World/Recipes/ToolRecipes.h | 2 +- Minecraft.World/Recipes/WeaponRecipes.cpp | 2 +- Minecraft.World/Recipes/WeaponRecipes.h | 2 +- Minecraft.World/Stats/Achievement.cpp | 14 ++-- Minecraft.World/Stats/Achievement.h | 10 +-- Minecraft.World/Stats/DurangoStats.cpp | 18 +++--- Minecraft.World/Stats/DurangoStats.h | 16 ++--- Minecraft.World/Stats/GeneralStat.cpp | 4 +- Minecraft.World/Stats/GeneralStat.h | 4 +- Minecraft.World/Stats/ItemStat.cpp | 2 +- Minecraft.World/Stats/ItemStat.h | 2 +- Minecraft.World/Stats/Stat.cpp | 14 ++-- Minecraft.World/Stats/Stat.h | 16 ++--- Minecraft.World/Stats/StatFormatter.h | 2 +- Minecraft.World/Util/AABB.cpp | 2 +- Minecraft.World/Util/AABB.h | 2 +- Minecraft.World/Util/BasicTypeContainers.cpp | 2 +- Minecraft.World/Util/BasicTypeContainers.h | 2 +- Minecraft.World/Util/BoundingBox.cpp | 2 +- Minecraft.World/Util/BoundingBox.h | 2 +- Minecraft.World/Util/DamageSource.cpp | 4 +- Minecraft.World/Util/DamageSource.h | 6 +- Minecraft.World/Util/DescFormatter.h | 2 +- Minecraft.World/Util/Exceptions.h | 10 +-- Minecraft.World/Util/FlippedIcon.cpp | 2 +- Minecraft.World/Util/FlippedIcon.h | 2 +- Minecraft.World/Util/Hasher.cpp | 6 +- Minecraft.World/Util/Hasher.h | 6 +- Minecraft.World/Util/I18n.cpp | 4 +- Minecraft.World/Util/I18n.h | 4 +- Minecraft.World/Util/Icon.h | 2 +- Minecraft.World/Util/IconRegister.h | 2 +- Minecraft.World/Util/Language.cpp | 10 +-- Minecraft.World/Util/Language.h | 8 +-- Minecraft.World/Util/NumberFormatters.h | 12 ++-- Minecraft.World/Util/PerformanceTimer.cpp | 2 +- Minecraft.World/Util/PerformanceTimer.h | 2 +- Minecraft.World/Util/ProgressListener.h | 2 +- Minecraft.World/Util/Rarity.cpp | 2 +- Minecraft.World/Util/Rarity.h | 4 +- Minecraft.World/Util/SharedConstants.cpp | 12 ++-- Minecraft.World/Util/SharedConstants.h | 6 +- Minecraft.World/Util/StringHelpers.cpp | 44 ++++++------- Minecraft.World/Util/StringHelpers.h | 20 +++--- Minecraft.World/Util/Vec3.cpp | 4 +- Minecraft.World/Util/Vec3.h | 2 +- Minecraft.World/WorldGen/Biomes/Biome.cpp | 2 +- Minecraft.World/WorldGen/Biomes/Biome.h | 4 +- .../WorldGen/Features/LargeFeature.cpp | 2 +- .../WorldGen/Features/LargeFeature.h | 2 +- .../WorldGen/Features/MonsterRoomFeature.cpp | 12 ++-- .../WorldGen/Features/MonsterRoomFeature.h | 2 +- .../WorldGen/Layers/BiomeOverrideLayer.cpp | 2 +- .../WorldGen/Sources/FlatLevelSource.cpp | 4 +- .../WorldGen/Sources/FlatLevelSource.h | 4 +- .../WorldGen/Sources/HellFlatLevelSource.cpp | 4 +- .../WorldGen/Sources/HellFlatLevelSource.h | 4 +- .../Sources/HellRandomLevelSource.cpp | 4 +- .../WorldGen/Sources/HellRandomLevelSource.h | 4 +- .../Sources/TheEndLevelRandomLevelSource.cpp | 4 +- .../Sources/TheEndLevelRandomLevelSource.h | 4 +- .../WorldGen/Structures/Village.cpp | 18 +++--- Minecraft.World/WorldGen/Structures/Village.h | 12 ++-- .../WorldGen/Structures/Villages.cpp | 4 +- .../WorldGen/Structures/Villages.h | 4 +- 581 files changed, 2156 insertions(+), 2154 deletions(-) diff --git a/.gitignore b/.gitignore index 319dee2dc..451c76e8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/ + # ----- Build output directories ----- build/ builddir/ diff --git a/4J.Profile/4J_Profile.cpp b/4J.Profile/4J_Profile.cpp index 3776dec6d..33b88d143 100644 --- a/4J.Profile/4J_Profile.cpp +++ b/4J.Profile/4J_Profile.cpp @@ -51,7 +51,7 @@ void C_4JProfile::SetPrimaryPad(int iPad) {} static char s_gamertag[64] = "Player"; char* C_4JProfile::GetGamertag(int iPad) { return s_gamertag; } -wstring C_4JProfile::GetDisplayName(int iPad) { return L"Player"; } +std::wstring C_4JProfile::GetDisplayName(int iPad) { return L"Player"; } bool C_4JProfile::IsFullVersion() { return true; } void C_4JProfile::SetSignInChangeCallback(void(*Func)(LPVOID, bool, unsigned int), LPVOID lpParam) {} void C_4JProfile::SetNotificationsCallback(void(*Func)(LPVOID, DWORD, unsigned int), LPVOID lpParam) {} diff --git a/4J.Profile/4J_Profile.h b/4J.Profile/4J_Profile.h index f1bd85bbe..4e6fc606c 100644 --- a/4J.Profile/4J_Profile.h +++ b/4J.Profile/4J_Profile.h @@ -76,7 +76,7 @@ public: int GetPrimaryPad(); void SetPrimaryPad(int iPad); char* GetGamertag(int iPad); - wstring GetDisplayName(int iPad); + std::wstring GetDisplayName(int iPad); bool IsFullVersion(); void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam); void SetNotificationsCallback(void ( *Func)(LPVOID, DWORD, unsigned int),LPVOID lpParam); diff --git a/4J.Storage/4J_Storage.h b/4J.Storage/4J_Storage.h index 7fa3f0745..aa1d74522 100644 --- a/4J.Storage/4J_Storage.h +++ b/4J.Storage/4J_Storage.h @@ -322,7 +322,7 @@ public: 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); - // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); + // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const std::wstring &Filename); // unsigned int CRC(unsigned char *buf, int len); // enum eXBLWS diff --git a/Minecraft.Client/Build/Extrax64Stubs.cpp b/Minecraft.Client/Build/Extrax64Stubs.cpp index a4626cb7b..0d7476e9f 100644 --- a/Minecraft.Client/Build/Extrax64Stubs.cpp +++ b/Minecraft.Client/Build/Extrax64Stubs.cpp @@ -500,7 +500,7 @@ void SetFakeGamertag(char *name){ strcpy_s(fakeGamerTag, name); } char* C_4JProfile::GetGamertag(int iPad){ return fakeGamerTag; } #else char* C_4JProfile::GetGamertag(int iPad){ return "PlayerName"; } -wstring C_4JProfile::GetDisplayName(int iPad){ return L"PlayerName"; } +std::wstring C_4JProfile::GetDisplayName(int iPad){ return L"PlayerName"; } #endif bool C_4JProfile::IsFullVersion() { return s_bProfileIsFullVersion; } void C_4JProfile::SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam) {} diff --git a/Minecraft.Client/Build/stubs.h b/Minecraft.Client/Build/stubs.h index dcb411079..56756ea6c 100644 --- a/Minecraft.Client/Build/stubs.h +++ b/Minecraft.Client/Build/stubs.h @@ -229,7 +229,7 @@ class ZipFile public: ZipFile(File *file) {} InputStream *getInputStream(ZipEntry *entry) { return NULL; } - ZipEntry *getEntry(const wstring& name) {return NULL;} + ZipEntry *getEntry(const std::wstring& name) {return NULL;} void close() {} }; @@ -245,7 +245,7 @@ public: static void create() {} static void destroy() {} static bool isKeyDown(int) {return false;} - static wstring getKeyName(int) { return L"KEYNAME"; } + static std::wstring getKeyName(int) { return L"KEYNAME"; } static void enableRepeatEvents(bool) {} static const int KEY_A = 0; static const int KEY_B = 1; diff --git a/Minecraft.Client/ClientConstants.cpp b/Minecraft.Client/ClientConstants.cpp index 844d94050..50ba494f7 100644 --- a/Minecraft.Client/ClientConstants.cpp +++ b/Minecraft.Client/ClientConstants.cpp @@ -1,4 +1,4 @@ #include "Build/stdafx.h" #include "ClientConstants.h" -const wstring ClientConstants::VERSION_STRING = wstring(L"Minecraft Xbox ") + VER_FILEVERSION_STR_W;//+ SharedConstants::VERSION_STRING; \ No newline at end of file +const std::wstring ClientConstants::VERSION_STRING = std::wstring(L"Minecraft Xbox ") + VER_FILEVERSION_STR_W;//+ SharedConstants::VERSION_STRING; \ No newline at end of file diff --git a/Minecraft.Client/ClientConstants.h b/Minecraft.Client/ClientConstants.h index 850eb05e6..62f4e8883 100644 --- a/Minecraft.Client/ClientConstants.h +++ b/Minecraft.Client/ClientConstants.h @@ -12,7 +12,7 @@ class ClientConstants // INTERNAL DEVELOPMENT SETTINGS public: - static const wstring VERSION_STRING; + static const std::wstring VERSION_STRING; static const bool DEADMAU5_CAMERA_CHEATS = false; static const bool IS_DEMO_VERSION = false; diff --git a/Minecraft.Client/GameState/DemoMode.cpp b/Minecraft.Client/GameState/DemoMode.cpp index 390885f6f..d001377e5 100644 --- a/Minecraft.Client/GameState/DemoMode.cpp +++ b/Minecraft.Client/GameState/DemoMode.cpp @@ -32,7 +32,7 @@ void DemoMode::tick() else if (day == 1) { Options *options = minecraft->options; - wstring message; + std::wstring message; if (time == 100) { minecraft.gui.addMessage("Seed: " + minecraft.level.getSeed()); diff --git a/Minecraft.Client/GameState/Options.cpp b/Minecraft.Client/GameState/Options.cpp index a3e58311d..e59ce7406 100644 --- a/Minecraft.Client/GameState/Options.cpp +++ b/Minecraft.Client/GameState/Options.cpp @@ -60,7 +60,7 @@ const Options::Option *Options::Option::getItem(int id) return &options[id]; } -Options::Option::Option(const wstring& captionId, bool hasProgress, bool isBoolean) : _isProgress(hasProgress), _isBoolean(isBoolean), captionId(captionId) +Options::Option::Option(const std::wstring& captionId, bool hasProgress, bool isBoolean) : _isProgress(hasProgress), _isBoolean(isBoolean), captionId(captionId) { } @@ -79,29 +79,29 @@ int Options::Option::getId() const return (int)(this-options); } -wstring Options::Option::getCaptionId() const +std::wstring Options::Option::getCaptionId() const { return captionId; } -const wstring Options::RENDER_DISTANCE_NAMES[] = +const std::wstring Options::RENDER_DISTANCE_NAMES[] = { L"options.renderDistance.far", L"options.renderDistance.normal", L"options.renderDistance.short", L"options.renderDistance.tiny" }; -const wstring Options::DIFFICULTY_NAMES[] = +const std::wstring Options::DIFFICULTY_NAMES[] = { L"options.difficulty.peaceful", L"options.difficulty.easy", L"options.difficulty.normal", L"options.difficulty.hard" }; -const wstring Options::GUI_SCALE[] = +const std::wstring Options::GUI_SCALE[] = { L"options.guiScale.auto", L"options.guiScale.small", L"options.guiScale.normal", L"options.guiScale.large" }; -const wstring Options::FRAMERATE_LIMITS[] = +const std::wstring Options::FRAMERATE_LIMITS[] = { L"performance.max", L"performance.balanced", L"performance.powersaver" }; -const wstring Options::PARTICLES[] = { +const std::wstring Options::PARTICLES[] = { L"options.particles.all", L"options.particles.decreased", L"options.particles.minimal" }; @@ -184,13 +184,13 @@ Options::Options() init(); } -wstring Options::getKeyDescription(int i) +std::wstring Options::getKeyDescription(int i) { Language *language = Language::getInstance(); return language->getElement(keyMappings[i]->name); } -wstring Options::getKeyMessage(int i) +std::wstring Options::getKeyMessage(int i) { int key = keyMappings[i]->key; if (key < 0) { @@ -307,12 +307,12 @@ bool Options::getBooleanValue(const Options::Option *item) return false; } -wstring Options::getMessage(const Options::Option *item) +std::wstring Options::getMessage(const Options::Option *item) { - // 4J TODO, should these wstrings append rather than add? + // 4J TODO, should these std::wstrings append rather than add? Language *language = Language::getInstance(); - wstring caption = language->getElement(item->getCaptionId()) + L": "; + std::wstring caption = language->getElement(item->getCaptionId()) + L": "; if (item->isProgress()) { @@ -411,14 +411,14 @@ void Options::load() // 4J - was new BufferedReader(new FileReader(optionsFile)); BufferedReader *br = new BufferedReader(new InputStreamReader( new FileInputStream( optionsFile ) ) ); - wstring line = L""; + std::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? { // 4J - removed try/catch // try { - wstring cmds[2]; + std::wstring cmds[2]; int splitpos = (int)line.find(L":"); - if( splitpos == wstring::npos ) + if( splitpos == std::wstring::npos ) { cmds[0] = line; cmds[1] = L""; @@ -469,7 +469,7 @@ void Options::load() } -float Options::readFloat(wstring string) +float Options::readFloat(std::wstring string) { if (string == L"true") return 1; if (string == L"false") return 0; @@ -488,20 +488,20 @@ void Options::save() dos.writeChars(L"music:" + _toString(music) + L"\n"); dos.writeChars(L"sound:" + _toString(sound) + L"\n"); - dos.writeChars(L"invertYMouse:" + wstring(invertYMouse ? L"true" : L"false") + L"\n"); + dos.writeChars(L"invertYMouse:" + std::wstring(invertYMouse ? L"true" : L"false") + L"\n"); dos.writeChars(L"mouseSensitivity:" + _toString(sensitivity)); dos.writeChars(L"fov:" + _toString(fov)); dos.writeChars(L"gamma:" + _toString(gamma)); dos.writeChars(L"viewDistance:" + _toString(viewDistance)); dos.writeChars(L"guiScale:" + _toString(guiScale)); dos.writeChars(L"particles:" + _toString(particles)); - dos.writeChars(L"bobView:" + wstring(bobView ? L"true" : L"false")); - dos.writeChars(L"anaglyph3d:" + wstring(anaglyph3d ? L"true" : L"false")); - dos.writeChars(L"advancedOpengl:" + wstring(advancedOpengl ? L"true" : L"false")); + dos.writeChars(L"bobView:" + std::wstring(bobView ? L"true" : L"false")); + dos.writeChars(L"anaglyph3d:" + std::wstring(anaglyph3d ? L"true" : L"false")); + dos.writeChars(L"advancedOpengl:" + std::wstring(advancedOpengl ? L"true" : L"false")); dos.writeChars(L"fpsLimit:" + _toString(framerateLimit)); dos.writeChars(L"difficulty:" + _toString(difficulty)); - dos.writeChars(L"fancyGraphics:" + wstring(fancyGraphics ? L"true" : L"false")); - dos.writeChars(L"ao:" + wstring(ambientOcclusion ? L"true" : L"false")); + dos.writeChars(L"fancyGraphics:" + std::wstring(fancyGraphics ? L"true" : L"false")); + dos.writeChars(L"ao:" + std::wstring(ambientOcclusion ? L"true" : L"false")); dos.writeChars(L"clouds:" + _toString(renderClouds)); dos.writeChars(L"skin:" + skin); dos.writeChars(L"lastServer:" + lastMpIp); diff --git a/Minecraft.Client/GameState/Options.h b/Minecraft.Client/GameState/Options.h index 8dfe15ed5..56e4a82bc 100644 --- a/Minecraft.Client/GameState/Options.h +++ b/Minecraft.Client/GameState/Options.h @@ -37,24 +37,24 @@ public: private: const bool _isProgress; const bool _isBoolean; - const wstring captionId; + const std::wstring captionId; public: static const Option *getItem(int id); - Option(const wstring& captionId, bool hasProgress, bool isBoolean); + Option(const std::wstring& captionId, bool hasProgress, bool isBoolean); bool isProgress() const; bool isBoolean() const; int getId() const; - wstring getCaptionId() const; + std::wstring getCaptionId() const; }; private: - static const wstring RENDER_DISTANCE_NAMES[]; - static const wstring DIFFICULTY_NAMES[]; - static const wstring GUI_SCALE[]; - static const wstring FRAMERATE_LIMITS[]; - static const wstring PARTICLES[]; + static const std::wstring RENDER_DISTANCE_NAMES[]; + static const std::wstring DIFFICULTY_NAMES[]; + static const std::wstring GUI_SCALE[]; + static const std::wstring FRAMERATE_LIMITS[]; + static const std::wstring PARTICLES[]; public: float music; @@ -69,7 +69,7 @@ public: bool fancyGraphics; bool ambientOcclusion; bool renderClouds; - wstring skin; + std::wstring skin; KeyMapping *keyUp; KeyMapping *keyLeft; @@ -99,7 +99,7 @@ public: bool hideGui; bool thirdPersonView; bool renderDebug; - wstring lastMpIp; + std::wstring lastMpIp; bool isFlying; bool smoothCamera; @@ -114,17 +114,17 @@ public: void init(); // 4J added Options(Minecraft *minecraft, File workingDirectory); Options(); - wstring getKeyDescription(int i); - wstring getKeyMessage(int i); + std::wstring getKeyDescription(int i); + std::wstring getKeyMessage(int i); void setKey(int i, int key); void set(const Options::Option *item, float value); void toggle(const Options::Option *option, int dir); float getProgressValue(const Options::Option *item); bool getBooleanValue(const Options::Option *item); - wstring getMessage(const Options::Option *item); + std::wstring getMessage(const Options::Option *item); void load(); private: - float readFloat(wstring string); + float readFloat(std::wstring string); public: void save(); diff --git a/Minecraft.Client/GameState/Settings.cpp b/Minecraft.Client/GameState/Settings.cpp index 377c812dd..296f8c920 100644 --- a/Minecraft.Client/GameState/Settings.cpp +++ b/Minecraft.Client/GameState/Settings.cpp @@ -15,7 +15,7 @@ void Settings::saveProperties() { } -wstring Settings::getString(const wstring& key, const wstring& defaultValue) +std::wstring Settings::getString(const std::wstring& key, const std::wstring& defaultValue) { if(properties.find(key) == properties.end()) { @@ -25,7 +25,7 @@ wstring Settings::getString(const wstring& key, const wstring& defaultValue) return properties[key]; } -int Settings::getInt(const wstring& key, int defaultValue) +int Settings::getInt(const std::wstring& key, int defaultValue) { if(properties.find(key) == properties.end()) { @@ -35,7 +35,7 @@ int Settings::getInt(const wstring& key, int defaultValue) return _fromString(properties[key]); } -bool Settings::getBoolean(const wstring& key, bool defaultValue) +bool Settings::getBoolean(const std::wstring& key, bool defaultValue) { if(properties.find(key) == properties.end()) { @@ -48,7 +48,7 @@ bool Settings::getBoolean(const wstring& key, bool defaultValue) return retval; } -void Settings::setBooleanAndSave(const wstring& key, bool value) +void Settings::setBooleanAndSave(const std::wstring& key, bool value) { properties[key] = _toString(value); saveProperties(); diff --git a/Minecraft.Client/GameState/Settings.h b/Minecraft.Client/GameState/Settings.h index 68a4fa8bd..fb634cbfe 100644 --- a/Minecraft.Client/GameState/Settings.h +++ b/Minecraft.Client/GameState/Settings.h @@ -7,15 +7,15 @@ class Settings // public static Logger logger = Logger.getLogger("Minecraft"); // private Properties properties = new Properties(); private: - std::unordered_map properties; // 4J - TODO was Properties type, will need to implement something we can serialise/deserialise too + std::unordered_map properties; // 4J - TODO was Properties type, will need to implement something we can serialise/deserialise too //File *file; public: Settings(File *file); void generateNewProperties(); void saveProperties(); - wstring getString(const wstring& key, const wstring& defaultValue); - int getInt(const wstring& key, int defaultValue); - bool getBoolean(const wstring& key, bool defaultValue); - void setBooleanAndSave(const wstring& key, bool value); + std::wstring getString(const std::wstring& key, const std::wstring& defaultValue); + int getInt(const std::wstring& key, int defaultValue); + bool getBoolean(const std::wstring& key, bool defaultValue); + void setBooleanAndSave(const std::wstring& key, bool value); }; diff --git a/Minecraft.Client/GameState/StatsSyncer.h b/Minecraft.Client/GameState/StatsSyncer.h index b3c9d0424..1fadfa71b 100644 --- a/Minecraft.Client/GameState/StatsSyncer.h +++ b/Minecraft.Client/GameState/StatsSyncer.h @@ -28,7 +28,7 @@ private: public: StatsSyncher(User *user, StatsCounter *statsCounter, File *dir); private: - void attemptRename(File *dir, const wstring& name, File *to); + void attemptRename(File *dir, const std::wstring& name, File *to); std::unordered_map *loadStatsFromDisk(File *file, File *tmp, File *old); std::unordered_map *loadStatsFromDisk(File *file); void doSend(std::unordered_map *stats); diff --git a/Minecraft.Client/Input/ConsoleInput.cpp b/Minecraft.Client/Input/ConsoleInput.cpp index 6a36b606b..ff6c3b6a0 100644 --- a/Minecraft.Client/Input/ConsoleInput.cpp +++ b/Minecraft.Client/Input/ConsoleInput.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "ConsoleInput.h" -ConsoleInput::ConsoleInput(const wstring& msg, ConsoleInputSource *source) +ConsoleInput::ConsoleInput(const std::wstring& msg, ConsoleInputSource *source) { this->msg = msg; this->source = source; diff --git a/Minecraft.Client/Input/ConsoleInput.h b/Minecraft.Client/Input/ConsoleInput.h index 1206b24ec..3b8a91eae 100644 --- a/Minecraft.Client/Input/ConsoleInput.h +++ b/Minecraft.Client/Input/ConsoleInput.h @@ -5,8 +5,8 @@ using namespace std; class ConsoleInput { public: - wstring msg; + std::wstring msg; ConsoleInputSource *source; - ConsoleInput(const wstring& msg, ConsoleInputSource *source); + ConsoleInput(const std::wstring& msg, ConsoleInputSource *source); }; \ No newline at end of file diff --git a/Minecraft.Client/Input/ConsoleInputSource.h b/Minecraft.Client/Input/ConsoleInputSource.h index ab2a25877..7d79c0941 100644 --- a/Minecraft.Client/Input/ConsoleInputSource.h +++ b/Minecraft.Client/Input/ConsoleInputSource.h @@ -3,7 +3,7 @@ class ConsoleInputSource { public: - virtual void info(const wstring& string) = 0; - virtual void warn(const wstring& string) = 0; - virtual wstring getConsoleName() = 0; + virtual void info(const std::wstring& string) = 0; + virtual void warn(const std::wstring& string) = 0; + virtual std::wstring getConsoleName() = 0; }; diff --git a/Minecraft.Client/Input/KeyMapping.cpp b/Minecraft.Client/Input/KeyMapping.cpp index 64f4d92bb..ade98f6b5 100644 --- a/Minecraft.Client/Input/KeyMapping.cpp +++ b/Minecraft.Client/Input/KeyMapping.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "KeyMapping.h" -KeyMapping::KeyMapping(const wstring& name, int key) +KeyMapping::KeyMapping(const std::wstring& name, int key) { this->name = name; this->key = key; diff --git a/Minecraft.Client/Input/KeyMapping.h b/Minecraft.Client/Input/KeyMapping.h index 45be54a32..68aff9f0d 100644 --- a/Minecraft.Client/Input/KeyMapping.h +++ b/Minecraft.Client/Input/KeyMapping.h @@ -4,7 +4,7 @@ using namespace std; class KeyMapping { public: - wstring name; + std::wstring name; int key; - KeyMapping(const wstring& name, int key); + KeyMapping(const std::wstring& name, int key); }; \ No newline at end of file diff --git a/Minecraft.Client/Level/DemoLevel.cpp b/Minecraft.Client/Level/DemoLevel.cpp index adab55825..44c5b1f97 100644 --- a/Minecraft.Client/Level/DemoLevel.cpp +++ b/Minecraft.Client/Level/DemoLevel.cpp @@ -11,7 +11,7 @@ LevelSettings DemoLevel::DEMO_LEVEL_SETTINGS = LevelSettings( 1.0 ); -DemoLevel::DemoLevel(std::shared_ptr levelStorage, const wstring& levelName) : Level(levelStorage, levelName, &DEMO_LEVEL_SETTINGS) +DemoLevel::DemoLevel(std::shared_ptr levelStorage, const std::wstring& levelName) : Level(levelStorage, levelName, &DEMO_LEVEL_SETTINGS) { } diff --git a/Minecraft.Client/Level/DemoLevel.h b/Minecraft.Client/Level/DemoLevel.h index 7e69ed160..d8639dee7 100644 --- a/Minecraft.Client/Level/DemoLevel.h +++ b/Minecraft.Client/Level/DemoLevel.h @@ -10,7 +10,7 @@ private: static const int DEMO_SPAWN_Z = -731; static LevelSettings DEMO_LEVEL_SETTINGS; public: - DemoLevel(std::shared_ptr levelStorage, const wstring& levelName); + DemoLevel(std::shared_ptr levelStorage, const std::wstring& levelName); DemoLevel(Level *level, Dimension *dimension); protected: virtual void setInitialSpawn(); diff --git a/Minecraft.Client/Level/DerivedServerLevel.cpp b/Minecraft.Client/Level/DerivedServerLevel.cpp index b6f6aabca..525cdb142 100644 --- a/Minecraft.Client/Level/DerivedServerLevel.cpp +++ b/Minecraft.Client/Level/DerivedServerLevel.cpp @@ -3,7 +3,7 @@ #include "../../Minecraft.World/Level/Storage/SavedDataStorage.h" #include "../../Minecraft.World/Level/DerivedLevelData.h" -DerivedServerLevel::DerivedServerLevel(MinecraftServer *server, std::shared_ptr levelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings, ServerLevel *wrapped) +DerivedServerLevel::DerivedServerLevel(MinecraftServer *server, std::shared_ptr levelStorage, const std::wstring& levelName, int dimension, LevelSettings *levelSettings, ServerLevel *wrapped) : ServerLevel(server, levelStorage, levelName, dimension, levelSettings) { // 4J-PB - we're going to override the savedDataStorage, so we need to delete the current one diff --git a/Minecraft.Client/Level/DerivedServerLevel.h b/Minecraft.Client/Level/DerivedServerLevel.h index ada362f4b..2c9048563 100644 --- a/Minecraft.Client/Level/DerivedServerLevel.h +++ b/Minecraft.Client/Level/DerivedServerLevel.h @@ -4,7 +4,7 @@ class DerivedServerLevel : public ServerLevel { public: - DerivedServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings, ServerLevel *wrapped); + DerivedServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const std::wstring& levelName, int dimension, LevelSettings *levelSettings, ServerLevel *wrapped); ~DerivedServerLevel(); protected: diff --git a/Minecraft.Client/Level/ServerLevel.cpp b/Minecraft.Client/Level/ServerLevel.cpp index 43448d7f0..7cfa5b743 100644 --- a/Minecraft.Client/Level/ServerLevel.cpp +++ b/Minecraft.Client/Level/ServerLevel.cpp @@ -91,7 +91,7 @@ void ServerLevel::staticCtor() }; -ServerLevel::ServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings) : Level(levelStorage, levelName, levelSettings, Dimension::getNew(dimension), false) +ServerLevel::ServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const std::wstring& levelName, int dimension, LevelSettings *levelSettings) : Level(levelStorage, levelName, levelSettings, Dimension::getNew(dimension), false) { InitializeCriticalSection(&m_limiterCS); InitializeCriticalSection(&m_tickNextTickCS); diff --git a/Minecraft.Client/Level/ServerLevel.h b/Minecraft.Client/Level/ServerLevel.h index c4dd4f5ec..93fe297a4 100644 --- a/Minecraft.Client/Level/ServerLevel.h +++ b/Minecraft.Client/Level/ServerLevel.h @@ -41,7 +41,7 @@ private: int activeTileEventsList; public: static void staticCtor(); - ServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings); + ServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const std::wstring& levelName, int dimension, LevelSettings *levelSettings); ~ServerLevel(); void tick(); Biome::MobSpawnerData *getRandomMobSpawnAt(MobCategory *mobCategory, int x, int y, int z); diff --git a/Minecraft.Client/Level/ServerLevelListener.cpp b/Minecraft.Client/Level/ServerLevelListener.cpp index 8201f05ff..f0cd1ab6e 100644 --- a/Minecraft.Client/Level/ServerLevelListener.cpp +++ b/Minecraft.Client/Level/ServerLevelListener.cpp @@ -20,7 +20,7 @@ ServerLevelListener::ServerLevelListener(MinecraftServer *server, ServerLevel *l // 4J removed - /* -void ServerLevelListener::addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za) +void ServerLevelListener::addParticle(const std::wstring& name, double x, double y, double z, double xa, double ya, double za) { } */ @@ -98,7 +98,7 @@ void ServerLevelListener::tileLightChanged(int x, int y, int z) { } -void ServerLevelListener::playStreamingMusic(const wstring& name, int x, int y, int z) +void ServerLevelListener::playStreamingMusic(const std::wstring& name, int x, int y, int z) { } diff --git a/Minecraft.Client/Level/ServerLevelListener.h b/Minecraft.Client/Level/ServerLevelListener.h index 339b30e71..d5ba2cbc2 100644 --- a/Minecraft.Client/Level/ServerLevelListener.h +++ b/Minecraft.Client/Level/ServerLevelListener.h @@ -15,7 +15,7 @@ private: public: ServerLevelListener(MinecraftServer *server, ServerLevel *level); - // 4J removed - virtual void addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za); + // 4J removed - virtual void addParticle(const std::wstring& name, double x, double y, double z, double xa, double ya, double za); virtual void addParticle(ePARTICLE_TYPE name, double x, double y, double z, double xa, double ya, double za); // 4J added virtual void allChanged(); virtual void entityAdded(std::shared_ptr entity); @@ -27,7 +27,7 @@ public: virtual void skyColorChanged(); virtual void tileChanged(int x, int y, int z); virtual void tileLightChanged(int x, int y, int z); - virtual void playStreamingMusic(const wstring& name, int x, int y, int z); + virtual void playStreamingMusic(const std::wstring& name, int x, int y, int z); virtual void levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data); virtual void destroyTileProgress(int id, int x, int y, int z, int progress); }; diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 5b1f6f59a..e7713b2dc 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -236,7 +236,7 @@ void Minecraft::clearConnectionFailed() app.SetDisconnectReason(DisconnectPacket::eDisconnect_None); } -void Minecraft::connectTo(const wstring& server, int port) +void Minecraft::connectTo(const std::wstring& server, int port) { connectToIp = server; connectToPort = port; @@ -489,7 +489,7 @@ File Minecraft::getWorkingDirectory() return workDir; } -File Minecraft::getWorkingDirectory(const wstring& applicationName) +File Minecraft::getWorkingDirectory(const std::wstring& applicationName) { #if 0 // 4J - original version @@ -514,7 +514,7 @@ File Minecraft::getWorkingDirectory(const wstring& applicationName) if (!workingDirectory.exists()) if (!workingDirectory.mkdirs()) throw new RuntimeException("The working directory could not be created: " + workingDirectory); return workingDirectory; #else - wstring userHome = L"home"; // 4J - TODO + std::wstring userHome = L"home"; // 4J - TODO File workingDirectory(userHome, applicationName); // 4J Removed //if (!workingDirectory.exists()) @@ -620,7 +620,7 @@ void Minecraft::setScreen(Screen *screen) }*/ } -void Minecraft::checkGlError(const wstring& string) +void Minecraft::checkGlError(const std::wstring& string) { // 4J - TODO } @@ -1025,7 +1025,7 @@ void Minecraft::addPendingLocalConnection(int idx, ClientConnection *connection) m_pendingLocalConnections[idx] = connection; } -std::shared_ptr Minecraft::createExtraLocalPlayer(int idx, const wstring& name, int iPad, int iDimension, ClientConnection *clientConnection /*= NULL*/,MultiPlayerLevel *levelpassedin) +std::shared_ptr Minecraft::createExtraLocalPlayer(int idx, const std::wstring& name, int iPad, int iDimension, ClientConnection *clientConnection /*= NULL*/,MultiPlayerLevel *levelpassedin) { if( clientConnection == NULL) return nullptr; @@ -1037,7 +1037,7 @@ std::shared_ptr Minecraft::createExtraLocalPlayer(int id // A temp player displaying a connecting screen tempScreenSection = localplayers[idx]->m_iScreenSection; } - wstring prevname = user->name; + std::wstring prevname = user->name; user->name = name; // Don't need this any more @@ -3439,7 +3439,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) #endif if( selected || wheel != 0 || (player->ullButtonsPressed&(1LL< selectedItem = player->getSelectedItem(); // 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; @@ -3782,16 +3782,16 @@ bool Minecraft::isClientSide() return level != NULL && level->isClientSide; } -void Minecraft::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, const wstring& levelName, LevelSettings *levelSettings) +void Minecraft::selectLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, const std::wstring& levelName, LevelSettings *levelSettings) { } -bool Minecraft::saveSlot(int slot, const wstring& name) +bool Minecraft::saveSlot(int slot, const std::wstring& name) { return false; } -bool Minecraft::loadSlot(const wstring& userName, int slot) +bool Minecraft::loadSlot(const std::wstring& userName, int slot) { return false; } @@ -3835,7 +3835,7 @@ MultiPlayerLevel *Minecraft::getLevel(int dimension) // Also causing ambiguous call for some reason // as it is matching std::shared_ptr from the func below with bool from this one -//void Minecraft::setLevel(Level *level, const wstring& message, bool doForceStatsSave /*= true*/) +//void Minecraft::setLevel(Level *level, const std::wstring& message, bool doForceStatsSave /*= true*/) //{ // setLevel(level, message, NULL, doForceStatsSave); //} @@ -4106,11 +4106,11 @@ void Minecraft::prepareLevel(int title) } } -void Minecraft::fileDownloaded(const wstring& name, File *file) +void Minecraft::fileDownloaded(const std::wstring& name, File *file) { int p = (int)name.find(L"/"); - wstring category = name.substr(0, p); - wstring name2 = name.substr(p + 1); + std::wstring category = name.substr(0, p); + std::wstring name2 = name.substr(p + 1); toLower(category); if (category==L"sound") { @@ -4134,25 +4134,25 @@ void Minecraft::fileDownloaded(const wstring& name, File *file) } } -wstring Minecraft::gatherStats1() +std::wstring Minecraft::gatherStats1() { //return levelRenderer->gatherStats1(); return L"Time to autosave: " + _toString( app.SecondsToAutosave() ) + L"s"; } -wstring Minecraft::gatherStats2() +std::wstring Minecraft::gatherStats2() { return g_NetworkManager.GatherStats(); //return levelRenderer->gatherStats2(); } -wstring Minecraft::gatherStats3() +std::wstring Minecraft::gatherStats3() { return g_NetworkManager.GatherRTTStats(); //return L"P: " + particleEngine->countParticles() + L". T: " + level->gatherStats(); } -wstring Minecraft::gatherStats4() +std::wstring Minecraft::gatherStats4() { return level->gatherChunkSourceStats(); } @@ -4260,15 +4260,15 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) gameRenderer->EnableUpdateThread(); } -void Minecraft::start(const wstring& name, const wstring& sid) +void Minecraft::start(const std::wstring& name, const std::wstring& sid) { startAndConnectTo(name, sid, L""); } -void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const wstring& url) +void Minecraft::startAndConnectTo(const std::wstring& name, const std::wstring& sid, const std::wstring& url) { bool fullScreen = false; - wstring userName = name; + std::wstring userName = name; /* 4J - removed window handling things here final Frame frame = new Frame("Minecraft"); @@ -4367,8 +4367,8 @@ int g_iMainThreadId; void Minecraft::main() { - wstring name; - wstring sessionId; + std::wstring name; + std::wstring sessionId; //g_iMainThreadId = GetCurrentThreadId(); @@ -4452,7 +4452,7 @@ bool Minecraft::renderDebug() return (m_instance != NULL && m_instance->options->renderDebug); } -bool Minecraft::handleClientSideCommand(const wstring& chatMessage) +bool Minecraft::handleClientSideCommand(const std::wstring& chatMessage) { /* 4J - TODO if (chatMessage.startsWith("/")) { @@ -4841,7 +4841,7 @@ void Minecraft::tickAllConnections() setLocalPlayerIdx(oldIdx); } -bool Minecraft::addPendingClientTextureRequest(const wstring &textureName) +bool Minecraft::addPendingClientTextureRequest(const std::wstring &textureName) { AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); if( it == m_pendingTextureRequests.end() ) @@ -4852,7 +4852,7 @@ bool Minecraft::addPendingClientTextureRequest(const wstring &textureName) return false; } -void Minecraft::handleClientTextureReceived(const wstring &textureName) +void Minecraft::handleClientTextureReceived(const std::wstring &textureName) { AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); if( it != m_pendingTextureRequests.end() ) diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index ea0a6e456..58106a326 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -56,7 +56,7 @@ private: }; public: - static const wstring VERSION_STRING; + static const std::wstring VERSION_STRING; Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet *minecraftApplet, int width, int height, bool fullscreen); void init(); @@ -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; } - std::shared_ptr createExtraLocalPlayer(int idx, const wstring& name, int pad, int iDimension, ClientConnection *clientConnection = NULL,MultiPlayerLevel *levelpassedin=NULL); + std::shared_ptr createExtraLocalPlayer(int idx, const std::wstring& name, int pad, int iDimension, ClientConnection *clientConnection = NULL,MultiPlayerLevel *levelpassedin=NULL); void createPrimaryLocalPlayer(int iPad); bool setLocalPlayerIdx(int idx); int getLocalPlayerIdx(); @@ -126,7 +126,7 @@ public: std::shared_ptr cameraTargetPlayer; ParticleEngine *particleEngine; User *user; - wstring serverDomain; + std::wstring serverDomain; Canvas *parent; bool appletMode; @@ -181,12 +181,12 @@ public: StatsCounter* stats[4]; private: - wstring connectToIp; + std::wstring connectToIp; int connectToPort; public: void clearConnectionFailed(); - void connectTo(const wstring& server, int port); + void connectTo(const std::wstring& server, int port); private: void renderLoadingScreen(); @@ -199,14 +199,14 @@ private: public: static File getWorkingDirectory(); - static File getWorkingDirectory(const wstring& applicationName); + static File getWorkingDirectory(const std::wstring& applicationName); private: static OS getPlatform(); public: LevelStorageSource *getLevelSource(); void setScreen(Screen *screen); private: - void checkGlError(const wstring& string); + void checkGlError(const std::wstring& string); #ifdef __ORBIS__ PsPlusUpsellWrapper *m_pPsPlusUpsell; @@ -215,7 +215,7 @@ private: public: void destroy(); volatile bool running; - wstring fpsString; + std::wstring fpsString; void run(); // 4J-PB - split the run into 3 parts so we can run it from our xbox game loop static Minecraft *GetInstance(); @@ -269,36 +269,36 @@ private: void reloadSound(); public: bool isClientSide(); - void selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, const wstring& levelName, LevelSettings *levelSettings); + void selectLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, const std::wstring& levelName, LevelSettings *levelSettings); //void toggleDimension(int targetDimension); - bool saveSlot(int slot, const wstring& name); - bool loadSlot(const wstring& userName, int slot); + bool saveSlot(int slot, const std::wstring& name); + bool loadSlot(const std::wstring& userName, int slot); void releaseLevel(int message); // 4J Stu - Added the doForceStatsSave param //void setLevel(Level *level, bool doForceStatsSave = true); - //void setLevel(Level *level, const wstring& message, bool doForceStatsSave = true); + //void setLevel(Level *level, const std::wstring& message, bool doForceStatsSave = true); void setLevel(MultiPlayerLevel *level, int message = -1, std::shared_ptr forceInsertPlayer = nullptr, bool doForceStatsSave = true,bool bPrimaryPlayerSignedOut=false); // 4J-PB - added to force in the 'other' level when the main player creates the level at game load time void forceaddLevel(MultiPlayerLevel *level); void prepareLevel(int title); // 4J - changed to public - void fileDownloaded(const wstring& name, File *file); + void fileDownloaded(const std::wstring& name, File *file); // OpenGLCapabilities getOpenGLCapabilities(); // 4J - removed - wstring gatherStats1(); - wstring gatherStats2(); - wstring gatherStats3(); - wstring gatherStats4(); + std::wstring gatherStats1(); + std::wstring gatherStats2(); + std::wstring gatherStats3(); + std::wstring gatherStats4(); void respawnPlayer(int iPad,int dimension,int newEntityId); - static void start(const wstring& name, const wstring& sid); - static void startAndConnectTo(const wstring& name, const wstring& sid, const wstring& url); + static void start(const std::wstring& name, const std::wstring& sid); + static void startAndConnectTo(const std::wstring& name, const std::wstring& sid, const std::wstring& url); ClientConnection *getConnection(int iPad); // 4J Stu added iPad param static void main(); static bool renderNames(); static bool useFancyGraphics(); static bool useAmbientOcclusion(); static bool renderDebug(); - bool handleClientSideCommand(const wstring& chatMessage); + bool handleClientSideCommand(const std::wstring& chatMessage); static int maxSupportedTextureSize(); void delayTextureReload(); @@ -331,15 +331,15 @@ public: Level *animateTickLevel; // 4J added // 4J - When a client requests a texture, it should add it to here while we are waiting for it - vector m_pendingTextureRequests; - vector m_pendingGeometryRequests; // additional skin box geometry + vector m_pendingTextureRequests; + vector m_pendingGeometryRequests; // additional skin box geometry // 4J Added - bool addPendingClientTextureRequest(const wstring &textureName); - void handleClientTextureReceived(const wstring &textureName); + bool addPendingClientTextureRequest(const std::wstring &textureName); + void handleClientTextureReceived(const std::wstring &textureName); void clearPendingClientTextureRequests() { m_pendingTextureRequests.clear(); } - bool addPendingClientGeometryRequest(const wstring &textureName); - void handleClientGeometryReceived(const wstring &textureName); + bool addPendingClientGeometryRequest(const std::wstring &textureName); + void handleClientGeometryReceived(const std::wstring &textureName); void clearPendingClientGeometryRequests() { m_pendingGeometryRequests.clear(); } unsigned int getCurrentTexturePackId(); diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 50a4763b9..4256cffff 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -64,7 +64,7 @@ int MinecraftServer::s_slowQueuePlayerIndex = 0; int MinecraftServer::s_slowQueueLastTime = 0; bool MinecraftServer::s_slowQueuePacketSent = false; -std::unordered_map MinecraftServer::ironTimers; +std::unordered_map MinecraftServer::ironTimers; MinecraftServer::MinecraftServer() { @@ -77,7 +77,7 @@ MinecraftServer::MinecraftServer() m_bLoaded = false; stopped = false; tickCount = 0; - wstring progressStatus; + std::wstring progressStatus; progress = 0; motd = L""; @@ -203,8 +203,8 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW __int64 levelNanoTime = System::nanoTime(); - wstring levelName = settings->getString(L"level-name", L"world"); - wstring levelTypeString; + std::wstring levelName = settings->getString(L"level-name", L"world"); + std::wstring levelTypeString; bool gameRuleUseFlatWorld = false; if(app.getLevelGenerationOptions() != NULL) @@ -244,7 +244,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW //settings->setProperty(L"max-build-height", maxBuildHeight); #if 0 - wstring levelSeedString = settings->getString(L"level-seed", L""); + std::wstring levelSeedString = settings->getString(L"level-seed", L""); __int64 levelSeed = (new Random())->nextLong(); if (levelSeedString.length() > 0) { @@ -378,7 +378,7 @@ void MinecraftServer::postProcessTerminate(ProgressRenderer *mcprogress) DeleteCriticalSection(&m_postProcessCS); } -bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData) +bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const std::wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData) { // 4J - TODO - do with new save stuff // if (storageSource->requiresConversion(name)) @@ -750,7 +750,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring return true; } -void MinecraftServer::setProgress(const wstring& status, int progress) +void MinecraftServer::setProgress(const std::wstring& status, int progress) { progressStatus = status; this->progress = progress; @@ -1347,7 +1347,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) wchar_t filename[128]; swprintf(filename,128,L"%ls%dx%dx%d.sch",initData->name,(initData->endX - initData->startX + 1), (initData->endY - initData->startY + 1), (initData->endZ - initData->startZ + 1)); - File dataFile = File( targetFileDir, wstring(filename) ); + File dataFile = File( targetFileDir, std::wstring(filename) ); if(dataFile.exists()) dataFile._delete(); FileOutputStream fos = FileOutputStream(dataFile); DataOutputStream dos = DataOutputStream(&fos); @@ -1440,7 +1440,7 @@ void MinecraftServer::broadcastStopSavingPacket() void MinecraftServer::tick() { - vector toRemove; + vector toRemove; for (AUTO_VAR(it, ironTimers.begin()); it != ironTimers.end(); it++ ) { int t = it->second; @@ -1561,7 +1561,7 @@ void MinecraftServer::tick() // } } -void MinecraftServer::handleConsoleInput(const wstring& msg, ConsoleInputSource *source) +void MinecraftServer::handleConsoleInput(const std::wstring& msg, ConsoleInputSource *source) { consoleInput.push_back(new ConsoleInput(msg, source)); } @@ -1599,20 +1599,20 @@ void MinecraftServer::HaltServer(bool bPrimaryPlayerSignedOut) } } -File *MinecraftServer::getFile(const wstring& name) +File *MinecraftServer::getFile(const std::wstring& name) { return new File(name); } -void MinecraftServer::info(const wstring& string) +void MinecraftServer::info(const std::wstring& string) { } -void MinecraftServer::warn(const wstring& string) +void MinecraftServer::warn(const std::wstring& string) { } -wstring MinecraftServer::getConsoleName() +std::wstring MinecraftServer::getConsoleName() { return L"CONSOLE"; } diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index 7bbd01dbf..944b9775a 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -24,8 +24,8 @@ typedef struct _LoadSaveDataThreadParam { LPVOID data; __int64 fileSize; - const wstring saveName; - _LoadSaveDataThreadParam(LPVOID data, __int64 filesize, const wstring &saveName) : data( data ), fileSize( filesize ), saveName( saveName ) {} + const std::wstring saveName; + _LoadSaveDataThreadParam(LPVOID data, __int64 filesize, const std::wstring &saveName) : data( data ), fileSize( filesize ), saveName( saveName ) {} } LoadSaveDataThreadParam; typedef struct _NetworkGameInitData @@ -60,18 +60,18 @@ using namespace std; class MinecraftServer : public ConsoleInputSource { public: - static const wstring VERSION; + static const std::wstring VERSION; static const int TICK_STATS_SPAN = SharedConstants::TICKS_PER_SECOND * 5; // static Logger logger = Logger.getLogger("Minecraft"); - static std::unordered_map ironTimers; + static std::unordered_map ironTimers; private: static const int DEFAULT_MINECRAFT_PORT = 25565; static const int MS_PER_TICK = 1000 / SharedConstants::TICKS_PER_SECOND; // 4J Stu - Added 1.0.1, Not needed - //wstring localIp; + //std::wstring localIp; //int port; public: ServerConnection *connection; @@ -93,7 +93,7 @@ public: int tickCount; public: - wstring progressStatus; + std::wstring progressStatus; int progress; private: // vector tickables = new ArrayList(); // 4J - removed @@ -105,7 +105,7 @@ public: bool npcs; bool pvp; bool allowFlight; - wstring motd; + std::wstring motd; int maxBuildHeight; private: @@ -127,8 +127,8 @@ private: // 4J Added - LoadSaveDataThreadParam bool initServer(__int64 seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed); void postProcessTerminate(ProgressRenderer *mcprogress); - bool loadLevel(LevelStorageSource *storageSource, const wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData); - void setProgress(const wstring& status, int progress); + bool loadLevel(LevelStorageSource *storageSource, const std::wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData); + void setProgress(const std::wstring& status, int progress); void endProgress(); void saveAllChunks(); void saveGameRules(); @@ -162,16 +162,16 @@ public: private: void tick(); public: - void handleConsoleInput(const wstring& msg, ConsoleInputSource *source); + void handleConsoleInput(const std::wstring& msg, ConsoleInputSource *source); void handleConsoleInputs(); // void addTickable(Tickable tickable); // 4J removed static void main(__int64 seed, void *lpParameter); static void HaltServer(bool bPrimaryPlayerSignedOut=false); - File *getFile(const wstring& name); - void info(const wstring& string); - void warn(const wstring& string); - wstring getConsoleName(); + File *getFile(const std::wstring& name); + void info(const std::wstring& string); + void warn(const std::wstring& string); + std::wstring getConsoleName(); ServerLevel *getLevel(int dimension); void setLevel(int dimension, ServerLevel *level); // 4J added static MinecraftServer *getInstance() { return server; } // 4J added diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index b570e0b39..8d36a103e 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -57,7 +57,7 @@ #include "../../Minecraft.World/Stats/GenericStats.h" #endif -ClientConnection::ClientConnection(Minecraft *minecraft, const wstring& ip, int port) +ClientConnection::ClientConnection(Minecraft *minecraft, const std::wstring& ip, int port) { // 4J Stu - No longer used as we use the socket version below. assert(FALSE); @@ -207,7 +207,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) // a skin? if(pMojangData->wchSkin[0]!=0L) { - wstring wstr=pMojangData->wchSkin; + std::wstring wstr=pMojangData->wchSkin; // check the file is not already in bRes=app.IsFileInMemoryTextures(wstr); if(!bRes) @@ -229,7 +229,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) // a cloak? if(pMojangData->wchCape[0]!=0L) { - wstring wstr=pMojangData->wchCape; + std::wstring wstr=pMojangData->wchCape; // check the file is not already in bRes=app.IsFileInMemoryTextures(wstr); if(!bRes) @@ -1277,12 +1277,12 @@ void ClientConnection::handleTakeItemEntity(std::shared_ptr packet) { - wstring message; + std::wstring message; int iPos; bool displayOnGui = true; - wstring playerDisplayName = L""; - wstring sourceDisplayName = L""; + std::wstring playerDisplayName = L""; + std::wstring sourceDisplayName = L""; // On platforms other than Xbox One this just sets display name to gamertag if (packet->m_stringArgs.size() >= 1) playerDisplayName = GetDisplayNameByGamertag(packet->m_stringArgs[0]); @@ -3053,7 +3053,7 @@ void ClientConnection::displayPrivilegeChanges(std::shared_ptrm_messageId); if(string != NULL) { - wstring message(string); + std::wstring message(string); message = GameRuleDefinition::generateDescriptionString(packet->m_definitionType,message,packet->m_data.data,packet->m_data.length); if(minecraft->localgameModes[m_userIndex]!=NULL) { @@ -3348,10 +3348,10 @@ int ClientConnection::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage:: } // -wstring ClientConnection::GetDisplayNameByGamertag(wstring gamertag) +std::wstring ClientConnection::GetDisplayNameByGamertag(std::wstring gamertag) { #ifdef _DURANGO - wstring displayName = g_NetworkManager.GetDisplayNameByGamertag(gamertag); + std::wstring displayName = g_NetworkManager.GetDisplayNameByGamertag(gamertag); return displayName; #else return gamertag; diff --git a/Minecraft.Client/Network/ClientConnection.h b/Minecraft.Client/Network/ClientConnection.h index 305b3a21b..1f0aae762 100644 --- a/Minecraft.Client/Network/ClientConnection.h +++ b/Minecraft.Client/Network/ClientConnection.h @@ -21,7 +21,7 @@ private: bool done; Connection *connection; public: - wstring message; + std::wstring message; bool createdOk; // 4J added private: Minecraft *minecraft; @@ -44,7 +44,7 @@ private: DWORD m_userIndex; // 4J Added public: SavedDataStorage *savedDataStorage; - ClientConnection(Minecraft *minecraft, const wstring& ip, int port); + ClientConnection(Minecraft *minecraft, const std::wstring& ip, int port); ClientConnection(Minecraft *minecraft, Socket *socket, int iUserIndex = -1); ~ClientConnection(); void tick(); @@ -90,7 +90,7 @@ public: virtual void handleEntityEvent(std::shared_ptr packet); private: std::shared_ptr getEntity(int entityId); - wstring GetDisplayNameByGamertag(wstring gamertag); + std::wstring GetDisplayNameByGamertag(std::wstring gamertag); public: virtual void handleSetHealth(std::shared_ptr packet); virtual void handleSetExperience(std::shared_ptr packet); diff --git a/Minecraft.Client/Network/MultiPlayerChunkCache.cpp b/Minecraft.Client/Network/MultiPlayerChunkCache.cpp index 93cedcbac..acbef3521 100644 --- a/Minecraft.Client/Network/MultiPlayerChunkCache.cpp +++ b/Minecraft.Client/Network/MultiPlayerChunkCache.cpp @@ -280,12 +280,12 @@ vector *MultiPlayerChunkCache::getMobsAt(MobCategory *m return NULL; } -TilePos *MultiPlayerChunkCache::findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z) +TilePos *MultiPlayerChunkCache::findNearestMapFeature(Level *level, const std::wstring &featureName, int x, int y, int z) { return NULL; } -wstring MultiPlayerChunkCache::gatherStats() +std::wstring MultiPlayerChunkCache::gatherStats() { EnterCriticalSection(&m_csLoadCreate); int size = (int)loadedChunkList.size(); diff --git a/Minecraft.Client/Network/MultiPlayerChunkCache.h b/Minecraft.Client/Network/MultiPlayerChunkCache.h index f18681b63..c557cd5d8 100644 --- a/Minecraft.Client/Network/MultiPlayerChunkCache.h +++ b/Minecraft.Client/Network/MultiPlayerChunkCache.h @@ -38,9 +38,9 @@ public: virtual bool tick(); virtual bool shouldSave(); virtual void postProcess(ChunkSource *parent, int x, int z); - virtual wstring gatherStats(); + virtual std::wstring gatherStats(); virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const std::wstring &featureName, int x, int y, int z); virtual void dataReceived(int x, int z); // 4J added virtual LevelChunk **getCache() { return cache; } // 4J added diff --git a/Minecraft.Client/Network/PendingConnection.cpp b/Minecraft.Client/Network/PendingConnection.cpp index f30124234..b0b9e869b 100644 --- a/Minecraft.Client/Network/PendingConnection.cpp +++ b/Minecraft.Client/Network/PendingConnection.cpp @@ -20,7 +20,7 @@ Random *PendingConnection::random = new Random(); -PendingConnection::PendingConnection(MinecraftServer *server, Socket *socket, const wstring& id) +PendingConnection::PendingConnection(MinecraftServer *server, Socket *socket, const std::wstring& id) { // 4J - added initialisers done = false; @@ -257,7 +257,7 @@ void PendingConnection::send(std::shared_ptr packet) connection->send(packet); } -wstring PendingConnection::getName() +std::wstring PendingConnection::getName() { return L"Unimplemented"; // if (name != null) return name + " [" + connection.getRemoteAddress().toString() + "]"; diff --git a/Minecraft.Client/Network/PendingConnection.h b/Minecraft.Client/Network/PendingConnection.h index e8c286721..50e9b35d5 100644 --- a/Minecraft.Client/Network/PendingConnection.h +++ b/Minecraft.Client/Network/PendingConnection.h @@ -23,12 +23,12 @@ public: private: MinecraftServer *server; int _tick; - wstring name; + std::wstring name; std::shared_ptr acceptedLogin; - wstring loginKey; + std::wstring loginKey; public: - PendingConnection(MinecraftServer *server, Socket *socket, const wstring& id); + PendingConnection(MinecraftServer *server, Socket *socket, const std::wstring& id); ~PendingConnection(); void tick(); void disconnect(DisconnectPacket::eDisconnectReason reason); @@ -40,7 +40,7 @@ public: virtual void handleKeepAlive(std::shared_ptr packet); virtual void onUnhandledPacket(std::shared_ptr packet); void send(std::shared_ptr packet); - wstring getName(); + std::wstring getName(); virtual bool isServerPacketListener(); private: diff --git a/Minecraft.Client/Network/PlayerConnection.cpp b/Minecraft.Client/Network/PlayerConnection.cpp index f931c8bbc..f5b40adc9 100644 --- a/Minecraft.Client/Network/PlayerConnection.cpp +++ b/Minecraft.Client/Network/PlayerConnection.cpp @@ -638,7 +638,7 @@ void PlayerConnection::handleChat(std::shared_ptr packet) { // 4J - TODO #if 0 - wstring message = packet->message; + std::wstring message = packet->message; if (message.length() > SharedConstants::maxChatLength) { disconnect(L"Chat message too long"); @@ -670,7 +670,7 @@ void PlayerConnection::handleChat(std::shared_ptr packet) #endif } -void PlayerConnection::handleCommand(const wstring& message) +void PlayerConnection::handleCommand(const std::wstring& message) { // 4J - TODO #if 0 @@ -737,19 +737,19 @@ int PlayerConnection::countDelayedPackets() return connection->countDelayedPackets(); } -void PlayerConnection::info(const wstring& string) +void PlayerConnection::info(const std::wstring& string) { // 4J-PB - removed, since it needs to be localised in the language the client is in //send( std::shared_ptr( new ChatPacket(L"§7" + string) ) ); } -void PlayerConnection::warn(const wstring& string) +void PlayerConnection::warn(const std::wstring& string) { // 4J-PB - removed, since it needs to be localised in the language the client is in //send( std::shared_ptr( new ChatPacket(L"§9" + string) ) ); } -wstring PlayerConnection::getConsoleName() +std::wstring PlayerConnection::getConsoleName() { return player->name; } @@ -894,7 +894,7 @@ void PlayerConnection::handleTextureAndGeometry(std::shared_ptrgetAuxValue()); - std::wstring id = wstring(buf); + std::wstring id = std::wstring(buf); if( data == NULL ) { data = std::shared_ptr( new MapItemSavedData(id) ); @@ -1292,7 +1292,7 @@ void PlayerConnection::handleSignUpdate(std::shared_ptr packet std::shared_ptr ste = dynamic_pointer_cast(te); for (int i = 0; i < 4; i++) { - wstring lineText = packet->lines[i].substr(0,15); + std::wstring lineText = packet->lines[i].substr(0,15); ste->SetMessage( i, lineText ); } ste->SetVerified(false); @@ -1498,7 +1498,7 @@ void PlayerConnection::handleCustomPayload(std::shared_ptr { ByteArrayInputStream bais(customPayloadPacket->data); DataInputStream dis(&bais); - wstring name = dis.readUTF(); + std::wstring name = dis.readUTF(); if (name.length() <= 30) { menu->setItemName(name); diff --git a/Minecraft.Client/Network/PlayerConnection.h b/Minecraft.Client/Network/PlayerConnection.h index bc3c376aa..0b8a74dc9 100644 --- a/Minecraft.Client/Network/PlayerConnection.h +++ b/Minecraft.Client/Network/PlayerConnection.h @@ -62,15 +62,15 @@ public: virtual void handleSetCarriedItem(std::shared_ptr packet); virtual void handleChat(std::shared_ptr packet); private: - void handleCommand(const wstring& message); + void handleCommand(const std::wstring& message); public: virtual void handleAnimate(std::shared_ptr packet); virtual void handlePlayerCommand(std::shared_ptr packet); virtual void handleDisconnect(std::shared_ptr packet); int countDelayedPackets(); - virtual void info(const wstring& string); - virtual void warn(const wstring& string); - virtual wstring getConsoleName(); + virtual void info(const std::wstring& string); + virtual void warn(const std::wstring& string); + virtual std::wstring getConsoleName(); virtual void handleInteract(std::shared_ptr packet); bool canHandleAsyncPackets(); virtual void handleClientCommand(std::shared_ptr packet); @@ -120,8 +120,8 @@ public: void closeOnTick() { m_bCloseOnTick = true; } // 4J Added so that we can send on textures that get received after this connection requested them - void handleTextureReceived(const wstring &textureName); - void handleTextureAndGeometryReceived(const wstring &textureName); + void handleTextureReceived(const std::wstring &textureName); + void handleTextureAndGeometryReceived(const std::wstring &textureName); void setShowOnMaps(bool bVal); @@ -133,7 +133,7 @@ public: private: bool m_bCloseOnTick; - vector m_texturesRequested; + vector m_texturesRequested; bool m_bWasKicked; }; diff --git a/Minecraft.Client/Network/PlayerInfo.h b/Minecraft.Client/Network/PlayerInfo.h index 427c78d88..280c9126f 100644 --- a/Minecraft.Client/Network/PlayerInfo.h +++ b/Minecraft.Client/Network/PlayerInfo.h @@ -4,10 +4,10 @@ using namespace std; class PlayerInfo { public: - wstring name; + std::wstring name; int latency; - PlayerInfo(const wstring &name) + PlayerInfo(const std::wstring &name) { this->name = name; latency = 0; diff --git a/Minecraft.Client/Network/PlayerList.cpp b/Minecraft.Client/Network/PlayerList.cpp index bfda41a48..6b2bd0cc8 100644 --- a/Minecraft.Client/Network/PlayerList.cpp +++ b/Minecraft.Client/Network/PlayerList.cpp @@ -439,7 +439,7 @@ void PlayerList::remove(std::shared_ptr player) saveAll(NULL,false); } -std::shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendingConnection, const wstring& userName, PlayerUID xuid, PlayerUID onlineXuid) +std::shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendingConnection, const std::wstring& userName, PlayerUID xuid, PlayerUID onlineXuid) { if (players.size() >= maxPlayers) { @@ -957,9 +957,9 @@ void PlayerList::broadcastAll(std::shared_ptr packet, int dimension) } } -wstring PlayerList::getPlayerNames() +std::wstring PlayerList::getPlayerNames() { - wstring msg; + std::wstring msg; for (unsigned int i = 0; i < players.size(); i++) { if (i > 0) msg += L", "; @@ -968,12 +968,12 @@ wstring PlayerList::getPlayerNames() return msg; } -bool PlayerList::isWhiteListed(const wstring& name) +bool PlayerList::isWhiteListed(const std::wstring& name) { return true; } -bool PlayerList::isOp(const wstring& name) +bool PlayerList::isOp(const std::wstring& name) { return false; } @@ -989,7 +989,7 @@ bool PlayerList::isOp(std::shared_ptr player) return isOp; } -std::shared_ptr PlayerList::getPlayer(const wstring& name) +std::shared_ptr PlayerList::getPlayer(const std::wstring& name) { for (unsigned int i = 0; i < players.size(); i++) { @@ -1016,7 +1016,7 @@ std::shared_ptr PlayerList::getPlayer(PlayerUID uid) return nullptr; } -void PlayerList::sendMessage(const wstring& name, const wstring& message) +void PlayerList::sendMessage(const std::wstring& name, const std::wstring& message) { std::shared_ptr player = getPlayer(name); if (player != NULL) @@ -1097,7 +1097,7 @@ void PlayerList::broadcast(std::shared_ptr except, double x, double y, d } -void PlayerList::broadcastToAllOps(const wstring& message) +void PlayerList::broadcastToAllOps(const std::wstring& message) { std::shared_ptr chatPacket = std::shared_ptr( new ChatPacket(message) ); for (unsigned int i = 0; i < players.size(); i++) @@ -1110,7 +1110,7 @@ void PlayerList::broadcastToAllOps(const wstring& message) } } -bool PlayerList::sendTo(const wstring& name, std::shared_ptr packet) +bool PlayerList::sendTo(const std::wstring& name, std::shared_ptr packet) { std::shared_ptr player = getPlayer(name); if (player != NULL) @@ -1142,11 +1142,11 @@ void PlayerList::saveAll(ProgressListener *progressListener, bool bDeleteGuestMa } } -void PlayerList::whiteList(const wstring& playerName) +void PlayerList::whiteList(const std::wstring& playerName) { } -void PlayerList::blackList(const wstring& playerName) +void PlayerList::blackList(const std::wstring& playerName) { } diff --git a/Minecraft.Client/Network/PlayerList.h b/Minecraft.Client/Network/PlayerList.h index ce50270d7..58ccd3641 100644 --- a/Minecraft.Client/Network/PlayerList.h +++ b/Minecraft.Client/Network/PlayerList.h @@ -75,7 +75,7 @@ public: void add(std::shared_ptr player); void move(std::shared_ptr player); void remove(std::shared_ptr player); - std::shared_ptr getPlayerForLogin(PendingConnection *pendingConnection, const wstring& userName, PlayerUID xuid, PlayerUID OnlineXuid); + std::shared_ptr getPlayerForLogin(PendingConnection *pendingConnection, const std::wstring& userName, PlayerUID xuid, PlayerUID OnlineXuid); std::shared_ptr respawn(std::shared_ptr serverPlayer, int targetDimension, bool keepAllPlayerData); void toggleDimension(std::shared_ptr player, int targetDimension); void tick(); @@ -84,23 +84,23 @@ public: void broadcastAll(std::shared_ptr packet); void broadcastAll(std::shared_ptr packet, int dimension); - wstring getPlayerNames(); + std::wstring getPlayerNames(); public: - bool isWhiteListed(const wstring& name); - bool isOp(const wstring& name); + bool isWhiteListed(const std::wstring& name); + bool isOp(const std::wstring& name); bool isOp(std::shared_ptr player); // 4J Added - std::shared_ptr getPlayer(const wstring& name); + std::shared_ptr getPlayer(const std::wstring& name); std::shared_ptr getPlayer(PlayerUID uid); - void sendMessage(const wstring& name, const wstring& message); + void sendMessage(const std::wstring& name, const std::wstring& message); void broadcast(double x, double y, double z, double range, int dimension, std::shared_ptr packet); void broadcast(std::shared_ptr except, double x, double y, double z, double range, int dimension, std::shared_ptr packet); - void broadcastToAllOps(const wstring& message); - bool sendTo(const wstring& name, std::shared_ptr packet); + void broadcastToAllOps(const std::wstring& message); + bool sendTo(const std::wstring& name, std::shared_ptr packet); // 4J Added ProgressListener *progressListener param and bDeleteGuestMaps param void saveAll(ProgressListener *progressListener, bool bDeleteGuestMaps = false); - void whiteList(const wstring& playerName); - void blackList(const wstring& playerName); + void whiteList(const std::wstring& playerName); + void blackList(const std::wstring& playerName); // Set getWhiteList(); / 4J removed void reloadWhitelist(); void sendLevelInfo(std::shared_ptr player, ServerLevel *level); diff --git a/Minecraft.Client/Network/ServerChunkCache.cpp b/Minecraft.Client/Network/ServerChunkCache.cpp index 7dcfd5ae7..178dd901e 100644 --- a/Minecraft.Client/Network/ServerChunkCache.cpp +++ b/Minecraft.Client/Network/ServerChunkCache.cpp @@ -897,7 +897,7 @@ bool ServerChunkCache::shouldSave() return !level->noSave; } -wstring ServerChunkCache::gatherStats() +std::wstring ServerChunkCache::gatherStats() { return L"ServerChunkCache: ";// + _toString(loadedChunks.size()) + L" Drop: " + _toString(toDrop.size()); } @@ -907,7 +907,7 @@ vector *ServerChunkCache::getMobsAt(MobCategory *mobCat return source->getMobsAt(mobCategory, x, y, z); } -TilePos *ServerChunkCache::findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z) +TilePos *ServerChunkCache::findNearestMapFeature(Level *level, const std::wstring &featureName, int x, int y, int z) { return source->findNearestMapFeature(level, featureName, x, y, z); } diff --git a/Minecraft.Client/Network/ServerChunkCache.h b/Minecraft.Client/Network/ServerChunkCache.h index d054050d1..46ed35903 100644 --- a/Minecraft.Client/Network/ServerChunkCache.h +++ b/Minecraft.Client/Network/ServerChunkCache.h @@ -80,10 +80,10 @@ public: virtual bool save(bool force, ProgressListener *progressListener); virtual bool tick(); virtual bool shouldSave(); - virtual wstring gatherStats(); + virtual std::wstring gatherStats(); virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const std::wstring &featureName, int x, int y, int z); private: typedef struct _SaveThreadData diff --git a/Minecraft.Client/Network/ServerCommandDispatcher.cpp b/Minecraft.Client/Network/ServerCommandDispatcher.cpp index 736e4209f..b9da8662d 100644 --- a/Minecraft.Client/Network/ServerCommandDispatcher.cpp +++ b/Minecraft.Client/Network/ServerCommandDispatcher.cpp @@ -52,7 +52,7 @@ ServerCommandDispatcher::ServerCommandDispatcher() Command::setLogger(this); } -void ServerCommandDispatcher::logAdminCommand(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message, int customData, const wstring& additionalMessage) +void ServerCommandDispatcher::logAdminCommand(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const std::wstring& message, int customData, const std::wstring& additionalMessage) { PlayerList *playerList = MinecraftServer::getInstance()->getPlayers(); //for (Player player : MinecraftServer.getInstance().getPlayers().players) diff --git a/Minecraft.Client/Network/ServerCommandDispatcher.h b/Minecraft.Client/Network/ServerCommandDispatcher.h index eaa98679b..8f5261914 100644 --- a/Minecraft.Client/Network/ServerCommandDispatcher.h +++ b/Minecraft.Client/Network/ServerCommandDispatcher.h @@ -7,5 +7,5 @@ class ServerCommandDispatcher : public CommandDispatcher, public AdminLogCommand { public: ServerCommandDispatcher(); - void logAdminCommand(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L""); + void logAdminCommand(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const std::wstring& message = L"", int customData = -1, const std::wstring& additionalMessage = L""); }; \ No newline at end of file diff --git a/Minecraft.Client/Network/ServerConnection.cpp b/Minecraft.Client/Network/ServerConnection.cpp index a22549f6f..5a8321865 100644 --- a/Minecraft.Client/Network/ServerConnection.cpp +++ b/Minecraft.Client/Network/ServerConnection.cpp @@ -114,7 +114,7 @@ void ServerConnection::tick() } -bool ServerConnection::addPendingTextureRequest(const wstring &textureName) +bool ServerConnection::addPendingTextureRequest(const std::wstring &textureName) { AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); if( it == m_pendingTextureRequests.end() ) @@ -129,7 +129,7 @@ bool ServerConnection::addPendingTextureRequest(const wstring &textureName) return true; } -void ServerConnection::handleTextureReceived(const wstring &textureName) +void ServerConnection::handleTextureReceived(const std::wstring &textureName) { AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); if( it != m_pendingTextureRequests.end() ) @@ -146,7 +146,7 @@ void ServerConnection::handleTextureReceived(const wstring &textureName) } } -void ServerConnection::handleTextureAndGeometryReceived(const wstring &textureName) +void ServerConnection::handleTextureAndGeometryReceived(const std::wstring &textureName) { AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); if( it != m_pendingTextureRequests.end() ) diff --git a/Minecraft.Client/Network/ServerConnection.h b/Minecraft.Client/Network/ServerConnection.h index e4105675f..7d95157e8 100644 --- a/Minecraft.Client/Network/ServerConnection.h +++ b/Minecraft.Client/Network/ServerConnection.h @@ -24,7 +24,7 @@ private: vector< std::shared_ptr > players; // 4J - When the server requests a texture, it should add it to here while we are waiting for it - vector m_pendingTextureRequests; + vector m_pendingTextureRequests; public: MinecraftServer *server; @@ -42,8 +42,8 @@ public: void tick(); // 4J Added - bool addPendingTextureRequest(const wstring &textureName); - void handleTextureReceived(const wstring &textureName); - void handleTextureAndGeometryReceived(const wstring &textureName); + bool addPendingTextureRequest(const std::wstring &textureName); + void handleTextureReceived(const std::wstring &textureName); + void handleTextureAndGeometryReceived(const std::wstring &textureName); void handleServerSettingsChanged(std::shared_ptr packet); }; diff --git a/Minecraft.Client/Network/ServerInterface.h b/Minecraft.Client/Network/ServerInterface.h index b504b3952..9f0988c94 100644 --- a/Minecraft.Client/Network/ServerInterface.h +++ b/Minecraft.Client/Network/ServerInterface.h @@ -3,27 +3,27 @@ using namespace std; class ServerInterface { - virtual int getConfigInt(const wstring &name, int defaultValue) = 0; - virtual wstring getConfigString(const wstring &name, const wstring &defaultValue) = 0; - virtual bool getConfigBoolean(const wstring &name, bool defaultValue) = 0; - virtual void setProperty(wstring &propertyName, void *value) = 0; + virtual int getConfigInt(const std::wstring &name, int defaultValue) = 0; + virtual std::wstring getConfigString(const std::wstring &name, const std::wstring &defaultValue) = 0; + virtual bool getConfigBoolean(const std::wstring &name, bool defaultValue) = 0; + virtual void setProperty(std::wstring &propertyName, void *value) = 0; virtual void configSave() = 0; - virtual wstring getConfigPath() = 0; - virtual wstring getServerIp() = 0; + virtual std::wstring getConfigPath() = 0; + virtual std::wstring getServerIp() = 0; virtual int getServerPort() = 0; - virtual wstring getServerName() = 0; - virtual wstring getServerVersion() = 0; + virtual std::wstring getServerName() = 0; + virtual std::wstring getServerVersion() = 0; virtual int getPlayerCount() = 0; virtual int getMaxPlayers() = 0; - virtual wstring[] getPlayerNames() = 0; - virtual wstring getWorldName() = 0; - virtual wstring getPluginNames() = 0; + virtual std::wstring[] getPlayerNames() = 0; + virtual std::wstring getWorldName() = 0; + virtual std::wstring getPluginNames() = 0; virtual void disablePlugin() = 0; - virtual wstring runCommand(const wstring &command) = 0; + virtual std::wstring runCommand(const std::wstring &command) = 0; virtual bool isDebugging() = 0; // Logging - virtual void info(const wstring &string) = 0; - virtual void warn(const wstring &string) = 0; - virtual void error(const wstring &string) = 0; - virtual void debug(const wstring &string) = 0; + virtual void info(const std::wstring &string) = 0; + virtual void warn(const std::wstring &string) = 0; + virtual void error(const std::wstring &string) = 0; + virtual void debug(const std::wstring &string) = 0; }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Storage.h index be5d57fd7..68fb8bc47 100644 --- a/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Storage.h @@ -474,7 +474,7 @@ public: 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); - bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); + bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const std::wstring &Filename); eTitleStorageState TMSPP_GetTitleStorageState(int iPad); void TMSPP_ClearTitleStorageState(int iPad); diff --git a/Minecraft.Client/Platform/Durango/Durango_App.cpp b/Minecraft.Client/Platform/Durango/Durango_App.cpp index d4105be5d..aa5f518aa 100644 --- a/Minecraft.Client/Platform/Durango/Durango_App.cpp +++ b/Minecraft.Client/Platform/Durango/Durango_App.cpp @@ -169,7 +169,7 @@ void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType) int CConsoleMinecraftApp::LoadLocalDLCImages() { - std::unordered_map *pDLCInfoA=app.GetDLCInfo(); + std::unordered_map *pDLCInfoA=app.GetDLCInfo(); // 4J-PB - Any local graphic files for the Minecraft Store? for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) { @@ -183,7 +183,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImages() void CConsoleMinecraftApp::FreeLocalDLCImages() { // 4J-PB - Any local graphic files for the Minecraft Store? - std::unordered_map *pDLCInfoA=app.GetDLCInfo(); + std::unordered_map *pDLCInfoA=app.GetDLCInfo(); for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) { @@ -263,7 +263,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame app.ClearTerrainFeaturePosition(); - wstring wWorldName = L"TestWorld"; + std::wstring wWorldName = L"TestWorld"; StorageManager.ResetSaveData(); StorageManager.SetSaveTitle(wWorldName.c_str()); diff --git a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.cpp b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.cpp index f4d4978b8..983efb9d4 100644 --- a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.cpp +++ b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.cpp @@ -408,7 +408,7 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperation(); m_statNames->Clear(); - for(wstring name : m_leaderboardStatNames[difficulty][type]) + for(std::wstring name : m_leaderboardStatNames[difficulty][type]) { m_statNames->Append(ref new P::String(name.c_str())); } @@ -548,7 +548,7 @@ void DurangoLeaderboardManager::updateStatsInfo(int userIndex, int difficulty, E } int statIndex = 0, sumScores = 0; - for(wstring statName : m_leaderboardStatNames[difficulty][type]) + for(std::wstring statName : m_leaderboardStatNames[difficulty][type]) { bool found = false; for(auto result : statsResult) @@ -585,7 +585,7 @@ void DurangoLeaderboardManager::GetProfilesCallback(LPVOID param, std::vector 0) { - dlm->m_displayNames = vector(); + dlm->m_displayNames = vector(); for (int i = 0; i < profiles.size(); i++) { dlm->m_displayNames.push_back(profiles[i]->GameDisplayName->Data()); @@ -699,7 +699,7 @@ void DurangoLeaderboardManager::setState(EStatsState newState) LeaveCriticalSection(&m_csStatsState); } -wstring DurangoLeaderboardManager::stateToString(EStatsState eState) +std::wstring DurangoLeaderboardManager::stateToString(EStatsState eState) { switch (eState) { diff --git a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.h b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.h index 3b0c005f6..b04fc6dae 100644 --- a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.h +++ b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.h @@ -35,12 +35,12 @@ private: unsigned int m_maxRank; MXS::XboxLiveContext^ m_xboxLiveContext; - wstring m_leaderboardNames[4][eStatsType_MAX]; - wstring m_socialLeaderboardNames[4][eStatsType_MAX]; - std::vector m_leaderboardStatNames[4][eStatsType_MAX]; + std::wstring m_leaderboardNames[4][eStatsType_MAX]; + std::wstring m_socialLeaderboardNames[4][eStatsType_MAX]; + std::vector m_leaderboardStatNames[4][eStatsType_MAX]; // Display names for the current scores - std::vector m_displayNames; + std::vector m_displayNames; bool m_waitingForProfiles; int m_difficulty; @@ -90,5 +90,5 @@ private: EStatsState getState(); void setState(EStatsState newState); - wstring stateToString(EStatsState eState); + std::wstring stateToString(EStatsState eState); }; diff --git a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.cpp b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.cpp index 03e37e037..dda2cf0db 100644 --- a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.cpp +++ b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.cpp @@ -16,14 +16,14 @@ namespace WFC = Windows::Foundation::Collections; namespace CC = concurrency; -StatParam::StatParam(const wstring &base) +StatParam::StatParam(const std::wstring &base) { m_base = base; //m_numArgs = numArgs; m_args = vector(); unsigned int count=0; - wstring::size_type pos =base.find(L"*"); + std::wstring::size_type pos =base.find(L"*"); while(pos!=string::npos) { count++; @@ -46,14 +46,14 @@ void StatParam::addArgs(int v1, ...) va_end(argptr); } -vector *StatParam::getStats() +vector *StatParam::getStats() { - vector *out = new vector(); + vector *out = new vector(); static const int MAXSIZE = 256; - static const wstring SUBSTR = L"*"; + static const std::wstring SUBSTR = L"*"; - wstring wstr_itr, wstr_num; + std::wstring wstr_itr, wstr_num; if (m_args.size() <= 0 || m_numArgs <= 0) { @@ -69,10 +69,10 @@ vector *StatParam::getStats() { for (int j=0; j *DurangoStatsDebugger::getStats() +vector *DurangoStatsDebugger::getStats() { - vector *out = new vector(); + vector *out = new vector(); for (auto it = m_stats.begin(); it!=m_stats.end(); it++) { - vector *sublist = (*it)->getStats(); + vector *sublist = (*it)->getStats(); out->insert(out->end(), sublist->begin(), sublist->end()); } @@ -322,11 +322,11 @@ void DurangoStatsDebugger::PrintStats(int iPad) { if (instance == NULL) instance = Initialize(); - vector *tmp = instance->getStats(); + vector *tmp = instance->getStats(); instance->m_printQueue.insert(instance->m_printQueue.end(), tmp->begin(), tmp->end()); // app.DebugPrintf("[DEBUG] START\n"); - // for (wstring t : *tmp) app.DebugPrintf("[DEBUG] %s\n", wstringtofilename(t)); + // for (std::wstring t : *tmp) app.DebugPrintf("[DEBUG] %s\n", wstringtofilename(t)); // app.DebugPrintf("[DEBUG] END\n"); instance->retrieveStats(iPad); @@ -407,7 +407,7 @@ void DurangoStatsDebugger::retrieveStats(int iPad) // Create Stat retrieval threads until there is no long any stats to start retrieving. while ( !instance->m_printQueue.empty() ) { - vector *printing = new vector(); + vector *printing = new vector(); if (m_printQueue.size() > R_SIZE) { diff --git a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.h b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.h index 80218c9d2..4c3f5d22b 100644 --- a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.h +++ b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.h @@ -11,17 +11,17 @@ namespace MXSL = Microsoft::Xbox::Services::Leaderboard; class StatParam { private: - wstring m_base; + std::wstring m_base; int m_numArgs; vector m_args; public: - StatParam(const wstring &base); + StatParam(const std::wstring &base); void addArgs(int v1, ...); - vector *getStats(); + vector *getStats(); }; @@ -67,7 +67,7 @@ protected: vector m_stats; - vector *getStats(); + vector *getStats(); public: static DurangoStatsDebugger *Initialize(); @@ -75,15 +75,15 @@ public: static void PrintStats(int iPad); private: - vector m_printQueue; + vector m_printQueue; void retrieveStats(int iPad); typedef struct { int m_iPad; - wstring m_statName; - wstring m_score; + std::wstring m_statName; + std::wstring m_score; } StatResult; CRITICAL_SECTION m_retrievedStatsLock; diff --git a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.cpp b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.cpp index 75226c7c5..f85448526 100644 --- a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.cpp +++ b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.cpp @@ -22,14 +22,14 @@ DQRNetworkManager::ePartyProcessType DQRNetworkManager::m_partyProcess = DQRNetw bool DQRNetworkManager::m_inviteReceived = false; int DQRNetworkManager::m_bootUserIndex; -wstring DQRNetworkManager::m_bootSessionName; -wstring DQRNetworkManager::m_bootServiceConfig; -wstring DQRNetworkManager::m_bootSessionTemplate; +std::wstring DQRNetworkManager::m_bootSessionName; +std::wstring DQRNetworkManager::m_bootServiceConfig; +std::wstring DQRNetworkManager::m_bootSessionTemplate; DQRNetworkManager * DQRNetworkManager::s_pDQRManager = NULL; //using namespace Windows::Xbox::Networking; -DQRNetworkManager::SessionInfo::SessionInfo(wstring& sessionName, wstring& serviceConfig, wstring& sessionTemplate) +DQRNetworkManager::SessionInfo::SessionInfo(std::wstring& sessionName, std::wstring& serviceConfig, std::wstring& sessionTemplate) { m_detailsValid = true; m_sessionName = sessionName; @@ -782,7 +782,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetPlayerByXuid(PlayerUID xuid) } // Retrieve player display name by gamertag -wstring DQRNetworkManager::GetDisplayNameByGamertag(wstring gamertag) +std::wstring DQRNetworkManager::GetDisplayNameByGamertag(std::wstring gamertag) { if (m_displayNames.find(gamertag) != m_displayNames.end()) { @@ -2184,7 +2184,7 @@ int DQRNetworkManager::HostGameThreadProc() if( m_currentUserMask & ( 1 << i ) && ProfileManager.IsSignedIn(i)) { auto user = ProfileManager.GetUser(i); - wstring displayName = ProfileManager.GetDisplayName(i); + std::wstring displayName = ProfileManager.GetDisplayName(i); DQRNetworkPlayer* pPlayer = new DQRNetworkPlayer(this, ( ( smallId == m_hostSmallId ) ? DQRNetworkPlayer::DNP_TYPE_HOST : DQRNetworkPlayer::DNP_TYPE_LOCAL ), true, i, localSessionAddress); pPlayer->SetSmallId(smallId); @@ -3031,7 +3031,7 @@ void DQRNetworkManager::GetProfileCallback(LPVOID pParam, Microsoft::Xbox::Servi } // Set player display name -void DQRNetworkManager::SetDisplayName(PlayerUID xuid, wstring displayName) +void DQRNetworkManager::SetDisplayName(PlayerUID xuid, std::wstring displayName) { EnterCriticalSection(&m_csRoomSyncData); for (int i = 0; i < m_roomSyncData.playerCount; i++) diff --git a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h index dc4929852..eee2d5a3b 100644 --- a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h +++ b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h @@ -119,12 +119,12 @@ public: class SessionInfo { public: - SessionInfo(wstring& sessionName, wstring& serviceConfig, wstring& sessionTemplate); + SessionInfo(std::wstring& sessionName, std::wstring& serviceConfig, std::wstring& sessionTemplate); SessionInfo(); bool m_detailsValid; - wstring m_sessionName; - wstring m_serviceConfig; - wstring m_sessionTemplate; + std::wstring m_sessionName; + std::wstring m_serviceConfig; + std::wstring m_sessionTemplate; }; static const int MAX_LOCAL_PLAYER_COUNT = 4; @@ -153,7 +153,7 @@ public: { public:; DQRNetworkPlayer* m_pPlayer; - wstring m_name; + std::wstring m_name; unsigned int m_sessionAddress; int m_channel; bool m_sync; @@ -181,7 +181,7 @@ public: DQRNetworkPlayer *GetPlayerByIndex(int idx); DQRNetworkPlayer *GetPlayerBySmallId(int idx); DQRNetworkPlayer *GetPlayerByXuid(PlayerUID xuid); - wstring GetDisplayNameByGamertag(wstring gamertag); + std::wstring GetDisplayNameByGamertag(std::wstring gamertag); DQRNetworkPlayer *GetLocalPlayerByUserIndex(int idx); DQRNetworkPlayer *GetHostPlayer(); int GetSessionIndex(DQRNetworkPlayer *player); @@ -223,16 +223,16 @@ public: public: SessionSearchResult() { m_extData = NULL; } ~SessionSearchResult() { free(m_extData); } - wstring m_partyId; - wstring m_sessionName; + std::wstring m_partyId; + std::wstring m_sessionName; // These names/xuids reflect the server controlled list of who is actually in the game - wstring m_playerNames[MAX_ONLINE_PLAYER_COUNT]; + std::wstring m_playerNames[MAX_ONLINE_PLAYER_COUNT]; PlayerUID m_playerXuids[MAX_ONLINE_PLAYER_COUNT]; int m_playerCount; // This count & set of xuids reflects the session document list of who is in the game - wstring m_sessionXuids[MAX_ONLINE_PLAYER_COUNT]; + std::wstring m_sessionXuids[MAX_ONLINE_PLAYER_COUNT]; int m_usedSlotCount; void *m_extData; @@ -488,7 +488,7 @@ public: bool JoinPartyFromSearchResult(SessionSearchResult *searchResult, int playerMask); void CancelJoinPartyFromSearchResult(); void RequestDisplayName(DQRNetworkPlayer *player); - void SetDisplayName(PlayerUID xuid, wstring displayName); + void SetDisplayName(PlayerUID xuid, std::wstring displayName); private: __int64 m_playersLeftPartyTime; @@ -509,7 +509,7 @@ private: int m_sessionResultCount; bool m_cancelJoinFromSearchResult; - map m_displayNames; // Player display names by gamertag + map m_displayNames; // Player display names by gamertag @@ -521,9 +521,9 @@ private: } ePartyProcessType; static int m_bootUserIndex; static ePartyProcessType m_partyProcess; - static wstring m_bootSessionName; - static wstring m_bootServiceConfig; - static wstring m_bootSessionTemplate; + static std::wstring m_bootSessionName; + static std::wstring m_bootServiceConfig; + static std::wstring m_bootSessionTemplate; static bool m_inviteReceived; static DQRNetworkManager *s_pDQRManager; diff --git a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager_FriendSessions.cpp b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager_FriendSessions.cpp index a78ed8853..644bc6c3f 100644 --- a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager_FriendSessions.cpp +++ b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager_FriendSessions.cpp @@ -421,7 +421,7 @@ int DQRNetworkManager::GetFriendsThreadProc() } for( int j = 0; j < m_sessionSearchResults[i].m_usedSlotCount; j++ ) { - m_sessionSearchResults[i].m_sessionXuids[j] = wstring( newSessionVector[i]->Members->GetAt(j)->XboxUserId->Data() ); + m_sessionSearchResults[i].m_sessionXuids[j] = std::wstring( newSessionVector[i]->Members->GetAt(j)->XboxUserId->Data() ); } m_sessionSearchResults[i].m_extData = malloc( sizeof(GameSessionData) ); diff --git a/Minecraft.Client/Platform/Durango/Network/DQRNetworkPlayer.cpp b/Minecraft.Client/Platform/Durango/Network/DQRNetworkPlayer.cpp index 404c872c2..e25f09aa5 100644 --- a/Minecraft.Client/Platform/Durango/Network/DQRNetworkPlayer.cpp +++ b/Minecraft.Client/Platform/Durango/Network/DQRNetworkPlayer.cpp @@ -192,13 +192,13 @@ void DQRNetworkPlayer::SetName(const wchar_t *name) } // Return display name (if display name is not set, return name instead) -wstring DQRNetworkPlayer::GetDisplayName() +std::wstring DQRNetworkPlayer::GetDisplayName() { return (m_displayName == L"") ? m_name : m_displayName; } // Set display name -void DQRNetworkPlayer::SetDisplayName(wstring displayName) +void DQRNetworkPlayer::SetDisplayName(std::wstring displayName) { m_displayName = displayName; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.cpp b/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.cpp index 304ad988a..5a2e2a01b 100644 --- a/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.cpp +++ b/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.cpp @@ -97,7 +97,7 @@ const wchar_t *NetworkPlayerDurango::GetOnlineName() return m_dqrPlayer->GetName(); } -wstring NetworkPlayerDurango::GetDisplayName() +std::wstring NetworkPlayerDurango::GetDisplayName() { return m_dqrPlayer->GetDisplayName(); } diff --git a/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.h b/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.h index e4051b1ed..e78d8a973 100644 --- a/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.h +++ b/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.h @@ -28,7 +28,7 @@ public: virtual void SetSocket(Socket *pSocket); virtual Socket *GetSocket(); virtual const wchar_t *GetOnlineName(); - virtual wstring GetDisplayName(); + virtual std::wstring GetDisplayName(); virtual PlayerUID GetUID(); void SetUID(PlayerUID UID); diff --git a/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.cpp b/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.cpp index 74445a433..c2c7a253b 100644 --- a/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.cpp +++ b/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.cpp @@ -744,12 +744,12 @@ bool CPlatformNetworkManagerDurango::SystemFlagGet(INetworkPlayer *pNetworkPlaye return false; } -wstring CPlatformNetworkManagerDurango::GatherStats() +std::wstring CPlatformNetworkManagerDurango::GatherStats() { return L""; } -wstring CPlatformNetworkManagerDurango::GatherRTTStats() +std::wstring CPlatformNetworkManagerDurango::GatherRTTStats() { return L""; } @@ -883,7 +883,7 @@ INetworkPlayer * CPlatformNetworkManagerDurango::GetPlayerBySmallId(unsigned cha return getNetworkPlayer(m_pDQRNet->GetPlayerBySmallId(smallId)); } -wstring CPlatformNetworkManagerDurango::GetDisplayNameByGamertag(wstring gamertag) +std::wstring CPlatformNetworkManagerDurango::GetDisplayNameByGamertag(std::wstring gamertag) { return m_pDQRNet->GetDisplayNameByGamertag(gamertag); } diff --git a/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.h b/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.h index 40d662f00..11a988445 100644 --- a/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.h +++ b/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.h @@ -28,7 +28,7 @@ public: virtual INetworkPlayer *GetPlayerByIndex(int playerIndex); virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid); virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId); - virtual wstring GetDisplayNameByGamertag(wstring gamertag); + virtual std::wstring GetDisplayNameByGamertag(std::wstring gamertag); virtual bool ShouldMessageForFullSession(); virtual INetworkPlayer *GetHostPlayer(); @@ -120,8 +120,8 @@ private: float m_lastPlayerEventTimeStart; public: - wstring GatherStats(); - wstring GatherRTTStats(); + std::wstring GatherStats(); + std::wstring GatherRTTStats(); private: vector friendsSessions[XUSER_MAX_COUNT]; diff --git a/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.cpp b/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.cpp index f53e3f824..c692fe0f5 100644 --- a/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.cpp +++ b/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.cpp @@ -971,9 +971,9 @@ DurangoStats *CDurangoTelemetryManager::durangoStats() return (DurangoStats*) GenericStats::getInstance(); } -wstring CDurangoTelemetryManager::guid2str(LPCGUID guid) +std::wstring CDurangoTelemetryManager::guid2str(LPCGUID guid) { - wstring out = L"GUID<"; + std::wstring out = L"GUID<"; out += _toString(guid->Data1); out += L":"; out += _toString(guid->Data2); diff --git a/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.h b/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.h index c4e6b23aa..2e78162b9 100644 --- a/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.h +++ b/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.h @@ -9,7 +9,7 @@ class CDurangoTelemetryManager : public CTelemetryManager public: static GUID ZERO_GUID; - std::unordered_map m_multiplayerRoundStartTimes; + std::unordered_map m_multiplayerRoundStartTimes; CDurangoTelemetryManager(); @@ -46,5 +46,5 @@ public: protected: DurangoStats *durangoStats(); - wstring guid2str(LPCGUID guid); + std::wstring guid2str(LPCGUID guid); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Linux/Linux_App.cpp b/Minecraft.Client/Platform/Linux/Linux_App.cpp index 5c94c4fc8..85421ed0e 100644 --- a/Minecraft.Client/Platform/Linux/Linux_App.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_App.cpp @@ -71,7 +71,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame app.ClearTerrainFeaturePosition(); - wstring wWorldName = L"TestWorld"; + std::wstring wWorldName = L"TestWorld"; StorageManager.ResetSaveData(); StorageManager.SetSaveTitle(wWorldName.c_str()); diff --git a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp index cb4fd70c1..3b4043e55 100644 --- a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp @@ -568,7 +568,7 @@ int StartMinecraftThreadProc( void* lpParameter ) AABB::UseDefaultThreadStorage(); Tesselator::CreateNewThreadStorage(1024*1024); RenderManager.InitialiseContext(); - Minecraft::start(wstring(),wstring()); + Minecraft::start(std::wstring(),std::wstring()); delete Tesselator::getInstance(); return 0; } @@ -991,7 +991,7 @@ Vec3::resetPool(); vector vRichPresenceStrings; -// convert wstring to UTF-8 string +// convert std::wstring to UTF-8 string std::string wstring_to_utf8 (const std::wstring& str) { std::wstring_convert> myconv; diff --git a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Profile.h index 03651b8fe..cfa964266 100644 --- a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Profile.h @@ -88,7 +88,7 @@ public: int GetPrimaryPad(); void SetPrimaryPad(int iPad); char* GetGamertag(int iPad); - wstring GetDisplayName(int iPad); + std::wstring GetDisplayName(int iPad); bool IsFullVersion(); void SetFullVersion(bool bFull); void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam); diff --git a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Storage.h index f586df2cb..230b540b8 100644 --- a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Storage.h @@ -405,7 +405,7 @@ public: void SetDLCProductCode(const char* szProductCode); void SetProductUpgradeKey(const char* szKey); bool CheckForTrialUpgradeKey(void( *Func)(LPVOID, bool),LPVOID lpParam); - void SetDLCInfoMap(std::unordered_map* pSONYDLCMap); + void SetDLCInfoMap(std::unordered_map* pSONYDLCMap); }; extern C4JStorage StorageManager; diff --git a/Minecraft.Client/Platform/Orbis/Leaderboards/OrbisLeaderboardManager.cpp b/Minecraft.Client/Platform/Orbis/Leaderboards/OrbisLeaderboardManager.cpp index 858c85d20..f7556b5d0 100644 --- a/Minecraft.Client/Platform/Orbis/Leaderboards/OrbisLeaderboardManager.cpp +++ b/Minecraft.Client/Platform/Orbis/Leaderboards/OrbisLeaderboardManager.cpp @@ -1005,8 +1005,8 @@ void OrbisLeaderboardManager::initReadScoreStruct(ReadScore &out, SceNpScoreRank out.m_uid.setOnlineID( rankData.npId.handle, true ); out.m_rank = rankData.rank; - // Convert to wstring and copy name. - wstring wstrName = convStringToWstring( string(rankData.npId.handle.data) ).c_str(); + // Convert to std::wstring and copy name. + std::wstring wstrName = convStringToWstring( string(rankData.npId.handle.data) ).c_str(); //memcpy(&out.m_name, wstrName.c_str(), XUSER_NAME_SIZE); out.m_name=wstrName; } diff --git a/Minecraft.Client/Platform/Orbis/Orbis_App.cpp b/Minecraft.Client/Platform/Orbis/Orbis_App.cpp index 731803892..2335af057 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_App.cpp +++ b/Minecraft.Client/Platform/Orbis/Orbis_App.cpp @@ -99,7 +99,7 @@ bool CConsoleMinecraftApp::IsAmericanSKU() SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle) { - wstring wstrTemp=convStringToWstring(pchTitle); + std::wstring wstrTemp=convStringToWstring(pchTitle); AUTO_VAR(it, m_SONYDLCMap.find(wstrTemp)); if(it == m_SONYDLCMap.end()) @@ -191,7 +191,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() // push this into a vector - wstring wstrTemp=convStringToWstring(chDLCTitle); + std::wstring wstrTemp=convStringToWstring(chDLCTitle); m_SONYDLCMap[wstrTemp]=pDLCInfo; } CloseHandle(file); @@ -288,7 +288,7 @@ int CConsoleMinecraftApp::GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameI int CConsoleMinecraftApp::LoadLocalDLCImages() { // 4J-PB - Any local graphic files for the Minecraft Store? - std::unordered_map*pDLCInfoA=app.GetSonyDLCMap(); + std::unordered_map*pDLCInfoA=app.GetSonyDLCMap(); for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) { SONYDLC * pDLCInfo=(*it).second; @@ -301,7 +301,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImages() void CConsoleMinecraftApp::FreeLocalDLCImages() { // 4J-PB - Any local graphic files for the Minecraft Store? - std::unordered_map*pDLCInfoA=app.GetSonyDLCMap(); + std::unordered_map*pDLCInfoA=app.GetSonyDLCMap(); for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) { SONYDLC * pDLCInfo=(*it).second; @@ -394,7 +394,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame app.ClearTerrainFeaturePosition(); - wstring wWorldName = L"TestWorld"; + std::wstring wWorldName = L"TestWorld"; StorageManager.ResetSaveData(); StorageManager.SetSaveTitle(wWorldName.c_str()); diff --git a/Minecraft.Client/Platform/Orbis/Orbis_App.h b/Minecraft.Client/Platform/Orbis/Orbis_App.h index 69ea7dfbc..d7f395533 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_App.h +++ b/Minecraft.Client/Platform/Orbis/Orbis_App.h @@ -161,7 +161,7 @@ public: bool DLCAlreadyPurchased(char *pchTitle); char *GetSkuIDFromProductList(); void GetDLCSkuIDFromProductList(char *,char *); - std::unordered_map* GetSonyDLCMap() { return &m_SONYDLCMap; } + std::unordered_map* GetSonyDLCMap() { return &m_SONYDLCMap; } static void CommerceInitCallback(LPVOID lpParam,int err); static void CommerceGetCategoriesCallback(LPVOID lpParam,int err); static void CommerceGetProductListCallback(LPVOID lpParam,int err); @@ -210,7 +210,7 @@ private: // SonyCommerce::ProductInfoDetailed m_ProductInfoDetailed; PRODUCTCODES ProductCodes; - std::unordered_map m_SONYDLCMap; + std::unordered_map m_SONYDLCMap; bool m_bVoiceChatAndUGCRestricted; diff --git a/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp b/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp index 814533725..d88c1c4f1 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp +++ b/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp @@ -757,7 +757,7 @@ int StartMinecraftThreadProc( void* lpParameter ) AABB::UseDefaultThreadStorage(); Tesselator::CreateNewThreadStorage(1024*1024); RenderManager.InitialiseContext(); - Minecraft::start(wstring(),wstring()); + Minecraft::start(std::wstring(),std::wstring()); delete Tesselator::getInstance(); return 0; } @@ -1462,8 +1462,8 @@ int main(int argc, const char *argv[] ) vector vRichPresenceStrings; -// convert wstring to UTF-8 string -std::string wstring_to_utf8 (const std::wstring& str) +// convert std::wstring to UTF-8 string +std::string std::wstring_to_utf8 (const std::wstring& str) { std::wstring_convert> myconv; return myconv.to_bytes(str); @@ -1475,7 +1475,7 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) LPCWSTR wchString=app.GetString(iID); std::wstring srcString = wchString; - std::string dstString = wstring_to_utf8(srcString); + std::string dstString = std::wstring_to_utf8(srcString); int dst_len = dstString.size()+1; uint8_t *strUtf8=(uint8_t *)malloc(dst_len); diff --git a/Minecraft.Client/Platform/Orbis/Orbis_PlayerUID.cpp b/Minecraft.Client/Platform/Orbis/Orbis_PlayerUID.cpp index 79a0ce409..633c43187 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_PlayerUID.cpp +++ b/Minecraft.Client/Platform/Orbis/Orbis_PlayerUID.cpp @@ -41,7 +41,7 @@ PlayerUID::PlayerUID(SceUserServiceUserId userID, SceNpOnlineId& onlineID, bool setOnlineID(onlineID, bSignedInPSN); } -PlayerUID::PlayerUID(wstring fromString) +PlayerUID::PlayerUID(std::wstring fromString) { // create for the format P_5e7ff8372ea9_00000004_Mark_4J @@ -53,14 +53,14 @@ PlayerUID::PlayerUID(wstring fromString) // parse the mac address next for(int i=0;i<6;i++) { - wstring macDigit = fromString.substr(2+(i*2),2); + std::wstring macDigit = fromString.substr(2+(i*2),2); m_macAddress[i] = _fromHEXString(macDigit); } int userIdLen = 0; // parse the userID - wstring userIDDigits = L""; + std::wstring userIDDigits = L""; while(fromString.at(15 + userIdLen) != L'_') { @@ -71,7 +71,7 @@ PlayerUID::PlayerUID(wstring fromString) m_userID = _fromString(userIDDigits); // finally, the onlineID, if there is one - wstring onlineID = fromString.substr(15 + userIdLen + 1); + std::wstring onlineID = fromString.substr(15 + userIdLen + 1); if(onlineID.size() > 0) { wcstombs(m_onlineID, onlineID.c_str(), 16); diff --git a/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Profile.h index 888c38cc5..288c8cb9e 100644 --- a/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Profile.h @@ -78,7 +78,7 @@ public: int GetPrimaryPad(); void SetPrimaryPad(int iPad); char* GetGamertag(int iPad); - wstring GetDisplayName(int iPad); + std::wstring GetDisplayName(int iPad); bool IsFullVersion(); void SetFullVersion(bool bFull); void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam); diff --git a/Minecraft.Client/Platform/PS3/Leaderboards/PS3LeaderboardManager.cpp b/Minecraft.Client/Platform/PS3/Leaderboards/PS3LeaderboardManager.cpp index a00908f7d..1ea484de9 100644 --- a/Minecraft.Client/Platform/PS3/Leaderboards/PS3LeaderboardManager.cpp +++ b/Minecraft.Client/Platform/PS3/Leaderboards/PS3LeaderboardManager.cpp @@ -990,8 +990,8 @@ void PS3LeaderboardManager::initReadScoreStruct(ReadScore &out, SceNpScoreRankDa out.m_uid.setOnlineID( rankData.npId.handle, true ); out.m_rank = rankData.rank; - // Convert to wstring and copy name. - wstring wstrName = convStringToWstring( string(rankData.onlineName.data) ).c_str(); + // Convert to std::wstring and copy name. + std::wstring wstrName = convStringToWstring( string(rankData.onlineName.data) ).c_str(); //memcpy(&out.m_name, wstrName.c_str(), XUSER_NAME_SIZE); out.m_name=wstrName; } diff --git a/Minecraft.Client/Platform/PS3/PS3_App.cpp b/Minecraft.Client/Platform/PS3/PS3_App.cpp index 575336597..80e64602b 100644 --- a/Minecraft.Client/Platform/PS3/PS3_App.cpp +++ b/Minecraft.Client/Platform/PS3/PS3_App.cpp @@ -105,7 +105,7 @@ bool CConsoleMinecraftApp::IsAmericanSKU() SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle) { - wstring wstrTemp=convStringToWstring(pchTitle); + std::wstring wstrTemp=convStringToWstring(pchTitle); SONYDLC *pTemp=m_SONYDLCMap.at(wstrTemp); return pTemp; @@ -174,7 +174,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() // push this into a vector - wstring wstrTemp=convStringToWstring(chDLCTitle); + std::wstring wstrTemp=convStringToWstring(chDLCTitle); m_SONYDLCMap[wstrTemp]=pDLCInfo; } CloseHandle(file); @@ -466,7 +466,7 @@ void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType) } -LoadSaveDataThreadParam* LoadSaveFromDisk(const wstring& pathName) +LoadSaveDataThreadParam* LoadSaveFromDisk(const std::wstring& pathName) { File saveFile(pathName); __int64 fileSize = saveFile.length(); @@ -501,7 +501,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame - app.ClearTerrainFeaturePosition(); wstring wWorldName = L"TestWorld"; + app.ClearTerrainFeaturePosition(); std::wstring wWorldName = L"TestWorld"; StorageManager.ResetSaveData(); StorageManager.SetSaveTitle(wWorldName.c_str()); @@ -519,7 +519,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; #ifdef SAVE_GAME_TO_LOAD - param->saveData = LoadSaveFromDisk(wstring(SAVE_GAME_TO_LOAD)); + param->saveData = LoadSaveFromDisk(std::wstring(SAVE_GAME_TO_LOAD)); #else param->saveData = NULL; #endif diff --git a/Minecraft.Client/Platform/PS3/PS3_App.h b/Minecraft.Client/Platform/PS3/PS3_App.h index 1498faf0b..aba7bbaf4 100644 --- a/Minecraft.Client/Platform/PS3/PS3_App.h +++ b/Minecraft.Client/Platform/PS3/PS3_App.h @@ -202,7 +202,7 @@ private: // SonyCommerce::ProductInfoDetailed m_ProductInfoDetailed; PRODUCTCODES ProductCodes; - std::unordered_map m_SONYDLCMap; + std::unordered_map m_SONYDLCMap; bool m_bVoiceChatAndUGCRestricted; diff --git a/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp b/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp index b3c9856a2..e1cc711e8 100644 --- a/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp +++ b/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp @@ -951,7 +951,7 @@ int main() // 4J-PB - TRC that we need to be able to see the BD in a different titled save from the digital game if(StorageManager.GetBootTypeDisc()) { - wstring wsTemp = app.GetString(IDS_GAMENAME); + std::wstring wsTemp = app.GetString(IDS_GAMENAME); WCHAR wchTemp[64]; wsTemp.append(L" ("); mbstowcs(wchTemp,app.GetDiscProductCode(),64); @@ -991,7 +991,7 @@ int main() delete [] baSaveImage.data; } - wstring wsName=L"Graphics\\SaveChest.png"; + std::wstring wsName=L"Graphics\\SaveChest.png"; byteArray baSaveLoadIcon = app.getArchiveFile(wsName); if(baSaveLoadIcon.data!=NULL) { diff --git a/Minecraft.Client/Platform/PS3/PS3_PlayerUID.cpp b/Minecraft.Client/Platform/PS3/PS3_PlayerUID.cpp index ed5790c56..8a2d75961 100644 --- a/Minecraft.Client/Platform/PS3/PS3_PlayerUID.cpp +++ b/Minecraft.Client/Platform/PS3/PS3_PlayerUID.cpp @@ -30,7 +30,7 @@ PlayerUID::PlayerUID(CellSysutilUserId userID, SceNpOnlineId& onlineID, bool bSi setOnlineID(onlineID, bSignedInPSN); } -PlayerUID::PlayerUID(wstring fromString) +PlayerUID::PlayerUID(std::wstring fromString) { // create for the format P_5e7ff8372ea9_00000004_Mark_4J @@ -42,16 +42,16 @@ PlayerUID::PlayerUID(wstring fromString) // parse the mac address next for(int i=0;i<6;i++) { - wstring macDigit = fromString.substr(2+(i*2),2); + std::wstring macDigit = fromString.substr(2+(i*2),2); m_macAddress[i] = _fromHEXString(macDigit); } // parse the userID - wstring userIDDigits = fromString.substr(15,8); + std::wstring userIDDigits = fromString.substr(15,8); m_userID = _fromString(userIDDigits); // finally, the onlineID, if there is one - wstring onlineID = fromString.substr(24); + std::wstring onlineID = fromString.substr(24); if(onlineID.size() > 0) { wcstombs(m_onlineID, onlineID.c_str(), 16); diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/HugeMushroomTile_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/HugeMushroomTile_SPU.h index 89aad1aa5..5ad1027cd 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/HugeMushroomTile_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/HugeMushroomTile_SPU.h @@ -4,8 +4,8 @@ class HugeMushroomTile_SPU : public Tile_SPU { public: -// static const wstring TEXTURE_STEM; -// static const wstring TEXTURE_INSIDE; +// static const std::wstring TEXTURE_STEM; +// static const std::wstring TEXTURE_INSIDE; private: static const int HUGE_MUSHROOM_TEXTURE_COUNT = 2; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h index f4ba6ccfa..b40a2b50b 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h @@ -49,7 +49,7 @@ public: return getV0() + (diff * ((float) offset / 16)); //SharedConstants::WORLD_RESOLUTION)); } -// virtual wstring getName() const = 0; +// virtual std::wstring getName() const = 0; // virtual int getSourceWidth() const = 0; // virtual int getSourceHeight() const = 0; }; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeafTile_SPU.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeafTile_SPU.cpp index 673732652..be7c1d3c1 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeafTile_SPU.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeafTile_SPU.cpp @@ -8,7 +8,7 @@ // IDS_TILE_LEAVES_BIRCH, // }; // -// const wstring LeafTile::TEXTURES[2][4] = { {L"leaves", L"leaves_spruce", L"leaves", L"leaves_jungle"}, {L"leaves_opaque", L"leaves_spruce_opaque", L"leaves_opaque", L"leaves_jungle_opaque"},}; +// const std::wstring LeafTile::TEXTURES[2][4] = { {L"leaves", L"leaves_spruce", L"leaves", L"leaves_jungle"}, {L"leaves_opaque", L"leaves_spruce_opaque", L"leaves_opaque", L"leaves_jungle_opaque"},}; // from TransparentTile, since we're no longer inheriting diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp index 41a6b0764..19d27230e 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp @@ -7,10 +7,10 @@ #include "../Common/spu_assert.h" #endif -// const wstring LiquidTile::TEXTURE_LAVA_STILL = L"lava"; -// const wstring LiquidTile::TEXTURE_WATER_STILL = L"water"; -// const wstring LiquidTile::TEXTURE_WATER_FLOW = L"water_flow"; -// const wstring LiquidTile::TEXTURE_LAVA_FLOW = L"lava_flow"; +// const std::wstring LiquidTile::TEXTURE_LAVA_STILL = L"lava"; +// const std::wstring LiquidTile::TEXTURE_WATER_STILL = L"water"; +// const std::wstring LiquidTile::TEXTURE_WATER_FLOW = L"water_flow"; +// const std::wstring LiquidTile::TEXTURE_LAVA_FLOW = L"lava_flow"; #define MATH_PI (3.141592654f) diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TallGrass_SPU.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TallGrass_SPU.cpp index cf849e993..98f356ef4 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TallGrass_SPU.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TallGrass_SPU.cpp @@ -11,7 +11,7 @@ const int TallGrass_SPU::DEAD_SHRUB = 0; const int TallGrass_SPU::TALL_GRASS = 1; const int TallGrass_SPU::FERN = 2; -// const wstring TallGrass::TEXTURE_NAMES[] = {L"deadbush", L"tallgrass", L"fern"}; +// const std::wstring TallGrass::TEXTURE_NAMES[] = {L"deadbush", L"tallgrass", L"fern"}; Icon_SPU *TallGrass_SPU::getTexture(int face, int data) diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp index a11e242f2..eb768ac4c 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp @@ -575,7 +575,7 @@ void Tile_SPU::updateDefaultShape() // return this; // } // -// wstring Tile_SPU::getName() +// std::wstring Tile_SPU::getName() // { // return I18n::get(getDescriptionId() + L".name"); // } @@ -655,12 +655,12 @@ Material_SPU* Tile_SPU::getMaterial() // icon = iconRegister->registerIcon(m_textureName); // } // -// wstring Tile_SPU::getTileItemIconName() +// std::wstring Tile_SPU::getTileItemIconName() // { // return L""; // } // -// Tile *Tile_SPU::setTextureName(const wstring &name) +// Tile *Tile_SPU::setTextureName(const std::wstring &name) // { // m_textureName = name; // return this; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h index f5c9793ea..b11dd5fc2 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h @@ -223,7 +223,7 @@ private: // unsigned int descriptionId; // unsigned int useDescriptionId; // 4J Added // -// wstring m_textureName; +// std::wstring m_textureName; protected: // Icon *icon; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h index e298ae2dc..e24f293dc 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h @@ -173,7 +173,7 @@ public: // public: // ZipFile(File *file) {} // InputStream *getInputStream(ZipEntry *entry) { return NULL; } -// ZipEntry *getEntry(const wstring& name) {return NULL;} +// ZipEntry *getEntry(const std::wstring& name) {return NULL;} // void close() {} // }; // @@ -189,7 +189,7 @@ public: // static void create() {} // static void destroy() {} // static bool isKeyDown(int) {return false;} -// static wstring getKeyName(int) { return L"KEYNAME"; } +// static std::wstring getKeyName(int) { return L"KEYNAME"; } // static void enableRepeatEvents(bool) {} // static const int KEY_A = 0; // static const int KEY_B = 1; diff --git a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Profile.h index 2fc9385a1..244783786 100644 --- a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Profile.h @@ -101,7 +101,7 @@ public: int GetPrimaryPad(); void SetPrimaryPad(int iPad); char* GetGamertag(int iPad); - wstring GetDisplayName(int iPad); + std::wstring GetDisplayName(int iPad); bool IsFullVersion(); void SetFullVersion(bool bFull); diff --git a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h index 552c247d4..c8d7d4b5a 100644 --- a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h @@ -381,7 +381,7 @@ public: void SetDLCProductCode(const char* szProductCode); void SetProductUpgradeKey(const char* szKey); bool CheckForTrialUpgradeKey(void( *Func)(LPVOID, bool),LPVOID lpParam); - void SetDLCInfoMap(std::unordered_map* pSONYDLCMap); + void SetDLCInfoMap(std::unordered_map* pSONYDLCMap); void EntitlementsCallback(bool bFoundEntitlements); }; diff --git a/Minecraft.Client/Platform/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp b/Minecraft.Client/Platform/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp index e4db28b58..7e3ddf9a7 100644 --- a/Minecraft.Client/Platform/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp +++ b/Minecraft.Client/Platform/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp @@ -1012,8 +1012,8 @@ void PSVitaLeaderboardManager::initReadScoreStruct(ReadScore &out, SceNpScoreRan out.m_uid.setOnlineID( rankData.npId.handle, true ); out.m_rank = rankData.rank; - // Convert to wstring and copy name. - wstring wstrName = convStringToWstring( string(rankData.npId.handle.data) ).c_str(); + // Convert to std::wstring and copy name. + std::wstring wstrName = convStringToWstring( string(rankData.npId.handle.data) ).c_str(); //memcpy(&out.m_name, wstrName.c_str(), XUSER_NAME_SIZE); out.m_name=wstrName; } diff --git a/Minecraft.Client/Platform/PSVita/PSVita_App.cpp b/Minecraft.Client/Platform/PSVita/PSVita_App.cpp index 3696778f3..7b903ccae 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_App.cpp +++ b/Minecraft.Client/Platform/PSVita/PSVita_App.cpp @@ -94,7 +94,7 @@ bool CConsoleMinecraftApp::IsAmericanSKU() SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle) { - wstring wstrTemp=convStringToWstring(pchTitle); + std::wstring wstrTemp=convStringToWstring(pchTitle); AUTO_VAR(it, m_SONYDLCMap.find(wstrTemp)); if(it == m_SONYDLCMap.end()) @@ -105,7 +105,7 @@ SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle) } return it->second; - /*wstring wstrTemp=convStringToWstring(pchTitle); + /*std::wstring wstrTemp=convStringToWstring(pchTitle); SONYDLC *pTemp=m_SONYDLCMap.at(wstrTemp); return pTemp;*/ @@ -172,7 +172,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() // push this into a vector - wstring wstrTemp=convStringToWstring(chDLCTitle); + std::wstring wstrTemp=convStringToWstring(chDLCTitle); m_SONYDLCMap[wstrTemp]=pDLCInfo; } CloseHandle(file); @@ -304,7 +304,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame app.ClearTerrainFeaturePosition(); - wstring wWorldName = L"TestWorld"; + std::wstring wWorldName = L"TestWorld"; bool isFlat = false; __int64 seedValue = 0;//BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements diff --git a/Minecraft.Client/Platform/PSVita/PSVita_App.h b/Minecraft.Client/Platform/PSVita/PSVita_App.h index 83253f738..ce204842c 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_App.h +++ b/Minecraft.Client/Platform/PSVita/PSVita_App.h @@ -159,7 +159,7 @@ public: bool DLCAlreadyPurchased(char *pchTitle); char *GetSkuIDFromProductList(); void GetDLCSkuIDFromProductList(char *,char *); - std::unordered_map* GetSonyDLCMap() { return &m_SONYDLCMap; } + std::unordered_map* GetSonyDLCMap() { return &m_SONYDLCMap; } static void CommerceInitCallback(LPVOID lpParam,int err); static void CommerceGetCategoriesCallback(LPVOID lpParam,int err); static void CommerceGetProductListCallback(LPVOID lpParam,int err); @@ -230,7 +230,7 @@ private: // SonyCommerce::ProductInfoDetailed m_ProductInfoDetailed; PRODUCTCODES ProductCodes; - std::unordered_map m_SONYDLCMap; + std::unordered_map m_SONYDLCMap; bool m_bVoiceChatAndUGCRestricted; diff --git a/Minecraft.Client/Platform/PSVita/PSVita_PlayerUID.cpp b/Minecraft.Client/Platform/PSVita/PSVita_PlayerUID.cpp index db7f8ebfe..5ab8cfa04 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_PlayerUID.cpp +++ b/Minecraft.Client/Platform/PSVita/PSVita_PlayerUID.cpp @@ -35,7 +35,7 @@ PlayerUID::PlayerUID(int userID, SceNpOnlineId& onlineID, bool bSignedInPSN, int setOnlineID(onlineID, bSignedInPSN); } -PlayerUID::PlayerUID(wstring fromString) +PlayerUID::PlayerUID(std::wstring fromString) { // create for the format P_5e7ff8372ea9_00000004_Mark_4J @@ -47,16 +47,16 @@ PlayerUID::PlayerUID(wstring fromString) // parse the mac address next for(int i=0;i<6;i++) { - wstring macDigit = fromString.substr(2+(i*2),2); + std::wstring macDigit = fromString.substr(2+(i*2),2); m_macAddress[i] = _fromHEXString(macDigit); } // parse the userID - wstring userIDDigits = fromString.substr(15,8); + std::wstring userIDDigits = fromString.substr(15,8); m_userID = _fromString(userIDDigits); // finally, the onlineID, if there is one - wstring onlineID = fromString.substr(24); + std::wstring onlineID = fromString.substr(24); if(onlineID.size() > 0) { wcstombs(m_onlineID, onlineID.c_str(), 16); diff --git a/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Profile.h index f1bd85bbe..4e6fc606c 100644 --- a/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Profile.h @@ -76,7 +76,7 @@ public: int GetPrimaryPad(); void SetPrimaryPad(int iPad); char* GetGamertag(int iPad); - wstring GetDisplayName(int iPad); + std::wstring GetDisplayName(int iPad); bool IsFullVersion(); void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam); void SetNotificationsCallback(void ( *Func)(LPVOID, DWORD, unsigned int),LPVOID lpParam); diff --git a/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Storage.h index 896f730a7..2b8df12de 100644 --- a/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Storage.h @@ -319,7 +319,7 @@ public: 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); - // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); + // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const std::wstring &Filename); // unsigned int CRC(unsigned char *buf, int len); // enum eXBLWS diff --git a/Minecraft.Client/Platform/Windows64/Windows64_App.cpp b/Minecraft.Client/Platform/Windows64/Windows64_App.cpp index 9ce653fb9..2b10b4ac0 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Platform/Windows64/Windows64_App.cpp @@ -71,7 +71,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame app.ClearTerrainFeaturePosition(); - wstring wWorldName = L"TestWorld"; + std::wstring wWorldName = L"TestWorld"; StorageManager.ResetSaveData(); StorageManager.SetSaveTitle(wWorldName.c_str()); diff --git a/Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Storage.h index 2988dc2c1..9bdcf2c2e 100644 --- a/Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Storage.h @@ -287,7 +287,7 @@ public: 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); - bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); + bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const std::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, diff --git a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp index 7431a23e5..c156fd141 100644 --- a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp @@ -438,7 +438,7 @@ void SoundEngine::XACTNotificationCallback( const XACT_NOTIFICATION* pNotificati } } -char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) +char *SoundEngine::ConvertSoundPathToName(const std::wstring& name, bool bConvertSpaces) { static char buf[256]; assert(name.length()<256); @@ -468,7 +468,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa { return; } - wstring name = wchSoundNames[iSound]; + std::wstring name = wchSoundNames[iSound]; //const unsigned char *name=ucSoundNames[iSound]; char *xboxName = ConvertSoundPathToName(name); @@ -576,7 +576,7 @@ void SoundEngine::playUI(int iSound, float, float) { return; } - wstring name = wchSoundNames[iSound]; + std::wstring name = wchSoundNames[iSound]; char *xboxName = (char *)ConvertSoundPathToName(name); @@ -635,7 +635,7 @@ void SoundEngine::playUI(int iSound, float, float) cueInstance->Play(); } -void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, float vol, float pitch, bool bMusicDelay) +void SoundEngine::playStreaming(const std::wstring& name, float x, float y, float z, float vol, float pitch, bool bMusicDelay) { IXACT3SoundBank *pSoundBank=NULL; @@ -1065,14 +1065,14 @@ void SoundEngine::tick(std::shared_ptr *players, float a) m_pXACT3Engine->DoWork(); } -void SoundEngine::add(const wstring& name, File *file) +void SoundEngine::add(const std::wstring& name, File *file) { } -void SoundEngine::addMusic(const wstring& name, File *file) +void SoundEngine::addMusic(const std::wstring& name, File *file) { } -void SoundEngine::addStreaming(const wstring& name, File *file) +void SoundEngine::addStreaming(const std::wstring& name, File *file) { } diff --git a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h index e34ad4c9d..fd3a2fdbc 100644 --- a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h +++ b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h @@ -79,7 +79,7 @@ public: SoundEngine(); virtual void destroy(); virtual void play(int iSound, float x, float y, float z, float volume, float pitch); - virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true); + virtual void playStreaming(const std::wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true); virtual void playUI(int iSound, float volume, float pitch); virtual void playMusicTick(); virtual void updateMusicVolume(float fVal); @@ -87,16 +87,16 @@ public: virtual void updateSoundEffectVolume(float fVal); virtual void init(Options *); virtual void tick(std::shared_ptr *players, float a); // 4J - updated to take array of local players rather than single one - virtual void add(const wstring& name, File *file); - virtual void addMusic(const wstring& name, File *file); - virtual void addStreaming(const wstring& name, File *file); + virtual void add(const std::wstring& name, File *file); + virtual void addMusic(const std::wstring& name, File *file); + virtual void addStreaming(const std::wstring& name, File *file); #ifndef __PS3__ static void setXACTEngine( IXACT3Engine *pXACT3Engine); void CreateStreamingWavebank(const char *pchName, IXACT3WaveBank **ppStreamedWaveBank); void CreateSoundbank(const char *pchName, IXACT3SoundBank **ppSoundBank); #endif // __PS3__ - virtual char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false); + virtual char *ConvertSoundPathToName(const std::wstring& name, bool bConvertSpaces=false); bool isStreamingWavebankReady(); // 4J Added #ifdef _XBOX bool isStreamingWavebankReady(IXACT3WaveBank *pWaveBank); diff --git a/Minecraft.Client/Platform/Xbox/Font/XUI_Font.h b/Minecraft.Client/Platform/Xbox/Font/XUI_Font.h index 1b6278e3c..b0b797f90 100644 --- a/Minecraft.Client/Platform/Xbox/Font/XUI_Font.h +++ b/Minecraft.Client/Platform/Xbox/Font/XUI_Font.h @@ -36,8 +36,8 @@ public: DWORD m_dwNestedBeginCount; - wstring m_fontName; - wstring m_fallbackFont; + std::wstring m_fontName; + std::wstring m_fallbackFont; DWORD refCount; public: float getScaleFactor() { return m_fScaleFactor; } @@ -53,7 +53,7 @@ public: // m_fXScaleFactor = m_fYScaleFactor = m_fScaleFactor; } - void SetFallbackFont(const wstring &fallbackFont) { m_fallbackFont = fallbackFont; } + void SetFallbackFont(const std::wstring &fallbackFont) { m_fallbackFont = fallbackFont; } void IncRefCount() { ++refCount; } void DecRefCount() { --refCount; } diff --git a/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.cpp b/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.cpp index 2745a2b5b..f2b172f8e 100644 --- a/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.cpp +++ b/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.cpp @@ -239,7 +239,7 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat #if 1 for( int i = 0; i < dwCount; i++ ) { - wstring string; + std::wstring string; string.push_back(pCharData[i].wch); lineYPos = pCharData[i].y; lineXPos = pCharData[i].x; @@ -257,7 +257,7 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat DWORD i = 0; while( i < dwCount ) { - wstring string; + std::wstring string; lineYPos = pCharData[i].y; lineXPos = pCharData[i].x; colour = pCharData[i].dwColor; diff --git a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp index 3d9b0f561..4d9668cc3 100644 --- a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp +++ b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp @@ -1097,15 +1097,15 @@ bool CPlatformNetworkManagerXbox::SystemFlagGet(INetworkPlayer *pNetworkPlayer, return false; } -wstring CPlatformNetworkManagerXbox::GatherStats() +std::wstring CPlatformNetworkManagerXbox::GatherStats() { return L"Queue messages: " + _toString(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) ) + L" Queue bytes: " + _toString( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) ); } -wstring CPlatformNetworkManagerXbox::GatherRTTStats() +std::wstring CPlatformNetworkManagerXbox::GatherRTTStats() { - wstring stats(L"Rtt: "); + std::wstring stats(L"Rtt: "); wchar_t stat[32]; @@ -1529,7 +1529,7 @@ vector *CPlatformNetworkManagerXbox::GetSessionList(int iPa { sessionInfo->data = *(GameSessionData *)pxnqi->pbData; - wstring gamerName = convStringToWstring(sessionInfo->data.hostName); + std::wstring gamerName = convStringToWstring(sessionInfo->data.hostName); #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<data = *(GameSessionData *)pxnqi->pbData; - wstring gamerName = convStringToWstring(sessionInfo->data.hostName); + std::wstring gamerName = convStringToWstring(sessionInfo->data.hostName); swprintf(sessionInfo->displayLabel,app.GetString(IDS_GAME_HOST_NAME),L"MWWWWWWWWWWWWWWM");// gamerName.c_str() ); } else diff --git a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.h b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.h index 5c9dd0c92..492299228 100644 --- a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.h +++ b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.h @@ -121,8 +121,8 @@ private: float m_lastPlayerEventTimeStart; public: - wstring GatherStats(); - wstring GatherRTTStats(); + std::wstring GatherStats(); + std::wstring GatherRTTStats(); private: vector friendsSessions[XUSER_MAX_COUNT]; diff --git a/Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp b/Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp index 60b593fc4..8217cf0ba 100644 --- a/Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp +++ b/Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp @@ -316,7 +316,7 @@ void CSocialManager::DestroyPreviewPostImage() void CSocialManager::SetSocialPostText(LPCWSTR pwchTitle, LPCWSTR pwchCaption, LPCWSTR pwchDesc) { - wstring wTemp; + std::wstring wTemp; ZeroMemory(m_wchTitleA,sizeof(WCHAR)*(MAX_SOCIALPOST_CAPTION+1)); ZeroMemory(m_wchCaptionA,sizeof(WCHAR)*(MAX_SOCIALPOST_CAPTION+1)); diff --git a/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp b/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp index 32d84617a..d00147e06 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp +++ b/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp @@ -141,7 +141,7 @@ void ConsoleUIController::DisplayGamertag(unsigned int iPad, bool show) CXuiSceneBase::DisplayGamertag(iPad, show?TRUE:FALSE); } -void ConsoleUIController::SetSelectedItem(unsigned int iPad, const wstring &name) +void ConsoleUIController::SetSelectedItem(unsigned int iPad, const std::wstring &name) { CXuiSceneBase::SetSelectedItem(iPad, name); } diff --git a/Minecraft.Client/Platform/Xbox/Xbox_UIController.h b/Minecraft.Client/Platform/Xbox/Xbox_UIController.h index 5ec996554..f7fb90844 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_UIController.h +++ b/Minecraft.Client/Platform/Xbox/Xbox_UIController.h @@ -37,7 +37,7 @@ public: virtual void PlayUISFX(ESoundEffect eSound); virtual void DisplayGamertag(unsigned int iPad, bool show); - virtual void SetSelectedItem(unsigned int iPad, const wstring &name); + virtual void SetSelectedItem(unsigned int iPad, const std::wstring &name); virtual void UpdateSelectedItemPos(unsigned int iPad); virtual void HandleDLCMountingComplete(); diff --git a/Minecraft.Client/Player/LocalPlayer.cpp b/Minecraft.Client/Player/LocalPlayer.cpp index d4bee1869..aaa84ed61 100644 --- a/Minecraft.Client/Player/LocalPlayer.cpp +++ b/Minecraft.Client/Player/LocalPlayer.cpp @@ -674,7 +674,7 @@ void LocalPlayer::take(std::shared_ptr e, int orgCount) minecraft->particleEngine->add( std::shared_ptr( new TakeAnimationParticle((Level *)minecraft->level, e, shared_from_this(), -0.5f) ) ); } -void LocalPlayer::chat(const wstring& message) +void LocalPlayer::chat(const std::wstring& message) { } diff --git a/Minecraft.Client/Player/LocalPlayer.h b/Minecraft.Client/Player/LocalPlayer.h index 8abbb3657..a4054c974 100644 --- a/Minecraft.Client/Player/LocalPlayer.h +++ b/Minecraft.Client/Player/LocalPlayer.h @@ -111,7 +111,7 @@ public: virtual void crit(std::shared_ptr e); virtual void magicCrit(std::shared_ptr e); virtual void take(std::shared_ptr e, int orgCount); - virtual void chat(const wstring& message); + virtual void chat(const std::wstring& message); virtual bool isSneaking(); //virtual bool isIdle(); virtual void hurtTo(int newHealth, ETelemetryChallenges damageSource); diff --git a/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp b/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp index ed2c4beb8..50deaa970 100644 --- a/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp +++ b/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp @@ -162,7 +162,7 @@ void MultiplayerLocalPlayer::reallyDrop(std::shared_ptr itemEntity) { } -void MultiplayerLocalPlayer::chat(const wstring& message) +void MultiplayerLocalPlayer::chat(const std::wstring& message) { connection->send( std::shared_ptr( new ChatPacket(message) ) ); } diff --git a/Minecraft.Client/Player/MultiPlayerLocalPlayer.h b/Minecraft.Client/Player/MultiPlayerLocalPlayer.h index f8815ea43..54c6001da 100644 --- a/Minecraft.Client/Player/MultiPlayerLocalPlayer.h +++ b/Minecraft.Client/Player/MultiPlayerLocalPlayer.h @@ -37,7 +37,7 @@ public: protected: virtual void reallyDrop(std::shared_ptr itemEntity); public: - virtual void chat(const wstring& message); + virtual void chat(const std::wstring& message); virtual void swing(); virtual void respawn(); protected: diff --git a/Minecraft.Client/Player/RemotePlayer.cpp b/Minecraft.Client/Player/RemotePlayer.cpp index 4cd436340..0d9a6e977 100644 --- a/Minecraft.Client/Player/RemotePlayer.cpp +++ b/Minecraft.Client/Player/RemotePlayer.cpp @@ -3,7 +3,7 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.item.h" #include "../../Minecraft.World/Util/Mth.h" -RemotePlayer::RemotePlayer(Level *level, const wstring& name) : Player(level) +RemotePlayer::RemotePlayer(Level *level, const std::wstring& name) : Player(level) { // 4J - added initialisers hasStartedUsingItem = false; diff --git a/Minecraft.Client/Player/RemotePlayer.h b/Minecraft.Client/Player/RemotePlayer.h index 641bf293a..7082a10c0 100644 --- a/Minecraft.Client/Player/RemotePlayer.h +++ b/Minecraft.Client/Player/RemotePlayer.h @@ -10,7 +10,7 @@ private: bool hasStartedUsingItem; public: Input *input; - RemotePlayer(Level *level, const wstring& name); + RemotePlayer(Level *level, const std::wstring& name); protected: virtual void setDefaultHeadHeight(); public: diff --git a/Minecraft.Client/Player/ServerPlayer.cpp b/Minecraft.Client/Player/ServerPlayer.cpp index 7e4bcaf6a..a27e9ba6d 100644 --- a/Minecraft.Client/Player/ServerPlayer.cpp +++ b/Minecraft.Client/Player/ServerPlayer.cpp @@ -27,7 +27,7 @@ #include "../../Minecraft.World/Level/LevelChunk.h" #include "../Rendering/LevelRenderer.h" -ServerPlayer::ServerPlayer(MinecraftServer *server, Level *level, const wstring& name, ServerPlayerGameMode *gameMode) : Player(level) +ServerPlayer::ServerPlayer(MinecraftServer *server, Level *level, const std::wstring& name, ServerPlayerGameMode *gameMode) : Player(level) { // 4J - added initialisers connection = nullptr; @@ -369,7 +369,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) okToSend = true; MinecraftServer::s_slowQueuePacketSent = true; -// static std::unordered_map mapLastTime; +// static std::unordered_map mapLastTime; // __int64 thisTime = System::currentTimeMillis(); // __int64 lastTime = mapLastTime[connection->getNetworkPlayer()->GetUID().toString()]; // app.DebugPrintf(" - OK to send (%d ms since last)\n", thisTime - lastTime); @@ -1342,7 +1342,7 @@ void ServerPlayer::displayClientMessage(int messageId) } //Language *language = Language::getInstance(); - //wstring languageString = app.GetString(messageId);//language->getElement(messageId); + //std::wstring languageString = app.GetString(messageId);//language->getElement(messageId); //connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); } @@ -1423,7 +1423,7 @@ void ServerPlayer::setGameMode(GameType *mode) connection->send(std::shared_ptr(new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, mode->getId()))); } -void ServerPlayer::sendMessage(const wstring& message, ChatPacket::EChatPacketMessage type /*= e_ChatCustom*/, int customData /*= -1*/, const wstring& additionalMessage /*= L""*/) +void ServerPlayer::sendMessage(const std::wstring& message, ChatPacket::EChatPacketMessage type /*= e_ChatCustom*/, int customData /*= -1*/, const std::wstring& additionalMessage /*= L""*/) { connection->send(std::shared_ptr(new ChatPacket(message,type,customData,additionalMessage))); } diff --git a/Minecraft.Client/Player/ServerPlayer.h b/Minecraft.Client/Player/ServerPlayer.h index 136d08362..82eb27abc 100644 --- a/Minecraft.Client/Player/ServerPlayer.h +++ b/Minecraft.Client/Player/ServerPlayer.h @@ -39,7 +39,7 @@ private: int lastBrupSendTickCount; // 4J Added public: - ServerPlayer(MinecraftServer *server, Level *level, const wstring& name, ServerPlayerGameMode *gameMode); + ServerPlayer(MinecraftServer *server, Level *level, const std::wstring& name, ServerPlayerGameMode *gameMode); ~ServerPlayer(); void flagEntitiesToBeRemoved(unsigned int *flags, bool *removedFound); // 4J added @@ -137,7 +137,7 @@ public: void onUpdateAbilities(); ServerLevel *getLevel(); void setGameMode(GameType *mode); - void sendMessage(const wstring& message, ChatPacket::EChatPacketMessage type = ChatPacket::e_ChatCustom, int customData = -1, const wstring& additionalMessage = L""); + void sendMessage(const std::wstring& message, ChatPacket::EChatPacketMessage type = ChatPacket::e_ChatCustom, int customData = -1, const std::wstring& additionalMessage = L""); bool hasPermission(EGameCommand command); // 4J - Don't use //void updateOptions(std::shared_ptr packet); diff --git a/Minecraft.Client/Player/User.cpp b/Minecraft.Client/Player/User.cpp index c0355293b..533985dcc 100644 --- a/Minecraft.Client/Player/User.cpp +++ b/Minecraft.Client/Player/User.cpp @@ -38,7 +38,7 @@ void User::staticCtor() allowedTiles.push_back(Tile::obsidian); } -User::User(const wstring& name, const wstring& sessionId) +User::User(const std::wstring& name, const std::wstring& sessionId) { this->name = name; this->sessionId = sessionId; diff --git a/Minecraft.Client/Player/User.h b/Minecraft.Client/Player/User.h index b888c7d4d..5d87832cb 100644 --- a/Minecraft.Client/Player/User.h +++ b/Minecraft.Client/Player/User.h @@ -6,9 +6,9 @@ class User public: static vector allowedTiles; static void staticCtor(); - wstring name; - wstring sessionId; - wstring mpPassword; + std::wstring name; + std::wstring sessionId; + std::wstring mpPassword; - User(const wstring& name, const wstring& sessionId); + User(const std::wstring& name, const std::wstring& sessionId); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Cube.cpp b/Minecraft.Client/Rendering/Cube.cpp index 45714e3a7..ee007f111 100644 --- a/Minecraft.Client/Rendering/Cube.cpp +++ b/Minecraft.Client/Rendering/Cube.cpp @@ -106,7 +106,7 @@ void Cube::render(Tesselator *t,float scale) } } -Cube *Cube::setId(const wstring &id) +Cube *Cube::setId(const std::wstring &id) { this->id = id; return this; diff --git a/Minecraft.Client/Rendering/Cube.h b/Minecraft.Client/Rendering/Cube.h index 388910015..eafa57ba5 100644 --- a/Minecraft.Client/Rendering/Cube.h +++ b/Minecraft.Client/Rendering/Cube.h @@ -15,7 +15,7 @@ private: public: const float x0, y0, z0, x1, y1, z1; - wstring id; + std::wstring id; public: Cube(ModelPart *modelPart, int xTexOffs, int yTexOffs, float x0, float y0, float z0, int w, int h, int d, float g, int faceMask = 63, bool bFlipPoly3UVs = false); // 4J - added faceMask @@ -25,5 +25,5 @@ private: public: void render(Tesselator *t,float scale); - Cube *setId(const wstring &id); + Cube *setId(const std::wstring &id); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.cpp index 5d0208fad..ed9678837 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.cpp @@ -31,12 +31,12 @@ void EntityRenderer::bindTexture(int resourceName) entityRenderDispatcher->textures->bindTexture(resourceName); } -void EntityRenderer::bindTexture(const wstring& resourceName) +void EntityRenderer::bindTexture(const std::wstring& resourceName) { entityRenderDispatcher->textures->bindTexture(resourceName); } -bool EntityRenderer::bindTexture(const wstring& urlTexture, int backupTexture) +bool EntityRenderer::bindTexture(const std::wstring& urlTexture, int backupTexture) { Textures *t = entityRenderDispatcher->textures; @@ -57,7 +57,7 @@ bool EntityRenderer::bindTexture(const wstring& urlTexture, int backupTexture) } } -bool EntityRenderer::bindTexture(const wstring& urlTexture, const wstring& backupTexture) +bool EntityRenderer::bindTexture(const std::wstring& urlTexture, const std::wstring& backupTexture) { Textures *t = entityRenderDispatcher->textures; diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.h index 529d905ac..2095385b6 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.h @@ -39,10 +39,10 @@ public: virtual void render(std::shared_ptr entity, double x, double y, double z, float rot, float a) = 0; protected: virtual void bindTexture(int resourceName); // 4J - added - virtual void bindTexture(const wstring& resourceName); + virtual void bindTexture(const std::wstring& resourceName); - virtual bool bindTexture(const wstring& urlTexture, int backupTexture); // 4J added - virtual bool bindTexture(const wstring& urlTexture, const wstring& backupTexture); + virtual bool bindTexture(const std::wstring& urlTexture, int backupTexture); // 4J added + virtual bool bindTexture(const std::wstring& urlTexture, const std::wstring& backupTexture); private: virtual void renderFlame(std::shared_ptr e, double x, double y, double z, float a); virtual void renderShadow(std::shared_ptr e, double x, double y, double z, float pow, float a); diff --git a/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.cpp index 0de9da0c5..7fc66de50 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.cpp @@ -70,7 +70,7 @@ void HumanoidMobRenderer::additionalRendering(std::shared_ptr mob, float a) float s = 17 / 16.0f; glScalef(s, -s, -s); - wstring extra = L""; + std::wstring extra = L""; if (headGear->hasTag() && headGear->getTag()->contains(L"SkullOwner")) { extra = headGear->getTag()->getString(L"SkullOwner"); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp index a64d2e792..82c2b3713 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp @@ -565,7 +565,7 @@ void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, std: renderGuiItemDecorations(font, textures, item, x, y, L"", fAlpha); } -void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, const wstring &countText, float fAlpha) +void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, const std::wstring &countText, float fAlpha) { if (item == NULL) { @@ -578,7 +578,7 @@ void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, std: if (item->count > 1 || !countText.empty() || item->GetForceNumberDisplay()) { MemSect(31); - wstring amount = countText; + std::wstring amount = countText; if(amount.empty()) { int count = item->count; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h index 830e85100..f2f68a254 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h @@ -43,7 +43,7 @@ private: public: void renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, float fAlpha = 1.0f); - void renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, const wstring &countText, float fAlpha = 1.0f); + void renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, const std::wstring &countText, float fAlpha = 1.0f); private: void fillRect(Tesselator *t, int x, int y, int w, int h, int c); public: diff --git a/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.cpp index b2cb23ebf..dae750050 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.cpp @@ -330,7 +330,7 @@ void MobRenderer::renderName(std::shared_ptr mob, double x, double y, doubl } // 4J Added parameter for color here so that we can colour players names -void MobRenderer::renderNameTag(std::shared_ptr mob, const wstring& OriginalName, double x, double y, double z, int maxDist, int color /*= 0xffffffff*/) +void MobRenderer::renderNameTag(std::shared_ptr mob, const std::wstring& OriginalName, double x, double y, double z, int maxDist, int color /*= 0xffffffff*/) { if ( app.GetGameSettings(eGameSetting_DisplayHUD)==0 ) @@ -399,7 +399,7 @@ void MobRenderer::renderNameTag(std::shared_ptr mob, const wstring& Origina std::shared_ptr player = dynamic_pointer_cast(mob); if (player != NULL && app.isXuidDeadmau5( player->getXuid() ) ) offs = -10; - wstring playerName; + std::wstring playerName; WCHAR wchName[2]; #if defined(__PS3__) || defined(__ORBIS__) diff --git a/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.h index 6a5df478e..1f5c01b7f 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.h @@ -38,7 +38,7 @@ protected: virtual int getOverlayColor(std::shared_ptr mob, float br, float a); virtual void scale(std::shared_ptr mob, float a); virtual void renderName(std::shared_ptr mob, double x, double y, double z); - virtual void renderNameTag(std::shared_ptr mob, const wstring& name, double x, double y, double z, int maxDist, int color = 0xff000000); + virtual void renderNameTag(std::shared_ptr mob, const std::wstring& name, double x, double y, double z, int maxDist, int color = 0xff000000); public: // 4J Added diff --git a/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h index c367e9b03..1ca51db47 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h @@ -5,7 +5,7 @@ using namespace std; class MobSpawnerRenderer : public TileEntityRenderer { private: - std::unordered_map > models; + std::unordered_map > models; public: virtual void render(std::shared_ptr _spawner, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp index 3f938f302..2cff2584f 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp @@ -27,7 +27,7 @@ const unsigned int PlayerRenderer::s_nametagColors[MINECRAFT_NET_MAX_PLAYERS] = #endif }; -const wstring PlayerRenderer::MATERIAL_NAMES[5] = { L"cloth", L"chain", L"iron", L"diamond", L"gold" }; +const std::wstring PlayerRenderer::MATERIAL_NAMES[5] = { L"cloth", L"chain", L"iron", L"diamond", L"gold" }; PlayerRenderer::PlayerRenderer() : MobRenderer( new HumanoidModel(0), 0.5f ) { @@ -245,7 +245,7 @@ void PlayerRenderer::renderName(std::shared_ptr _mob, double x, double y, d if (dist < maxDist * maxDist) { // Truncate display names longer than 16 char - wstring msg = mob->getDisplayName(); + std::wstring msg = mob->getDisplayName(); if (msg.length() > 16) { msg.resize(16); @@ -351,7 +351,7 @@ void PlayerRenderer::additionalRendering(std::shared_ptr _mob, float a) float s = 17 / 16.0f; glScalef(s, -s, -s); - wstring extra = L""; + std::wstring extra = L""; if (headGear->hasTag() && headGear->getTag()->contains(L"SkullOwner")) { extra = headGear->getTag()->getString(L"SkullOwner"); diff --git a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.h index 6ed16f260..292a2f693 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.h @@ -20,7 +20,7 @@ public: static unsigned int getNametagColour(int index); private: - static const wstring MATERIAL_NAMES[5]; + static const std::wstring MATERIAL_NAMES[5]; protected: virtual int prepareArmor(std::shared_ptr _player, int layer, float a); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.cpp index 03befa51e..054df57c2 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.cpp @@ -195,7 +195,7 @@ void ProgressRenderer::setType(eProgressStringType eType) LeaveCriticalSection( &ProgressRenderer::s_progress ); } -void ProgressRenderer::progressStage(wstring &wstrText) +void ProgressRenderer::progressStage(std::wstring &wstrText) { EnterCriticalSection( &ProgressRenderer::s_progress ); m_wstrText=wstrText; @@ -203,10 +203,10 @@ void ProgressRenderer::progressStage(wstring &wstrText) LeaveCriticalSection( &ProgressRenderer::s_progress ); } -wstring& ProgressRenderer::getProgressString(void) +std::wstring& ProgressRenderer::getProgressString(void) { EnterCriticalSection( &ProgressRenderer::s_progress ); - wstring &temp=m_wstrText; + std::wstring &temp=m_wstrText; LeaveCriticalSection( &ProgressRenderer::s_progress ); return temp; } diff --git a/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.h index 1244d3733..bb3446c4c 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.h @@ -15,7 +15,7 @@ public: int getCurrentPercent(); int getCurrentTitle(); int getCurrentStatus(); - wstring& getProgressString(void); + std::wstring& getProgressString(void); ProgressRenderer::eProgressStringType getType(); private: @@ -27,7 +27,7 @@ private: int title; __int64 lastTime; bool noAbort; - wstring m_wstrText; + std::wstring m_wstrText; eProgressStringType m_eType; void setType(eProgressStringType eType); @@ -38,6 +38,6 @@ public: virtual void progressStartNoAbort(int string); void _progressStart(int title); virtual void progressStage(int status); - virtual void progressStage(wstring &wstrText); + virtual void progressStage(std::wstring &wstrText); virtual void progressStagePercentage(int i); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp index 5c88b92ed..43e8a7e14 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp @@ -60,7 +60,7 @@ void SignRenderer::render(std::shared_ptr _sign, double x, double y, glDepthMask(false); int col = Minecraft::GetInstance()->getColourTable()->getColor(eMinecraftColour_Sign_Text); - wstring msg; + std::wstring msg; // need to send the new data // Get the current language setting from the console DWORD dwLanguage = XGetLanguage( ); diff --git a/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.cpp index 873c268fa..71f1f137f 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.cpp @@ -31,7 +31,7 @@ void SkullTileRenderer::init(TileEntityRenderDispatcher *tileEntityRenderDispatc instance = this; } -void SkullTileRenderer::renderSkull(float x, float y, float z, int face, float rot, int type, const wstring &extra) +void SkullTileRenderer::renderSkull(float x, float y, float z, int face, float rot, int type, const std::wstring &extra) { Model *model = skeletonModel; @@ -47,7 +47,7 @@ void SkullTileRenderer::renderSkull(float x, float y, float z, int face, float r case SkullTileEntity::TYPE_CHAR: //if (!extra.empty()) //{ - // wstring url = "http://skins.minecraft.net/MinecraftSkins/" + StringUtil.stripColor(extra) + ".png"; + // std::wstring url = "http://skins.minecraft.net/MinecraftSkins/" + StringUtil.stripColor(extra) + ".png"; // if (!instance->tileEntityRenderDispatcher->textures->hasHttpTexture(url)) // { diff --git a/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.h index e9d2bf0f6..e2ef38605 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.h @@ -20,5 +20,5 @@ public: void render(std::shared_ptr skull, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled = true); void init(TileEntityRenderDispatcher *tileEntityRenderDispatcher); - void renderSkull(float x, float y, float z, int face, float rot, int type, const wstring &extra); + void renderSkull(float x, float y, float z, int face, float rot, int type, const std::wstring &extra); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.cpp index 9a997b6e2..d31ddfd8e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.cpp @@ -8,7 +8,7 @@ void TileEntityRenderer::bindTexture(int resourceName) if(t != NULL) t->bind(t->loadTexture(resourceName)); } -void TileEntityRenderer::bindTexture(const wstring& urlTexture, int backupTexture) +void TileEntityRenderer::bindTexture(const std::wstring& urlTexture, int backupTexture) { Textures *t = tileEntityRenderDispatcher->textures; if(t != NULL) t->bind(t->loadHttpTexture(urlTexture, backupTexture)); diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.h index 7e01b4964..e9c4c1887 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.h @@ -13,8 +13,8 @@ public: virtual void render(std::shared_ptr entity, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) = 0; // 4J added setColor param and alpha and useCompiled virtual void onNewLevel(Level *level) {} protected: - void bindTexture(int resourceName); // 4J - changed from wstring to int - void bindTexture(const wstring& urlTexture, int backupTexture); // 4J - changed from wstring to int + void bindTexture(int resourceName); // 4J - changed from std::wstring to int + void bindTexture(const std::wstring& urlTexture, int backupTexture); // 4J - changed from std::wstring to int private: Level *getLevel(); public: diff --git a/Minecraft.Client/Rendering/LevelRenderer.cpp b/Minecraft.Client/Rendering/LevelRenderer.cpp index 759d17d73..04854e5e2 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.cpp +++ b/Minecraft.Client/Rendering/LevelRenderer.cpp @@ -603,12 +603,12 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a) mc->gameRenderer->turnOffLightLayer(a); // 4J - brought forward from 1.8.2 } -wstring LevelRenderer::gatherStats1() +std::wstring LevelRenderer::gatherStats1() { return L"C: " + _toString(renderedChunks) + L"/" + _toString(totalChunks) + L". F: " + _toString(offscreenChunks) + L", O: " + _toString(occludedChunks) + L", E: " + _toString(emptyChunks); } -wstring LevelRenderer::gatherStats2() +std::wstring LevelRenderer::gatherStats2() { return L"E: " + _toString(renderedEntities) + L"/" + _toString(totalEntities) + L". B: " + _toString(culledEntities) + L", I: " + _toString((totalEntities - culledEntities) - renderedEntities); } @@ -2560,7 +2560,7 @@ void LevelRenderer::cull(Culler *culler, float a) } } -void LevelRenderer::playStreamingMusic(const wstring& name, int x, int y, int z) +void LevelRenderer::playStreamingMusic(const std::wstring& name, int x, int y, int z) { if (name != L"") { @@ -2603,7 +2603,7 @@ void LevelRenderer::playSound(std::shared_ptr entity,int iSound, double // 4J-PB - original function. I've changed to an enum instead of string compares // 4J removed - /* -void LevelRenderer::addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za) +void LevelRenderer::addParticle(const std::wstring& name, double x, double y, double z, double xa, double ya, double za) { if (mc == NULL || mc->cameraTargetPlayer == NULL || mc->particleEngine == NULL) return; diff --git a/Minecraft.Client/Rendering/LevelRenderer.h b/Minecraft.Client/Rendering/LevelRenderer.h index b456752e3..bdf371752 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.h +++ b/Minecraft.Client/Rendering/LevelRenderer.h @@ -68,8 +68,8 @@ public: void AddDLCSkinsToMemTextures(); public: void renderEntities(Vec3 *cam, Culler *culler, float a); - wstring gatherStats1(); - wstring gatherStats2(); + std::wstring gatherStats1(); + std::wstring gatherStats2(); private: void resortChunks(int xc, int yc, int zc); public: @@ -106,7 +106,7 @@ public: bool m_bSPUCullStarted[4]; #endif // __PS3__ void cull(Culler *culler, float a); - void playStreamingMusic(const wstring& name, int x, int y, int z); + void playStreamingMusic(const std::wstring& name, int x, int y, int z); void playSound(int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f); void playSound(std::shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f); void addParticle(ePARTICLE_TYPE eParticleType, double x, double y, double z, double xa, double ya, double za); // 4J added diff --git a/Minecraft.Client/Rendering/Models/Model.cpp b/Minecraft.Client/Rendering/Models/Model.cpp index eebebf763..e3a1f2976 100644 --- a/Minecraft.Client/Rendering/Models/Model.cpp +++ b/Minecraft.Client/Rendering/Models/Model.cpp @@ -11,12 +11,12 @@ Model::Model() texHeight=32; } -void Model::setMapTex(wstring id, int x, int y) +void Model::setMapTex(std::wstring id, int x, int y) { mappedTexOffs[id]=new TexOffs(x, y); } -TexOffs *Model::getMapTex(wstring id) +TexOffs *Model::getMapTex(std::wstring id) { // 4J-PB - assuming there will always be this one return mappedTexOffs[id]; diff --git a/Minecraft.Client/Rendering/Models/Model.h b/Minecraft.Client/Rendering/Models/Model.h index bb474e98c..335afb9ca 100644 --- a/Minecraft.Client/Rendering/Models/Model.h +++ b/Minecraft.Client/Rendering/Models/Model.h @@ -14,7 +14,7 @@ public: bool riding; vector cubes; bool young; - std::unordered_map mappedTexOffs; + std::unordered_map mappedTexOffs; int texWidth; int texHeight; @@ -25,8 +25,8 @@ public: virtual ModelPart *getRandomCube(Random random) {return cubes.at(random.nextInt((int)cubes.size()));} virtual ModelPart * AddOrRetrievePart(SKIN_BOX *pBox) { return NULL;} - void setMapTex(wstring id, int x, int y); - TexOffs *getMapTex(wstring id); + void setMapTex(std::wstring id, int x, int y); + TexOffs *getMapTex(std::wstring id); protected: float yHeadOffs; diff --git a/Minecraft.Client/Rendering/Models/ModelPart.cpp b/Minecraft.Client/Rendering/Models/ModelPart.cpp index 182dc15cd..a93adfc69 100644 --- a/Minecraft.Client/Rendering/Models/ModelPart.cpp +++ b/Minecraft.Client/Rendering/Models/ModelPart.cpp @@ -23,7 +23,7 @@ ModelPart::ModelPart() _init(); } -ModelPart::ModelPart(Model *model, const wstring& id) +ModelPart::ModelPart(Model *model, const std::wstring& id) { construct(model, id); } @@ -39,7 +39,7 @@ ModelPart::ModelPart(Model *model, int xTexOffs, int yTexOffs) } -void ModelPart::construct(Model *model, const wstring& id) +void ModelPart::construct(Model *model, const std::wstring& id) { _init(); this->model = model; @@ -108,7 +108,7 @@ ModelPart *ModelPart::texOffs(int xTexOffs, int yTexOffs) return this; } -ModelPart *ModelPart::addBox(wstring id, float x0, float y0, float z0, int w, int h, int d) +ModelPart *ModelPart::addBox(std::wstring id, float x0, float y0, float z0, int w, int h, int d) { id = this->id + L"." + id; TexOffs *offs = model->getMapTex(id); diff --git a/Minecraft.Client/Rendering/Models/ModelPart.h b/Minecraft.Client/Rendering/Models/ModelPart.h index 5d22ad3a8..fbc90c7cd 100644 --- a/Minecraft.Client/Rendering/Models/ModelPart.h +++ b/Minecraft.Client/Rendering/Models/ModelPart.h @@ -22,7 +22,7 @@ public: static const float RAD; private: - wstring id; + std::wstring id; int xTexOffs, yTexOffs; boolean compiled; int list; @@ -31,12 +31,12 @@ private: public: void _init(); // 4J added ModelPart(); - ModelPart(Model *model, const wstring &id); + ModelPart(Model *model, const std::wstring &id); ModelPart(Model *model); ModelPart(Model *model, int xTexOffs, int yTexOffs); // MGH - had to add these for PS3, as calling constructors from others was only introduced in c++11 - https://en.wikipedia.org/wiki/C++11#Object_construction_improvement - void construct(Model *model, const wstring &id); + void construct(Model *model, const std::wstring &id); void construct(Model *model); void construct(Model *model, int xTexOffs, int yTexOffs); @@ -44,7 +44,7 @@ public: ModelPart * retrieveChild(SKIN_BOX *pBox); ModelPart *mirror(); ModelPart *texOffs(int xTexOffs, int yTexOffs); - ModelPart *addBox(wstring id, float x0, float y0, float z0, int w, int h, int d); + ModelPart *addBox(std::wstring id, float x0, float y0, float z0, int w, int h, int d); ModelPart *addBox(float x0, float y0, float z0, int w, int h, int d); ModelPart *addBoxWithMask(float x0, float y0, float z0, int w, int h, int d, int faceMask); // 4J added void addBox(float x0, float y0, float z0, int w, int h, int d, float g); diff --git a/Minecraft.Client/Rendering/Particles/Particle.cpp b/Minecraft.Client/Rendering/Particles/Particle.cpp index 0cc278286..3b5fd697c 100644 --- a/Minecraft.Client/Rendering/Particles/Particle.cpp +++ b/Minecraft.Client/Rendering/Particles/Particle.cpp @@ -240,7 +240,7 @@ bool Particle::isAttackable() } //@Override -wstring Particle::toString() +std::wstring Particle::toString() { return L"A particle"; //getClass()->getSimpleName() + ", Pos (" + x + "," + y + "," + z + "), RGBA (" + rCol + "," + gCol + "," + bCol + "," + alpha + "), Age " + age; } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Particles/Particle.h b/Minecraft.Client/Rendering/Particles/Particle.h index abf2aa0f7..572794401 100644 --- a/Minecraft.Client/Rendering/Particles/Particle.h +++ b/Minecraft.Client/Rendering/Particles/Particle.h @@ -49,5 +49,5 @@ public: virtual void setMiscTex(int slotIndex); virtual void setNextMiscAnimTex(); virtual bool isAttackable(); - virtual wstring toString(); + virtual std::wstring toString(); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp b/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp index 073bf105e..d979256f1 100644 --- a/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp +++ b/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp @@ -205,7 +205,7 @@ void ParticleEngine::crack(int x, int y, int z, int face) } -wstring ParticleEngine::countParticles() +std::wstring ParticleEngine::countParticles() { int l = level->dimension->id == 0 ? 0 : (level->dimension->id == -1 ? 1 : 2 ); return _toString((int)(particles[l][0].size() + particles[l][1].size() + particles[l][2].size())); diff --git a/Minecraft.Client/Rendering/Particles/ParticleEngine.h b/Minecraft.Client/Rendering/Particles/ParticleEngine.h index 0fee7a165..8913d3140 100644 --- a/Minecraft.Client/Rendering/Particles/ParticleEngine.h +++ b/Minecraft.Client/Rendering/Particles/ParticleEngine.h @@ -40,5 +40,5 @@ public: void setLevel(Level *level); void destroy(int x, int y, int z, int tid, int data); void crack(int x, int y, int z, int face); - wstring countParticles(); + std::wstring countParticles(); }; \ No newline at end of file diff --git a/Minecraft.Client/Textures/BufferedImage.cpp b/Minecraft.Client/Textures/BufferedImage.cpp index 7c1e42dd1..70b9664eb 100644 --- a/Minecraft.Client/Textures/BufferedImage.cpp +++ b/Minecraft.Client/Textures/BufferedImage.cpp @@ -47,11 +47,11 @@ void BufferedImage::ByteFlip4(unsigned int &data) // Loads a bitmap into a buffered image - only currently supports the 2 types of 32-bit image that we've made so far // and determines which of these is which by the compression method. Compression method 3 is a 32-bit image with only // 24-bits used (ie no alpha channel) whereas method 0 is a full 32-bit image with a valid alpha channel. -BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/) +BufferedImage::BufferedImage(const std::wstring& File, bool filenameHasExtension /*=false*/, bool bTitleUpdateTexture /*=false*/, const std::wstring &drive /*=L""*/) { HRESULT hr; - wstring wDrive; - wstring filePath; + std::wstring wDrive; + std::wstring filePath; filePath = File; wDrive = drive; @@ -87,7 +87,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f pchUsrDir=getUsrDirPath(); } - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); if(bTitleUpdateTexture) { @@ -102,7 +102,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f /*char *pchUsrDir=getUsrDirPath(); - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); if(bTitleUpdateTexture) { @@ -145,8 +145,8 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f for( int l = 0; l < 10; l++ ) { - wstring name; - wstring mipMapPath = L""; + std::wstring name; + std::wstring mipMapPath = L""; if( l != 0 ) { mipMapPath = L"MipMapLevel" + _toString(l+1); @@ -189,10 +189,10 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f } } -BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenameHasExtension /*= false*/ ) +BufferedImage::BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool filenameHasExtension /*= false*/ ) { HRESULT hr; - wstring filePath = File; + std::wstring filePath = File; BYTE *pbData = NULL; DWORD dwBytes = 0; @@ -203,8 +203,8 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam for( int l = 0; l < 10; l++ ) { - wstring name; - wstring mipMapPath = L""; + std::wstring name; + std::wstring mipMapPath = L""; if( l != 0 ) { mipMapPath = L"MipMapLevel" + _toString(l+1); diff --git a/Minecraft.Client/Textures/BufferedImage.h b/Minecraft.Client/Textures/BufferedImage.h index a0227fe29..428ff29c8 100644 --- a/Minecraft.Client/Textures/BufferedImage.h +++ b/Minecraft.Client/Textures/BufferedImage.h @@ -15,8 +15,8 @@ public: static const int TYPE_INT_ARGB = 0; static const int TYPE_INT_RGB = 1; BufferedImage(int width,int height,int type); - BufferedImage(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L""); // 4J added - BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenameHasExtension = false ); // 4J Added + BufferedImage(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L""); // 4J added + BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool filenameHasExtension = false ); // 4J Added BufferedImage(BYTE *pbData, DWORD dwBytes); // 4J added ~BufferedImage(); diff --git a/Minecraft.Client/Textures/HttpTexture.cpp b/Minecraft.Client/Textures/HttpTexture.cpp index 4ba5a9bbe..8f8aa8378 100644 --- a/Minecraft.Client/Textures/HttpTexture.cpp +++ b/Minecraft.Client/Textures/HttpTexture.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "HttpTexture.h" -HttpTexture::HttpTexture(const wstring& _url, HttpTextureProcessor *processor) +HttpTexture::HttpTexture(const std::wstring& _url, HttpTextureProcessor *processor) { // 4J - added count = 1; diff --git a/Minecraft.Client/Textures/HttpTexture.h b/Minecraft.Client/Textures/HttpTexture.h index 469ef6cb5..b123e1c57 100644 --- a/Minecraft.Client/Textures/HttpTexture.h +++ b/Minecraft.Client/Textures/HttpTexture.h @@ -10,5 +10,5 @@ public: int id; bool isLoaded; - HttpTexture(const wstring& _url, HttpTextureProcessor *processor); + HttpTexture(const std::wstring& _url, HttpTextureProcessor *processor); }; \ No newline at end of file diff --git a/Minecraft.Client/Textures/MemTexture.cpp b/Minecraft.Client/Textures/MemTexture.cpp index ebdd38c43..5dc6e5166 100644 --- a/Minecraft.Client/Textures/MemTexture.cpp +++ b/Minecraft.Client/Textures/MemTexture.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "MemTexture.h" -MemTexture::MemTexture(const wstring& _url, PBYTE pbData,DWORD dwBytes, MemTextureProcessor *processor) +MemTexture::MemTexture(const std::wstring& _url, PBYTE pbData,DWORD dwBytes, MemTextureProcessor *processor) { // 4J - added count = 1; diff --git a/Minecraft.Client/Textures/MemTexture.h b/Minecraft.Client/Textures/MemTexture.h index d11d68b12..e08c1bbb5 100644 --- a/Minecraft.Client/Textures/MemTexture.h +++ b/Minecraft.Client/Textures/MemTexture.h @@ -12,6 +12,6 @@ public: int ticksSinceLastUse; static const int UNUSED_TICKS_TO_FREE = 20; - MemTexture(const wstring& _name, PBYTE pbData, DWORD dwBytes, MemTextureProcessor *processor); + MemTexture(const std::wstring& _name, PBYTE pbData, DWORD dwBytes, MemTextureProcessor *processor); ~MemTexture(); }; \ No newline at end of file diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp index 6629fe9a2..4ff7b9c6f 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp @@ -4,7 +4,7 @@ #include "../../../Minecraft.World/IO/Streams/InputOutputStream.h" #include "../../../Minecraft.World/Util/StringHelpers.h" -AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback) : id(id), name(name) +AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const std::wstring &name, TexturePack *fallback) : id(id), name(name) { // 4J init textureId = -1; @@ -25,7 +25,7 @@ AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &na //loadDescription(); } -wstring AbstractTexturePack::trim(wstring line) +std::wstring AbstractTexturePack::trim(std::wstring line) { if (!line.empty() && line.length() > 34) { @@ -101,7 +101,7 @@ void AbstractTexturePack::loadName() { } -InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFallback) //throws IOException +InputStream *AbstractTexturePack::getResource(const std::wstring &name, bool allowFallback) //throws IOException { app.DebugPrintf("texture - %ls\n",name.c_str()); InputStream *is = getResourceImplementation(name); @@ -114,7 +114,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal } // 4J Currently removed due to override in TexturePack class -//InputStream *AbstractTexturePack::getResource(const wstring &name) //throws IOException +//InputStream *AbstractTexturePack::getResource(const std::wstring &name) //throws IOException //{ // return getResource(name, true); //} @@ -145,7 +145,7 @@ void AbstractTexturePack::load(Textures *textures) } } -bool AbstractTexturePack::hasFile(const wstring &name, bool allowFallback) +bool AbstractTexturePack::hasFile(const std::wstring &name, bool allowFallback) { bool hasFile = this->hasFile(name); @@ -157,34 +157,34 @@ DWORD AbstractTexturePack::getId() return id; } -wstring AbstractTexturePack::getName() +std::wstring AbstractTexturePack::getName() { return texname; } -wstring AbstractTexturePack::getWorldName() +std::wstring AbstractTexturePack::getWorldName() { return m_wsWorldName; } -wstring AbstractTexturePack::getDesc1() +std::wstring AbstractTexturePack::getDesc1() { return desc1; } -wstring AbstractTexturePack::getDesc2() +std::wstring AbstractTexturePack::getDesc2() { return desc2; } -wstring AbstractTexturePack::getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback) +std::wstring AbstractTexturePack::getAnimationString(const std::wstring &textureName, const std::wstring &path, bool allowFallback) { return getAnimationString(textureName, path); } -wstring AbstractTexturePack::getAnimationString(const wstring &textureName, const wstring &path) +std::wstring AbstractTexturePack::getAnimationString(const std::wstring &textureName, const std::wstring &path) { - wstring animationDefinitionFile = textureName + L".txt"; + std::wstring animationDefinitionFile = textureName + L".txt"; bool requiresFallback = !hasFile(L"\\" + textureName + L".png", false); @@ -197,9 +197,9 @@ wstring AbstractTexturePack::getAnimationString(const wstring &textureName, cons InputStreamReader isr(fileStream); BufferedReader br(&isr); - wstring result = L""; + std::wstring result = L""; - wstring line = br.readLine(); + std::wstring line = br.readLine(); while (!line.empty()) { line = trimString(line); @@ -215,7 +215,7 @@ wstring AbstractTexturePack::getAnimationString(const wstring &textureName, cons return result; } -BufferedImage *AbstractTexturePack::getImageResource(const wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/) +BufferedImage *AbstractTexturePack::getImageResource(const std::wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const std::wstring &drive /*=L""*/) { const char *pchTexture=wstringtofilename(File); app.DebugPrintf("AbstractTexturePack::getImageResource - %s, drive is %s\n",pchTexture, wstringtofilename(drive)); @@ -361,7 +361,7 @@ void AbstractTexturePack::unloadUI() // Do nothing } -wstring AbstractTexturePack::getXuiRootPath() +std::wstring AbstractTexturePack::getXuiRootPath() { const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h index e6410c193..9bccba975 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h @@ -9,15 +9,15 @@ class AbstractTexturePack : public TexturePack { private: const DWORD id; - const wstring name; + const std::wstring name; protected: File *file; - wstring texname; - wstring m_wsWorldName; + std::wstring texname; + std::wstring m_wsWorldName; - wstring desc1; - wstring desc2; + std::wstring desc1; + std::wstring desc2; PBYTE m_iconData; DWORD m_iconSize; @@ -36,10 +36,10 @@ private: int textureId; protected: - AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback); + AbstractTexturePack(DWORD id, File *file, const std::wstring &name, TexturePack *fallback); private: - static wstring trim(wstring line); + static std::wstring trim(std::wstring line); protected: virtual void loadIcon(); @@ -48,29 +48,29 @@ protected: virtual void loadName(); public: - virtual InputStream *getResource(const wstring &name, bool allowFallback); //throws IOException + virtual InputStream *getResource(const std::wstring &name, bool allowFallback); //throws IOException // 4J Removed do to current override in TexturePack class - //virtual InputStream *getResource(const wstring &name); //throws IOException + //virtual InputStream *getResource(const std::wstring &name); //throws IOException virtual DLCPack * getDLCPack() =0; protected: - virtual InputStream *getResourceImplementation(const wstring &name) = 0; // throws IOException; + virtual InputStream *getResourceImplementation(const std::wstring &name) = 0; // throws IOException; public: virtual void unload(Textures *textures); virtual void load(Textures *textures); - virtual bool hasFile(const wstring &name, bool allowFallback); - virtual bool hasFile(const wstring &name) = 0; + virtual bool hasFile(const std::wstring &name, bool allowFallback); + virtual bool hasFile(const std::wstring &name) = 0; virtual DWORD getId(); - virtual wstring getName(); - virtual wstring getDesc1(); - virtual wstring getDesc2(); - virtual wstring getWorldName(); + virtual std::wstring getName(); + virtual std::wstring getDesc1(); + virtual std::wstring getDesc2(); + virtual std::wstring getWorldName(); - virtual wstring getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback); + virtual std::wstring getAnimationString(const std::wstring &textureName, const std::wstring &path, bool allowFallback); protected: - virtual wstring getAnimationString(const wstring &textureName, const wstring &path); + virtual std::wstring getAnimationString(const std::wstring &textureName, const std::wstring &path); void loadDefaultUI(); void loadDefaultColourTable(); void loadDefaultHTMLColourTable(); @@ -79,11 +79,11 @@ protected: #endif public: - virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L""); + virtual BufferedImage *getImageResource(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L""); virtual void loadColourTable(); virtual void loadUI(); virtual void unloadUI(); - virtual wstring getXuiRootPath(); + virtual std::wstring getXuiRootPath(); virtual PBYTE getPackIcon(DWORD &dwImageBytes); virtual PBYTE getPackComparison(DWORD &dwImageBytes); virtual unsigned int getDLCParentPackId(); diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index 00fc395cc..0be09c786 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -101,7 +101,7 @@ void DLCTexturePack::loadDescription() } } -wstring DLCTexturePack::getResource(const wstring& name) +std::wstring DLCTexturePack::getResource(const std::wstring& name) { // 4J Stu - We should never call this function #ifndef __CONTENT_PACKAGE @@ -110,7 +110,7 @@ wstring DLCTexturePack::getResource(const wstring& name) return L""; } -InputStream *DLCTexturePack::getResourceImplementation(const wstring &name) //throws IOException +InputStream *DLCTexturePack::getResourceImplementation(const std::wstring &name) //throws IOException { // 4J Stu - We should never call this function #ifndef _CONTENT_PACKAGE @@ -120,7 +120,7 @@ InputStream *DLCTexturePack::getResourceImplementation(const wstring &name) //th return NULL; //resource; } -bool DLCTexturePack::hasFile(const wstring &name) +bool DLCTexturePack::hasFile(const std::wstring &name) { bool hasFile = false; if(m_dlcDataPack != NULL) hasFile = m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_Texture, name); @@ -132,16 +132,16 @@ bool DLCTexturePack::isTerrainUpdateCompatible() return true; } -wstring DLCTexturePack::getPath(bool bTitleUpdateTexture /*= false*/) +std::wstring DLCTexturePack::getPath(bool bTitleUpdateTexture /*= false*/) { return L""; } -wstring DLCTexturePack::getAnimationString(const wstring &textureName, const wstring &path) +std::wstring DLCTexturePack::getAnimationString(const std::wstring &textureName, const std::wstring &path) { - wstring result = L""; + std::wstring result = L""; - wstring fullpath = L"res/" + path + textureName + L".png"; + std::wstring fullpath = L"res/" + path + textureName + L".png"; if(hasFile(fullpath)) { result = m_dlcDataPack->getFile(DLCManager::e_DLCType_Texture, fullpath)->getParameterAsString(DLCManager::e_DLCParamType_Anim); @@ -150,7 +150,7 @@ wstring DLCTexturePack::getAnimationString(const wstring &textureName, const wst return result; } -BufferedImage *DLCTexturePack::getImageResource(const wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/) +BufferedImage *DLCTexturePack::getImageResource(const std::wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const std::wstring &drive /*=L""*/) { if(m_dlcDataPack) return new BufferedImage(m_dlcDataPack, L"/" + File, filenameHasExtension); else return fallback->getImageResource(File, filenameHasExtension, bTitleUpdateTexture, drive); @@ -267,7 +267,7 @@ void DLCTexturePack::loadData() -wstring DLCTexturePack::getFilePath(DWORD packId, wstring filename, bool bAddDataFolder) +std::wstring DLCTexturePack::getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder) { return app.getFilePath(packId,filename,bAddDataFolder); } @@ -288,7 +288,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen texturePack->setHasAudio(false); DWORD dwFilesProcessed = 0; // Load the DLC textures - wstring dataFilePath = texturePack->m_dlcInfoPack->getFullDataPath(); + std::wstring dataFilePath = texturePack->m_dlcInfoPack->getFullDataPath(); if(!dataFilePath.empty()) { if(!app.m_dlcManager.readDLCDataFile(dwFilesProcessed, getFilePath(texturePack->m_dlcInfoPack->GetPackID(), dataFilePath),texturePack->m_dlcDataPack)) @@ -301,7 +301,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen if(texturePack->m_dlcDataPack != NULL) { #ifdef _XBOX - File xzpPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"TexturePack.xzp") ) ); + File xzpPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), std::wstring(L"TexturePack.xzp") ) ); if(xzpPath.exists()) { @@ -332,7 +332,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen } } #else - File archivePath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"media.arc") ) ); + File archivePath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), std::wstring(L"media.arc") ) ); if(archivePath.exists()) texturePack->m_archiveFile = new ArchiveFile(archivePath); #endif @@ -355,7 +355,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen if (grf.exists()) { #if defined(_UNICODE) && !defined(__linux__) - wstring path = grf.getPath(); + std::wstring path = grf.getPath(); const WCHAR *pchFilename=path.c_str(); HANDLE fileHandle = CreateFile( pchFilename, // file name @@ -407,7 +407,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen if (grf.exists()) { #if defined(_UNICODE) && !defined(__linux__) - wstring path = grf.getPath(); + std::wstring path = grf.getPath(); const WCHAR *pchFilename=path.c_str(); HANDLE fileHandle = CreateFile( pchFilename, // file name @@ -452,8 +452,8 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen // any audio data? #ifdef _XBOX - File audioXSBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"MashUp.xsb") ) ); - File audioXWBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"MashUp.xwb") ) ); + File audioXSBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), std::wstring(L"MashUp.xsb") ) ); + File audioXWBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), std::wstring(L"MashUp.xwb") ) ); if(audioXSBPath.exists() && audioXWBPath.exists()) { @@ -584,9 +584,9 @@ void DLCTexturePack::unloadUI() bUILoaded = false; } -wstring DLCTexturePack::getXuiRootPath() +std::wstring DLCTexturePack::getXuiRootPath() { - wstring path = L""; + std::wstring path = L""; if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) { DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.h b/Minecraft.Client/Textures/Packs/DLCTexturePack.h index 14e6ea23e..375c8cafe 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.h +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.h @@ -25,7 +25,7 @@ public: DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback); ~DLCTexturePack(); - virtual wstring getResource(const wstring& name); + virtual std::wstring getResource(const std::wstring& name); virtual DLCPack * getDLCPack(); // Added for sound banks with MashUp packs #ifdef _XBOX @@ -38,31 +38,31 @@ protected: void loadComparison(); void loadName(); void loadDescription(); - InputStream *getResourceImplementation(const wstring &name); //throws IOException + InputStream *getResourceImplementation(const std::wstring &name); //throws IOException public: //@Override - bool hasFile(const wstring &name); + bool hasFile(const std::wstring &name); bool isTerrainUpdateCompatible(); // 4J Added - virtual wstring getPath(bool bTitleUpdateTexture = false); - 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 std::wstring getPath(bool bTitleUpdateTexture = false); + virtual std::wstring getAnimationString(const std::wstring &textureName, const std::wstring &path); + virtual BufferedImage *getImageResource(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L""); virtual void loadColourTable(); virtual bool hasData() { return m_bHasLoadedData; } virtual bool isLoadingData() { return m_bLoadingData; } private: - static wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder); - static wstring getFilePath(DWORD packId, wstring filename, bool bAddDataFolder=true); + static std::wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder); + static std::wstring getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder=true); public: static int packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask); virtual void loadData(); virtual void loadUI(); virtual void unloadUI(); - virtual wstring getXuiRootPath(); + virtual std::wstring getXuiRootPath(); virtual ArchiveFile *getArchiveFile() { return m_archiveFile; } virtual unsigned int getDLCParentPackId(); diff --git a/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp b/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp index b92b2b649..5484ada30 100644 --- a/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp @@ -45,7 +45,7 @@ void DefaultTexturePack::loadName() texname = L"Minecraft"; } -bool DefaultTexturePack::hasFile(const wstring &name) +bool DefaultTexturePack::hasFile(const std::wstring &name) { // return DefaultTexturePack::class->getResourceAsStream(name) != null; return true; @@ -56,9 +56,9 @@ bool DefaultTexturePack::isTerrainUpdateCompatible() return true; } -InputStream *DefaultTexturePack::getResourceImplementation(const wstring &name)// throws FileNotFoundException +InputStream *DefaultTexturePack::getResourceImplementation(const std::wstring &name)// throws FileNotFoundException { - wstring wDrive = L""; + std::wstring wDrive = L""; // Make the content package point to to the UPDATE: drive is needed #ifdef _XBOX #ifdef _TU_BUILD @@ -84,14 +84,14 @@ InputStream *DefaultTexturePack::getResourceImplementation(const wstring &name)/ } - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); wDrive = wstr + L"\\Common\\res\\TitleUpdate\\res"; #elif __PSVITA__ /* char *pchUsrDir=getUsrDirPath(); - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); wDrive = wstr + L"Common\\res\\TitleUpdate\\res"; */ diff --git a/Minecraft.Client/Textures/Packs/DefaultTexturePack.h b/Minecraft.Client/Textures/Packs/DefaultTexturePack.h index 9aa87a07a..1b46f22f3 100644 --- a/Minecraft.Client/Textures/Packs/DefaultTexturePack.h +++ b/Minecraft.Client/Textures/Packs/DefaultTexturePack.h @@ -15,14 +15,14 @@ protected: public: //@Override - bool hasFile(const wstring &name); + bool hasFile(const std::wstring &name); bool isTerrainUpdateCompatible(); - wstring getDesc1() {return app.GetString(IDS_DEFAULT_TEXTUREPACK);} + std::wstring getDesc1() {return app.GetString(IDS_DEFAULT_TEXTUREPACK);} protected: //@Override - InputStream *getResourceImplementation(const wstring &name); // throws FileNotFoundException + InputStream *getResourceImplementation(const std::wstring &name); // throws FileNotFoundException public: virtual bool hasData() { return true; } diff --git a/Minecraft.Client/Textures/Packs/FileTexturePack.cpp b/Minecraft.Client/Textures/Packs/FileTexturePack.cpp index 6798d570a..93c9426a9 100644 --- a/Minecraft.Client/Textures/Packs/FileTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/FileTexturePack.cpp @@ -24,7 +24,7 @@ void FileTexturePack::unload(Textures *textures) #endif } -InputStream *FileTexturePack::getResourceImplementation(const wstring &name) //throws IOException +InputStream *FileTexturePack::getResourceImplementation(const std::wstring &name) //throws IOException { #if 0 loadZipFile(); @@ -39,7 +39,7 @@ InputStream *FileTexturePack::getResourceImplementation(const wstring &name) //t return NULL; } -bool FileTexturePack::hasFile(const wstring &name) +bool FileTexturePack::hasFile(const std::wstring &name) { #if 0 try { diff --git a/Minecraft.Client/Textures/Packs/FileTexturePack.h b/Minecraft.Client/Textures/Packs/FileTexturePack.h index 85221d114..082f4444b 100644 --- a/Minecraft.Client/Textures/Packs/FileTexturePack.h +++ b/Minecraft.Client/Textures/Packs/FileTexturePack.h @@ -18,11 +18,11 @@ public: void unload(Textures *textures); protected: - InputStream *getResourceImplementation(const wstring &name); //throws IOException + InputStream *getResourceImplementation(const std::wstring &name); //throws IOException public: //@Override - bool hasFile(const wstring &name); + bool hasFile(const std::wstring &name); private: void loadZipFile(); //throws IOException diff --git a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp index f512f4eb9..a63498ecf 100644 --- a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp @@ -1,7 +1,7 @@ #include "../../Build/stdafx.h" #include "FolderTexturePack.h" -FolderTexturePack::FolderTexturePack(DWORD id, const wstring &name, File *folder, TexturePack *fallback) : AbstractTexturePack(id, folder, name, fallback) +FolderTexturePack::FolderTexturePack(DWORD id, const std::wstring &name, File *folder, TexturePack *fallback) : AbstractTexturePack(id, folder, name, fallback) { // 4J Stu - These calls need to be in the most derived version of the class loadIcon(); @@ -11,7 +11,7 @@ FolderTexturePack::FolderTexturePack(DWORD id, const wstring &name, File *folder bUILoaded = false; } -InputStream *FolderTexturePack::getResourceImplementation(const wstring &name) //throws IOException +InputStream *FolderTexturePack::getResourceImplementation(const std::wstring &name) //throws IOException { #if 0 final File file = new File(this.file, name.substring(1)); @@ -22,7 +22,7 @@ InputStream *FolderTexturePack::getResourceImplementation(const wstring &name) / return new BufferedInputStream(new FileInputStream(file)); #endif - wstring wDrive = L""; + std::wstring wDrive = L""; // Make the content package point to to the UPDATE: drive is needed #ifdef _XBOX wDrive=L"GAME:\\DummyTexturePack\\res"; @@ -40,7 +40,7 @@ InputStream *FolderTexturePack::getResourceImplementation(const wstring &name) / return resource; } -bool FolderTexturePack::hasFile(const wstring &name) +bool FolderTexturePack::hasFile(const std::wstring &name) { File file = File( getPath() + name); return file.exists() && file.isFile(); @@ -58,9 +58,9 @@ bool FolderTexturePack::isTerrainUpdateCompatible() return true; } -wstring FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/) +std::wstring FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/) { - wstring wDrive; + std::wstring wDrive; #ifdef _XBOX wDrive=L"GAME:\\" + file->getPath() + L"\\"; #else diff --git a/Minecraft.Client/Textures/Packs/FolderTexturePack.h b/Minecraft.Client/Textures/Packs/FolderTexturePack.h index fff4abf5d..c57d2576e 100644 --- a/Minecraft.Client/Textures/Packs/FolderTexturePack.h +++ b/Minecraft.Client/Textures/Packs/FolderTexturePack.h @@ -8,19 +8,19 @@ private: bool bUILoaded; public: - FolderTexturePack(DWORD id, const wstring &name, File *folder, TexturePack *fallback); + FolderTexturePack(DWORD id, const std::wstring &name, File *folder, TexturePack *fallback); protected: //@Override - InputStream *getResourceImplementation(const wstring &name); //throws IOException + InputStream *getResourceImplementation(const std::wstring &name); //throws IOException public: //@Override - bool hasFile(const wstring &name); + bool hasFile(const std::wstring &name); bool isTerrainUpdateCompatible(); // 4J Added - virtual wstring getPath(bool bTitleUpdateTexture = false); + virtual std::wstring getPath(bool bTitleUpdateTexture = false); virtual void loadUI(); virtual void unloadUI(); }; \ No newline at end of file diff --git a/Minecraft.Client/Textures/Packs/TexturePack.cpp b/Minecraft.Client/Textures/Packs/TexturePack.cpp index 4102b533a..77e1d8b87 100644 --- a/Minecraft.Client/Textures/Packs/TexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/TexturePack.cpp @@ -1,9 +1,9 @@ #include "../../Build/stdafx.h" #include "TexturePack.h" -wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/) +std::wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/) { - wstring wDrive; + std::wstring wDrive; #ifdef _XBOX if(bTitleUpdateTexture) { @@ -27,7 +27,7 @@ wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/) char *pchUsrDir=getUsrDirPath(); - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); if(bTitleUpdateTexture) { @@ -42,7 +42,7 @@ wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/) #elif __PSVITA__ char *pchUsrDir="";//getUsrDirPath(); - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); if(bTitleUpdateTexture) { diff --git a/Minecraft.Client/Textures/Packs/TexturePack.h b/Minecraft.Client/Textures/Packs/TexturePack.h index 16f877b8a..ee2a9af3b 100644 --- a/Minecraft.Client/Textures/Packs/TexturePack.h +++ b/Minecraft.Client/Textures/Packs/TexturePack.h @@ -19,16 +19,16 @@ public: virtual void loadData() {} virtual void unload(Textures *textures) = 0; virtual void load(Textures *textures) = 0; - virtual InputStream *getResource(const wstring &name, bool allowFallback) = 0;// throws IOException; - //virtual InputStream *getResource(const wstring &name) = 0;// throws IOException; + virtual InputStream *getResource(const std::wstring &name, bool allowFallback) = 0;// throws IOException; + //virtual InputStream *getResource(const std::wstring &name) = 0;// throws IOException; virtual DWORD getId() = 0; - virtual wstring getName() = 0; - virtual wstring getDesc1() = 0; - virtual wstring getDesc2() = 0; - virtual bool hasFile(const wstring &name, bool allowFallback) = 0; + virtual std::wstring getName() = 0; + virtual std::wstring getDesc1() = 0; + virtual std::wstring getDesc2() = 0; + virtual bool hasFile(const std::wstring &name, bool allowFallback) = 0; virtual bool isTerrainUpdateCompatible() = 0; - virtual wstring getResource(const wstring& name) // 4J - changed to just return a name rather than an input stream + virtual std::wstring getResource(const std::wstring& name) // 4J - changed to just return a name rather than an input stream { /* 4J - TODO return TexturePack.class.getResourceAsStream(name); @@ -39,13 +39,13 @@ public: // 4J Added - virtual wstring getPath(bool bTitleUpdateTexture = false); - 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 std::wstring getPath(bool bTitleUpdateTexture = false); + virtual std::wstring getAnimationString(const std::wstring &textureName, const std::wstring &path, bool allowFallback) = 0; + virtual BufferedImage *getImageResource(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L"") = 0; virtual void loadColourTable() = 0; virtual void loadUI() = 0; virtual void unloadUI() = 0; - virtual wstring getXuiRootPath() = 0; + virtual std::wstring getXuiRootPath() = 0; virtual PBYTE getPackIcon(DWORD &dwImageBytes) = 0; virtual PBYTE getPackComparison(DWORD &dwImageBytes) = 0; virtual unsigned int getDLCParentPackId() = 0; diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp index 817fc7aac..3bae4d69a 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp @@ -105,7 +105,7 @@ bool TexturePackRepository::selectSkin(TexturePack *skin) return true; } -void TexturePackRepository::selectWebSkin(const wstring &url) +void TexturePackRepository::selectWebSkin(const std::wstring &url) { app.DebugPrintf("TexturePackRepository::selectWebSkin is not implemented\n"); #if 0 @@ -117,7 +117,7 @@ void TexturePackRepository::selectWebSkin(const wstring &url) #endif } -void TexturePackRepository::downloadWebSkin(const wstring &url, File file) +void TexturePackRepository::downloadWebSkin(const std::wstring &url, File file) { app.DebugPrintf("TexturePackRepository::selectWebSkin is not implemented\n"); #if 0 @@ -219,7 +219,7 @@ void TexturePackRepository::updateList() #endif } -wstring TexturePackRepository::getIdOrNull(File file) +std::wstring TexturePackRepository::getIdOrNull(File file) { app.DebugPrintf("TexturePackRepository::getIdOrNull is not implemented\n"); #if 0 @@ -291,14 +291,14 @@ bool TexturePackRepository::canUseWebSkin() return false; } -vector< pair > *TexturePackRepository::getTexturePackIdNames() +vector< pair > *TexturePackRepository::getTexturePackIdNames() { - vector< pair > *packList = new vector< pair >(); + vector< pair > *packList = new vector< pair >(); for(AUTO_VAR(it,texturePacks->begin()); it != texturePacks->end(); ++it) { TexturePack *pack = *it; - packList->push_back( pair(pack->getId(),pack->getName()) ); + packList->push_back( pair(pack->getId(),pack->getName()) ); } return packList; } diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.h b/Minecraft.Client/Textures/Packs/TexturePackRepository.h index 922b440de..99e89852e 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.h +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.h @@ -37,10 +37,10 @@ private: public: bool selectSkin(TexturePack *skin); - void selectWebSkin(const wstring &url); + void selectWebSkin(const std::wstring &url); private: - void downloadWebSkin(const wstring &url, File file); + void downloadWebSkin(const std::wstring &url, File file); public: bool isUsingWebSkin(); @@ -48,7 +48,7 @@ public: void updateList(); private: - wstring getIdOrNull(File file); + std::wstring getIdOrNull(File file); vector getWorkDirContents(); public: @@ -60,7 +60,7 @@ public: bool isUsingDefaultSkin() { return selected == DEFAULT_TEXTURE_PACK; } // 4J Added TexturePack *getDefault() { return DEFAULT_TEXTURE_PACK; } // 4J Added - vector< pair > *getTexturePackIdNames(); + vector< pair > *getTexturePackIdNames(); bool selectTexturePackById(DWORD id); // 4J Added TexturePack *getTexturePackById(DWORD id); // 4J Added diff --git a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp index cc024b19a..8bf37af90 100644 --- a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp @@ -19,9 +19,9 @@ #include "../CompassTexture.h" #include "../ClockTexture.h" -const wstring PreStitchedTextureMap::NAME_MISSING_TEXTURE = L"missingno"; +const std::wstring PreStitchedTextureMap::NAME_MISSING_TEXTURE = L"missingno"; -PreStitchedTextureMap::PreStitchedTextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipmap) : iconType(type), name(name), path(path), extension(L".png") +PreStitchedTextureMap::PreStitchedTextureMap(int type, const std::wstring &name, const std::wstring &path, BufferedImage *missingTexture, bool mipmap) : iconType(type), name(name), path(path), extension(L".png") { this->missingTexture = missingTexture; @@ -77,7 +77,7 @@ void PreStitchedTextureMap::stitch() animatedTextures.clear(); // Create the final image - wstring filename = name + extension; + std::wstring filename = name + extension; TexturePack *texturePack = Minecraft::GetInstance()->skins->getSelected(); //try { @@ -87,7 +87,7 @@ void PreStitchedTextureMap::stitch() int magFilter = Texture::TFLT_NEAREST; MemSect(32); - wstring drive = L""; + std::wstring drive = L""; if(texturePack->hasFile(L"res/" + filename,false)) { drive = texturePack->getPath(true); @@ -129,8 +129,8 @@ void PreStitchedTextureMap::stitch() MemSect(52); for(AUTO_VAR(it, texturesToAnimate.begin()); it != texturesToAnimate.end(); ++it) { - wstring textureName = it->first; - wstring textureFileName = it->second; + std::wstring textureName = it->first; + std::wstring textureFileName = it->second; StitchedTexture *preStitched = (StitchedTexture *)texturesByName[textureName]; @@ -140,7 +140,7 @@ void PreStitchedTextureMap::stitch() continue; } - wstring filename = path + textureFileName + extension; + std::wstring filename = path + textureFileName + extension; // TODO: [EB] Put the frames into a proper object, not this inside out hack vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); @@ -164,7 +164,7 @@ void PreStitchedTextureMap::stitch() { animatedTextures.push_back(preStitched); - wstring animString = texturePack->getAnimationString(textureFileName, path, true); + std::wstring animString = texturePack->getAnimationString(textureFileName, path, true); preStitched->loadAnimationFrames(animString); } @@ -216,7 +216,7 @@ void PreStitchedTextureMap::stitch() #endif } -StitchedTexture *PreStitchedTextureMap::getTexture(const wstring &name) +StitchedTexture *PreStitchedTextureMap::getTexture(const std::wstring &name) { #ifndef _CONTENT_PACKAGE app.DebugPrintf("Not implemented!\n"); @@ -246,7 +246,7 @@ Texture *PreStitchedTextureMap::getStitchedTexture() } // 4J Stu - register is a reserved keyword in C++ -Icon *PreStitchedTextureMap::registerIcon(const wstring &name) +Icon *PreStitchedTextureMap::registerIcon(const std::wstring &name) { Icon *result = NULL; if (name.empty()) @@ -363,11 +363,11 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"compassP1",new SimpleIcon(L"compassP1",slotSize*8,slotSize*14,slotSize*(8+1),slotSize*(14+1)))); texturesByName.insert(stringIconMap::value_type(L"compassP2",new SimpleIcon(L"compassP2",slotSize*9,slotSize*14,slotSize*(9+1),slotSize*(14+1)))); texturesByName.insert(stringIconMap::value_type(L"compassP3",new SimpleIcon(L"compassP3",slotSize*10,slotSize*14,slotSize*(10+1),slotSize*(14+1)))); - texturesToAnimate.push_back(pair(L"compass",L"compass")); - texturesToAnimate.push_back(pair(L"compassP0",L"compass")); - texturesToAnimate.push_back(pair(L"compassP1",L"compass")); - texturesToAnimate.push_back(pair(L"compassP2",L"compass")); - texturesToAnimate.push_back(pair(L"compassP3",L"compass")); + texturesToAnimate.push_back(pair(L"compass",L"compass")); + texturesToAnimate.push_back(pair(L"compassP0",L"compass")); + texturesToAnimate.push_back(pair(L"compassP1",L"compass")); + texturesToAnimate.push_back(pair(L"compassP2",L"compass")); + texturesToAnimate.push_back(pair(L"compassP3",L"compass")); texturesByName.insert(stringIconMap::value_type(L"diamond",new SimpleIcon(L"diamond",slotSize*7,slotSize*3,slotSize*(7+1),slotSize*(3+1)))); texturesByName.insert(stringIconMap::value_type(L"redstone",new SimpleIcon(L"redstone",slotSize*8,slotSize*3,slotSize*(8+1),slotSize*(3+1)))); texturesByName.insert(stringIconMap::value_type(L"clay",new SimpleIcon(L"clay",slotSize*9,slotSize*3,slotSize*(9+1),slotSize*(3+1)))); @@ -388,11 +388,11 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"clockP1",new SimpleIcon(L"clockP1",slotSize*12,slotSize*14,slotSize*(12+1),slotSize*(14+1)))); texturesByName.insert(stringIconMap::value_type(L"clockP2",new SimpleIcon(L"clockP2",slotSize*13,slotSize*14,slotSize*(13+1),slotSize*(14+1)))); texturesByName.insert(stringIconMap::value_type(L"clockP3",new SimpleIcon(L"clockP3",slotSize*14,slotSize*14,slotSize*(14+1),slotSize*(14+1)))); - texturesToAnimate.push_back(pair(L"clock",L"clock")); - texturesToAnimate.push_back(pair(L"clockP0",L"clock")); - texturesToAnimate.push_back(pair(L"clockP1",L"clock")); - texturesToAnimate.push_back(pair(L"clockP2",L"clock")); - texturesToAnimate.push_back(pair(L"clockP3",L"clock")); + texturesToAnimate.push_back(pair(L"clock",L"clock")); + texturesToAnimate.push_back(pair(L"clockP0",L"clock")); + texturesToAnimate.push_back(pair(L"clockP1",L"clock")); + texturesToAnimate.push_back(pair(L"clockP2",L"clock")); + texturesToAnimate.push_back(pair(L"clockP3",L"clock")); texturesByName.insert(stringIconMap::value_type(L"bowl",new SimpleIcon(L"bowl",slotSize*7,slotSize*4,slotSize*(7+1),slotSize*(4+1)))); texturesByName.insert(stringIconMap::value_type(L"mushroomStew",new SimpleIcon(L"mushroomStew",slotSize*8,slotSize*4,slotSize*(8+1),slotSize*(4+1)))); texturesByName.insert(stringIconMap::value_type(L"yellowDust",new SimpleIcon(L"yellowDust",slotSize*9,slotSize*4,slotSize*(9+1),slotSize*(4+1)))); @@ -607,7 +607,7 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"rose",new SimpleIcon(L"rose",slotSize*12,slotSize*0,slotSize*(12+1),slotSize*(0+1)))); texturesByName.insert(stringIconMap::value_type(L"flower",new SimpleIcon(L"flower",slotSize*13,slotSize*0,slotSize*(13+1),slotSize*(0+1)))); texturesByName.insert(stringIconMap::value_type(L"portal",new SimpleIcon(L"portal",slotSize*14,slotSize*0,slotSize*(14+1),slotSize*(0+1)))); - texturesToAnimate.push_back(pair(L"portal",L"portal")); + texturesToAnimate.push_back(pair(L"portal",L"portal")); texturesByName.insert(stringIconMap::value_type(L"sapling",new SimpleIcon(L"sapling",slotSize*15,slotSize*0,slotSize*(15+1),slotSize*(0+1)))); texturesByName.insert(stringIconMap::value_type(L"stonebrick",new SimpleIcon(L"stonebrick",slotSize*0,slotSize*1,slotSize*(0+1),slotSize*(1+1)))); texturesByName.insert(stringIconMap::value_type(L"bedrock",new SimpleIcon(L"bedrock",slotSize*1,slotSize*1,slotSize*(1+1),slotSize*(1+1)))); @@ -625,7 +625,7 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"mushroom_brown",new SimpleIcon(L"mushroom_brown",slotSize*13,slotSize*1,slotSize*(13+1),slotSize*(1+1)))); texturesByName.insert(stringIconMap::value_type(L"sapling_jungle",new SimpleIcon(L"sapling_jungle",slotSize*14,slotSize*1,slotSize*(14+1),slotSize*(1+1)))); texturesByName.insert(stringIconMap::value_type(L"fire_0",new SimpleIcon(L"fire_0",slotSize*15,slotSize*1,slotSize*(15+1),slotSize*(1+1)))); - texturesToAnimate.push_back(pair(L"fire_0",L"fire_0")); + texturesToAnimate.push_back(pair(L"fire_0",L"fire_0")); texturesByName.insert(stringIconMap::value_type(L"oreGold",new SimpleIcon(L"oreGold",slotSize*0,slotSize*2,slotSize*(0+1),slotSize*(2+1)))); texturesByName.insert(stringIconMap::value_type(L"oreIron",new SimpleIcon(L"oreIron",slotSize*1,slotSize*2,slotSize*(1+1),slotSize*(2+1)))); texturesByName.insert(stringIconMap::value_type(L"oreCoal",new SimpleIcon(L"oreCoal",slotSize*2,slotSize*2,slotSize*(2+1),slotSize*(2+1)))); @@ -642,7 +642,7 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"furnace_side",new SimpleIcon(L"furnace_side",slotSize*13,slotSize*2,slotSize*(13+1),slotSize*(2+1)))); texturesByName.insert(stringIconMap::value_type(L"dispenser_front",new SimpleIcon(L"dispenser_front",slotSize*14,slotSize*2,slotSize*(14+1),slotSize*(2+1)))); texturesByName.insert(stringIconMap::value_type(L"fire_1",new SimpleIcon(L"fire_1",slotSize*15,slotSize*1,slotSize*(15+1),slotSize*(1+1)))); - texturesToAnimate.push_back(pair(L"fire_1",L"fire_1")); + texturesToAnimate.push_back(pair(L"fire_1",L"fire_1")); texturesByName.insert(stringIconMap::value_type(L"sponge",new SimpleIcon(L"sponge",slotSize*0,slotSize*3,slotSize*(0+1),slotSize*(3+1)))); texturesByName.insert(stringIconMap::value_type(L"glass",new SimpleIcon(L"glass",slotSize*1,slotSize*3,slotSize*(1+1),slotSize*(3+1)))); texturesByName.insert(stringIconMap::value_type(L"oreDiamond",new SimpleIcon(L"oreDiamond",slotSize*2,slotSize*3,slotSize*(2+1),slotSize*(3+1)))); @@ -803,9 +803,9 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"potatoes_2",new SimpleIcon(L"potatoes_2",slotSize*10,slotSize*12,slotSize*(10+1),slotSize*(12+1)))); texturesByName.insert(stringIconMap::value_type(L"potatoes_3",new SimpleIcon(L"potatoes_3",slotSize*12,slotSize*12,slotSize*(12+1),slotSize*(12+1)))); texturesByName.insert(stringIconMap::value_type(L"water",new SimpleIcon(L"water",slotSize*13,slotSize*12,slotSize*(13+1),slotSize*(12+1)))); - texturesToAnimate.push_back(pair(L"water",L"water")); + texturesToAnimate.push_back(pair(L"water",L"water")); texturesByName.insert(stringIconMap::value_type(L"water_flow",new SimpleIcon(L"water_flow",slotSize*14,slotSize*12,slotSize*(14+2),slotSize*(12+2)))); - texturesToAnimate.push_back(pair(L"water_flow",L"water_flow")); + texturesToAnimate.push_back(pair(L"water_flow",L"water_flow")); texturesByName.insert(stringIconMap::value_type(L"sandstone_bottom",new SimpleIcon(L"sandstone_bottom",slotSize*0,slotSize*13,slotSize*(0+1),slotSize*(13+1)))); texturesByName.insert(stringIconMap::value_type(L"cloth_9",new SimpleIcon(L"cloth_9",slotSize*1,slotSize*13,slotSize*(1+1),slotSize*(13+1)))); texturesByName.insert(stringIconMap::value_type(L"cloth_1",new SimpleIcon(L"cloth_1",slotSize*2,slotSize*13,slotSize*(2+1),slotSize*(13+1)))); @@ -834,9 +834,9 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"quartzblock_side",new SimpleIcon(L"quartzblock_side",slotSize*11,slotSize*14,slotSize*(11+1),slotSize*(14+1)))); texturesByName.insert(stringIconMap::value_type(L"hopper_inside",new SimpleIcon(L"hopper_inside",slotSize*12,slotSize*14,slotSize*(12+1),slotSize*(14+1)))); texturesByName.insert(stringIconMap::value_type(L"lava",new SimpleIcon(L"lava",slotSize*13,slotSize*14,slotSize*(13+1),slotSize*(14+1)))); - texturesToAnimate.push_back(pair(L"lava",L"lava")); + texturesToAnimate.push_back(pair(L"lava",L"lava")); texturesByName.insert(stringIconMap::value_type(L"lava_flow",new SimpleIcon(L"lava_flow",slotSize*14,slotSize*14,slotSize*(14+2),slotSize*(14+2)))); - texturesToAnimate.push_back(pair(L"lava_flow",L"lava_flow")); + texturesToAnimate.push_back(pair(L"lava_flow",L"lava_flow")); texturesByName.insert(stringIconMap::value_type(L"destroy_0",new SimpleIcon(L"destroy_0",slotSize*0,slotSize*15,slotSize*(0+1),slotSize*(15+1)))); texturesByName.insert(stringIconMap::value_type(L"destroy_1",new SimpleIcon(L"destroy_1",slotSize*1,slotSize*15,slotSize*(1+1),slotSize*(15+1)))); texturesByName.insert(stringIconMap::value_type(L"destroy_2",new SimpleIcon(L"destroy_2",slotSize*2,slotSize*15,slotSize*(2+1),slotSize*(15+1)))); diff --git a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h index aab22ffab..763d2cab7 100644 --- a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h +++ b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h @@ -12,37 +12,37 @@ class BufferedImage; class PreStitchedTextureMap : public IconRegister { public: - static const wstring NAME_MISSING_TEXTURE; + static const std::wstring NAME_MISSING_TEXTURE; private: const int iconType; - const wstring name; - const wstring path; - const wstring extension; + const std::wstring name; + const std::wstring path; + const std::wstring extension; bool m_mipMap; - typedef std::unordered_map stringIconMap; + typedef std::unordered_map stringIconMap; stringIconMap texturesByName; // = new HashMap(); BufferedImage *missingTexture; // = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); StitchedTexture *missingPosition; Texture *stitchResult; vector animatedTextures; // = new ArrayList(); - vector > texturesToAnimate; + vector > texturesToAnimate; void loadUVs(); public: - PreStitchedTextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipMap = false); + PreStitchedTextureMap(int type, const std::wstring &name, const std::wstring &path, BufferedImage *missingTexture, bool mipMap = false); void stitch(); - StitchedTexture *getTexture(const wstring &name); + StitchedTexture *getTexture(const std::wstring &name); void cycleAnimationFrames(); Texture *getStitchedTexture(); // 4J Stu - register is a reserved keyword in C++ - Icon *registerIcon(const wstring &name); + Icon *registerIcon(const std::wstring &name); int getIconType(); Icon *getMissingIcon(); diff --git a/Minecraft.Client/Textures/Stitching/StitchSlot.cpp b/Minecraft.Client/Textures/Stitching/StitchSlot.cpp index c044dcce2..15dcc2327 100644 --- a/Minecraft.Client/Textures/Stitching/StitchSlot.cpp +++ b/Minecraft.Client/Textures/Stitching/StitchSlot.cpp @@ -150,7 +150,7 @@ void StitchSlot::collectAssignments(vector *result) } //@Override -wstring StitchSlot::toString() +std::wstring StitchSlot::toString() { return L"Slot{originX=" + _toString(originX) + L", originY=" + _toString(originY) + L", width=" + _toString(width) + L", height=" + _toString(height) + L", texture=" + _toString(textureHolder) + L", subSlots=" + _toString(subSlots) + L'}'; } \ No newline at end of file diff --git a/Minecraft.Client/Textures/Stitching/StitchSlot.h b/Minecraft.Client/Textures/Stitching/StitchSlot.h index 0990a06ef..3cedce6b4 100644 --- a/Minecraft.Client/Textures/Stitching/StitchSlot.h +++ b/Minecraft.Client/Textures/Stitching/StitchSlot.h @@ -24,5 +24,5 @@ public: void collectAssignments(vector *result); //@Override - wstring toString(); + std::wstring toString(); }; \ No newline at end of file diff --git a/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp b/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp index 4ed06b861..3fce9033a 100644 --- a/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp +++ b/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp @@ -6,7 +6,7 @@ #include "StitchedTexture.h" #include "../TextureManager.h" -StitchedTexture *StitchedTexture::create(const wstring &name) +StitchedTexture *StitchedTexture::create(const std::wstring &name) { // TODO: Generalize? if (name.compare(L"clock") == 0) @@ -23,7 +23,7 @@ StitchedTexture *StitchedTexture::create(const wstring &name) } } -StitchedTexture::StitchedTexture(const wstring &name) : name(name) +StitchedTexture::StitchedTexture(const std::wstring &name) : name(name) { // 4J Initialisers source = NULL; @@ -170,7 +170,7 @@ float StitchedTexture::getV(double offset, bool adjust/*=false*/) const return getV0(adjust) + (diff * ((float) offset / SharedConstants::WORLD_RESOLUTION)); } -wstring StitchedTexture::getName() const +std::wstring StitchedTexture::getName() const { return name; } @@ -256,7 +256,7 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader) intPairVector *results = new intPairVector(); //try { - wstring line = bufferedReader->readLine(); + std::wstring line = bufferedReader->readLine(); while (!line.empty()) { line = trimString(line); @@ -266,7 +266,7 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader) //for (String token : tokens) for(AUTO_VAR(it, tokens.begin()); it != tokens.end(); ++it) { - wstring token = *it; + std::wstring token = *it; int multiPos = token.find_first_of('*'); if (multiPos > 0) { @@ -297,7 +297,7 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader) } } -void StitchedTexture::loadAnimationFrames(const wstring &string) +void StitchedTexture::loadAnimationFrames(const std::wstring &string) { if(frameOverride != NULL) { @@ -313,7 +313,7 @@ void StitchedTexture::loadAnimationFrames(const wstring &string) //for (String token : tokens) for(AUTO_VAR(it, tokens.begin()); it != tokens.end(); ++it) { - wstring token = trimString(*it); + std::wstring token = trimString(*it); int multiPos = token.find_first_of('*'); if (multiPos > 0) { diff --git a/Minecraft.Client/Textures/Stitching/StitchedTexture.h b/Minecraft.Client/Textures/Stitching/StitchedTexture.h index 62ce19ccc..e1c72e401 100644 --- a/Minecraft.Client/Textures/Stitching/StitchedTexture.h +++ b/Minecraft.Client/Textures/Stitching/StitchedTexture.h @@ -7,7 +7,7 @@ class Texture; class StitchedTexture : public Icon { private: - const wstring name; + const std::wstring name; protected: Texture *source; @@ -41,11 +41,11 @@ protected: int subFrame; public: - static StitchedTexture *create(const wstring &name); + static StitchedTexture *create(const std::wstring &name); ~StitchedTexture(); protected: - StitchedTexture(const wstring &name); + StitchedTexture(const std::wstring &name); public: void initUVs(float U0, float V0, float U1, float V1); @@ -61,7 +61,7 @@ public: float getV0(bool adjust = false) const; float getV1(bool adjust = false) const; float getV(double offset, bool adjust = false) const; - wstring getName() const; + std::wstring getName() const; virtual int getSourceWidth() const; virtual int getSourceHeight() const; virtual void cycleFrames(); @@ -80,7 +80,7 @@ public: * @param bufferedReader */ void loadAnimationFrames(BufferedReader *bufferedReader); - void loadAnimationFrames(const wstring &string); // 4J Added + void loadAnimationFrames(const std::wstring &string); // 4J Added int getFlags() const ; // 4J added void setFlags(int flags); // 4J added diff --git a/Minecraft.Client/Textures/Stitching/Stitcher.cpp b/Minecraft.Client/Textures/Stitching/Stitcher.cpp index 821a72af6..ede0953e8 100644 --- a/Minecraft.Client/Textures/Stitching/Stitcher.cpp +++ b/Minecraft.Client/Textures/Stitching/Stitcher.cpp @@ -6,7 +6,7 @@ #include "StitchedTexture.h" #include "Stitcher.h" -void Stitcher::_init(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale) +void Stitcher::_init(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale) { this->name = name; this->maxWidth = maxWidth; @@ -20,12 +20,12 @@ void Stitcher::_init(const wstring &name, int maxWidth, int maxHeight, bool forc stitchedTexture = NULL; } -Stitcher::Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo) +Stitcher::Stitcher(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo) { _init(name, maxWidth, maxHeight, forcePowerOfTwo, 0); } -Stitcher::Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale) +Stitcher::Stitcher(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale) { _init(name, maxWidth, maxHeight, forcePowerOfTwo, forcedScale); } diff --git a/Minecraft.Client/Textures/Stitching/Stitcher.h b/Minecraft.Client/Textures/Stitching/Stitcher.h index b7f37a3de..62803955a 100644 --- a/Minecraft.Client/Textures/Stitching/Stitcher.h +++ b/Minecraft.Client/Textures/Stitching/Stitcher.h @@ -28,13 +28,13 @@ private: Texture *stitchedTexture; - wstring name; + std::wstring name; - void _init(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale); + void _init(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale); public: - Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo); - Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale); + Stitcher(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo); + Stitcher(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale); int getWidth(); int getHeight(); diff --git a/Minecraft.Client/Textures/Stitching/TextureMap.cpp b/Minecraft.Client/Textures/Stitching/TextureMap.cpp index 8277da0ec..a36517f94 100644 --- a/Minecraft.Client/Textures/Stitching/TextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/TextureMap.cpp @@ -15,9 +15,9 @@ #include "../Packs/TexturePackRepository.h" #include "TextureMap.h" -const wstring TextureMap::NAME_MISSING_TEXTURE = L"missingno"; +const std::wstring TextureMap::NAME_MISSING_TEXTURE = L"missingno"; -TextureMap::TextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipmap) : iconType(type), name(name), path(path), extension(L".png") +TextureMap::TextureMap(int type, const std::wstring &name, const std::wstring &path, BufferedImage *missingTexture, bool mipmap) : iconType(type), name(name), path(path), extension(L".png") { this->missingTexture = missingTexture; @@ -82,9 +82,9 @@ void TextureMap::stitch() //for (final String name : texturesToRegister.keySet()) for(AUTO_VAR(it, texturesToRegister.begin()); it != texturesToRegister.end(); ++it) { - wstring name = it->first; + std::wstring name = it->first; - wstring filename = path + name + extension; + std::wstring filename = path + name + extension; // TODO: [EB] Put the frames into a proper object, not this inside out hack vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); @@ -121,7 +121,7 @@ void TextureMap::stitch() TextureHolder *textureHolder = slot->getHolder(); Texture *texture = textureHolder->getTexture(); - wstring textureName = texture->getName(); + std::wstring textureName = texture->getName(); vector *frames = textures.find(textureHolder)->second; @@ -155,7 +155,7 @@ void TextureMap::stitch() { animatedTextures.push_back(stored); - wstring animationDefinitionFile = textureName + L".txt"; + std::wstring animationDefinitionFile = textureName + L".txt"; TexturePack *texturePack = Minecraft::GetInstance()->skins->getSelected(); bool requiresFallback = !texturePack->hasFile(L"\\" + textureName + L".png", false); @@ -189,7 +189,7 @@ void TextureMap::stitch() stitchResult->updateOnGPU(); } -StitchedTexture *TextureMap::getTexture(const wstring &name) +StitchedTexture *TextureMap::getTexture(const std::wstring &name) { StitchedTexture *result = texturesByName.find(name)->second; if (result == NULL) result = missingPosition; @@ -212,7 +212,7 @@ Texture *TextureMap::getStitchedTexture() } // 4J Stu - register is a reserved keyword in C++ -Icon *TextureMap::registerIcon(const wstring &name) +Icon *TextureMap::registerIcon(const std::wstring &name) { if (name.empty()) { diff --git a/Minecraft.Client/Textures/Stitching/TextureMap.h b/Minecraft.Client/Textures/Stitching/TextureMap.h index 173dd15e1..73c35d1ff 100644 --- a/Minecraft.Client/Textures/Stitching/TextureMap.h +++ b/Minecraft.Client/Textures/Stitching/TextureMap.h @@ -10,18 +10,18 @@ class BufferedImage; class TextureMap : public IconRegister { public: - static const wstring NAME_MISSING_TEXTURE; + static const std::wstring NAME_MISSING_TEXTURE; private: const int iconType; - const wstring name; - const wstring path; - const wstring extension; + const std::wstring name; + const std::wstring path; + const std::wstring extension; bool m_mipMap; - typedef std::unordered_map stringStitchedTextureMap; + typedef std::unordered_map stringStitchedTextureMap; stringStitchedTextureMap texturesByName; // = new HashMap(); BufferedImage *missingTexture; // = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); StitchedTexture *missingPosition; @@ -31,15 +31,15 @@ private: stringStitchedTextureMap texturesToRegister; // = new HashMap(); public: - TextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipMap = false); + TextureMap(int type, const std::wstring &name, const std::wstring &path, BufferedImage *missingTexture, bool mipMap = false); void stitch(); - StitchedTexture *getTexture(const wstring &name); + StitchedTexture *getTexture(const std::wstring &name); void cycleAnimationFrames(); Texture *getStitchedTexture(); // 4J Stu - register is a reserved keyword in C++ - Icon *registerIcon(const wstring &name); + Icon *registerIcon(const std::wstring &name); int getIconType(); Icon *getMissingIcon(); diff --git a/Minecraft.Client/Textures/Texture.cpp b/Minecraft.Client/Textures/Texture.cpp index 178d44d05..16084d176 100644 --- a/Minecraft.Client/Textures/Texture.cpp +++ b/Minecraft.Client/Textures/Texture.cpp @@ -15,12 +15,12 @@ C4JSpursJobQueue::Port* g_texBlitJobQueuePort; #define MAX_MIP_LEVELS 5 -Texture::Texture(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap) +Texture::Texture(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap) { _init(name, mode, width, height, depth, wrapMode, format, minFilter, magFilter, mipMap); } -void Texture::_init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap) +void Texture::_init(const std::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) @@ -101,7 +101,7 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de managerId = TextureManager::getInstance()->createTextureID(); } -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) +void Texture::_init(const std::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) @@ -178,12 +178,12 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de } } -Texture::Texture(const wstring &name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap) +Texture::Texture(const std::wstring &name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap) { _init(name, mode, width, height, 1, wrapMode, format, minFilter, magFilter, image, mipMap); } -Texture::Texture(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap) +Texture::Texture(const std::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, image, mipMap); } @@ -242,7 +242,7 @@ void Texture::fill(const Rect2i *rect, int color) } } -void Texture::writeAsBMP(const wstring &name) +void Texture::writeAsBMP(const std::wstring &name) { // 4J Don't need #if 0 @@ -329,7 +329,7 @@ void Texture::writeAsBMP(const wstring &name) #endif } -void Texture::writeAsPNG(const wstring &filename) +void Texture::writeAsPNG(const std::wstring &filename) { // 4J Don't need #if 0 @@ -769,7 +769,7 @@ int Texture::getHeight() return height; } -wstring Texture::getName() +std::wstring Texture::getName() { return name; } diff --git a/Minecraft.Client/Textures/Texture.h b/Minecraft.Client/Textures/Texture.h index 09b7495e9..74afaea66 100644 --- a/Minecraft.Client/Textures/Texture.h +++ b/Minecraft.Client/Textures/Texture.h @@ -48,7 +48,7 @@ private: int magFilter; int wrapMode; bool mipmapped; - wstring name; + std::wstring name; Rect2i *rect; @@ -67,19 +67,19 @@ public: ~Texture(); private: - Texture(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap = true); + Texture(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap = true); - void _init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap); - void _init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap); + void _init(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap); + void _init(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap); public: - Texture(const wstring &name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap = true); - Texture(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap = true); + Texture(const std::wstring &name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap = true); + Texture(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap = true); const Rect2i *getRect(); void fill(const Rect2i *rect, int color); - void writeAsBMP(const wstring &name); - void writeAsPNG(const wstring &filename); + void writeAsBMP(const std::wstring &name); + void writeAsPNG(const std::wstring &filename); void blit(int x, int y, Texture *source); void blit(int x, int y, Texture *source, bool rotated); void transferFromBuffer(intArray buffer); @@ -88,7 +88,7 @@ public: int getGlId(); int getWidth(); int getHeight(); - wstring getName(); + std::wstring getName(); void setImmediateUpdate(bool immediateUpdate); void bind(int mipMapIndex); void updateOnGPU(); diff --git a/Minecraft.Client/Textures/TextureHolder.cpp b/Minecraft.Client/Textures/TextureHolder.cpp index 61cce49af..085e413c0 100644 --- a/Minecraft.Client/Textures/TextureHolder.cpp +++ b/Minecraft.Client/Textures/TextureHolder.cpp @@ -56,7 +56,7 @@ void TextureHolder::setForcedScale(int targetSize) } //@Override -wstring TextureHolder::toString() +std::wstring TextureHolder::toString() { return L"TextureHolder{width=" + _toString(width) + L", height=" + _toString(height) + L'}'; } diff --git a/Minecraft.Client/Textures/TextureHolder.h b/Minecraft.Client/Textures/TextureHolder.h index 57fd2ca2e..cab827dd1 100644 --- a/Minecraft.Client/Textures/TextureHolder.h +++ b/Minecraft.Client/Textures/TextureHolder.h @@ -26,7 +26,7 @@ private: public: void setForcedScale(int targetSize); //@Override - wstring toString(); + std::wstring toString(); int compareTo(const TextureHolder *other) const; }; diff --git a/Minecraft.Client/Textures/TextureManager.cpp b/Minecraft.Client/Textures/TextureManager.cpp index 377f6e98b..c8f2f3230 100644 --- a/Minecraft.Client/Textures/TextureManager.cpp +++ b/Minecraft.Client/Textures/TextureManager.cpp @@ -29,7 +29,7 @@ int TextureManager::createTextureID() return nextID++; } -Texture *TextureManager::getTexture(const wstring &name) +Texture *TextureManager::getTexture(const std::wstring &name) { if (stringToIDMap.find(name) != stringToIDMap.end()) { @@ -39,7 +39,7 @@ Texture *TextureManager::getTexture(const wstring &name) return NULL; } -void TextureManager::registerName(const wstring &name, Texture *texture) +void TextureManager::registerName(const std::wstring &name, Texture *texture) { stringToIDMap.insert( stringIntMap::value_type( name, texture->getManagerId() ) ); @@ -64,7 +64,7 @@ void TextureManager::registerTexture(Texture *texture) idToTextureMap.insert( intTextureMap::value_type( texture->getManagerId(), texture ) ); } -void TextureManager::unregisterTexture(const wstring &name, Texture *texture) +void TextureManager::unregisterTexture(const std::wstring &name, Texture *texture) { AUTO_VAR(it, idToTextureMap.find(texture->getManagerId())); if(it != idToTextureMap.end()) idToTextureMap.erase(it); @@ -73,14 +73,14 @@ void TextureManager::unregisterTexture(const wstring &name, Texture *texture) if(it2 != stringToIDMap.end()) stringToIDMap.erase(it2); } -Stitcher *TextureManager::createStitcher(const wstring &name) +Stitcher *TextureManager::createStitcher(const std::wstring &name) { int maxTextureSize = Minecraft::maxSupportedTextureSize(); return new Stitcher(name, maxTextureSize, maxTextureSize, true); } -vector *TextureManager::createTextures(const wstring &filename, bool mipmap) +vector *TextureManager::createTextures(const std::wstring &filename, bool mipmap) { vector *result = new vector(); TexturePack *texturePack = Minecraft::GetInstance()->skins->getSelected(); @@ -92,7 +92,7 @@ vector *TextureManager::createTextures(const wstring &filename, bool int magFilter = Texture::TFLT_NEAREST; MemSect(32); - wstring drive = L""; + std::wstring drive = L""; if(texturePack->hasFile(L"res/" + filename,false)) @@ -106,7 +106,7 @@ vector *TextureManager::createTextures(const wstring &filename, bool { const char *pchTextureName=wstringtofilename(filename); char *pchUsrDir = app.GetBDUsrDirPath(pchTextureName); - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); drive= wstr + L"\\Common\\res\\TitleUpdate\\"; } else @@ -123,7 +123,7 @@ vector *TextureManager::createTextures(const wstring &filename, bool int height = image->getHeight(); int width = image->getWidth(); - wstring texName = getTextureNameFromPath(filename); + std::wstring texName = getTextureNameFromPath(filename); if (isAnimation(filename, texturePack)) { @@ -168,27 +168,27 @@ vector *TextureManager::createTextures(const wstring &filename, bool return result; } -wstring TextureManager::getTextureNameFromPath(const wstring &filename) +std::wstring TextureManager::getTextureNameFromPath(const std::wstring &filename) { File file(filename); return file.getName().substr(0, file.getName().find_last_of(L'.')); } -bool TextureManager::isAnimation(const wstring &filename, TexturePack *texturePack) +bool TextureManager::isAnimation(const std::wstring &filename, TexturePack *texturePack) { - wstring dataFileName = L"/" + filename.substr(0, filename.find_last_of(L'.')) + L".txt"; + std::wstring dataFileName = L"/" + filename.substr(0, filename.find_last_of(L'.')) + L".txt"; bool hasOriginalImage = texturePack->hasFile(L"/" + filename, false); return Minecraft::GetInstance()->skins->getSelected()->hasFile(dataFileName, !hasOriginalImage); } -Texture *TextureManager::createTexture(const wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image) +Texture *TextureManager::createTexture(const std::wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image) { Texture *newTex = new Texture(name, mode, width, height, wrap, format, minFilter, magFilter, image, mipmap); registerTexture(newTex); return newTex; } -Texture *TextureManager::createTexture(const wstring &name, int mode, int width, int height, int format, bool mipmap) +Texture *TextureManager::createTexture(const std::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); diff --git a/Minecraft.Client/Textures/TextureManager.h b/Minecraft.Client/Textures/TextureManager.h index f62209cb6..c67ea151b 100644 --- a/Minecraft.Client/Textures/TextureManager.h +++ b/Minecraft.Client/Textures/TextureManager.h @@ -10,7 +10,7 @@ private: static TextureManager *instance; int nextID; - typedef std::unordered_map stringIntMap; + typedef std::unordered_map stringIntMap; typedef std::unordered_map intTextureMap; intTextureMap idToTextureMap; stringIntMap stringToIDMap; @@ -24,18 +24,18 @@ private: public: int createTextureID(); - Texture *getTexture(const wstring &name); - void registerName(const wstring &name, Texture *texture); + Texture *getTexture(const std::wstring &name); + void registerName(const std::wstring &name, Texture *texture); void registerTexture(Texture *texture); - void unregisterTexture(const wstring &name, Texture *texture); - Stitcher *createStitcher(const wstring &name); - vector *createTextures(const wstring &filename, bool mipmap); // 4J added mipmap param + void unregisterTexture(const std::wstring &name, Texture *texture); + Stitcher *createStitcher(const std::wstring &name); + vector *createTextures(const std::wstring &filename, bool mipmap); // 4J added mipmap param private: - wstring getTextureNameFromPath(const wstring &filename); - bool isAnimation(const wstring &filename, TexturePack *texturePack); + std::wstring getTextureNameFromPath(const std::wstring &filename); + bool isAnimation(const std::wstring &filename, TexturePack *texturePack); public: - Texture *createTexture(const wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image); - Texture *createTexture(const wstring &name, int mode, int width, int height, int format, bool mipmap); // 4J Added mipmap param + Texture *createTexture(const std::wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image); + Texture *createTexture(const std::wstring &name, int mode, int width, int height, int format, bool mipmap); // 4J Added mipmap param }; \ No newline at end of file diff --git a/Minecraft.Client/Textures/Textures.cpp b/Minecraft.Client/Textures/Textures.cpp index 5d146a518..c7138f94e 100644 --- a/Minecraft.Client/Textures/Textures.cpp +++ b/Minecraft.Client/Textures/Textures.cpp @@ -252,11 +252,11 @@ void Textures::loadIndexedTextures() // 4J - added - preload a set of commonly used textures that can then be referenced directly be an enumerated type rather by string for( int i = 0; i < TN_COUNT - 2; i++ ) { - preLoadedIdx[i] = loadTexture((TEXTURE_NAME)i, wstring(preLoaded[i]) + L".png"); + preLoadedIdx[i] = loadTexture((TEXTURE_NAME)i, std::wstring(preLoaded[i]) + L".png"); } } -intArray Textures::loadTexturePixels(TEXTURE_NAME texId, const wstring& resourceName) +intArray Textures::loadTexturePixels(TEXTURE_NAME texId, const std::wstring& resourceName) { TexturePack *skin = skins->getSelected(); @@ -270,7 +270,7 @@ intArray Textures::loadTexturePixels(TEXTURE_NAME texId, const wstring& resource // 4J - removed try/catch // try { intArray res; - //wstring in = skin->getResource(resourceName); + //std::wstring in = skin->getResource(resourceName); if (false)// 4J - removed - was ( in == NULL) { res = loadTexturePixels(missingNo); @@ -335,7 +335,7 @@ int Textures::loadTexture(int idx) // 4J added - textures default to standard 32-bit RGBA format, but where we can, use an 8-bit format. There's 3 different varieties of these currently // in the renderer that map the single 8-bit channel to RGBA differently. -void Textures::setTextureFormat(const wstring& resourceName) +void Textures::setTextureFormat(const std::wstring& resourceName) { // 4J Stu - These texture formats are not currently in the render header #ifdef _XBOX @@ -366,7 +366,7 @@ void Textures::setTextureFormat(const wstring& resourceName) } } -void Textures::bindTexture(const wstring &resourceName) +void Textures::bindTexture(const std::wstring &resourceName) { bind(loadTexture(TN_COUNT,resourceName)); } @@ -392,7 +392,7 @@ void Textures::clearLastBoundId() lastBoundId = -1; } -int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName) +int Textures::loadTexture(TEXTURE_NAME texId, const std::wstring& resourceName) { // char buf[256]; // wcstombs(buf, resourceName.c_str(), 256); @@ -417,7 +417,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName) if (inMap) return id; } - wstring pathName = resourceName; + std::wstring pathName = resourceName; // 4J - added special cases to avoid mipmapping on clouds & shadows if( (resourceName == L"environment/clouds.png") || @@ -437,7 +437,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName) int id = MemoryTracker::genTextures(); - wstring prefix = L"%blur%"; + std::wstring prefix = L"%blur%"; bool blur = resourceName.substr(0, prefix.size()).compare(prefix) == 0; //resourceName.startsWith("%blur%"); if (blur) pathName = resourceName.substr(6); @@ -445,7 +445,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName) bool clamp = resourceName.substr(0, prefix.size()).compare(prefix) == 0; //resourceName.startsWith("%clamp%"); if (clamp) pathName = resourceName.substr(7); - //wstring in = skins->getSelected()->getResource(pathName); + //std::wstring in = skins->getSelected()->getResource(pathName); if (false ) // 4J - removed was ( in == NULL) { loadTexture(missingNo, id, blur, clamp); @@ -831,7 +831,7 @@ void Textures::releaseTexture(int id) glDeleteTextures(id); } -int Textures::loadHttpTexture(const wstring& url, const wstring& backup) +int Textures::loadHttpTexture(const std::wstring& url, const std::wstring& backup) { HttpTexture *texture = httpTextures[url]; if (texture != NULL) @@ -857,7 +857,7 @@ int Textures::loadHttpTexture(const wstring& url, const wstring& backup) return texture->id; } -int Textures::loadHttpTexture(const wstring& url, int backup) +int Textures::loadHttpTexture(const std::wstring& url, int backup) { HttpTexture *texture = httpTextures[url]; if (texture != NULL) @@ -882,12 +882,12 @@ int Textures::loadHttpTexture(const wstring& url, int backup) return texture->id; } -bool Textures::hasHttpTexture(const wstring &url) +bool Textures::hasHttpTexture(const std::wstring &url) { return httpTextures.find(url) != httpTextures.end(); } -HttpTexture *Textures::addHttpTexture(const wstring& url, HttpTextureProcessor *processor) +HttpTexture *Textures::addHttpTexture(const std::wstring& url, HttpTextureProcessor *processor) { HttpTexture *texture = httpTextures[url]; if (texture == NULL) @@ -901,7 +901,7 @@ HttpTexture *Textures::addHttpTexture(const wstring& url, HttpTextureProcessor * return texture; } -void Textures::removeHttpTexture(const wstring& url) +void Textures::removeHttpTexture(const std::wstring& url) { HttpTexture *texture = httpTextures[url]; if (texture != NULL) @@ -916,7 +916,7 @@ 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) +int Textures::loadMemTexture(const std::wstring& url, const std::wstring& backup) { MemTexture *texture = NULL; AUTO_VAR(it, memTextures.find(url) ); @@ -960,7 +960,7 @@ int Textures::loadMemTexture(const wstring& url, const wstring& backup) return texture->id; } -int Textures::loadMemTexture(const wstring& url, int backup) +int Textures::loadMemTexture(const std::wstring& url, int backup) { MemTexture *texture = NULL; AUTO_VAR(it, memTextures.find(url) ); @@ -1003,7 +1003,7 @@ int Textures::loadMemTexture(const wstring& url, int backup) return texture->id; } -MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *processor) +MemTexture *Textures::addMemTexture(const std::wstring& name,MemTextureProcessor *processor) { MemTexture *texture = NULL; AUTO_VAR(it, memTextures.find(name) ); @@ -1039,7 +1039,7 @@ MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *pro return texture; } -// MemTexture *Textures::getMemTexture(const wstring& url, MemTextureProcessor *processor) +// MemTexture *Textures::getMemTexture(const std::wstring& url, MemTextureProcessor *processor) // { // MemTexture *texture = memTextures[url]; // if (texture != NULL) @@ -1049,7 +1049,7 @@ MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *pro // return texture; // } -void Textures::removeMemTexture(const wstring& url) +void Textures::removeMemTexture(const std::wstring& url) { MemTexture *texture = NULL; AUTO_VAR(it, memTextures.find(url) ); @@ -1146,27 +1146,27 @@ void Textures::reloadAll() } AUTO_VAR(itEndHT, httpTextures.end()); - for(std::unordered_map::iterator it = httpTextures.begin(); it != itEndHT; it++ ) + for(std::unordered_map::iterator it = httpTextures.begin(); it != itEndHT; it++ ) { it->second->isLoaded = false; } AUTO_VAR(itEndMT, memTextures.end()); - for(std::unordered_map::iterator it = memTextures.begin(); it != itEndMT; it++ ) + for(std::unordered_map::iterator it = memTextures.begin(); it != itEndMT; it++ ) { it->second->isLoaded = false; } AUTO_VAR(itEndIM, idMap.end()); - for( std::unordered_map::iterator it = idMap.begin(); it != itEndIM; it++ ) + for( std::unordered_map::iterator it = idMap.begin(); it != itEndIM; it++ ) { - wstring name = it->first; + std::wstring name = it->first; int id = idMap[name]; BufferedImage *image; - wstring prefix = L"%blur%"; + std::wstring prefix = L"%blur%"; bool blur = name.substr(0, prefix.size()).compare(prefix) == 0; //name.startsWith("%blur%"); if (blur) name = name.substr(6); @@ -1180,9 +1180,9 @@ void Textures::reloadAll() delete image; } AUTO_VAR(itEndPM, pixelsMap.end()); - for( std::unordered_map::iterator it = pixelsMap.begin(); it != itEndPM; it++ ) + for( std::unordered_map::iterator it = pixelsMap.begin(); it != itEndPM; it++ ) { - wstring name = it->first; + std::wstring name = it->first; BufferedImage *image = readImage(skin->getResource(name)); loadTexturePixels(image, pixelsMap[name]); @@ -1213,13 +1213,13 @@ Icon *Textures::getMissingIcon(int type) } } -BufferedImage *Textures::readImage(TEXTURE_NAME texId, const wstring& name) // 4J was InputStream *in +BufferedImage *Textures::readImage(TEXTURE_NAME texId, const std::wstring& name) // 4J was InputStream *in { BufferedImage *img=NULL; MemSect(32); // is this image one of the Title Update ones? bool isTu = IsTUImage(texId, name); - wstring drive = L""; + std::wstring drive = L""; if(!skins->isUsingDefaultSkin() && skins->getSelected()->hasFile(L"res/" + name,false)) { @@ -1233,7 +1233,7 @@ BufferedImage *Textures::readImage(TEXTURE_NAME texId, const wstring& name) // 4 if(app.GetBootedFromDiscPatch() && app.IsFileInPatchList(pchName)) { char *pchUsrDir = app.GetBDUsrDirPath(pchName); - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); if(isTu) { @@ -1334,7 +1334,7 @@ const wchar_t *TUImagePaths[] = NULL }; -bool Textures::IsTUImage(TEXTURE_NAME texId, const wstring& name) +bool Textures::IsTUImage(TEXTURE_NAME texId, const std::wstring& name) { int i = 0; if(texId < TN_COUNT) @@ -1383,7 +1383,7 @@ wchar_t *OriginalImagesPaths[] = NULL }; -bool Textures::IsOriginalImage(TEXTURE_NAME texId, const wstring& name) +bool Textures::IsOriginalImage(TEXTURE_NAME texId, const std::wstring& name) { int i = 0; if(texId < TN_COUNT) diff --git a/Minecraft.Client/Textures/Textures.h b/Minecraft.Client/Textures/Textures.h index afd0564f4..9f4e83e63 100644 --- a/Minecraft.Client/Textures/Textures.h +++ b/Minecraft.Client/Textures/Textures.h @@ -208,14 +208,14 @@ private: static const wchar_t *preLoaded[TN_COUNT]; static int preLoadedIdx[TN_COUNT]; - std::unordered_map idMap; - std::unordered_map pixelsMap; + std::unordered_map idMap; + std::unordered_map pixelsMap; std::unordered_map loadedImages; //IntBuffer *pixels; // 4J - removed so we don't have a permanent buffer kicking round using up 1MB - std::unordered_map httpTextures; + std::unordered_map httpTextures; // 4J-PB - Added for GTS textures - std::unordered_map memTextures; + std::unordered_map memTextures; Options *options; private: @@ -232,14 +232,14 @@ private: void loadIndexedTextures(); // 4J Added public: - intArray loadTexturePixels(TEXTURE_NAME texId, const wstring& resourceName); + intArray loadTexturePixels(TEXTURE_NAME texId, const std::wstring& resourceName); private: intArray loadTexturePixels(BufferedImage *img); intArray loadTexturePixels(BufferedImage *img, intArray pixels); - void setTextureFormat(const wstring& resourceName); // 4J added + void setTextureFormat(const std::wstring& resourceName); // 4J added public: - void bindTexture(const wstring &resourceName); + void bindTexture(const std::wstring &resourceName); void bindTexture(int resourceId); // 4J Added // 4J Made public for use in XUI controls @@ -249,7 +249,7 @@ public: void clearLastBoundId(); private: - int loadTexture(TEXTURE_NAME texId, const wstring& resourceName); + int loadTexture(TEXTURE_NAME texId, const std::wstring& resourceName); public: int loadTexture(int idx); // 4J added int getTexture(BufferedImage *img, C4JRender::eTextureFormat format = C4JRender::TEXTURE_FORMAT_RxGyBzAw, bool mipmap = true); @@ -262,26 +262,26 @@ public: void replaceTextureDirect(intArray rawPixels, int w, int h, int id); // 4J added as optimisation void replaceTextureDirect(shortArray rawPixels, int w, int h, int id); // 4J added as optimisation void releaseTexture(int id); - int loadHttpTexture(const wstring& url, const wstring& backup); - int loadHttpTexture(const wstring& url, int backup); // 4J added - bool hasHttpTexture(const wstring &url); - HttpTexture *addHttpTexture(const wstring& url, HttpTextureProcessor *processor); - void removeHttpTexture(const wstring& url); + int loadHttpTexture(const std::wstring& url, const std::wstring& backup); + int loadHttpTexture(const std::wstring& url, int backup); // 4J added + bool hasHttpTexture(const std::wstring &url); + HttpTexture *addHttpTexture(const std::wstring& url, HttpTextureProcessor *processor); + void removeHttpTexture(const std::wstring& url); // 4J-PB - for the GTS textures - int loadMemTexture(const wstring& url, const wstring& backup); - int loadMemTexture(const wstring& url, int backup); - MemTexture * addMemTexture(const wstring& url, MemTextureProcessor *processor); - //MemTexture * getMemTexture(const wstring& url, MemTextureProcessor *processor); - void removeMemTexture(const wstring& url); + int loadMemTexture(const std::wstring& url, const std::wstring& backup); + int loadMemTexture(const std::wstring& url, int backup); + MemTexture * addMemTexture(const std::wstring& url, MemTextureProcessor *processor); + //MemTexture * getMemTexture(const std::wstring& url, MemTextureProcessor *processor); + void removeMemTexture(const std::wstring& url); void tick(bool updateTextures, bool tickDynamics = true); // 4J added updateTextures parameter & tickDynamics public: void reloadAll(); void stitch(); Icon *getMissingIcon(int type); - BufferedImage *readImage(TEXTURE_NAME texId, const wstring& name); // Moved this to public for Font.cpp access + BufferedImage *readImage(TEXTURE_NAME texId, const std::wstring& name); // Moved this to public for Font.cpp access // check list of title update textures to see if we need to use the UPDATE: drive - static bool IsTUImage(TEXTURE_NAME texId, const wstring& name); - static bool IsOriginalImage(TEXTURE_NAME texId, const wstring& name); + static bool IsTUImage(TEXTURE_NAME texId, const std::wstring& name); + static bool IsOriginalImage(TEXTURE_NAME texId, const std::wstring& name); }; diff --git a/Minecraft.Client/UI/Button.cpp b/Minecraft.Client/UI/Button.cpp index cd4f8d3b2..cb74f5fc2 100644 --- a/Minecraft.Client/UI/Button.cpp +++ b/Minecraft.Client/UI/Button.cpp @@ -2,18 +2,18 @@ #include "Button.h" #include "../Textures/Textures.h" -Button::Button(int id, int x, int y, const wstring& msg) +Button::Button(int id, int x, int y, const std::wstring& msg) { init(id, x, y, 200, 20, msg); } -Button::Button(int id, int x, int y, int w, int h, const wstring& msg) +Button::Button(int id, int x, int y, int w, int h, const std::wstring& msg) { init(id, x, y, w, h, msg); } // 4J - added -void Button::init(int id, int x, int y, int w, int h, const wstring& msg) +void Button::init(int id, int x, int y, int w, int h, const std::wstring& msg) { active = true; visible = true; diff --git a/Minecraft.Client/UI/Button.h b/Minecraft.Client/UI/Button.h index 0bef133c6..b7409e003 100644 --- a/Minecraft.Client/UI/Button.h +++ b/Minecraft.Client/UI/Button.h @@ -9,14 +9,14 @@ protected: int h; public: int x, y; - wstring msg; + std::wstring msg; int id; bool active; bool visible; - Button(int id, int x, int y, const wstring& msg); - Button(int id, int x, int y, int w, int h, const wstring& msg); - void init(int id, int x, int y, int w, int h, const wstring& msg); // 4J - added + Button(int id, int x, int y, const std::wstring& msg); + Button(int id, int x, int y, int w, int h, const std::wstring& msg); + void init(int id, int x, int y, int w, int h, const std::wstring& msg); // 4J - added protected: virtual int getYImage(bool hovered); public: diff --git a/Minecraft.Client/UI/EditBox.cpp b/Minecraft.Client/UI/EditBox.cpp index 27c1e85c2..5d29b7291 100644 --- a/Minecraft.Client/UI/EditBox.cpp +++ b/Minecraft.Client/UI/EditBox.cpp @@ -2,7 +2,7 @@ #include "EditBox.h" #include "../../Minecraft.World/Util/SharedConstants.h" -EditBox::EditBox(Screen *screen, Font *font, int x, int y, int width, int height, const wstring& value) +EditBox::EditBox(Screen *screen, Font *font, int x, int y, int width, int height, const std::wstring& value) { // 4J - added initialisers maxLength = 0; @@ -17,12 +17,12 @@ EditBox::EditBox(Screen *screen, Font *font, int x, int y, int width, int height this->setValue(value); } -void EditBox::setValue(const wstring& value) +void EditBox::setValue(const std::wstring& value) { this->value = value; } -wstring EditBox::getValue() +std::wstring EditBox::getValue() { return value; } @@ -60,7 +60,7 @@ void EditBox::keyPressed(wchar_t ch, int eventKey) { value = value.substr(0, value.length() - 1); } - if (SharedConstants::acceptableLetters.find(ch) != wstring::npos && (value.length() < maxLength || maxLength == 0)) + if (SharedConstants::acceptableLetters.find(ch) != std::wstring::npos && (value.length() < maxLength || maxLength == 0)) { value += ch; } diff --git a/Minecraft.Client/UI/EditBox.h b/Minecraft.Client/UI/EditBox.h index 9e24553f9..6c59a61f3 100644 --- a/Minecraft.Client/UI/EditBox.h +++ b/Minecraft.Client/UI/EditBox.h @@ -12,7 +12,7 @@ private: int y; int width; int height; - wstring value; + std::wstring value; unsigned int maxLength; int frame; @@ -23,9 +23,9 @@ private: Screen *screen; public: - EditBox(Screen *screen, Font *font, int x, int y, int width, int height, const wstring& value); - void setValue(const wstring& value); - wstring getValue(); + EditBox(Screen *screen, Font *font, int x, int y, int width, int height, const std::wstring& value); + void setValue(const std::wstring& value); + std::wstring getValue(); void tick(); void keyPressed(wchar_t ch, int eventKey); void mouseClicked(int mouseX, int mouseY, int buttonNum); diff --git a/Minecraft.Client/UI/Font.cpp b/Minecraft.Client/UI/Font.cpp index df0758e26..3b5e99d21 100644 --- a/Minecraft.Client/UI/Font.cpp +++ b/Minecraft.Client/UI/Font.cpp @@ -8,7 +8,7 @@ #include "../../Minecraft.World/Util/StringHelpers.h" #include "../../Minecraft.World/Util/Random.h" -Font::Font(Options *options, const wstring& name, Textures* textures, bool enforceUnicode, TEXTURE_NAME textureName, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[]/* = nullptr */) : textures(textures) +Font::Font(Options *options, const std::wstring& name, Textures* textures, bool enforceUnicode, TEXTURE_NAME textureName, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[]/* = nullptr */) : textures(textures) { int charC = cols * rows; // Number of characters in the font @@ -169,36 +169,36 @@ void Font::renderCharacter(wchar_t c) xPos += (float) charWidths[c]; } -void Font::drawShadow(const wstring& str, int x, int y, int color) +void Font::drawShadow(const std::wstring& str, int x, int y, int color) { draw(str, x + 1, y + 1, color, true); draw(str, x, y, color, false); } -void Font::drawShadowWordWrap(const wstring &str, int x, int y, int w, int color, int h) +void Font::drawShadowWordWrap(const std::wstring &str, int x, int y, int w, int color, int h) { drawWordWrapInternal(str, x + 1, y + 1, w, color, true, h); drawWordWrapInternal(str, x, y, w, color, h); } -void Font::draw(const wstring& str, int x, int y, int color) +void Font::draw(const std::wstring& str, int x, int y, int color) { draw(str, x, y, color, false); } -wstring Font::reorderBidi(const wstring &str) +std::wstring Font::reorderBidi(const std::wstring &str) { // 4J Not implemented return str; } -void Font::draw(const wstring &str, bool dropShadow) +void Font::draw(const std::wstring &str, bool dropShadow) { // Bind the texture textures->bindTexture(m_textureName); bool noise = false; - wstring cleanStr = sanitize(str); + std::wstring cleanStr = sanitize(str); for (int i = 0; i < (int)cleanStr.length(); ++i) { @@ -250,7 +250,7 @@ void Font::draw(const wstring &str, bool dropShadow) } } -void Font::draw(const wstring& str, int x, int y, int color, bool dropShadow) +void Font::draw(const std::wstring& str, int x, int y, int color, bool dropShadow) { if (!str.empty()) { @@ -268,9 +268,9 @@ void Font::draw(const wstring& str, int x, int y, int color, bool dropShadow) } } -int Font::width(const wstring& str) +int Font::width(const std::wstring& str) { - wstring cleanStr = sanitize(str); + std::wstring cleanStr = sanitize(str); if (cleanStr == L"") return 0; // 4J - was NULL comparison int len = 0; @@ -293,9 +293,9 @@ int Font::width(const wstring& str) return len; } -wstring Font::sanitize(const wstring& str) +std::wstring Font::sanitize(const std::wstring& str) { - wstring sb = str; + std::wstring sb = str; for (unsigned int i = 0; i < sb.length(); i++) { @@ -337,7 +337,7 @@ bool Font::CharacterExists(wchar_t c) } } -void Font::drawWordWrap(const wstring &string, int x, int y, int w, int col, int h) +void Font::drawWordWrap(const std::wstring &string, int x, int y, int w, int col, int h) { //if (bidirectional) //{ @@ -346,12 +346,12 @@ void Font::drawWordWrap(const wstring &string, int x, int y, int w, int col, int drawWordWrapInternal(string, x, y, w, col, h); } -void Font::drawWordWrapInternal(const wstring &string, int x, int y, int w, int col, int h) +void Font::drawWordWrapInternal(const std::wstring &string, int x, int y, int w, int col, int h) { drawWordWrapInternal(string, x, y, w, col, false, h); } -void Font::drawWordWrap(const wstring &string, int x, int y, int w, int col, bool darken, int h) +void Font::drawWordWrap(const std::wstring &string, int x, int y, int w, int col, bool darken, int h) { //if (bidirectional) //{ @@ -360,9 +360,9 @@ void Font::drawWordWrap(const wstring &string, int x, int y, int w, int col, boo drawWordWrapInternal(string, x, y, w, col, darken, h); } -void Font::drawWordWrapInternal(const wstring& string, int x, int y, int w, int col, bool darken, int h) +void Font::drawWordWrapInternal(const std::wstring& string, int x, int y, int w, int col, bool darken, int h) { - vectorlines = stringSplit(string,L'\n'); + vectorlines = stringSplit(string,L'\n'); if (lines.size() > 1) { AUTO_VAR(itEnd, lines.end()); @@ -375,11 +375,11 @@ void Font::drawWordWrapInternal(const wstring& string, int x, int y, int w, int } return; } - vector words = stringSplit(string,L' '); + vector words = stringSplit(string,L' '); unsigned int pos = 0; while (pos < words.size()) { - wstring line = words[pos++] + L" "; + std::wstring line = words[pos++] + L" "; while (pos < words.size() && width(line + words[pos]) < w) { line += words[pos++] + L" "; @@ -411,9 +411,9 @@ void Font::drawWordWrapInternal(const wstring& string, int x, int y, int w, int } -int Font::wordWrapHeight(const wstring& string, int w) +int Font::wordWrapHeight(const std::wstring& string, int w) { - vector lines = stringSplit(string,L'\n'); + vector lines = stringSplit(string,L'\n'); if (lines.size() > 1) { int h = 0; @@ -424,12 +424,12 @@ int Font::wordWrapHeight(const wstring& string, int w) } return h; } - vector words = stringSplit(string,L' '); + vector words = stringSplit(string,L' '); unsigned int pos = 0; int y = 0; while (pos < words.size()) { - wstring line = words[pos++] + L" "; + std::wstring line = words[pos++] + L" "; while (pos < words.size() && width(line + words[pos]) < w) { line += words[pos++] + L" "; @@ -466,7 +466,7 @@ void Font::setBidirectional(bool bidirectional) this->bidirectional = bidirectional; } -bool Font::AllCharactersValid(const wstring &str) +bool Font::AllCharactersValid(const std::wstring &str) { for (int i = 0; i < (int)str.length(); ++i) { diff --git a/Minecraft.Client/UI/Font.h b/Minecraft.Client/UI/Font.h index b6ad555db..e7769698c 100644 --- a/Minecraft.Client/UI/Font.h +++ b/Minecraft.Client/UI/Font.h @@ -30,7 +30,7 @@ private: std::map m_charMap; public: - Font(Options *options, const wstring& name, Textures* textures, bool enforceUnicode, TEXTURE_NAME textureName, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[] = NULL); + Font(Options *options, const std::wstring& name, Textures* textures, bool enforceUnicode, TEXTURE_NAME textureName, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[] = NULL); #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(); @@ -41,9 +41,9 @@ private: void renderCharacter(wchar_t c); // 4J added public: - void drawShadow(const wstring& str, int x, int y, int color); - void drawShadowWordWrap(const wstring &str, int x, int y, int w, int color, int h); // 4J Added h param - void draw(const wstring &str, int x, int y, int color); + void drawShadow(const std::wstring& str, int x, int y, int color); + void drawShadowWordWrap(const std::wstring &str, int x, int y, int w, int color, int h); // 4J Added h param + void draw(const std::wstring &str, int x, int y, int color); /** * Reorders the string according to bidirectional levels. A bit expensive at * the moment. @@ -52,32 +52,32 @@ public: * @return */ private: - wstring reorderBidi(const wstring &str); + std::wstring reorderBidi(const std::wstring &str); - void draw(const wstring &str, bool dropShadow); - void draw(const wstring& str, int x, int y, int color, bool dropShadow); + void draw(const std::wstring &str, bool dropShadow); + void draw(const std::wstring& str, int x, int y, int color, bool dropShadow); int MapCharacter(wchar_t c); // 4J added bool CharacterExists(wchar_t c); // 4J added public: - int width(const wstring& str); - wstring sanitize(const wstring& str); - void drawWordWrap(const wstring &string, int x, int y, int w, int col, int h); // 4J Added h param + int width(const std::wstring& str); + std::wstring sanitize(const std::wstring& str); + void drawWordWrap(const std::wstring &string, int x, int y, int w, int col, int h); // 4J Added h param private: - void drawWordWrapInternal(const wstring &string, int x, int y, int w, int col, int h); // 4J Added h param + void drawWordWrapInternal(const std::wstring &string, int x, int y, int w, int col, int h); // 4J Added h param public: - void drawWordWrap(const wstring &string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param + void drawWordWrap(const std::wstring &string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param private: - void drawWordWrapInternal(const wstring& string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param + void drawWordWrapInternal(const std::wstring& string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param public: - int wordWrapHeight(const wstring& string, int w); + int wordWrapHeight(const std::wstring& string, int w); void setEnforceUnicodeSheet(bool enforceUnicodeSheet); void setBidirectional(bool bidirectional); // 4J-PB - check for invalid player name - Japanese local name - bool AllCharactersValid(const wstring &str); + bool AllCharactersValid(const std::wstring &str); }; diff --git a/Minecraft.Client/UI/Gui.cpp b/Minecraft.Client/UI/Gui.cpp index a2b096283..fb30994c7 100644 --- a/Minecraft.Client/UI/Gui.cpp +++ b/Minecraft.Client/UI/Gui.cpp @@ -700,7 +700,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) wchar_t formatted[10]; swprintf(formatted, 10, L"%d",minecraft->player->experienceLevel); - wstring str = formatted; + std::wstring str = formatted; int x = iWidthOffset + (screenWidth - font->width(str)) / 2; int y = screenHeight - iSafezoneYHalf - iTooltipsYOffset; // If we're in creative mode, we don't need to offset the XP display so much @@ -795,7 +795,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) if(minecraft->level->dimension->id==0) { - wstring wfeature[eTerrainFeature_Count]; + std::wstring wfeature[eTerrainFeature_Count]; wfeature[eTerrainFeature_Stronghold] = L"Stronghold: "; wfeature[eTerrainFeature_Mineshaft] = L"Mineshaft: "; @@ -806,7 +806,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { FEATURE_DATA *pFeatureData=app.m_vTerrainFeatures[i]; - wstring itemInfo = L"[" + _toString( pFeatureData->x*16 ) + L", " + _toString( pFeatureData->z*16 ) + L"] "; + std::wstring itemInfo = L"[" + _toString( pFeatureData->x*16 ) + L", " + _toString( pFeatureData->z*16 ) + L"] "; wfeature[pFeatureData->eTerrainFeature] += itemInfo; } @@ -940,7 +940,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) y+= iHeightOffset; } - wstring msg = guiMessages[iPad][i].string; + std::wstring msg = guiMessages[iPad][i].string; // 4J-PB - fill the black bar across the whole screen, otherwise it looks odd due to the safe area this->fill(0, y - 1, screenWidth/fScaleFactorWidth, y + 8, (alpha / 2) << 24); glEnable(GL_BLEND); @@ -1050,7 +1050,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) // blit(xLeft, yo, 0, 79, progress, 5); // } // -// wstring msg = L"Boss health - NON LOCALISED"; +// std::wstring msg = L"Boss health - NON LOCALISED"; // font->drawShadow(msg, screenWidth / 2 - font->width(msg) / 2, yo - 10, 0xff00ff); // glColor4f(1, 1, 1, 1); // glBindTexture(GL_TEXTURE_2D, pMinecraft->textures->loadTexture(TN_GUI_ICONS) );//"/gui/icons.png")); @@ -1211,9 +1211,9 @@ void Gui::clearMessages(int iPad) } -void Gui::addMessage(const wstring& _string,int iPad,bool bIsDeathMessage) +void Gui::addMessage(const std::wstring& _string,int iPad,bool bIsDeathMessage) { - wstring string = _string; // 4J - Take copy of input as it is const + std::wstring string = _string; // 4J - Take copy of input as it is const //int iScale=1; //if((minecraft->player->m_iScreenSection==C4JRender::VIEWPORT_TYPE_SPLIT_TOP) || @@ -1374,7 +1374,7 @@ float Gui::getJukeboxOpacity(int iPad) return alpha; } -void Gui::setNowPlaying(const wstring& string) +void Gui::setNowPlaying(const std::wstring& string) { // overlayMessageString = L"Now playing: " + string; overlayMessageString = app.GetString(IDS_NOWPLAYING) + string; @@ -1385,7 +1385,7 @@ void Gui::setNowPlaying(const wstring& string) void Gui::displayClientMessage(int messageId, int iPad) { //Language *language = Language::getInstance(); - wstring languageString = app.GetString(messageId);//language->getElement(messageId); + std::wstring languageString = app.GetString(messageId);//language->getElement(messageId); addMessage(languageString, iPad); } diff --git a/Minecraft.Client/UI/Gui.h b/Minecraft.Client/UI/Gui.h index 417620163..3db5c4191 100644 --- a/Minecraft.Client/UI/Gui.h +++ b/Minecraft.Client/UI/Gui.h @@ -17,10 +17,10 @@ private: Minecraft *minecraft; public: - wstring selectedName; + std::wstring selectedName; private: int tickCount; - wstring overlayMessageString; + std::wstring overlayMessageString; int overlayMessageTime; bool animateOverlayMessageColor; @@ -50,16 +50,16 @@ private: public: void tick(); void clearMessages(int iPad=-1); - void addMessage(const wstring& string, int iPad,bool bIsDeathMessage=false); - void setNowPlaying(const wstring& string); + void addMessage(const std::wstring& string, int iPad,bool bIsDeathMessage=false); + void setNowPlaying(const std::wstring& string); void displayClientMessage(int messageId, int iPad); // 4J Added DWORD getMessagesCount(int iPad) { return (int)guiMessages[iPad].size(); } - wstring getMessage(int iPad, DWORD index) { return guiMessages[iPad].at(index).string; } + std::wstring getMessage(int iPad, DWORD index) { return guiMessages[iPad].at(index).string; } float getOpacity(int iPad, DWORD index); - wstring getJukeboxMessage(int iPad) { return overlayMessageString; } + std::wstring getJukeboxMessage(int iPad) { return overlayMessageString; } float getJukeboxOpacity(int iPad); // 4J Added diff --git a/Minecraft.Client/UI/GuiComponent.cpp b/Minecraft.Client/UI/GuiComponent.cpp index 3e3976703..8ffc8b4d4 100644 --- a/Minecraft.Client/UI/GuiComponent.cpp +++ b/Minecraft.Client/UI/GuiComponent.cpp @@ -95,12 +95,12 @@ GuiComponent::GuiComponent() blitOffset = 0; } -void GuiComponent::drawCenteredString(Font *font, const wstring& str, int x, int y, int color) +void GuiComponent::drawCenteredString(Font *font, const std::wstring& str, int x, int y, int color) { font->drawShadow(str, x - (font->width(str)) / 2, y, color); } -void GuiComponent::drawString(Font *font, const wstring& str, int x, int y, int color) +void GuiComponent::drawString(Font *font, const std::wstring& str, int x, int y, int color) { font->drawShadow(str, x, y, color); } diff --git a/Minecraft.Client/UI/GuiComponent.h b/Minecraft.Client/UI/GuiComponent.h index 7073db404..5819b5eaf 100644 --- a/Minecraft.Client/UI/GuiComponent.h +++ b/Minecraft.Client/UI/GuiComponent.h @@ -13,7 +13,7 @@ protected: void fillGradient(int x0, int y0, int x1, int y1, int col1, int col2); public: GuiComponent(); // 4J added - void drawCenteredString(Font *font, const wstring& str, int x, int y, int color); - void drawString(Font *font, const wstring& str, int x, int y, int color); + void drawCenteredString(Font *font, const std::wstring& str, int x, int y, int color); + void drawString(Font *font, const std::wstring& str, int x, int y, int color); void blit(int x, int y, int sx, int sy, int w, int h); }; diff --git a/Minecraft.Client/UI/GuiMessage.cpp b/Minecraft.Client/UI/GuiMessage.cpp index a7c33a0b3..b0c034f8f 100644 --- a/Minecraft.Client/UI/GuiMessage.cpp +++ b/Minecraft.Client/UI/GuiMessage.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "GuiMessage.h" -GuiMessage::GuiMessage(const wstring& string) +GuiMessage::GuiMessage(const std::wstring& string) { this->string = string; ticks = 0; diff --git a/Minecraft.Client/UI/GuiMessage.h b/Minecraft.Client/UI/GuiMessage.h index dac9a9e39..6fee65f39 100644 --- a/Minecraft.Client/UI/GuiMessage.h +++ b/Minecraft.Client/UI/GuiMessage.h @@ -4,7 +4,7 @@ using namespace std; class GuiMessage { public: - wstring string; + std::wstring string; int ticks; - GuiMessage(const wstring& string); + GuiMessage(const std::wstring& string); }; \ No newline at end of file diff --git a/Minecraft.Client/UI/Screen.cpp b/Minecraft.Client/UI/Screen.cpp index 6aa70d4e0..56133bc12 100644 --- a/Minecraft.Client/UI/Screen.cpp +++ b/Minecraft.Client/UI/Screen.cpp @@ -38,13 +38,13 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey) } } -wstring Screen::getClipboard() +std::wstring Screen::getClipboard() { // 4J - removed return NULL; } -void Screen::setClipboard(const wstring& str) +void Screen::setClipboard(const std::wstring& str) { // 4J - removed } diff --git a/Minecraft.Client/UI/Screen.h b/Minecraft.Client/UI/Screen.h index 50deb1d08..324f4ca5c 100644 --- a/Minecraft.Client/UI/Screen.h +++ b/Minecraft.Client/UI/Screen.h @@ -26,8 +26,8 @@ public: protected: virtual void keyPressed(wchar_t eventCharacter, int eventKey); public: - static wstring getClipboard(); - static void setClipboard(const wstring& str); + static std::wstring getClipboard(); + static void setClipboard(const std::wstring& str); private: Button *clickedButton; diff --git a/Minecraft.Client/UI/Screens/AbstractContainerScreen.cpp b/Minecraft.Client/UI/Screens/AbstractContainerScreen.cpp index 06cda6045..df09bfb3f 100644 --- a/Minecraft.Client/UI/Screens/AbstractContainerScreen.cpp +++ b/Minecraft.Client/UI/Screens/AbstractContainerScreen.cpp @@ -96,7 +96,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a) if (inventory->getCarried() == NULL && hoveredSlot != NULL && hoveredSlot->hasItem()) { - wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId())); + std::wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId())); if (elementName.length() > 0) { diff --git a/Minecraft.Client/UI/Screens/AchievementPopup.cpp b/Minecraft.Client/UI/Screens/AchievementPopup.cpp index 065349317..7a60c7ea9 100644 --- a/Minecraft.Client/UI/Screens/AchievementPopup.cpp +++ b/Minecraft.Client/UI/Screens/AchievementPopup.cpp @@ -77,9 +77,9 @@ void AchievementPopup::render() Lighting::turnOff(); prepareWindow(); - wstring title = L"Minecraft " + SharedConstants::VERSION_STRING + L" Unlicensed Copy :("; - wstring msg1 = L"(Or logged in from another location)"; - wstring msg2 = L"Purchase at minecraft.net"; + std::wstring title = L"Minecraft " + SharedConstants::VERSION_STRING + L" Unlicensed Copy :("; + std::wstring msg1 = L"(Or logged in from another location)"; + std::wstring msg2 = L"Purchase at minecraft.net"; mc->font->drawShadow(title, 2, 2 + 9 * 0, 0xffffff); mc->font->drawShadow(msg1, 2, 2 + 9 * 1, 0xffffff); diff --git a/Minecraft.Client/UI/Screens/AchievementPopup.h b/Minecraft.Client/UI/Screens/AchievementPopup.h index 75e33be77..5d7b04663 100644 --- a/Minecraft.Client/UI/Screens/AchievementPopup.h +++ b/Minecraft.Client/UI/Screens/AchievementPopup.h @@ -10,8 +10,8 @@ private: Minecraft *mc; int width, height; - wstring title; - wstring desc; + std::wstring title; + std::wstring desc; Achievement *ach; __int64 startTime; ItemRenderer *ir; diff --git a/Minecraft.Client/UI/Screens/AchievementScreen.cpp b/Minecraft.Client/UI/Screens/AchievementScreen.cpp index df642bd90..53166d631 100644 --- a/Minecraft.Client/UI/Screens/AchievementScreen.cpp +++ b/Minecraft.Client/UI/Screens/AchievementScreen.cpp @@ -380,8 +380,8 @@ void AchievementScreen::renderBg(int xm, int ym, float a) if (hoveredAchievement != NULL) { Achievement *ach = hoveredAchievement; - wstring name = ach->name; - wstring descr = ach->getDescription(); + std::wstring name = ach->name; + std::wstring descr = ach->getDescription(); int x = xm + 12; int y = ym - 4; @@ -405,7 +405,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a) else { int width = Math::_max(font->width(name), 120); - wstring msg = I18n::get(L"achievement.requires", ach->requires->name); + std::wstring msg = I18n::get(L"achievement.requires", ach->requires->name); int height = font->wordWrapHeight(msg, width); fillGradient(x - 3, y - 3, x + width + 3, y + height + 12 + 3, 0xc0000000, 0xc0000000); font->drawWordWrap(msg, x, y + 12, width, 0xff705050); diff --git a/Minecraft.Client/UI/Screens/ChatScreen.cpp b/Minecraft.Client/UI/Screens/ChatScreen.cpp index d7c944fbe..4d14e9e01 100644 --- a/Minecraft.Client/UI/Screens/ChatScreen.cpp +++ b/Minecraft.Client/UI/Screens/ChatScreen.cpp @@ -4,7 +4,7 @@ #include "../../../Minecraft.World/Util/SharedConstants.h" #include "../../../Minecraft.World/Util/StringHelpers.h" -const wstring ChatScreen::allowedChars = SharedConstants::readAcceptableChars(); +const std::wstring ChatScreen::allowedChars = SharedConstants::readAcceptableChars(); ChatScreen::ChatScreen() { @@ -35,10 +35,10 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey) } if (eventKey == Keyboard::KEY_RETURN) { - wstring msg = trimString(message); + std::wstring msg = trimString(message); if (msg.length() > 0) { - wstring trim = trimString(message); + std::wstring trim = trimString(message); if (!minecraft->handleClientSideCommand(trim)) { minecraft->player->chat(trim); diff --git a/Minecraft.Client/UI/Screens/ChatScreen.h b/Minecraft.Client/UI/Screens/ChatScreen.h index fe5fa29c0..b0e471cf7 100644 --- a/Minecraft.Client/UI/Screens/ChatScreen.h +++ b/Minecraft.Client/UI/Screens/ChatScreen.h @@ -5,7 +5,7 @@ using namespace std; class ChatScreen : public Screen { protected: - wstring message; + std::wstring message; private: int frame; @@ -15,7 +15,7 @@ public: virtual void removed(); virtual void tick(); private: - static const wstring allowedChars; + static const std::wstring allowedChars; protected: void keyPressed(wchar_t ch, int eventKey); public: diff --git a/Minecraft.Client/UI/Screens/ConfirmScreen.cpp b/Minecraft.Client/UI/Screens/ConfirmScreen.cpp index 44b5b7cf6..edd398443 100644 --- a/Minecraft.Client/UI/Screens/ConfirmScreen.cpp +++ b/Minecraft.Client/UI/Screens/ConfirmScreen.cpp @@ -3,7 +3,7 @@ #include "../SmallButton.h" #include "../../../Minecraft.World/Headers/net.minecraft.locale.h" -ConfirmScreen::ConfirmScreen(Screen *parent, const wstring& title1, const wstring& title2, int id) +ConfirmScreen::ConfirmScreen(Screen *parent, const std::wstring& title1, const std::wstring& title2, int id) { this->parent = parent; this->title1 = title1; @@ -15,7 +15,7 @@ ConfirmScreen::ConfirmScreen(Screen *parent, const wstring& title1, const wstrin noButton = language->getElement(L"gui.no"); } -ConfirmScreen::ConfirmScreen(Screen *parent, const wstring& title1, const wstring& title2, const wstring& yesButton, const wstring& noButton, int id) +ConfirmScreen::ConfirmScreen(Screen *parent, const std::wstring& title1, const std::wstring& title2, const std::wstring& yesButton, const std::wstring& noButton, int id) { this->parent = parent; this->title1 = title1; diff --git a/Minecraft.Client/UI/Screens/ConfirmScreen.h b/Minecraft.Client/UI/Screens/ConfirmScreen.h index 7436a2b80..d4dcdaec0 100644 --- a/Minecraft.Client/UI/Screens/ConfirmScreen.h +++ b/Minecraft.Client/UI/Screens/ConfirmScreen.h @@ -6,15 +6,15 @@ class ConfirmScreen : public Screen { private: Screen *parent; - wstring title1; - wstring title2; - wstring yesButton; - wstring noButton; + std::wstring title1; + std::wstring title2; + std::wstring yesButton; + std::wstring noButton; int id; public: - ConfirmScreen(Screen *parent, const wstring& title1, const wstring& title2, int id); - ConfirmScreen(Screen *parent, const wstring& title1, const wstring& title2, const wstring& yesButton, const wstring& noButton, int id); + ConfirmScreen(Screen *parent, const std::wstring& title1, const std::wstring& title2, int id); + ConfirmScreen(Screen *parent, const std::wstring& title1, const std::wstring& title2, const std::wstring& yesButton, const std::wstring& noButton, int id); virtual void init(); protected: virtual void buttonClicked(Button *button); diff --git a/Minecraft.Client/UI/Screens/ConnectScreen.cpp b/Minecraft.Client/UI/Screens/ConnectScreen.cpp index 9a5af6412..8631cbbd1 100644 --- a/Minecraft.Client/UI/Screens/ConnectScreen.cpp +++ b/Minecraft.Client/UI/Screens/ConnectScreen.cpp @@ -8,7 +8,7 @@ #include "../../../Minecraft.World/Headers/net.minecraft.locale.h" -ConnectScreen::ConnectScreen(Minecraft *minecraft, const wstring& ip, int port) +ConnectScreen::ConnectScreen(Minecraft *minecraft, const std::wstring& ip, int port) { aborted = false; // System.out.println("Connecting to " + ip + ", " + port); diff --git a/Minecraft.Client/UI/Screens/ConnectScreen.h b/Minecraft.Client/UI/Screens/ConnectScreen.h index 57b13dfae..1de5b2f06 100644 --- a/Minecraft.Client/UI/Screens/ConnectScreen.h +++ b/Minecraft.Client/UI/Screens/ConnectScreen.h @@ -11,7 +11,7 @@ private: ClientConnection *connection; bool aborted; public: - ConnectScreen(Minecraft *minecraft, const wstring& ip, int port); + ConnectScreen(Minecraft *minecraft, const std::wstring& ip, int port); virtual void tick(); protected: virtual void keyPressed(char eventCharacter, int eventKey); diff --git a/Minecraft.Client/UI/Screens/ControlsScreen.h b/Minecraft.Client/UI/Screens/ControlsScreen.h index 92c4b75da..07778abdc 100644 --- a/Minecraft.Client/UI/Screens/ControlsScreen.h +++ b/Minecraft.Client/UI/Screens/ControlsScreen.h @@ -8,7 +8,7 @@ class ControlsScreen : public Screen private: Screen *lastScreen; protected: - wstring title; + std::wstring title; private: Options *options; diff --git a/Minecraft.Client/UI/Screens/CreateWorldScreen.cpp b/Minecraft.Client/UI/Screens/CreateWorldScreen.cpp index 82708b54c..27e3d33e7 100644 --- a/Minecraft.Client/UI/Screens/CreateWorldScreen.cpp +++ b/Minecraft.Client/UI/Screens/CreateWorldScreen.cpp @@ -51,7 +51,7 @@ void CreateWorldScreen::updateResultFolder() for( int i = 0; i < SharedConstants::ILLEGAL_FILE_CHARACTERS_LENGTH; i++ ) { size_t pos; - while( (pos = resultFolder.find(SharedConstants::ILLEGAL_FILE_CHARACTERS[i])) != wstring::npos) + while( (pos = resultFolder.find(SharedConstants::ILLEGAL_FILE_CHARACTERS[i])) != std::wstring::npos) { resultFolder[pos] = L'_'; } @@ -65,9 +65,9 @@ void CreateWorldScreen::updateResultFolder() } -wstring CreateWorldScreen::findAvailableFolderName(LevelStorageSource *levelSource, const wstring& folder) +std::wstring CreateWorldScreen::findAvailableFolderName(LevelStorageSource *levelSource, const std::wstring& folder) { - wstring folder2 = folder; // 4J - copy input as it is const + std::wstring folder2 = folder; // 4J - copy input as it is const #if 0 while (levelSource->getDataTagFor(folder2) != NULL) @@ -98,7 +98,7 @@ void CreateWorldScreen::buttonClicked(Button *button) done = true; __int64 seedValue = (new Random())->nextLong(); - wstring seedString = seedEdit->getValue(); + std::wstring seedString = seedEdit->getValue(); if (seedString.length() != 0) { diff --git a/Minecraft.Client/UI/Screens/CreateWorldScreen.h b/Minecraft.Client/UI/Screens/CreateWorldScreen.h index 09bf97a9a..3b3ded4f2 100644 --- a/Minecraft.Client/UI/Screens/CreateWorldScreen.h +++ b/Minecraft.Client/UI/Screens/CreateWorldScreen.h @@ -10,7 +10,7 @@ private: Screen *lastScreen; EditBox *nameEdit; EditBox *seedEdit; - wstring resultFolder; + std::wstring resultFolder; bool done; public: @@ -20,7 +20,7 @@ public: private: void updateResultFolder(); public: - static wstring findAvailableFolderName(LevelStorageSource *levelSource, const wstring& folder); + static std::wstring findAvailableFolderName(LevelStorageSource *levelSource, const std::wstring& folder); virtual void removed(); protected: virtual void buttonClicked(Button *button); diff --git a/Minecraft.Client/UI/Screens/DisconnectedScreen.cpp b/Minecraft.Client/UI/Screens/DisconnectedScreen.cpp index d41b6bc15..3e8db2ff4 100644 --- a/Minecraft.Client/UI/Screens/DisconnectedScreen.cpp +++ b/Minecraft.Client/UI/Screens/DisconnectedScreen.cpp @@ -4,7 +4,7 @@ #include "../Button.h" #include "../../../Minecraft.World/Headers/net.minecraft.locale.h" -DisconnectedScreen::DisconnectedScreen(const wstring& title, const wstring reason, void *reasonObjects, ...) +DisconnectedScreen::DisconnectedScreen(const std::wstring& title, const std::wstring reason, void *reasonObjects, ...) { Language *language = Language::getInstance(); diff --git a/Minecraft.Client/UI/Screens/DisconnectedScreen.h b/Minecraft.Client/UI/Screens/DisconnectedScreen.h index 6d7b89065..d949656b9 100644 --- a/Minecraft.Client/UI/Screens/DisconnectedScreen.h +++ b/Minecraft.Client/UI/Screens/DisconnectedScreen.h @@ -5,10 +5,10 @@ using namespace std; class DisconnectedScreen : public Screen { private: - wstring title, reason; + std::wstring title, reason; public: - DisconnectedScreen(const wstring& title, const wstring reason, void *reasonObjects, ...); + DisconnectedScreen(const std::wstring& title, const std::wstring reason, void *reasonObjects, ...); virtual void tick(); protected: using Screen::keyPressed; diff --git a/Minecraft.Client/UI/Screens/ErrorScreen.cpp b/Minecraft.Client/UI/Screens/ErrorScreen.cpp index fbfec3b26..ba151cb0c 100644 --- a/Minecraft.Client/UI/Screens/ErrorScreen.cpp +++ b/Minecraft.Client/UI/Screens/ErrorScreen.cpp @@ -1,7 +1,7 @@ #include "../../Build/stdafx.h" #include "ErrorScreen.h" -ErrorScreen::ErrorScreen(const wstring& title, const wstring& message) +ErrorScreen::ErrorScreen(const std::wstring& title, const std::wstring& message) { this->title = title; this->message = message; diff --git a/Minecraft.Client/UI/Screens/ErrorScreen.h b/Minecraft.Client/UI/Screens/ErrorScreen.h index 5bdf97444..4b8d675b8 100644 --- a/Minecraft.Client/UI/Screens/ErrorScreen.h +++ b/Minecraft.Client/UI/Screens/ErrorScreen.h @@ -4,9 +4,9 @@ class ErrorScreen : public Screen { private: - wstring title, message; + std::wstring title, message; public: - ErrorScreen(const wstring& title, const wstring& message); + ErrorScreen(const std::wstring& title, const std::wstring& message); virtual void init(); virtual void render(int xm, int ym, float a); protected: diff --git a/Minecraft.Client/UI/Screens/InBedChatScreen.cpp b/Minecraft.Client/UI/Screens/InBedChatScreen.cpp index 9113f4bca..c3d7cb85d 100644 --- a/Minecraft.Client/UI/Screens/InBedChatScreen.cpp +++ b/Minecraft.Client/UI/Screens/InBedChatScreen.cpp @@ -28,7 +28,7 @@ void InBedChatScreen::keyPressed(wchar_t ch, int eventKey) } else if (eventKey == Keyboard::KEY_RETURN) { - wstring msg = trimString(message); + std::wstring msg = trimString(message); if (msg.length() > 0) { minecraft->player->chat(trimString(message)); diff --git a/Minecraft.Client/UI/Screens/JoinMultiplayerScreen.cpp b/Minecraft.Client/UI/Screens/JoinMultiplayerScreen.cpp index 0dff15369..5b0c755c6 100644 --- a/Minecraft.Client/UI/Screens/JoinMultiplayerScreen.cpp +++ b/Minecraft.Client/UI/Screens/JoinMultiplayerScreen.cpp @@ -24,7 +24,7 @@ void JoinMultiplayerScreen::init() buttons.clear(); buttons.push_back(new Button(0, width / 2 - 100, height / 4 + 24 * 4 + 12, language->getElement(L"multiplayer.connect"))); buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + 12, language->getElement(L"gui.cancel"))); - wstring ip = replaceAll(minecraft->options->lastMpIp,L"_", L":"); + std::wstring ip = replaceAll(minecraft->options->lastMpIp,L"_", L":"); buttons[0]->active = ip.length() > 0; ipEdit = new EditBox(this, font, width / 2 - 100, height / 4 - 10 + 50 + 18, 200, 20, ip); @@ -47,19 +47,19 @@ void JoinMultiplayerScreen::buttonClicked(Button *button) } else if (button->id == 0) { - wstring ip = trimString(ipEdit->getValue()); + std::wstring ip = trimString(ipEdit->getValue()); minecraft->options->lastMpIp = replaceAll(ip,L":", L"_"); minecraft->options->save(); - vector parts = stringSplit(ip,L'L'); + vector parts = stringSplit(ip,L'L'); if (ip[0]==L'[') { int pos = (int)ip.find(L"]"); - if (pos != wstring::npos) + if (pos != std::wstring::npos) { - wstring path = ip.substr(1, pos); - wstring port = trimString(ip.substr(pos + 1)); + std::wstring path = ip.substr(1, pos); + std::wstring port = trimString(ip.substr(pos + 1)); if (port[0]==L':' && port.length() > 0) { port = port.substr(1); @@ -86,7 +86,7 @@ void JoinMultiplayerScreen::buttonClicked(Button *button) } } -int JoinMultiplayerScreen::parseInt(const wstring& str, int def) +int JoinMultiplayerScreen::parseInt(const std::wstring& str, int def) { return _fromString(str); } diff --git a/Minecraft.Client/UI/Screens/JoinMultiplayerScreen.h b/Minecraft.Client/UI/Screens/JoinMultiplayerScreen.h index aed68c5d7..631ab3763 100644 --- a/Minecraft.Client/UI/Screens/JoinMultiplayerScreen.h +++ b/Minecraft.Client/UI/Screens/JoinMultiplayerScreen.h @@ -17,7 +17,7 @@ public: protected: virtual void buttonClicked(Button *button); private: - virtual int parseInt(const wstring& str, int def); + virtual int parseInt(const std::wstring& str, int def); protected: virtual void keyPressed(wchar_t ch, int eventKey); virtual void mouseClicked(int x, int y, int buttonNum); diff --git a/Minecraft.Client/UI/Screens/NameEntryScreen.cpp b/Minecraft.Client/UI/Screens/NameEntryScreen.cpp index e567777ef..0f4f968ad 100644 --- a/Minecraft.Client/UI/Screens/NameEntryScreen.cpp +++ b/Minecraft.Client/UI/Screens/NameEntryScreen.cpp @@ -3,9 +3,9 @@ #include "../Button.h" #include "../../../Minecraft.World/Util/StringHelpers.h" -const wstring NameEntryScreen::allowedChars = L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_'*!\"#%/()=+?[]{}<>"; +const std::wstring NameEntryScreen::allowedChars = L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_'*!\"#%/()=+?[]{}<>"; -NameEntryScreen::NameEntryScreen(Screen *lastScreen, const wstring& oldName, int slot) +NameEntryScreen::NameEntryScreen(Screen *lastScreen, const std::wstring& oldName, int slot) { frame = 0; // 4J added @@ -53,7 +53,7 @@ void NameEntryScreen::buttonClicked(Button button) void NameEntryScreen::keyPressed(wchar_t ch, int eventKey) { if (eventKey == Keyboard::KEY_BACK && name.length() > 0) name = name.substr(0, name.length() - 1); - if (allowedChars.find(ch) != wstring::npos && name.length()<64) + if (allowedChars.find(ch) != std::wstring::npos && name.length()<64) { name += ch; } diff --git a/Minecraft.Client/UI/Screens/NameEntryScreen.h b/Minecraft.Client/UI/Screens/NameEntryScreen.h index 8793d58d7..096fe6805 100644 --- a/Minecraft.Client/UI/Screens/NameEntryScreen.h +++ b/Minecraft.Client/UI/Screens/NameEntryScreen.h @@ -6,20 +6,20 @@ class NameEntryScreen : public Screen private: Screen *lastScreen; protected: - wstring title; + std::wstring title; private: int slot; - wstring name; + std::wstring name; int frame; public: - NameEntryScreen(Screen *lastScreen, const wstring& oldName, int slot); + NameEntryScreen(Screen *lastScreen, const std::wstring& oldName, int slot); virtual void init(); virtual void removed(); virtual void tick(); protected: virtual void buttonClicked(Button button); private: - static const wstring allowedChars; + static const std::wstring allowedChars; protected: virtual void keyPressed(wchar_t ch, int eventKey); public: diff --git a/Minecraft.Client/UI/Screens/OptionsScreen.h b/Minecraft.Client/UI/Screens/OptionsScreen.h index 301161c0f..ed412bd8d 100644 --- a/Minecraft.Client/UI/Screens/OptionsScreen.h +++ b/Minecraft.Client/UI/Screens/OptionsScreen.h @@ -10,7 +10,7 @@ private: static const int VIDEO_BUTTON_ID = 101; Screen *lastScreen; protected: - wstring title; + std::wstring title; private: Options *options; public: diff --git a/Minecraft.Client/UI/Screens/RenameWorldScreen.cpp b/Minecraft.Client/UI/Screens/RenameWorldScreen.cpp index 62cf95c75..6c62d5d6d 100644 --- a/Minecraft.Client/UI/Screens/RenameWorldScreen.cpp +++ b/Minecraft.Client/UI/Screens/RenameWorldScreen.cpp @@ -6,7 +6,7 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.level.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.level.storage.h" -RenameWorldScreen::RenameWorldScreen(Screen *lastScreen, const wstring& levelId) +RenameWorldScreen::RenameWorldScreen(Screen *lastScreen, const std::wstring& levelId) { nameEdit = NULL; this->lastScreen = lastScreen; @@ -31,7 +31,7 @@ void RenameWorldScreen::init() LevelStorageSource *levelSource = minecraft->getLevelSource(); LevelData *levelData = levelSource->getDataTagFor(levelId); - wstring currentName = levelData->getLevelName(); + std::wstring currentName = levelData->getLevelName(); nameEdit = new EditBox(this, font, width / 2 - 100, 60, 200, 20, currentName); nameEdit->inFocus = true; diff --git a/Minecraft.Client/UI/Screens/RenameWorldScreen.h b/Minecraft.Client/UI/Screens/RenameWorldScreen.h index e1c398b1d..8aef6b83e 100644 --- a/Minecraft.Client/UI/Screens/RenameWorldScreen.h +++ b/Minecraft.Client/UI/Screens/RenameWorldScreen.h @@ -9,10 +9,10 @@ class RenameWorldScreen : public Screen private: Screen *lastScreen; EditBox *nameEdit; - wstring levelId; + std::wstring levelId; public: - RenameWorldScreen(Screen *lastScreen, const wstring& levelId); + RenameWorldScreen(Screen *lastScreen, const std::wstring& levelId); virtual void tick(); virtual void init() ; virtual void removed(); diff --git a/Minecraft.Client/UI/Screens/SelectWorldScreen.cpp b/Minecraft.Client/UI/Screens/SelectWorldScreen.cpp index f23d225d9..42afd57ff 100644 --- a/Minecraft.Client/UI/Screens/SelectWorldScreen.cpp +++ b/Minecraft.Client/UI/Screens/SelectWorldScreen.cpp @@ -48,14 +48,14 @@ void SelectWorldScreen::loadLevelList() selectedWorld = -1; } -wstring SelectWorldScreen::getWorldId(int id) +std::wstring SelectWorldScreen::getWorldId(int id) { return levelList->at(id)->getLevelId(); } -wstring SelectWorldScreen::getWorldName(int id) +std::wstring SelectWorldScreen::getWorldName(int id) { - wstring levelName = levelList->at(id)->getLevelName(); + std::wstring levelName = levelList->at(id)->getLevelName(); if ( levelName.length() == 0 ) { @@ -87,16 +87,16 @@ void SelectWorldScreen::buttonClicked(Button *button) if (!button->active) return; if (button->id == BUTTON_DELETE_ID) { - wstring worldName = getWorldName(selectedWorld); + std::wstring worldName = getWorldName(selectedWorld); if (worldName != L"") { isDeleting = true; Language *language = Language::getInstance(); - wstring title = language->getElement(L"selectWorld.deleteQuestion"); - wstring warning = L"'" + worldName + L"' " + language->getElement(L"selectWorld.deleteWarning"); - wstring yes = language->getElement(L"selectWorld.deleteButton"); - wstring no = language->getElement(L"gui.cancel"); + std::wstring title = language->getElement(L"selectWorld.deleteQuestion"); + std::wstring warning = L"'" + worldName + L"' " + language->getElement(L"selectWorld.deleteWarning"); + std::wstring yes = language->getElement(L"selectWorld.deleteButton"); + std::wstring no = language->getElement(L"gui.cancel"); ConfirmScreen *confirmScreen = new ConfirmScreen(this, title, warning, yes, no, selectedWorld); minecraft->setScreen(confirmScreen); @@ -147,7 +147,7 @@ void SelectWorldScreen::worldSelected(int id) done = true; minecraft->gameMode = NULL; //new SurvivalMode(minecraft); - wstring worldFolderName = getWorldId(id); + std::wstring worldFolderName = getWorldId(id); if (worldFolderName == L"") // 4J - was NULL comparison { worldFolderName = L"World" + _toString(id); @@ -271,13 +271,13 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y, int { LevelSummary *levelSummary = parent->levelList->at(i); - wstring name = levelSummary->getLevelName(); + std::wstring name = levelSummary->getLevelName(); if (name.length()==0) { name = parent->worldLang + L" " + _toString(i + 1); } - wstring id = levelSummary->getLevelId(); + std::wstring id = levelSummary->getLevelId(); ULARGE_INTEGER rawtime; rawtime.QuadPart = levelSummary->getLastPlayed() * 10000; // Convert it from milliseconds back to FileTime @@ -296,7 +296,7 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y, int __int64 size = levelSummary->getSizeOnDisk(); id = id + L", " + _toString(size / 1024 * 100 / 1024 / 100.0f) + L" MB)"; - wstring info; + std::wstring info; if (levelSummary->isRequiresConversion()) { diff --git a/Minecraft.Client/UI/Screens/SelectWorldScreen.h b/Minecraft.Client/UI/Screens/SelectWorldScreen.h index b85869f31..11a3b82d9 100644 --- a/Minecraft.Client/UI/Screens/SelectWorldScreen.h +++ b/Minecraft.Client/UI/Screens/SelectWorldScreen.h @@ -25,14 +25,14 @@ private: protected: Screen *lastScreen; - wstring title; + std::wstring title; private: bool done; int selectedWorld; vector *levelList; WorldSelectionList *worldSelectionList; - wstring worldLang; - wstring conversionLang; + std::wstring worldLang; + std::wstring conversionLang; bool isDeleting; Button *deleteButton; @@ -45,8 +45,8 @@ public: private: void loadLevelList(); protected: - wstring getWorldId(int id); - wstring getWorldName(int id); + std::wstring getWorldId(int id); + std::wstring getWorldName(int id); public: virtual void postInit(); diff --git a/Minecraft.Client/UI/Screens/StatsScreen.cpp b/Minecraft.Client/UI/Screens/StatsScreen.cpp index 0c9983069..71e34ca49 100644 --- a/Minecraft.Client/UI/Screens/StatsScreen.cpp +++ b/Minecraft.Client/UI/Screens/StatsScreen.cpp @@ -133,7 +133,7 @@ void StatsScreen::GeneralStatisticsList::renderItem(int i, int x, int y, int h, { Stat *stat = Stats::generalStats->at(i); parent->drawString(parent->font, stat->name, x + 2, y + 1, i % 2 == 0 ? 0xffffff : 0x909090); - wstring msg = stat->format(parent->stats->getTotalValue(stat)); + std::wstring msg = stat->format(parent->stats->getTotalValue(stat)); parent->drawString(parent->font, msg, x + 2 + 213 - parent->font->width(msg), y + 1, i % 2 == 0 ? 0xffffff : 0x909090); } @@ -305,12 +305,12 @@ void StatsScreen::StatisticsList::renderStat(ItemStat *stat, int x, int y, bool { if (stat != NULL) { - wstring msg = stat->format(parent->stats->getTotalValue(stat)); + std::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); } else { - wstring msg = L"-"; + std::wstring msg = L"-"; parent->drawString(parent->font, msg, x - parent->font->width(msg), y + SLOT_TEXT_OFFSET, shaded ? 0xffffff : 0x909090); } } @@ -336,7 +336,7 @@ void StatsScreen::StatisticsList::renderDecorations(int mouseX, int mouseY) } else { - wstring elementName; + std::wstring elementName; if (mouseX >= (rowX + ROW_COL_1 - SLOT_BG_SIZE) && mouseX <= (rowX + ROW_COL_1)) { elementName = getHeaderDescriptionId(0); @@ -380,7 +380,7 @@ void StatsScreen::StatisticsList::renderMousehoverTooltip(ItemStat *stat, int x, Item *item = Item::items[stat->getItemId()]; - wstring elementName = trimString(L"" + Language::getInstance()->getElementName(item->getDescriptionId())); + std::wstring elementName = trimString(L"" + Language::getInstance()->getElementName(item->getDescriptionId())); if (elementName.length() > 0) { @@ -526,7 +526,7 @@ void StatsScreen::ItemStatisticsList::renderItem(int i, int x, int y, int h, Tes renderStat((ItemStat *) stat, x + ROW_COL_3, y, i % 2 == 0);*/ } -wstring StatsScreen::ItemStatisticsList::getHeaderDescriptionId(int column) +std::wstring StatsScreen::ItemStatisticsList::getHeaderDescriptionId(int column) { if (column == COLUMN_CRAFTED) { @@ -653,7 +653,7 @@ void StatsScreen::BlockStatisticsList::renderItem(int i, int x, int y, int h, Te renderStat((ItemStat *) mineCount, x + ROW_COL_3, y, i % 2 == 0);*/ } -wstring StatsScreen::BlockStatisticsList::getHeaderDescriptionId(int column) +std::wstring StatsScreen::BlockStatisticsList::getHeaderDescriptionId(int column) { if (column == COLUMN_CRAFTED) { diff --git a/Minecraft.Client/UI/Screens/StatsScreen.h b/Minecraft.Client/UI/Screens/StatsScreen.h index 39660d0cf..26d9a2103 100644 --- a/Minecraft.Client/UI/Screens/StatsScreen.h +++ b/Minecraft.Client/UI/Screens/StatsScreen.h @@ -15,7 +15,7 @@ protected: static const int BUTTON_ITEMSTATS_ID = 3; Screen *lastScreen; - wstring title; + std::wstring title; public: class GeneralStatisticsList; class ItemStatisticsList; @@ -92,7 +92,7 @@ private: virtual void clickedHeader(int headerMouseX, int headerMouseY); virtual int getNumberOfItems(); ItemStat *getSlotStat(int slot); - virtual wstring getHeaderDescriptionId(int column) = 0; + virtual std::wstring getHeaderDescriptionId(int column) = 0; virtual void renderStat(ItemStat *stat, int x, int y, bool shaded); virtual void renderDecorations(int mouseX, int mouseY); virtual void renderMousehoverTooltip(ItemStat *stat, int x, int y); @@ -112,7 +112,7 @@ public: ItemStatisticsList(StatsScreen *ss); // 4J - added parameter so we can access parent virtual void renderHeader(int x, int y, Tesselator *t); virtual void renderItem(int i, int x, int y, int h, Tesselator *t); - virtual wstring getHeaderDescriptionId(int column); + virtual std::wstring getHeaderDescriptionId(int column); }; class BlockStatisticsList : public StatisticsList @@ -127,7 +127,7 @@ public: BlockStatisticsList(StatsScreen *ss); // 4J - added parameter so we can access parent virtual void renderHeader(int x, int y, Tesselator *t); virtual void renderItem(int i, int x, int y, int h, Tesselator *t); - virtual wstring getHeaderDescriptionId(int column); + virtual std::wstring getHeaderDescriptionId(int column); }; }; \ No newline at end of file diff --git a/Minecraft.Client/UI/Screens/TextEditScreen.cpp b/Minecraft.Client/UI/Screens/TextEditScreen.cpp index 667d1eb09..82acbf81a 100644 --- a/Minecraft.Client/UI/Screens/TextEditScreen.cpp +++ b/Minecraft.Client/UI/Screens/TextEditScreen.cpp @@ -11,7 +11,7 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.level.tile.h" -const wstring TextEditScreen::allowedChars = SharedConstants::readAcceptableChars(); +const std::wstring TextEditScreen::allowedChars = SharedConstants::readAcceptableChars(); TextEditScreen::TextEditScreen(std::shared_ptr sign) { @@ -61,12 +61,12 @@ void TextEditScreen::keyPressed(wchar_t ch, int eventKey) if (eventKey == Keyboard::KEY_UP) line = (line - 1) & 3; if (eventKey == Keyboard::KEY_DOWN || eventKey == Keyboard::KEY_RETURN) line = (line + 1) & 3; - wstring temp=sign->GetMessage(line); + std::wstring temp=sign->GetMessage(line); if (eventKey == Keyboard::KEY_BACK && temp.length() > 0) { temp = temp.substr(0, temp.length() - 1); } - if (allowedChars.find(ch) != wstring::npos && temp.length() < 15) + if (allowedChars.find(ch) != std::wstring::npos && temp.length() < 15) { temp += ch; } diff --git a/Minecraft.Client/UI/Screens/TextEditScreen.h b/Minecraft.Client/UI/Screens/TextEditScreen.h index 706817f66..da1636f90 100644 --- a/Minecraft.Client/UI/Screens/TextEditScreen.h +++ b/Minecraft.Client/UI/Screens/TextEditScreen.h @@ -6,7 +6,7 @@ using namespace std; class TextEditScreen : public Screen { protected: - wstring title; + std::wstring title; private: std::shared_ptr sign; int frame; @@ -20,7 +20,7 @@ public: protected: virtual void buttonClicked(Button *button); private: - static const wstring allowedChars; + static const std::wstring allowedChars; protected: virtual void keyPressed(wchar_t ch, int eventKey); public: diff --git a/Minecraft.Client/UI/Screens/TitleScreen.cpp b/Minecraft.Client/UI/Screens/TitleScreen.cpp index a98807442..165774991 100644 --- a/Minecraft.Client/UI/Screens/TitleScreen.cpp +++ b/Minecraft.Client/UI/Screens/TitleScreen.cpp @@ -22,12 +22,12 @@ TitleScreen::TitleScreen() splash = L"missingno"; // try { // 4J - removed try/catch - vector splashes; + vector splashes; /* BufferedReader *br = new BufferedReader(new InputStreamReader(InputStream::getResourceAsStream(L"res\\title\\splashes.txt"))); //, Charset.forName("UTF-8") - wstring line = L""; + std::wstring line = L""; while ( !(line = br->readLine()).empty() ) { line = trimString( line ); diff --git a/Minecraft.Client/UI/Screens/TitleScreen.h b/Minecraft.Client/UI/Screens/TitleScreen.h index 0f2a8ebc0..9829ae504 100644 --- a/Minecraft.Client/UI/Screens/TitleScreen.h +++ b/Minecraft.Client/UI/Screens/TitleScreen.h @@ -11,7 +11,7 @@ private: float vo; - wstring splash; + std::wstring splash; Button *multiplayerButton; public: diff --git a/Minecraft.Client/UI/Screens/VideoSettingsScreen.h b/Minecraft.Client/UI/Screens/VideoSettingsScreen.h index f4520c768..7570c0014 100644 --- a/Minecraft.Client/UI/Screens/VideoSettingsScreen.h +++ b/Minecraft.Client/UI/Screens/VideoSettingsScreen.h @@ -8,7 +8,7 @@ class VideoSettingsScreen : public Screen private: Screen *lastScreen; protected: - wstring title; + std::wstring title; private: Options *options; diff --git a/Minecraft.Client/UI/SimpleIcon.cpp b/Minecraft.Client/UI/SimpleIcon.cpp index ae6a73857..c69a9938b 100644 --- a/Minecraft.Client/UI/SimpleIcon.cpp +++ b/Minecraft.Client/UI/SimpleIcon.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "SimpleIcon.h" -SimpleIcon::SimpleIcon(const wstring &name, float U0, float V0, float U1, float V1) : StitchedTexture(name) +SimpleIcon::SimpleIcon(const std::wstring &name, float U0, float V0, float U1, float V1) : StitchedTexture(name) { u0 = U0; u1 = U1; diff --git a/Minecraft.Client/UI/SimpleIcon.h b/Minecraft.Client/UI/SimpleIcon.h index 5bece8346..f75a6081a 100644 --- a/Minecraft.Client/UI/SimpleIcon.h +++ b/Minecraft.Client/UI/SimpleIcon.h @@ -7,5 +7,5 @@ using namespace std; class SimpleIcon : public StitchedTexture { public: - SimpleIcon(const wstring &name, float u0, float v0, float u1, float v1); + SimpleIcon(const std::wstring &name, float u0, float v0, float u1, float v1); }; \ No newline at end of file diff --git a/Minecraft.Client/UI/SlideButton.cpp b/Minecraft.Client/UI/SlideButton.cpp index cb86776c1..a9d4c250e 100644 --- a/Minecraft.Client/UI/SlideButton.cpp +++ b/Minecraft.Client/UI/SlideButton.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "SlideButton.h" -SlideButton::SlideButton(int id, int x, int y, const Options::Option *option, const wstring& msg, float value) : Button(id, x, y, 150, 20, msg) +SlideButton::SlideButton(int id, int x, int y, const Options::Option *option, const std::wstring& msg, float value) : Button(id, x, y, 150, 20, msg) { this->sliding = false; //4J added this->option = option; diff --git a/Minecraft.Client/UI/SlideButton.h b/Minecraft.Client/UI/SlideButton.h index 21ed3548a..2947e7015 100644 --- a/Minecraft.Client/UI/SlideButton.h +++ b/Minecraft.Client/UI/SlideButton.h @@ -12,7 +12,7 @@ private: const Options::Option *option; public: - SlideButton(int id, int x, int y, const Options::Option *option, const wstring& msg, float value); + SlideButton(int id, int x, int y, const Options::Option *option, const std::wstring& msg, float value); protected: virtual int getYImage(bool hovered); virtual void renderBg(Minecraft *minecraft, int xm, int ym); diff --git a/Minecraft.Client/UI/SmallButton.cpp b/Minecraft.Client/UI/SmallButton.cpp index 0ce93d0eb..ff736996f 100644 --- a/Minecraft.Client/UI/SmallButton.cpp +++ b/Minecraft.Client/UI/SmallButton.cpp @@ -1,17 +1,17 @@ #include "../Build/stdafx.h" #include "SmallButton.h" -SmallButton::SmallButton(int id, int x, int y, const wstring& msg) : Button(id, x, y, 150, 20, msg) +SmallButton::SmallButton(int id, int x, int y, const std::wstring& msg) : Button(id, x, y, 150, 20, msg) { this->option = NULL; } -SmallButton::SmallButton(int id, int x, int y, int width, int height, const wstring& msg) : Button(id, x, y, width, height, msg) +SmallButton::SmallButton(int id, int x, int y, int width, int height, const std::wstring& msg) : Button(id, x, y, width, height, msg) { this->option = NULL; } -SmallButton::SmallButton(int id, int x, int y, const Options::Option *item, const wstring& msg) : Button(id, x, y, 150, 20, msg) +SmallButton::SmallButton(int id, int x, int y, const Options::Option *item, const std::wstring& msg) : Button(id, x, y, 150, 20, msg) { this->option = item; } diff --git a/Minecraft.Client/UI/SmallButton.h b/Minecraft.Client/UI/SmallButton.h index ede350be6..7ddf9f56f 100644 --- a/Minecraft.Client/UI/SmallButton.h +++ b/Minecraft.Client/UI/SmallButton.h @@ -8,8 +8,8 @@ private: const Options::Option *option; public: - SmallButton(int id, int x, int y, const wstring& msg); - SmallButton(int id, int x, int y, int width, int height, const wstring& msg); - SmallButton(int id, int x, int y, const Options::Option *item, const wstring& msg); + SmallButton(int id, int x, int y, const std::wstring& msg); + SmallButton(int id, int x, int y, int width, int height, const std::wstring& msg); + SmallButton(int id, int x, int y, const Options::Option *item, const std::wstring& msg); const Options::Option *getOption(); }; \ No newline at end of file diff --git a/Minecraft.Client/Utils/ArchiveFile.cpp b/Minecraft.Client/Utils/ArchiveFile.cpp index 29c8a651b..2678d33fb 100644 --- a/Minecraft.Client/Utils/ArchiveFile.cpp +++ b/Minecraft.Client/Utils/ArchiveFile.cpp @@ -24,7 +24,7 @@ void ArchiveFile::_readHeader(DataInputStream *dis) } else meta->isCompressed = false; - m_index.insert( pair(meta->filename,meta) ); + m_index.insert( pair(meta->filename,meta) ); } } @@ -74,9 +74,9 @@ ArchiveFile::~ArchiveFile() delete m_cachedData; } -vector *ArchiveFile::getFileList() +vector *ArchiveFile::getFileList() { - vector *out = new vector(); + vector *out = new vector(); for ( AUTO_VAR(it, m_index.begin()); it != m_index.end(); @@ -87,17 +87,17 @@ vector *ArchiveFile::getFileList() return out; } -bool ArchiveFile::hasFile(const wstring &filename) +bool ArchiveFile::hasFile(const std::wstring &filename) { return m_index.find(filename) != m_index.end(); } -int ArchiveFile::getFileSize(const wstring &filename) +int ArchiveFile::getFileSize(const std::wstring &filename) { return hasFile(filename) ? m_index.at(filename)->filesize : -1; } -byteArray ArchiveFile::getFile(const wstring &filename) +byteArray ArchiveFile::getFile(const std::wstring &filename) { byteArray out; AUTO_VAR(it,m_index.find(filename)); diff --git a/Minecraft.Client/Utils/ArchiveFile.h b/Minecraft.Client/Utils/ArchiveFile.h index f67c25b99..9f3ee9775 100644 --- a/Minecraft.Client/Utils/ArchiveFile.h +++ b/Minecraft.Client/Utils/ArchiveFile.h @@ -16,14 +16,14 @@ protected: typedef struct _MetaData { - wstring filename; + std::wstring filename; int ptr; int filesize; bool isCompressed; } MetaData, *PMetaData; - std::unordered_map m_index; + std::unordered_map m_index; public: void _readHeader(DataInputStream *dis); @@ -31,8 +31,8 @@ public: ArchiveFile(File file); ~ArchiveFile(); - vector *getFileList(); - bool hasFile(const wstring &filename); - int getFileSize(const wstring &filename); - byteArray getFile(const wstring &filename); + vector *getFileList(); + bool hasFile(const std::wstring &filename); + int getFileSize(const std::wstring &filename); + byteArray getFile(const std::wstring &filename); }; diff --git a/Minecraft.Client/Utils/StringTable.cpp b/Minecraft.Client/Utils/StringTable.cpp index 68764957a..6cf2de964 100644 --- a/Minecraft.Client/Utils/StringTable.cpp +++ b/Minecraft.Client/Utils/StringTable.cpp @@ -17,16 +17,16 @@ StringTable::StringTable(PBYTE pbData, DWORD dwSize) int versionNumber = dis.readInt(); int languagesCount = dis.readInt(); - vector< pair > langSizeMap; + vector< pair > langSizeMap; for(int i = 0; i < languagesCount; ++i) { - wstring langId = dis.readUTF(); + std::wstring langId = dis.readUTF(); int langSize = dis.readInt(); - langSizeMap.push_back( vector< pair >::value_type(langId, langSize)); + langSizeMap.push_back( vector< pair >::value_type(langId, langSize)); } - vector locales; + vector locales; app.getLocale(locales); bool foundLang = false; @@ -74,20 +74,20 @@ StringTable::StringTable(PBYTE pbData, DWORD dwSize) int langVersion = dis2.readInt(); isStatic = false; // 4J-JEV: Versions 1 and up could use - if (langVersion > 0) // integers rather than wstrings as keys. + if (langVersion > 0) // integers rather than std::wstrings as keys. isStatic = dis2.readBoolean(); - wstring langId = dis2.readUTF(); + std::wstring langId = dis2.readUTF(); int totalStrings = dis2.readInt(); if (!isStatic) { for(int i = 0; i < totalStrings; ++i) { - wstring stringId = dis2.readUTF(); - wstring stringValue = dis2.readUTF(); + std::wstring stringId = dis2.readUTF(); + std::wstring stringValue = dis2.readUTF(); - m_stringsMap.insert( std::unordered_map::value_type(stringId, stringValue) ); + m_stringsMap.insert( std::unordered_map::value_type(stringId, stringValue) ); } } else @@ -125,7 +125,7 @@ void StringTable::getData(PBYTE *ppData, UINT *pSize) *pSize = src.length; } -LPCWSTR StringTable::getString(const wstring &id) +LPCWSTR StringTable::getString(const std::wstring &id) { #ifndef _CONTENT_PACKAGE if (isStatic) diff --git a/Minecraft.Client/Utils/StringTable.h b/Minecraft.Client/Utils/StringTable.h index 5cb379b99..27374046e 100644 --- a/Minecraft.Client/Utils/StringTable.h +++ b/Minecraft.Client/Utils/StringTable.h @@ -15,8 +15,8 @@ class StringTable private: bool isStatic; - std::unordered_map m_stringsMap; - vector m_stringsVec; + std::unordered_map m_stringsMap; + vector m_stringsVec; byteArray src; @@ -64,7 +64,7 @@ public: void getData(PBYTE *ppbData, UINT *pdwSize); - LPCWSTR getString(const wstring &id); + LPCWSTR getString(const std::wstring &id); LPCWSTR getString(int id); //static LPCWSTR m_wchLocaleCode[LOCALE_COUNT]; @@ -72,7 +72,7 @@ public: private: - //wstring getLangId(DWORD dwLanguage=0); + //std::wstring getLangId(DWORD dwLanguage=0); }; diff --git a/Minecraft.Client/Utils/WstringLookup.cpp b/Minecraft.Client/Utils/WstringLookup.cpp index 376b9dfad..fa99e5008 100644 --- a/Minecraft.Client/Utils/WstringLookup.cpp +++ b/Minecraft.Client/Utils/WstringLookup.cpp @@ -8,7 +8,7 @@ WstringLookup::WstringLookup() numIDs = 0; } -wstring WstringLookup::lookup(UINT id) +std::wstring WstringLookup::lookup(UINT id) { // TODO //if (id > currentMaxID) @@ -17,12 +17,12 @@ wstring WstringLookup::lookup(UINT id) return int2str.at(id); } -UINT WstringLookup::lookup(wstring str) +UINT WstringLookup::lookup(std::wstring str) { if (str2int.find(str) == str2int.end()) { - pair p = - pair(str, numIDs); + pair p = + pair(str, numIDs); str2int.insert( p ); int2str.push_back( str ); @@ -35,13 +35,13 @@ UINT WstringLookup::lookup(wstring str) } } -VOID WstringLookup::getTable(wstring **lookup, UINT *len) +VOID WstringLookup::getTable(std::wstring **lookup, UINT *len) { // Outputs - wstring *out_lookup; UINT out_len; + std::wstring *out_lookup; UINT out_len; // Fill lookup. - out_lookup = new wstring[int2str.size()]; + out_lookup = new std::wstring[int2str.size()]; for (UINT i = 0; i < numIDs; i++) out_lookup[i] = int2str.at(i); diff --git a/Minecraft.Client/Utils/WstringLookup.h b/Minecraft.Client/Utils/WstringLookup.h index 45f92dc52..086b9da5e 100644 --- a/Minecraft.Client/Utils/WstringLookup.h +++ b/Minecraft.Client/Utils/WstringLookup.h @@ -6,15 +6,15 @@ class WstringLookup { private: UINT numIDs; - std::unordered_map str2int; - vector int2str; + std::unordered_map str2int; + vector int2str; public: WstringLookup(); - wstring lookup(UINT id); + std::wstring lookup(UINT id); - UINT lookup(wstring); + UINT lookup(std::wstring); - VOID getTable(wstring **lookup, UINT *len); + VOID getTable(std::wstring **lookup, UINT *len); }; \ No newline at end of file diff --git a/Minecraft.World/AI/Navigation/Node.cpp b/Minecraft.World/AI/Navigation/Node.cpp index 92fd4c24b..ad1104e3b 100644 --- a/Minecraft.World/AI/Navigation/Node.cpp +++ b/Minecraft.World/AI/Navigation/Node.cpp @@ -69,7 +69,7 @@ bool Node::inOpenSet() return heapIdx >= 0; } -wstring Node::toString() +std::wstring Node::toString() { return _toString(x) + L", " + _toString(y) + L", " + _toString(z); } \ No newline at end of file diff --git a/Minecraft.World/AI/Navigation/Node.h b/Minecraft.World/AI/Navigation/Node.h index 6d2bdda86..f85be5331 100644 --- a/Minecraft.World/AI/Navigation/Node.h +++ b/Minecraft.World/AI/Navigation/Node.h @@ -34,5 +34,5 @@ public: bool equals(Node *o); int hashCode(); bool inOpenSet(); - wstring toString(); + std::wstring toString(); }; diff --git a/Minecraft.World/Blocks/AnvilTile.cpp b/Minecraft.World/Blocks/AnvilTile.cpp index 761b1a03b..0e1c9dbad 100644 --- a/Minecraft.World/Blocks/AnvilTile.cpp +++ b/Minecraft.World/Blocks/AnvilTile.cpp @@ -13,7 +13,7 @@ const unsigned int AnvilTile::ANVIL_NAMES[ANVIL_NAMES_LENGTH] = { IDS_TILE_ANVIL }; -wstring AnvilTile::TEXTURE_DAMAGE_NAMES[ANVIL_NAMES_LENGTH] = { +std::wstring AnvilTile::TEXTURE_DAMAGE_NAMES[ANVIL_NAMES_LENGTH] = { L"anvil_top", L"anvil_top_damaged_1", L"anvil_top_damaged_2" }; diff --git a/Minecraft.World/Blocks/AnvilTile.h b/Minecraft.World/Blocks/AnvilTile.h index e625777d9..745d03997 100644 --- a/Minecraft.World/Blocks/AnvilTile.h +++ b/Minecraft.World/Blocks/AnvilTile.h @@ -19,7 +19,7 @@ public: static const unsigned int ANVIL_NAMES[ANVIL_NAMES_LENGTH]; private: - static wstring TEXTURE_DAMAGE_NAMES[ANVIL_NAMES_LENGTH]; + static std::wstring TEXTURE_DAMAGE_NAMES[ANVIL_NAMES_LENGTH]; public: int part; diff --git a/Minecraft.World/Blocks/BrewingStandTile.cpp b/Minecraft.World/Blocks/BrewingStandTile.cpp index fcdff6e91..0ecdc6d0a 100644 --- a/Minecraft.World/Blocks/BrewingStandTile.cpp +++ b/Minecraft.World/Blocks/BrewingStandTile.cpp @@ -6,7 +6,7 @@ #include "../Headers/net.minecraft.world.entity.item.h" #include "../Headers/net.minecraft.world.h" -const wstring BrewingStandTile::TEXTURE_BASE = L"brewingStand_base"; +const std::wstring BrewingStandTile::TEXTURE_BASE = L"brewingStand_base"; BrewingStandTile::BrewingStandTile(int id) : EntityTile(id, Material::metal, isSolidRender()) { diff --git a/Minecraft.World/Blocks/BrewingStandTile.h b/Minecraft.World/Blocks/BrewingStandTile.h index 29824c375..03b99361c 100644 --- a/Minecraft.World/Blocks/BrewingStandTile.h +++ b/Minecraft.World/Blocks/BrewingStandTile.h @@ -8,7 +8,7 @@ class BrewingStandTile : public EntityTile { friend ChunkRebuildData; public: - static const wstring TEXTURE_BASE; + static const std::wstring TEXTURE_BASE; private: Random *random; Icon *iconBase; diff --git a/Minecraft.World/Blocks/CauldronTile.cpp b/Minecraft.World/Blocks/CauldronTile.cpp index 8111aa9ab..1e2fdc637 100644 --- a/Minecraft.World/Blocks/CauldronTile.cpp +++ b/Minecraft.World/Blocks/CauldronTile.cpp @@ -8,8 +8,8 @@ #include "../Headers/net.minecraft.world.h" #include "../../Minecraft.Client/Player/ServerPlayer.h" -const wstring CauldronTile::TEXTURE_INSIDE = L"cauldron_inner"; -const wstring CauldronTile::TEXTURE_BOTTOM = L"cauldron_bottom"; +const std::wstring CauldronTile::TEXTURE_INSIDE = L"cauldron_inner"; +const std::wstring CauldronTile::TEXTURE_BOTTOM = L"cauldron_bottom"; CauldronTile::CauldronTile(int id) : Tile(id, Material::metal, isSolidRender()) { @@ -39,7 +39,7 @@ void CauldronTile::registerIcons(IconRegister *iconRegister) icon = iconRegister->registerIcon(L"cauldron_side"); } -Icon *CauldronTile::getTexture(const wstring &name) +Icon *CauldronTile::getTexture(const std::wstring &name) { if (name.compare(TEXTURE_INSIDE) == 0) return Tile::cauldron->iconInner; if (name.compare(TEXTURE_BOTTOM) == 0) return Tile::cauldron->iconBottom; diff --git a/Minecraft.World/Blocks/CauldronTile.h b/Minecraft.World/Blocks/CauldronTile.h index 61c98de35..804a33450 100644 --- a/Minecraft.World/Blocks/CauldronTile.h +++ b/Minecraft.World/Blocks/CauldronTile.h @@ -6,8 +6,8 @@ class IconRegister; class CauldronTile : public Tile { public: - static const wstring TEXTURE_INSIDE; - static const wstring TEXTURE_BOTTOM; + static const std::wstring TEXTURE_INSIDE; + static const std::wstring TEXTURE_BOTTOM; private: Icon *iconInner; @@ -20,7 +20,7 @@ public: virtual Icon *getTexture(int face, int data); //@Override void registerIcons(IconRegister *iconRegister); - static Icon *getTexture(const wstring &name); + static Icon *getTexture(const std::wstring &name); virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source); virtual void updateDefaultShape(); virtual bool isSolidRender(bool isServerLevel = false); diff --git a/Minecraft.World/Blocks/CocoaTile.cpp b/Minecraft.World/Blocks/CocoaTile.cpp index 7c24edde4..a30a9da63 100644 --- a/Minecraft.World/Blocks/CocoaTile.cpp +++ b/Minecraft.World/Blocks/CocoaTile.cpp @@ -6,7 +6,7 @@ #include "../Headers/net.minecraft.h" #include "CocoaTile.h" -const wstring CocoaTile::TEXTURE_AGES[] = { L"cocoa_0", L"cocoa_1", L"cocoa_2"}; +const std::wstring CocoaTile::TEXTURE_AGES[] = { L"cocoa_0", L"cocoa_1", L"cocoa_2"}; CocoaTile::CocoaTile(int id) : DirectionalTile(id, Material::plant, isSolidRender() ) { diff --git a/Minecraft.World/Blocks/CocoaTile.h b/Minecraft.World/Blocks/CocoaTile.h index 81de72ead..67345b338 100644 --- a/Minecraft.World/Blocks/CocoaTile.h +++ b/Minecraft.World/Blocks/CocoaTile.h @@ -6,7 +6,7 @@ class CocoaTile : public DirectionalTile { public: static const int COCOA_TEXTURES_LENGTH = 3; - static const wstring TEXTURE_AGES[]; + static const std::wstring TEXTURE_AGES[]; private: Icon **icons; diff --git a/Minecraft.World/Blocks/DoorTile.cpp b/Minecraft.World/Blocks/DoorTile.cpp index e973bc842..5940a39ea 100644 --- a/Minecraft.World/Blocks/DoorTile.cpp +++ b/Minecraft.World/Blocks/DoorTile.cpp @@ -8,7 +8,7 @@ #include "../Headers/net.minecraft.world.h" #include "../Headers/net.minecraft.h" -const wstring DoorTile::TEXTURES[] = { L"doorWood_lower", L"doorWood_upper", L"doorIron_lower", L"doorIron_upper" }; +const std::wstring DoorTile::TEXTURES[] = { L"doorWood_lower", L"doorWood_upper", L"doorIron_lower", L"doorIron_upper" }; DoorTile::DoorTile(int id, Material *material) : Tile(id, material,isSolidRender()) { diff --git a/Minecraft.World/Blocks/DoorTile.h b/Minecraft.World/Blocks/DoorTile.h index d9f84a60a..14c68b7ed 100644 --- a/Minecraft.World/Blocks/DoorTile.h +++ b/Minecraft.World/Blocks/DoorTile.h @@ -20,7 +20,7 @@ public: private: static const int DOOR_TILE_TEXTURE_COUNT = 4; - static const wstring TEXTURES[]; + static const std::wstring TEXTURES[]; int texBase; Icon **icons; diff --git a/Minecraft.World/Blocks/EnchantmentTableTile.cpp b/Minecraft.World/Blocks/EnchantmentTableTile.cpp index 5c111ebe6..3aa90c632 100644 --- a/Minecraft.World/Blocks/EnchantmentTableTile.cpp +++ b/Minecraft.World/Blocks/EnchantmentTableTile.cpp @@ -5,9 +5,9 @@ #include "../Headers/net.minecraft.h" #include "../Headers/net.minecraft.world.h" -const wstring EnchantmentTableTile::TEXTURE_SIDE = L"enchantment_side"; -const wstring EnchantmentTableTile::TEXTURE_TOP = L"enchantment_top"; -const wstring EnchantmentTableTile::TEXTURE_BOTTOM = L"enchantment_bottom"; +const std::wstring EnchantmentTableTile::TEXTURE_SIDE = L"enchantment_side"; +const std::wstring EnchantmentTableTile::TEXTURE_TOP = L"enchantment_top"; +const std::wstring EnchantmentTableTile::TEXTURE_BOTTOM = L"enchantment_bottom"; EnchantmentTableTile::EnchantmentTableTile(int id) : EntityTile(id, Material::stone, isSolidRender()) { diff --git a/Minecraft.World/Blocks/EnchantmentTableTile.h b/Minecraft.World/Blocks/EnchantmentTableTile.h index a789c5a01..13860d106 100644 --- a/Minecraft.World/Blocks/EnchantmentTableTile.h +++ b/Minecraft.World/Blocks/EnchantmentTableTile.h @@ -6,9 +6,9 @@ class EnchantmentTableTile : public EntityTile { friend class ChunkRebuildData; public: - static const wstring TEXTURE_SIDE; - static const wstring TEXTURE_TOP; - static const wstring TEXTURE_BOTTOM; + static const std::wstring TEXTURE_SIDE; + static const std::wstring TEXTURE_TOP; + static const std::wstring TEXTURE_BOTTOM; private: Icon *iconTop; diff --git a/Minecraft.World/Blocks/FenceTile.cpp b/Minecraft.World/Blocks/FenceTile.cpp index ee95c95e9..e5104eb5a 100644 --- a/Minecraft.World/Blocks/FenceTile.cpp +++ b/Minecraft.World/Blocks/FenceTile.cpp @@ -4,7 +4,7 @@ #include "../Headers/net.minecraft.world.h" #include "FenceTile.h" -FenceTile::FenceTile(int id, const wstring &texture, Material *material) : Tile( id, material, isSolidRender()) +FenceTile::FenceTile(int id, const std::wstring &texture, Material *material) : Tile( id, material, isSolidRender()) { this->texture = texture; } diff --git a/Minecraft.World/Blocks/FenceTile.h b/Minecraft.World/Blocks/FenceTile.h index d42465205..001fe19f8 100644 --- a/Minecraft.World/Blocks/FenceTile.h +++ b/Minecraft.World/Blocks/FenceTile.h @@ -5,10 +5,10 @@ class FenceTile : public Tile { private: - wstring texture; + std::wstring texture; public: - FenceTile(int id, const wstring &texture, Material *material); + FenceTile(int id, const std::wstring &texture, Material *material); virtual AABB *getAABB(Level *level, int x, int y, int z); virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual bool blocksLight(); diff --git a/Minecraft.World/Blocks/FireTile.cpp b/Minecraft.World/Blocks/FireTile.cpp index 7d0ce152e..c5af0901e 100644 --- a/Minecraft.World/Blocks/FireTile.cpp +++ b/Minecraft.World/Blocks/FireTile.cpp @@ -13,8 +13,8 @@ #include "../../Minecraft.Client/Rendering/Tesselator.h" -const wstring FireTile::TEXTURE_FIRST = L"fire_0"; -const wstring FireTile::TEXTURE_SECOND = L"fire_1"; +const std::wstring FireTile::TEXTURE_FIRST = L"fire_0"; +const std::wstring FireTile::TEXTURE_SECOND = L"fire_1"; FireTile::FireTile(int id) : Tile(id, Material::fire,isSolidRender()) { diff --git a/Minecraft.World/Blocks/FireTile.h b/Minecraft.World/Blocks/FireTile.h index 05c9e2b88..35a391b3d 100644 --- a/Minecraft.World/Blocks/FireTile.h +++ b/Minecraft.World/Blocks/FireTile.h @@ -9,8 +9,8 @@ class FireTile : public Tile friend class Tile; friend class ChunkRebuildData; public: - static const wstring TEXTURE_FIRST; - static const wstring TEXTURE_SECOND; + static const std::wstring TEXTURE_FIRST; + static const std::wstring TEXTURE_SECOND; static const int FLAME_INSTANT = 60; static const int FLAME_EASY = 30; diff --git a/Minecraft.World/Blocks/HalfTransparentTile.cpp b/Minecraft.World/Blocks/HalfTransparentTile.cpp index d031af57b..00d3e84d4 100644 --- a/Minecraft.World/Blocks/HalfTransparentTile.cpp +++ b/Minecraft.World/Blocks/HalfTransparentTile.cpp @@ -3,7 +3,7 @@ #include "../Headers/net.minecraft.world.h" #include "HalfTransparentTile.h" -HalfTransparentTile::HalfTransparentTile(int id, const wstring &tex, Material *material, bool allowSame) : Tile(id,material,isSolidRender()) +HalfTransparentTile::HalfTransparentTile(int id, const std::wstring &tex, Material *material, bool allowSame) : Tile(id,material,isSolidRender()) { this->allowSame = allowSame; this->texture = tex; diff --git a/Minecraft.World/Blocks/HalfTransparentTile.h b/Minecraft.World/Blocks/HalfTransparentTile.h index e3d34c3fd..b74cbeca0 100644 --- a/Minecraft.World/Blocks/HalfTransparentTile.h +++ b/Minecraft.World/Blocks/HalfTransparentTile.h @@ -8,9 +8,9 @@ class HalfTransparentTile : public Tile friend class ChunkRebuildData; private: bool allowSame; - wstring texture; + std::wstring texture; protected: - HalfTransparentTile(int id, const wstring &tex, Material *material, bool allowSame); + HalfTransparentTile(int id, const std::wstring &tex, Material *material, bool allowSame); public: virtual bool isSolidRender(bool isServerLevel = false); virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face); diff --git a/Minecraft.World/Blocks/HugeMushroomTile.cpp b/Minecraft.World/Blocks/HugeMushroomTile.cpp index 614949a54..9da041510 100644 --- a/Minecraft.World/Blocks/HugeMushroomTile.cpp +++ b/Minecraft.World/Blocks/HugeMushroomTile.cpp @@ -2,9 +2,9 @@ #include "../Headers/net.minecraft.world.h" #include "HugeMushroomTile.h" -const wstring HugeMushroomTile::TEXTURE_STEM = L"mushroom_skin_stem"; -const wstring HugeMushroomTile::TEXTURE_INSIDE = L"mushroom_inside"; -const wstring HugeMushroomTile::TEXTURE_TYPE[] = {L"mushroom_skin_brown", L"mushroom_skin_red"}; +const std::wstring HugeMushroomTile::TEXTURE_STEM = L"mushroom_skin_stem"; +const std::wstring HugeMushroomTile::TEXTURE_INSIDE = L"mushroom_inside"; +const std::wstring HugeMushroomTile::TEXTURE_TYPE[] = {L"mushroom_skin_brown", L"mushroom_skin_red"}; HugeMushroomTile::HugeMushroomTile(int id, Material *material, int type) : Tile(id, material) { diff --git a/Minecraft.World/Blocks/HugeMushroomTile.h b/Minecraft.World/Blocks/HugeMushroomTile.h index 2aa22fbb5..2dc4a0ddc 100644 --- a/Minecraft.World/Blocks/HugeMushroomTile.h +++ b/Minecraft.World/Blocks/HugeMushroomTile.h @@ -6,12 +6,12 @@ class HugeMushroomTile : public Tile { friend class ChunkRebuildData; public: - static const wstring TEXTURE_STEM; - static const wstring TEXTURE_INSIDE; + static const std::wstring TEXTURE_STEM; + static const std::wstring TEXTURE_INSIDE; private: static const int HUGE_MUSHROOM_TEXTURE_COUNT = 2; - static const wstring TEXTURE_TYPE[]; + static const std::wstring TEXTURE_TYPE[]; int type; Icon **icons; Icon *iconStem; diff --git a/Minecraft.World/Blocks/LeafTile.cpp b/Minecraft.World/Blocks/LeafTile.cpp index cd928fed4..7f14e90c0 100644 --- a/Minecraft.World/Blocks/LeafTile.cpp +++ b/Minecraft.World/Blocks/LeafTile.cpp @@ -13,7 +13,7 @@ const unsigned int LeafTile::LEAF_NAMES[LEAF_NAMES_LENGTH] = { IDS_TILE_LEAVES_O IDS_TILE_LEAVES_JUNGLE, }; -const wstring LeafTile::TEXTURES[2][4] = { {L"leaves", L"leaves_spruce", L"leaves", L"leaves_jungle"}, {L"leaves_opaque", L"leaves_spruce_opaque", L"leaves_opaque", L"leaves_jungle_opaque"},}; +const std::wstring LeafTile::TEXTURES[2][4] = { {L"leaves", L"leaves_spruce", L"leaves", L"leaves_jungle"}, {L"leaves_opaque", L"leaves_spruce_opaque", L"leaves_opaque", L"leaves_jungle_opaque"},}; LeafTile::LeafTile(int id) : TransparentTile(id, Material::leaves, false, isSolidRender()) { diff --git a/Minecraft.World/Blocks/LeafTile.h b/Minecraft.World/Blocks/LeafTile.h index 428a293f1..20b5d73c7 100644 --- a/Minecraft.World/Blocks/LeafTile.h +++ b/Minecraft.World/Blocks/LeafTile.h @@ -9,7 +9,7 @@ class LeafTile : public TransparentTile friend class Tile; friend class ChunkRebuildData; public: - static const wstring TEXTURES[2][4]; + static const std::wstring TEXTURES[2][4]; static const int REQUIRED_WOOD_RANGE = 4; static const int UPDATE_LEAF_BIT = 8; diff --git a/Minecraft.World/Blocks/LiquidTile.cpp b/Minecraft.World/Blocks/LiquidTile.cpp index a168a8b4b..7283c0850 100644 --- a/Minecraft.World/Blocks/LiquidTile.cpp +++ b/Minecraft.World/Blocks/LiquidTile.cpp @@ -7,10 +7,10 @@ #include "../Util/Facing.h" #include "../Util/SoundTypes.h" -const wstring LiquidTile::TEXTURE_LAVA_STILL = L"lava"; -const wstring LiquidTile::TEXTURE_WATER_STILL = L"water"; -const wstring LiquidTile::TEXTURE_WATER_FLOW = L"water_flow"; -const wstring LiquidTile::TEXTURE_LAVA_FLOW = L"lava_flow"; +const std::wstring LiquidTile::TEXTURE_LAVA_STILL = L"lava"; +const std::wstring LiquidTile::TEXTURE_WATER_STILL = L"water"; +const std::wstring LiquidTile::TEXTURE_WATER_FLOW = L"water_flow"; +const std::wstring LiquidTile::TEXTURE_LAVA_FLOW = L"lava_flow"; LiquidTile::LiquidTile(int id, Material *material) : Tile(id, material,isSolidRender()) { @@ -408,7 +408,7 @@ void LiquidTile::registerIcons(IconRegister *iconRegister) } } -Icon *LiquidTile::getTexture(const wstring &name) +Icon *LiquidTile::getTexture(const std::wstring &name) { if (name.compare(TEXTURE_WATER_STILL)==0) return Tile::water->icons[0]; if (name.compare(TEXTURE_WATER_FLOW)==0) return Tile::water->icons[1]; diff --git a/Minecraft.World/Blocks/LiquidTile.h b/Minecraft.World/Blocks/LiquidTile.h index 53649acbc..4a0e8e6d5 100644 --- a/Minecraft.World/Blocks/LiquidTile.h +++ b/Minecraft.World/Blocks/LiquidTile.h @@ -9,10 +9,10 @@ class LiquidTile : public Tile { friend class ChunkRebuildData; public: - static const wstring TEXTURE_LAVA_STILL; - static const wstring TEXTURE_WATER_STILL; - static const wstring TEXTURE_WATER_FLOW; - static const wstring TEXTURE_LAVA_FLOW; + static const std::wstring TEXTURE_LAVA_STILL; + static const std::wstring TEXTURE_WATER_STILL; + static const std::wstring TEXTURE_WATER_FLOW; + static const std::wstring TEXTURE_LAVA_FLOW; private: Icon *icons[2]; @@ -58,5 +58,5 @@ protected: public: void registerIcons(IconRegister *iconRegister); - static Icon *getTexture(const wstring &name); + static Icon *getTexture(const std::wstring &name); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/MelonTile.cpp b/Minecraft.World/Blocks/MelonTile.cpp index 320e03b30..3d441ba10 100644 --- a/Minecraft.World/Blocks/MelonTile.cpp +++ b/Minecraft.World/Blocks/MelonTile.cpp @@ -4,8 +4,8 @@ #include "../Headers/net.minecraft.world.h" #include "../Util/Facing.h" -const wstring MelonTile::TEX = L"melon_side"; -const wstring MelonTile::TEX_TOP = L"melon_top"; +const std::wstring MelonTile::TEX = L"melon_side"; +const std::wstring MelonTile::TEX_TOP = L"melon_top"; MelonTile::MelonTile(int id) : Tile(id, Material::vegetable) { diff --git a/Minecraft.World/Blocks/MelonTile.h b/Minecraft.World/Blocks/MelonTile.h index 029cb1cb1..43b456e64 100644 --- a/Minecraft.World/Blocks/MelonTile.h +++ b/Minecraft.World/Blocks/MelonTile.h @@ -6,8 +6,8 @@ class MelonTile : public Tile { friend class ChunkRebuildData; private: - static const wstring TEX; - static const wstring TEX_TOP; + static const std::wstring TEX; + static const std::wstring TEX_TOP; Icon *iconTop; diff --git a/Minecraft.World/Blocks/MushroomPlantTile.cpp b/Minecraft.World/Blocks/MushroomPlantTile.cpp index caa026b72..6099a9e2a 100644 --- a/Minecraft.World/Blocks/MushroomPlantTile.cpp +++ b/Minecraft.World/Blocks/MushroomPlantTile.cpp @@ -4,7 +4,7 @@ #include "../Headers/net.minecraft.world.h" #include "MushroomPlantTile.h" -Mushroom::Mushroom(int id, const wstring &texture) : Bush(id) +Mushroom::Mushroom(int id, const std::wstring &texture) : Bush(id) { this->updateDefaultShape(); this->setTicking(true); diff --git a/Minecraft.World/Blocks/MushroomPlantTile.h b/Minecraft.World/Blocks/MushroomPlantTile.h index c5cfbd88d..04f82d81c 100644 --- a/Minecraft.World/Blocks/MushroomPlantTile.h +++ b/Minecraft.World/Blocks/MushroomPlantTile.h @@ -7,9 +7,9 @@ class Mushroom : public Bush { friend class Tile; private: - wstring texture; + std::wstring texture; protected: - Mushroom(int id, const wstring &texture); + Mushroom(int id, const std::wstring &texture); public: virtual void updateDefaultShape(); // 4J Added override virtual void tick(Level *level, int x, int y, int z, Random *random); diff --git a/Minecraft.World/Blocks/NetherStalkTile.cpp b/Minecraft.World/Blocks/NetherStalkTile.cpp index 689967831..9c4f9bfaf 100644 --- a/Minecraft.World/Blocks/NetherStalkTile.cpp +++ b/Minecraft.World/Blocks/NetherStalkTile.cpp @@ -5,7 +5,7 @@ #include "../Headers/net.minecraft.world.item.h" #include "../Headers/net.minecraft.world.h" -const wstring NetherStalkTile::TEXTURE_NAMES[] = { L"netherStalk_0", L"netherStalk_1", L"netherStalk_2" }; +const std::wstring NetherStalkTile::TEXTURE_NAMES[] = { L"netherStalk_0", L"netherStalk_1", L"netherStalk_2" }; NetherStalkTile::NetherStalkTile(int id) : Bush(id) { diff --git a/Minecraft.World/Blocks/NetherStalkTile.h b/Minecraft.World/Blocks/NetherStalkTile.h index 55e70d930..f6dd55e35 100644 --- a/Minecraft.World/Blocks/NetherStalkTile.h +++ b/Minecraft.World/Blocks/NetherStalkTile.h @@ -9,7 +9,7 @@ private: static const int MAX_AGE = 3; static const int NETHER_STALK_TEXTURE_COUNT = 3; - static const wstring TEXTURE_NAMES[]; + static const std::wstring TEXTURE_NAMES[]; Icon **icons; diff --git a/Minecraft.World/Blocks/PistonBaseTile.cpp b/Minecraft.World/Blocks/PistonBaseTile.cpp index d61a6d58b..043db0f16 100644 --- a/Minecraft.World/Blocks/PistonBaseTile.cpp +++ b/Minecraft.World/Blocks/PistonBaseTile.cpp @@ -11,11 +11,11 @@ #include "../Level/LevelChunk.h" #include "../Level/Dimensions/Dimension.h" -const wstring PistonBaseTile::EDGE_TEX = L"piston_side"; -const wstring PistonBaseTile::PLATFORM_TEX = L"piston_top"; -const wstring PistonBaseTile::PLATFORM_STICKY_TEX = L"piston_top_sticky"; -const wstring PistonBaseTile::BACK_TEX = L"piston_bottom"; -const wstring PistonBaseTile::INSIDE_TEX = L"piston_inner_top"; +const std::wstring PistonBaseTile::EDGE_TEX = L"piston_side"; +const std::wstring PistonBaseTile::PLATFORM_TEX = L"piston_top"; +const std::wstring PistonBaseTile::PLATFORM_STICKY_TEX = L"piston_top_sticky"; +const std::wstring PistonBaseTile::BACK_TEX = L"piston_bottom"; +const std::wstring PistonBaseTile::INSIDE_TEX = L"piston_inner_top"; const float PistonBaseTile::PLATFORM_THICKNESS = 4.0f; @@ -90,7 +90,7 @@ Icon *PistonBaseTile::getTexture(int face, int data) return icon; } -Icon *PistonBaseTile::getTexture(const wstring &name) +Icon *PistonBaseTile::getTexture(const std::wstring &name) { if (name.compare(EDGE_TEX) == 0) return Tile::pistonBase->icon; if (name.compare(PLATFORM_TEX) == 0) return Tile::pistonBase->iconPlatform; diff --git a/Minecraft.World/Blocks/PistonBaseTile.h b/Minecraft.World/Blocks/PistonBaseTile.h index c5127e8c2..9e5ca11e1 100644 --- a/Minecraft.World/Blocks/PistonBaseTile.h +++ b/Minecraft.World/Blocks/PistonBaseTile.h @@ -12,11 +12,11 @@ public: static const int TRIGGER_EXTEND = 0; static const int TRIGGER_CONTRACT = 1; - static const wstring EDGE_TEX; - static const wstring PLATFORM_TEX; - static const wstring PLATFORM_STICKY_TEX; - static const wstring BACK_TEX; - static const wstring INSIDE_TEX; + static const std::wstring EDGE_TEX; + static const std::wstring PLATFORM_TEX; + static const std::wstring PLATFORM_STICKY_TEX; + static const std::wstring BACK_TEX; + static const std::wstring INSIDE_TEX; private: bool isSticky; @@ -37,7 +37,7 @@ public: virtual void updateShape(float x0, float y0, float z0, float x1, float y1, float z1); virtual Icon *getTexture(int face, int data); - static Icon *getTexture(const wstring &name); + static Icon *getTexture(const std::wstring &name); void registerIcons(IconRegister *iconRegister); virtual int getRenderShape(); diff --git a/Minecraft.World/Blocks/PressurePlateTile.cpp b/Minecraft.World/Blocks/PressurePlateTile.cpp index 5262d17a9..5c21957a8 100644 --- a/Minecraft.World/Blocks/PressurePlateTile.cpp +++ b/Minecraft.World/Blocks/PressurePlateTile.cpp @@ -7,7 +7,7 @@ #include "PressurePlateTile.h" #include "../Util/SoundTypes.h" -PressurePlateTile::PressurePlateTile(int id, const wstring &tex, Material *material, Sensitivity sensitivity) : Tile(id, material, isSolidRender()) +PressurePlateTile::PressurePlateTile(int id, const std::wstring &tex, Material *material, Sensitivity sensitivity) : Tile(id, material, isSolidRender()) { this->sensitivity = sensitivity; this->setTicking(true); diff --git a/Minecraft.World/Blocks/PressurePlateTile.h b/Minecraft.World/Blocks/PressurePlateTile.h index 49780acbe..a6219feb2 100644 --- a/Minecraft.World/Blocks/PressurePlateTile.h +++ b/Minecraft.World/Blocks/PressurePlateTile.h @@ -8,7 +8,7 @@ class PressurePlateTile : public Tile { friend class Tile; private: - wstring texture; + std::wstring texture; public: enum Sensitivity { @@ -20,7 +20,7 @@ public: private: Sensitivity sensitivity; protected: - PressurePlateTile(int id, const wstring &tex, Material *material, Sensitivity sensitivity); + PressurePlateTile(int id, const std::wstring &tex, Material *material, Sensitivity sensitivity); public: virtual int getTickDelay(); virtual AABB *getAABB(Level *level, int x, int y, int z); diff --git a/Minecraft.World/Blocks/PumpkinTile.cpp b/Minecraft.World/Blocks/PumpkinTile.cpp index 41c5c3485..d41567b9b 100644 --- a/Minecraft.World/Blocks/PumpkinTile.cpp +++ b/Minecraft.World/Blocks/PumpkinTile.cpp @@ -8,8 +8,8 @@ #include "../Entities/Mobs/SnowMan.h" #include "../Entities/MobCategory.h" -const wstring PumpkinTile::TEXTURE_FACE = L"pumpkin_face"; -const wstring PumpkinTile::TEXTURE_LANTERN = L"pumpkin_jack"; +const std::wstring PumpkinTile::TEXTURE_FACE = L"pumpkin_face"; +const std::wstring PumpkinTile::TEXTURE_LANTERN = L"pumpkin_jack"; PumpkinTile::PumpkinTile(int id, bool lit) : DirectionalTile(id, Material::vegetable) { diff --git a/Minecraft.World/Blocks/PumpkinTile.h b/Minecraft.World/Blocks/PumpkinTile.h index 03e555695..5117c9c30 100644 --- a/Minecraft.World/Blocks/PumpkinTile.h +++ b/Minecraft.World/Blocks/PumpkinTile.h @@ -15,8 +15,8 @@ public: static const int DIR_EAST = 3; private: - static const wstring TEXTURE_FACE; - static const wstring TEXTURE_LANTERN; + static const std::wstring TEXTURE_FACE; + static const std::wstring TEXTURE_LANTERN; bool lit; Icon *iconTop; Icon *iconFace; diff --git a/Minecraft.World/Blocks/QuartzBlockTile.cpp b/Minecraft.World/Blocks/QuartzBlockTile.cpp index 553d97943..46628dbc6 100644 --- a/Minecraft.World/Blocks/QuartzBlockTile.cpp +++ b/Minecraft.World/Blocks/QuartzBlockTile.cpp @@ -12,11 +12,11 @@ int QuartzBlockTile::BLOCK_NAMES[QUARTZ_BLOCK_NAMES] = { IDS_TILE_QUARTZ_BLOCK, IDS_TILE_QUARTZ_BLOCK_CHISELED, IDS_TILE_QUARTZ_BLOCK_LINES, IDS_TILE_QUARTZ_BLOCK_LINES, IDS_TILE_QUARTZ_BLOCK_LINES }; -const wstring QuartzBlockTile::TEXTURE_TOP = L"quartzblock_top"; -const wstring QuartzBlockTile::TEXTURE_CHISELED_TOP = L"quartzblock_chiseled_top"; -const wstring QuartzBlockTile::TEXTURE_LINES_TOP = L"quartzblock_lines_top"; -const wstring QuartzBlockTile::TEXTURE_BOTTOM = L"quartzblock_bottom"; -const wstring QuartzBlockTile::TEXTURE_NAMES[QUARTZ_BLOCK_TEXTURES] = { L"quartzblock_side", L"quartzblock_chiseled", L"quartzblock_lines", L"", L""}; +const std::wstring QuartzBlockTile::TEXTURE_TOP = L"quartzblock_top"; +const std::wstring QuartzBlockTile::TEXTURE_CHISELED_TOP = L"quartzblock_chiseled_top"; +const std::wstring QuartzBlockTile::TEXTURE_LINES_TOP = L"quartzblock_lines_top"; +const std::wstring QuartzBlockTile::TEXTURE_BOTTOM = L"quartzblock_bottom"; +const std::wstring QuartzBlockTile::TEXTURE_NAMES[QUARTZ_BLOCK_TEXTURES] = { L"quartzblock_side", L"quartzblock_chiseled", L"quartzblock_lines", L"", L""}; QuartzBlockTile::QuartzBlockTile(int id) : Tile(id, Material::stone) { diff --git a/Minecraft.World/Blocks/QuartzBlockTile.h b/Minecraft.World/Blocks/QuartzBlockTile.h index d812e8a18..7a4e0719b 100644 --- a/Minecraft.World/Blocks/QuartzBlockTile.h +++ b/Minecraft.World/Blocks/QuartzBlockTile.h @@ -19,11 +19,11 @@ public: private: static const int QUARTZ_BLOCK_TEXTURES = 5; - static const wstring TEXTURE_TOP; - static const wstring TEXTURE_CHISELED_TOP; - static const wstring TEXTURE_LINES_TOP; - static const wstring TEXTURE_BOTTOM; - static const wstring TEXTURE_NAMES[QUARTZ_BLOCK_TEXTURES]; + static const std::wstring TEXTURE_TOP; + static const std::wstring TEXTURE_CHISELED_TOP; + static const std::wstring TEXTURE_LINES_TOP; + static const std::wstring TEXTURE_BOTTOM; + static const std::wstring TEXTURE_NAMES[QUARTZ_BLOCK_TEXTURES]; Icon *icons[QUARTZ_BLOCK_TEXTURES]; Icon *iconChiseledTop; diff --git a/Minecraft.World/Blocks/RedStoneDustTile.cpp b/Minecraft.World/Blocks/RedStoneDustTile.cpp index 2ae1efc05..630267dd4 100644 --- a/Minecraft.World/Blocks/RedStoneDustTile.cpp +++ b/Minecraft.World/Blocks/RedStoneDustTile.cpp @@ -11,10 +11,10 @@ #include "../IO/Streams/IntBuffer.h" #include "../../Minecraft.Client/Rendering/Tesselator.h" -const wstring RedStoneDustTile::TEXTURE_CROSS = L"redstoneDust_cross"; -const wstring RedStoneDustTile::TEXTURE_LINE = L"redstoneDust_line"; -const wstring RedStoneDustTile::TEXTURE_CROSS_OVERLAY = L"redstoneDust_cross_overlay"; -const wstring RedStoneDustTile::TEXTURE_LINE_OVERLAY = L"redstoneDust_line_overlay"; +const std::wstring RedStoneDustTile::TEXTURE_CROSS = L"redstoneDust_cross"; +const std::wstring RedStoneDustTile::TEXTURE_LINE = L"redstoneDust_line"; +const std::wstring RedStoneDustTile::TEXTURE_CROSS_OVERLAY = L"redstoneDust_cross_overlay"; +const std::wstring RedStoneDustTile::TEXTURE_LINE_OVERLAY = L"redstoneDust_line_overlay"; RedStoneDustTile::RedStoneDustTile(int id) : Tile(id, Material::decoration,isSolidRender()) { @@ -415,7 +415,7 @@ void RedStoneDustTile::registerIcons(IconRegister *iconRegister) icon = iconCross; } -Icon *RedStoneDustTile::getTexture(const wstring &name) +Icon *RedStoneDustTile::getTexture(const std::wstring &name) { #ifdef __PSVITA__ // AP - alpha cut out is expensive on vita. Set the Alpha Cut out flag diff --git a/Minecraft.World/Blocks/RedStoneDustTile.h b/Minecraft.World/Blocks/RedStoneDustTile.h index 5c262f988..12a1bca64 100644 --- a/Minecraft.World/Blocks/RedStoneDustTile.h +++ b/Minecraft.World/Blocks/RedStoneDustTile.h @@ -11,10 +11,10 @@ class RedStoneDustTile : public Tile { friend ChunkRebuildData; public: - static const wstring TEXTURE_CROSS; - static const wstring TEXTURE_LINE; - static const wstring TEXTURE_CROSS_OVERLAY; - static const wstring TEXTURE_LINE_OVERLAY; + static const std::wstring TEXTURE_CROSS; + static const std::wstring TEXTURE_LINE; + static const std::wstring TEXTURE_CROSS_OVERLAY; + static const std::wstring TEXTURE_LINE_OVERLAY; private: bool shouldSignal; unordered_set toUpdate; @@ -57,5 +57,5 @@ public: virtual int cloneTileId(Level *level, int x, int y, int z); void registerIcons(IconRegister *iconRegister); - static Icon *getTexture(const wstring &name); + static Icon *getTexture(const std::wstring &name); }; diff --git a/Minecraft.World/Blocks/SandStoneTile.cpp b/Minecraft.World/Blocks/SandStoneTile.cpp index 5ff288fa1..c4436d32d 100644 --- a/Minecraft.World/Blocks/SandStoneTile.cpp +++ b/Minecraft.World/Blocks/SandStoneTile.cpp @@ -4,9 +4,9 @@ #include "../Headers/net.minecraft.world.h" #include "SandStoneTile.h" -const wstring SandStoneTile::TEXTURE_TOP = L"sandstone_top"; -const wstring SandStoneTile::TEXTURE_BOTTOM = L"sandstone_bottom"; -const wstring SandStoneTile::TEXTURE_NAMES[] = {L"sandstone_side", L"sandstone_carved", L"sandstone_smooth"}; +const std::wstring SandStoneTile::TEXTURE_TOP = L"sandstone_top"; +const std::wstring SandStoneTile::TEXTURE_BOTTOM = L"sandstone_bottom"; +const std::wstring SandStoneTile::TEXTURE_NAMES[] = {L"sandstone_side", L"sandstone_carved", L"sandstone_smooth"}; int SandStoneTile::SANDSTONE_NAMES[SANDSTONE_BLOCK_NAMES] = { IDS_TILE_SANDSTONE, IDS_TILE_SANDSTONE_CHISELED, IDS_TILE_SANDSTONE_SMOOTH diff --git a/Minecraft.World/Blocks/SandStoneTile.h b/Minecraft.World/Blocks/SandStoneTile.h index ac6f9ff78..247d15339 100644 --- a/Minecraft.World/Blocks/SandStoneTile.h +++ b/Minecraft.World/Blocks/SandStoneTile.h @@ -20,9 +20,9 @@ public: static int SANDSTONE_NAMES[SANDSTONE_BLOCK_NAMES]; private: - static const wstring TEXTURE_TOP; - static const wstring TEXTURE_BOTTOM; - static const wstring TEXTURE_NAMES[]; + static const std::wstring TEXTURE_TOP; + static const std::wstring TEXTURE_BOTTOM; + static const std::wstring TEXTURE_NAMES[]; static const int SANDSTONE_TILE_TEXTURE_COUNT = 3; Icon **icons; diff --git a/Minecraft.World/Blocks/SaplingPlantTile.cpp b/Minecraft.World/Blocks/SaplingPlantTile.cpp index 13e348201..16ed8c322 100644 --- a/Minecraft.World/Blocks/SaplingPlantTile.cpp +++ b/Minecraft.World/Blocks/SaplingPlantTile.cpp @@ -12,7 +12,7 @@ const unsigned int Sapling::SAPLING_NAMES[SAPLING_NAMES_SIZE] = { IDS_TILE_SAPLI IDS_TILE_SAPLING_JUNGLE }; -const wstring Sapling::TEXTURE_NAMES[] = {L"sapling", L"sapling_spruce", L"sapling_birch", L"sapling_jungle"}; +const std::wstring Sapling::TEXTURE_NAMES[] = {L"sapling", L"sapling_spruce", L"sapling_birch", L"sapling_jungle"}; Sapling::Sapling(int id) : Bush( id ) { diff --git a/Minecraft.World/Blocks/SaplingPlantTile.h b/Minecraft.World/Blocks/SaplingPlantTile.h index 1d3e267b3..3996b6be9 100644 --- a/Minecraft.World/Blocks/SaplingPlantTile.h +++ b/Minecraft.World/Blocks/SaplingPlantTile.h @@ -21,7 +21,7 @@ public: static const unsigned int SAPLING_NAMES[SAPLING_NAMES_SIZE]; private: - static const wstring TEXTURE_NAMES[]; + static const std::wstring TEXTURE_NAMES[]; Icon **icons; diff --git a/Minecraft.World/Blocks/SkullTile.cpp b/Minecraft.World/Blocks/SkullTile.cpp index 59c6f9c0f..0f0a7e03a 100644 --- a/Minecraft.World/Blocks/SkullTile.cpp +++ b/Minecraft.World/Blocks/SkullTile.cpp @@ -263,7 +263,7 @@ Icon *SkullTile::getTexture(int face, int data) return Tile::hellSand->getTexture(face); } -wstring SkullTile::getTileItemIconName() +std::wstring SkullTile::getTileItemIconName() { return L""; //return SkullItem::ICON_NAMES[0]; diff --git a/Minecraft.World/Blocks/SkullTile.h b/Minecraft.World/Blocks/SkullTile.h index eef309a0c..3a2ece7b6 100644 --- a/Minecraft.World/Blocks/SkullTile.h +++ b/Minecraft.World/Blocks/SkullTile.h @@ -40,5 +40,5 @@ private: public: void registerIcons(IconRegister *iconRegister); Icon *getTexture(int face, int data); - wstring getTileItemIconName(); + std::wstring getTileItemIconName(); }; diff --git a/Minecraft.World/Blocks/SmoothStoneBrickTile.cpp b/Minecraft.World/Blocks/SmoothStoneBrickTile.cpp index ae12b20fb..068e7b99f 100644 --- a/Minecraft.World/Blocks/SmoothStoneBrickTile.cpp +++ b/Minecraft.World/Blocks/SmoothStoneBrickTile.cpp @@ -2,7 +2,7 @@ #include "SmoothStoneBrickTile.h" #include "../Headers/net.minecraft.world.h" -const wstring SmoothStoneBrickTile::TEXTURE_NAMES[] = {L"stonebricksmooth", L"stonebricksmooth_mossy", L"stonebricksmooth_cracked", L"stonebricksmooth_carved"}; +const std::wstring SmoothStoneBrickTile::TEXTURE_NAMES[] = {L"stonebricksmooth", L"stonebricksmooth_mossy", L"stonebricksmooth_cracked", L"stonebricksmooth_carved"}; const unsigned int SmoothStoneBrickTile::SMOOTH_STONE_BRICK_NAMES[SMOOTH_STONE_BRICK_NAMES_LENGTH] = { IDS_TILE_STONE_BRICK_SMOOTH, IDS_TILE_STONE_BRICK_SMOOTH_MOSSY, diff --git a/Minecraft.World/Blocks/SmoothStoneBrickTile.h b/Minecraft.World/Blocks/SmoothStoneBrickTile.h index 1464c6daf..915e74b35 100644 --- a/Minecraft.World/Blocks/SmoothStoneBrickTile.h +++ b/Minecraft.World/Blocks/SmoothStoneBrickTile.h @@ -11,7 +11,7 @@ public: static const int TYPE_CRACKED = 2; static const int TYPE_DETAIL = 3; - static const wstring TEXTURE_NAMES[]; + static const std::wstring TEXTURE_NAMES[]; static const int SMOOTH_STONE_BRICK_NAMES_LENGTH = 4; diff --git a/Minecraft.World/Blocks/StemTile.cpp b/Minecraft.World/Blocks/StemTile.cpp index 9d3544e82..5f83ab3d7 100644 --- a/Minecraft.World/Blocks/StemTile.cpp +++ b/Minecraft.World/Blocks/StemTile.cpp @@ -7,7 +7,7 @@ #include "../../Minecraft.Client/Build/Common/Colours/ColourTable.h" #include "StemTile.h" -const wstring StemTile::TEXTURE_ANGLED = L"stem_bent"; +const std::wstring StemTile::TEXTURE_ANGLED = L"stem_bent"; StemTile::StemTile(int id, Tile *fruit) : Bush(id) { diff --git a/Minecraft.World/Blocks/StemTile.h b/Minecraft.World/Blocks/StemTile.h index c4b4f87a4..bc2b34894 100644 --- a/Minecraft.World/Blocks/StemTile.h +++ b/Minecraft.World/Blocks/StemTile.h @@ -7,7 +7,7 @@ class StemTile : public Bush { friend class ChunkRebuildData; public: - static const wstring TEXTURE_ANGLED; + static const std::wstring TEXTURE_ANGLED; private: Tile *fruit; diff --git a/Minecraft.World/Blocks/TallGrassPlantTile.cpp b/Minecraft.World/Blocks/TallGrassPlantTile.cpp index daf5efac6..01f2a8033 100644 --- a/Minecraft.World/Blocks/TallGrassPlantTile.cpp +++ b/Minecraft.World/Blocks/TallGrassPlantTile.cpp @@ -12,7 +12,7 @@ const unsigned int TallGrass::TALL_GRASS_TILE_NAMES[TALL_GRASS_TILE_NAMES_LENGTH IDS_TILE_FERN, }; -const wstring TallGrass::TEXTURE_NAMES[] = {L"deadbush", L"tallgrass", L"fern"}; +const std::wstring TallGrass::TEXTURE_NAMES[] = {L"deadbush", L"tallgrass", L"fern"}; TallGrass::TallGrass(int id) : Bush(id, Material::replaceable_plant) { diff --git a/Minecraft.World/Blocks/TallGrassPlantTile.h b/Minecraft.World/Blocks/TallGrassPlantTile.h index 3af76cabc..786132a45 100644 --- a/Minecraft.World/Blocks/TallGrassPlantTile.h +++ b/Minecraft.World/Blocks/TallGrassPlantTile.h @@ -17,7 +17,7 @@ public: static const unsigned int TALL_GRASS_TILE_NAMES[TALL_GRASS_TILE_NAMES_LENGTH]; private: - static const wstring TEXTURE_NAMES[]; + static const std::wstring TEXTURE_NAMES[]; Icon **icons; protected: diff --git a/Minecraft.World/Blocks/TheEndPortalFrameTile.cpp b/Minecraft.World/Blocks/TheEndPortalFrameTile.cpp index 5a266f11f..86ccd7130 100644 --- a/Minecraft.World/Blocks/TheEndPortalFrameTile.cpp +++ b/Minecraft.World/Blocks/TheEndPortalFrameTile.cpp @@ -4,7 +4,7 @@ #include "../Headers/net.minecraft.world.h" #include "../Util/Facing.h" -const wstring TheEndPortalFrameTile::TEXTURE_EYE = L"endframe_eye"; +const std::wstring TheEndPortalFrameTile::TEXTURE_EYE = L"endframe_eye"; TheEndPortalFrameTile::TheEndPortalFrameTile(int id) : Tile(id, Material::glass, isSolidRender() ) { diff --git a/Minecraft.World/Blocks/TheEndPortalFrameTile.h b/Minecraft.World/Blocks/TheEndPortalFrameTile.h index bedad14d5..ab3180ef3 100644 --- a/Minecraft.World/Blocks/TheEndPortalFrameTile.h +++ b/Minecraft.World/Blocks/TheEndPortalFrameTile.h @@ -5,7 +5,7 @@ class TheEndPortalFrameTile : public Tile { public: static const int EYE_BIT = 4; - static const wstring TEXTURE_EYE; + static const std::wstring TEXTURE_EYE; private: Icon *iconTop; diff --git a/Minecraft.World/Blocks/ThinFenceTile.cpp b/Minecraft.World/Blocks/ThinFenceTile.cpp index 697338e2d..deb687c01 100644 --- a/Minecraft.World/Blocks/ThinFenceTile.cpp +++ b/Minecraft.World/Blocks/ThinFenceTile.cpp @@ -3,7 +3,7 @@ #include "../Headers/net.minecraft.world.level.h" #include "../Headers/net.minecraft.world.h" -ThinFenceTile::ThinFenceTile(int id, const wstring &tex, const wstring &edgeTex, Material *material, bool dropsResources) : Tile(id, material,isSolidRender()) +ThinFenceTile::ThinFenceTile(int id, const std::wstring &tex, const std::wstring &edgeTex, Material *material, bool dropsResources) : Tile(id, material,isSolidRender()) { iconSide = NULL; edgeTexture = edgeTex; diff --git a/Minecraft.World/Blocks/ThinFenceTile.h b/Minecraft.World/Blocks/ThinFenceTile.h index 0f1c3bfa1..7c39cabff 100644 --- a/Minecraft.World/Blocks/ThinFenceTile.h +++ b/Minecraft.World/Blocks/ThinFenceTile.h @@ -5,13 +5,13 @@ class ThinFenceTile : public Tile { private: - wstring edgeTexture; + std::wstring edgeTexture; bool dropsResources; - wstring texture; + std::wstring texture; Icon *iconSide; public: - ThinFenceTile(int id, const wstring &tex, const wstring &edgeTex, Material *material, bool dropsResources); + ThinFenceTile(int id, const std::wstring &tex, const std::wstring &edgeTex, Material *material, bool dropsResources); virtual int getResource(int data, Random *random, int playerBonusLevel); virtual bool isSolidRender(bool isServerLevel = false); virtual bool isCubeShaped(); diff --git a/Minecraft.World/Blocks/Tile.cpp b/Minecraft.World/Blocks/Tile.cpp index e80d0637c..60d6fb77f 100644 --- a/Minecraft.World/Blocks/Tile.cpp +++ b/Minecraft.World/Blocks/Tile.cpp @@ -16,7 +16,7 @@ #include "../Headers/net.minecraft.h" #include "Tile.h" -wstring Tile::TILE_DESCRIPTION_PREFIX = L"Tile."; +std::wstring Tile::TILE_DESCRIPTION_PREFIX = L"Tile."; const float Tile::INDESTRUCTIBLE_DESTROY_TIME = -1.0f; @@ -1260,7 +1260,7 @@ Tile *Tile::setDescriptionId(unsigned int id) return this; } -wstring Tile::getName() +std::wstring Tile::getName() { return L"";//I18n::get(getDescriptionId() + L".name"); } @@ -1342,12 +1342,12 @@ void Tile::registerIcons(IconRegister *iconRegister) icon = iconRegister->registerIcon(m_textureName); } -wstring Tile::getTileItemIconName() +std::wstring Tile::getTileItemIconName() { return L""; } -Tile *Tile::setTextureName(const wstring &name) +Tile *Tile::setTextureName(const std::wstring &name) { m_textureName = name; return this; @@ -1461,8 +1461,8 @@ float Tile::SoundType::getPitch() const { return pitch; } -//wstring getBreakSound() const { return breakSound; } -//wstring getStepSound() const { return stepSound; } +//std::wstring getBreakSound() const { return breakSound; } +//std::wstring getStepSound() const { return stepSound; } int Tile::SoundType::getBreakSound() const { return iBreakSound; diff --git a/Minecraft.World/Blocks/Tile.h b/Minecraft.World/Blocks/Tile.h index 7d93d6bbb..08a1f6b61 100644 --- a/Minecraft.World/Blocks/Tile.h +++ b/Minecraft.World/Blocks/Tile.h @@ -69,7 +69,7 @@ public: private: // 4J Stu - Was const but had to change it so that we can initialise it in TileStaticInit - static wstring TILE_DESCRIPTION_PREFIX; + static std::wstring TILE_DESCRIPTION_PREFIX; protected: static const float INDESTRUCTIBLE_DESTROY_TIME; @@ -78,9 +78,9 @@ public: class SoundType { public: -// wstring name; -// wstring breakSound; -// wstring stepSound; +// std::wstring name; +// std::wstring breakSound; +// std::wstring stepSound; eMATERIALSOUND_TYPE eMaterialSound; int iBreakSound,iStepSound,iPlaceSound; float volume; @@ -90,8 +90,8 @@ public: float getVolume() const; float getPitch() const; - //wstring getBreakSound() const { return breakSound; } - //wstring getStepSound() const { return stepSound; } + //std::wstring getBreakSound() const { return breakSound; } + //std::wstring getStepSound() const { return stepSound; } int getBreakSound() const; int getStepSound() const; int getPlaceSound() const; @@ -498,7 +498,7 @@ private: unsigned int descriptionId; unsigned int useDescriptionId; // 4J Added - wstring m_textureName; + std::wstring m_textureName; protected: Icon *icon; @@ -615,7 +615,7 @@ public: virtual void setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by); virtual void finalizePlacement(Level *level, int x, int y, int z, int data); virtual Tile *setDescriptionId(unsigned int id); - virtual wstring getName(); + virtual std::wstring getName(); virtual unsigned int getDescriptionId(int iData = -1); virtual Tile *setUseDescriptionId(unsigned int id); // 4J Added virtual unsigned int getUseDescriptionId(); // 4J Added @@ -638,9 +638,9 @@ public: virtual void handleRain(Level *level, int x, int y, int z); virtual void levelTimeChanged(Level *level, __int64 delta, __int64 newTime); virtual void registerIcons(IconRegister *iconRegister); - virtual wstring getTileItemIconName(); + virtual std::wstring getTileItemIconName(); // 4J Using per-item textures now - Tile *setTextureName(const wstring &name); + Tile *setTextureName(const std::wstring &name); // AP - added this function so we can generate the faceFlags for a block in a single fast function int getFaceFlags(LevelSource *level, int x, int y, int z); }; diff --git a/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.cpp index 9142bebf8..33c173dc5 100644 --- a/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.cpp @@ -35,12 +35,12 @@ MobSpawnerTileEntity::MobSpawnerTileEntity() : TileEntity() displayEntity = nullptr; } -wstring MobSpawnerTileEntity::getEntityId() +std::wstring MobSpawnerTileEntity::getEntityId() { return entityId; } -void MobSpawnerTileEntity::setEntityId(const wstring& entityId) +void MobSpawnerTileEntity::setEntityId(const std::wstring& entityId) { this->entityId = entityId; } diff --git a/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.h b/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.h index 61c69d3ef..88aae9314 100644 --- a/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/MobSpawnerTileEntity.h @@ -21,7 +21,7 @@ public: int spawnDelay; private: - wstring entityId; + std::wstring entityId; CompoundTag *spawnData; bool m_bEntityIdUpdated; // 4J Added @@ -38,8 +38,8 @@ private: public: MobSpawnerTileEntity(); - wstring getEntityId(); - void setEntityId(const wstring& entityId); + std::wstring getEntityId(); + void setEntityId(const std::wstring& entityId); bool isNearPlayer(); virtual void tick(); void fillExtraData(std::shared_ptr entity); diff --git a/Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp b/Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp index b72ee7fb1..6103a6ada 100644 --- a/Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp +++ b/Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp @@ -65,34 +65,34 @@ const int PotionBrewing::DEFAULT_APPEARANCES[] = * Therefore if bit 13 is on, don't use netherwart! * Added "&!13" which requires that bit 13 be turned off. */ -const wstring PotionBrewing::MOD_NETHERWART = L"+4&!13"; // L"+4" +const std::wstring PotionBrewing::MOD_NETHERWART = L"+4&!13"; // L"+4" #if _SIMPLIFIED_BREWING -const wstring PotionBrewing::MOD_WATER = L""; -const wstring PotionBrewing::MOD_SUGAR = L"-0+1-2-3&4-4+13"; -const wstring PotionBrewing::MOD_GHASTTEARS = L"+0-1-2-3&4-4+13"; -const wstring PotionBrewing::MOD_SPIDEREYE = L"-0-1+2-3&4-4+13"; -const wstring PotionBrewing::MOD_FERMENTEDEYE = L"-0+3-4+13"; -const wstring PotionBrewing::MOD_SPECKLEDMELON = L"+0-1+2-3&4-4+13"; -const wstring PotionBrewing::MOD_BLAZEPOWDER = L"+0-1-2+3&4-4+13"; -const wstring PotionBrewing::MOD_GOLDENCARROT = L"-0+1+2-3+13&4-4"; -const wstring PotionBrewing::MOD_MAGMACREAM = L"+0+1-2-3&4-4+13"; -const wstring PotionBrewing::MOD_REDSTONE = L"-5+6-7"; // redstone increases duration -const wstring PotionBrewing::MOD_GLOWSTONE = L"+5-6-7"; // glowstone increases amplification +const std::wstring PotionBrewing::MOD_WATER = L""; +const std::wstring PotionBrewing::MOD_SUGAR = L"-0+1-2-3&4-4+13"; +const std::wstring PotionBrewing::MOD_GHASTTEARS = L"+0-1-2-3&4-4+13"; +const std::wstring PotionBrewing::MOD_SPIDEREYE = L"-0-1+2-3&4-4+13"; +const std::wstring PotionBrewing::MOD_FERMENTEDEYE = L"-0+3-4+13"; +const std::wstring PotionBrewing::MOD_SPECKLEDMELON = L"+0-1+2-3&4-4+13"; +const std::wstring PotionBrewing::MOD_BLAZEPOWDER = L"+0-1-2+3&4-4+13"; +const std::wstring PotionBrewing::MOD_GOLDENCARROT = L"-0+1+2-3+13&4-4"; +const std::wstring PotionBrewing::MOD_MAGMACREAM = L"+0+1-2-3&4-4+13"; +const std::wstring PotionBrewing::MOD_REDSTONE = L"-5+6-7"; // redstone increases duration +const std::wstring PotionBrewing::MOD_GLOWSTONE = L"+5-6-7"; // glowstone increases amplification // 4J Stu - Don't require bit 13 to be set. We don't use it in the creative menu. Side effect is you can make a (virtually useless) Splash Mundane potion with water bottle and gunpowder -const wstring PotionBrewing::MOD_GUNPOWDER = L"+14";//&13-13"; // gunpowder makes them throwable! // gunpowder requires 13 and sets 14 +const std::wstring PotionBrewing::MOD_GUNPOWDER = L"+14";//&13-13"; // gunpowder makes them throwable! // gunpowder requires 13 and sets 14 #else -const wstring PotionBrewing::MOD_WATER = L"-1-3-5-7-9-11-13"; -const wstring PotionBrewing::MOD_SUGAR = L"+0"; -const wstring PotionBrewing::MOD_GHASTTEARS = L"+11"; -const wstring PotionBrewing::MOD_SPIDEREYE = L"+10+7+5"; -const wstring PotionBrewing::MOD_FERMENTEDEYE = L"+14+9"; -const wstring PotionBrewing::MOD_SPECKLEDMELON = L""; -const wstring PotionBrewing::MOD_BLAZEPOWDER = L"+14"; -const wstring PotionBrewing::MOD_MAGMACREAM = L"+14+6+1"; -const wstring PotionBrewing::MOD_REDSTONE = L""; // redstone increases duration -const wstring PotionBrewing::MOD_GLOWSTONE = L""; // glowstone increases amplification -const wstring PotionBrewing::MOD_GUNPOWDER = L""; // gunpowder makes them throwable! // gunpowder requires 13 and sets 14 +const std::wstring PotionBrewing::MOD_WATER = L"-1-3-5-7-9-11-13"; +const std::wstring PotionBrewing::MOD_SUGAR = L"+0"; +const std::wstring PotionBrewing::MOD_GHASTTEARS = L"+11"; +const std::wstring PotionBrewing::MOD_SPIDEREYE = L"+10+7+5"; +const std::wstring PotionBrewing::MOD_FERMENTEDEYE = L"+14+9"; +const std::wstring PotionBrewing::MOD_SPECKLEDMELON = L""; +const std::wstring PotionBrewing::MOD_BLAZEPOWDER = L"+14"; +const std::wstring PotionBrewing::MOD_MAGMACREAM = L"+14+6+1"; +const std::wstring PotionBrewing::MOD_REDSTONE = L""; // redstone increases duration +const std::wstring PotionBrewing::MOD_GLOWSTONE = L""; // glowstone increases amplification +const std::wstring PotionBrewing::MOD_GUNPOWDER = L""; // gunpowder makes them throwable! // gunpowder requires 13 and sets 14 #endif PotionBrewing::intStringMap PotionBrewing::potionEffectDuration; @@ -309,7 +309,7 @@ int PotionBrewing::countOnes(int brew) #if _SIMPLIFIED_BREWING // 4J Stu - Trimmed this function to remove all the unused features for simplified brewing -int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start, int end, int brew) +int PotionBrewing::parseEffectFormulaValue(const std::wstring &definition, int start, int end, int brew) { if (start >= definition.length() || end < 0 || start >= end) { @@ -397,7 +397,7 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start, return result; } #else -int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start, int end, int brew) +int PotionBrewing::parseEffectFormulaValue(const std::wstring &definition, int start, int end, int brew) { if (start >= definition.length() || end < 0 || start >= end) { @@ -554,13 +554,13 @@ vector *PotionBrewing::getEffects(int brew, bool includeDis { continue; } - //wstring durationString = potionEffectDuration.get(effect->getId()); + //std::wstring durationString = potionEffectDuration.get(effect->getId()); AUTO_VAR(effIt, potionEffectDuration.find(effect->getId())); if ( effIt == potionEffectDuration.end() ) { continue; } - wstring durationString = effIt->second; + std::wstring durationString = effIt->second; int duration = parseEffectFormulaValue(durationString, 0, (int)durationString.length(), brew); if (duration > 0) @@ -569,7 +569,7 @@ vector *PotionBrewing::getEffects(int brew, bool includeDis AUTO_VAR(ampIt, potionEffectAmplifier.find(effect->getId())); if (ampIt != potionEffectAmplifier.end()) { - wstring amplifierString = ampIt->second; + std::wstring amplifierString = ampIt->second; amplifier = parseEffectFormulaValue(amplifierString, 0, (int)amplifierString.length(), brew); if (amplifier < 0) { @@ -742,7 +742,7 @@ int PotionBrewing::applyBrewBit(int currentBrew, int bit, bool isNeg, bool isNot return currentBrew; } -int PotionBrewing::applyBrew(int currentBrew, const wstring &formula) +int PotionBrewing::applyBrew(int currentBrew, const std::wstring &formula) { int start = 0; @@ -831,9 +831,9 @@ int PotionBrewing::valueOf(int brew, int p1, int p2, int p3, int p4, int p5) return (isLit(brew, p1) ? 0x10 : 0) | (isLit(brew, p2) ? 0x08 : 0) | (isLit(brew, p3) ? 0x04 : 0) | (isLit(brew, p4) ? 0x02 : 0) | (isLit(brew, p5) ? 0x01 : 0); } -wstring PotionBrewing::toString(int brew) +std::wstring PotionBrewing::toString(int brew) { - wstring string; + std::wstring string; int bit = NUM_BITS - 1; while (bit >= 0) diff --git a/Minecraft.World/Blocks/TileEntities/PotionBrewing.h b/Minecraft.World/Blocks/TileEntities/PotionBrewing.h index 6f0197e6b..e06742ff1 100644 --- a/Minecraft.World/Blocks/TileEntities/PotionBrewing.h +++ b/Minecraft.World/Blocks/TileEntities/PotionBrewing.h @@ -14,22 +14,22 @@ public: static const int THROWABLE_BIT = 14; static const int THROWABLE_MASK = (1 << THROWABLE_BIT); - static const wstring MOD_WATER; - static const wstring MOD_SUGAR; - static const wstring MOD_GHASTTEARS; - static const wstring MOD_SPIDEREYE; - static const wstring MOD_FERMENTEDEYE; - static const wstring MOD_SPECKLEDMELON; - static const wstring MOD_BLAZEPOWDER; - static const wstring MOD_MAGMACREAM; - static const wstring MOD_REDSTONE; - static const wstring MOD_GLOWSTONE; - static const wstring MOD_NETHERWART; - static const wstring MOD_GUNPOWDER; - static const wstring MOD_GOLDENCARROT; + static const std::wstring MOD_WATER; + static const std::wstring MOD_SUGAR; + static const std::wstring MOD_GHASTTEARS; + static const std::wstring MOD_SPIDEREYE; + static const std::wstring MOD_FERMENTEDEYE; + static const std::wstring MOD_SPECKLEDMELON; + static const std::wstring MOD_BLAZEPOWDER; + static const std::wstring MOD_MAGMACREAM; + static const std::wstring MOD_REDSTONE; + static const std::wstring MOD_GLOWSTONE; + static const std::wstring MOD_NETHERWART; + static const std::wstring MOD_GUNPOWDER; + static const std::wstring MOD_GOLDENCARROT; private: - typedef std::unordered_map intStringMap; + typedef std::unordered_map intStringMap; static intStringMap potionEffectDuration; static intStringMap potionEffectAmplifier; @@ -77,7 +77,7 @@ private: static int constructParsedValue(bool isNot, bool hasMultiplier, bool isNeg, int countCompare, int valuePart, int multiplierPart, int brew); static int countOnes(int brew); - static int parseEffectFormulaValue(const wstring &definition, int start, int end, int brew); + static int parseEffectFormulaValue(const std::wstring &definition, int start, int end, int brew); public: static vector *getEffects(int brew, bool includeDisabledEffects); @@ -92,10 +92,10 @@ private: static int applyBrewBit(int currentBrew, int bit, bool isNeg, bool isNot, bool isRequired); public: - static int applyBrew(int currentBrew, const wstring &formula); + static int applyBrew(int currentBrew, const std::wstring &formula); static int setBit(int brew, int position, bool onOff); static int valueOf(int brew, int p1, int p2, int p3, int p4); static int valueOf(int brew, int p1, int p2, int p3, int p4, int p5); - static wstring toString(int brew); + static std::wstring toString(int brew); //static void main(String[] args); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp index f8ae04c9a..a62b298ca 100644 --- a/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp @@ -86,7 +86,7 @@ void SignTileEntity::load(CompoundTag *tag) std::shared_ptr SignTileEntity::getUpdatePacket() { - wstring copy[MAX_SIGN_LINES]; + std::wstring copy[MAX_SIGN_LINES]; for (int i = 0; i < MAX_SIGN_LINES; i++) { copy[i] = m_wsmessages[i]; @@ -149,7 +149,7 @@ void SignTileEntity::setChanged() } -void SignTileEntity::SetMessage(int iIndex,wstring &wsText) +void SignTileEntity::SetMessage(int iIndex,std::wstring &wsText) { m_wsmessages[iIndex]=wsText; diff --git a/Minecraft.World/Blocks/TileEntities/SignTileEntity.h b/Minecraft.World/Blocks/TileEntities/SignTileEntity.h index 8713c6272..6329c6eca 100644 --- a/Minecraft.World/Blocks/TileEntities/SignTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/SignTileEntity.h @@ -16,9 +16,9 @@ public: public: SignTileEntity(); virtual ~SignTileEntity(); - wstring GetMessage(int i) { return m_wsmessages[i];} - wstring *GetMessages() { return m_wsmessages;} - void SetMessage(int iIndex,wstring &wsText); + std::wstring GetMessage(int i) { return m_wsmessages[i];} + std::wstring *GetMessages() { return m_wsmessages;} + void SetMessage(int iIndex,std::wstring &wsText); int GetSelectedLine() {return m_iSelectedLine;} void SetSelectedLine(int iLine) {m_iSelectedLine=iLine;} bool IsVerified() {return m_bVerified;} @@ -33,7 +33,7 @@ private: bool m_bCensored; int m_iSelectedLine; - wstring m_wsmessages[MAX_SIGN_LINES]; + std::wstring m_wsmessages[MAX_SIGN_LINES]; public: virtual void save(CompoundTag *tag); diff --git a/Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp index 7c7550a84..abe43de6c 100644 --- a/Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp @@ -33,7 +33,7 @@ std::shared_ptr SkullTileEntity::getUpdatePacket() return std::shared_ptr(new TileEntityDataPacket(x, y, z, TileEntityDataPacket::TYPE_SKULL, tag)); } -void SkullTileEntity::setSkullType(int skullType, const wstring &extra) +void SkullTileEntity::setSkullType(int skullType, const std::wstring &extra) { this->skullType = skullType; this->extraType = extra; @@ -54,7 +54,7 @@ void SkullTileEntity::setRotation(int rot) rotation = rot; } -wstring SkullTileEntity::getExtraType() +std::wstring SkullTileEntity::getExtraType() { return extraType; } diff --git a/Minecraft.World/Blocks/TileEntities/SkullTileEntity.h b/Minecraft.World/Blocks/TileEntities/SkullTileEntity.h index db1580fa0..51b9d5e77 100644 --- a/Minecraft.World/Blocks/TileEntities/SkullTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/SkullTileEntity.h @@ -17,7 +17,7 @@ public: private: int skullType; int rotation; - wstring extraType; + std::wstring extraType; public: SkullTileEntity(); @@ -25,11 +25,11 @@ public: void save(CompoundTag *tag); void load(CompoundTag *tag); std::shared_ptr getUpdatePacket(); - void setSkullType(int skullType, const wstring &extra); + void setSkullType(int skullType, const std::wstring &extra); int getSkullType(); int getRotation(); void setRotation(int rot); - wstring getExtraType(); + std::wstring getExtraType(); // 4J Added virtual std::shared_ptr clone(); diff --git a/Minecraft.World/Blocks/TileEntities/TileEntity.cpp b/Minecraft.World/Blocks/TileEntities/TileEntity.cpp index 7e01678c4..a47215476 100644 --- a/Minecraft.World/Blocks/TileEntities/TileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/TileEntity.cpp @@ -8,8 +8,8 @@ -TileEntity::idToCreateMapType TileEntity::idCreateMap = std::unordered_map(); -TileEntity::classToIdMapType TileEntity::classIdMap = std::unordered_map(); +TileEntity::idToCreateMapType TileEntity::idCreateMap = std::unordered_map(); +TileEntity::classToIdMapType TileEntity::classIdMap = std::unordered_map(); void TileEntity::staticCtor() { @@ -28,7 +28,7 @@ void TileEntity::staticCtor() TileEntity::setId(SkullTileEntity::create,eTYPE_SKULLTILEENTITY, L"Skull"); } -void TileEntity::setId(tileEntityCreateFn createFn, eINSTANCEOF clas, wstring id) +void TileEntity::setId(tileEntityCreateFn createFn, eINSTANCEOF clas, std::wstring id) { // 4J Stu - Java has classIdMap.containsKey(id) which would never work as id is not of the type of the key in classIdMap // I have changed to use idClassMap instead so that we can still search from the string key diff --git a/Minecraft.World/Blocks/TileEntities/TileEntity.h b/Minecraft.World/Blocks/TileEntities/TileEntity.h index 4833f2910..65544407e 100644 --- a/Minecraft.World/Blocks/TileEntities/TileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/TileEntity.h @@ -16,11 +16,11 @@ public: static void staticCtor(); virtual eINSTANCEOF GetType() { return eTYPE_TILEENTITY; } private: - typedef std::unordered_map idToCreateMapType; - typedef std::unordered_map classToIdMapType; + typedef std::unordered_map idToCreateMapType; + typedef std::unordered_map classToIdMapType; static idToCreateMapType idCreateMap; static classToIdMapType classIdMap; - static void setId(tileEntityCreateFn createFn, eINSTANCEOF clas, wstring id); + static void setId(tileEntityCreateFn createFn, eINSTANCEOF clas, std::wstring id); bool remove; unsigned char renderRemoveStage; // 4J added diff --git a/Minecraft.World/Blocks/TreeTile.cpp b/Minecraft.World/Blocks/TreeTile.cpp index 935520686..682fcd974 100644 --- a/Minecraft.World/Blocks/TreeTile.cpp +++ b/Minecraft.World/Blocks/TreeTile.cpp @@ -13,7 +13,7 @@ const unsigned int TreeTile::TREE_NAMES[TREE_NAMES_LENGTH] = { IDS_TILE_LOG_OAK, IDS_TILE_LOG_JUNGLE }; -const wstring TreeTile::TREE_TEXTURES[] = {L"tree_side", L"tree_spruce", L"tree_birch", L"tree_jungle"}; +const std::wstring TreeTile::TREE_TEXTURES[] = {L"tree_side", L"tree_spruce", L"tree_birch", L"tree_jungle"}; TreeTile::TreeTile(int id) : Tile(id, Material::wood) { diff --git a/Minecraft.World/Blocks/TreeTile.h b/Minecraft.World/Blocks/TreeTile.h index a245064f1..295f3f82c 100644 --- a/Minecraft.World/Blocks/TreeTile.h +++ b/Minecraft.World/Blocks/TreeTile.h @@ -25,7 +25,7 @@ public: static const unsigned int TREE_NAMES[TREE_NAMES_LENGTH]; - static const wstring TREE_TEXTURES[]; + static const std::wstring TREE_TEXTURES[]; private: Icon **icons; diff --git a/Minecraft.World/Blocks/WoodTile.cpp b/Minecraft.World/Blocks/WoodTile.cpp index c333c258f..b875741ba 100644 --- a/Minecraft.World/Blocks/WoodTile.cpp +++ b/Minecraft.World/Blocks/WoodTile.cpp @@ -13,7 +13,7 @@ const unsigned int WoodTile::WOOD_NAMES[WOOD_NAMES_LENGTH] = { IDS_TILE_OAKWOOD_ IDS_TILE_JUNGLE_PLANKS, }; -const wstring WoodTile::TEXTURE_NAMES[] = {L"wood", L"wood_spruce", L"wood_birch", L"wood_jungle"}; +const std::wstring WoodTile::TEXTURE_NAMES[] = {L"wood", L"wood_spruce", L"wood_birch", L"wood_jungle"}; // public static final String[] WOOD_NAMES = { // "oak", "spruce", "birch", "jungle" diff --git a/Minecraft.World/Blocks/WoodTile.h b/Minecraft.World/Blocks/WoodTile.h index 23bbdfb17..a380d934d 100644 --- a/Minecraft.World/Blocks/WoodTile.h +++ b/Minecraft.World/Blocks/WoodTile.h @@ -11,7 +11,7 @@ public: static const unsigned int WOOD_NAMES[WOOD_NAMES_LENGTH]; - static const wstring TEXTURE_NAMES[]; + static const std::wstring TEXTURE_NAMES[]; private: Icon **icons; diff --git a/Minecraft.World/Commands/AdminLogCommand.h b/Minecraft.World/Commands/AdminLogCommand.h index 0c80e1b0f..f3d4a483b 100644 --- a/Minecraft.World/Commands/AdminLogCommand.h +++ b/Minecraft.World/Commands/AdminLogCommand.h @@ -9,5 +9,5 @@ class AdminLogCommand public: static const int LOGTYPE_DONT_SHOW_TO_SELF = 1; - virtual void logAdminCommand(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L"") = 0; + virtual void logAdminCommand(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const std::wstring& message = L"", int customData = -1, const std::wstring& additionalMessage = L"") = 0; }; \ No newline at end of file diff --git a/Minecraft.World/Commands/Command.cpp b/Minecraft.World/Commands/Command.cpp index e96b07cc3..d4f5bd4f0 100644 --- a/Minecraft.World/Commands/Command.cpp +++ b/Minecraft.World/Commands/Command.cpp @@ -12,12 +12,12 @@ bool Command::canExecute(std::shared_ptr source) return source->hasPermission(getId()); } -void Command::logAdminAction(std::shared_ptr source, ChatPacket::EChatPacketMessage messageType, const wstring& message, int customData, const wstring& additionalMessage) +void Command::logAdminAction(std::shared_ptr source, ChatPacket::EChatPacketMessage messageType, const std::wstring& message, int customData, const std::wstring& additionalMessage) { logAdminAction(source, 0, messageType, message, customData, additionalMessage); } -void Command::logAdminAction(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message, int customData, const wstring& additionalMessage) +void Command::logAdminAction(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const std::wstring& message, int customData, const std::wstring& additionalMessage) { if (logger != NULL) { diff --git a/Minecraft.World/Commands/Command.h b/Minecraft.World/Commands/Command.h index 580a98412..a0db21851 100644 --- a/Minecraft.World/Commands/Command.h +++ b/Minecraft.World/Commands/Command.h @@ -19,8 +19,8 @@ public: virtual void execute(std::shared_ptr source, byteArray commandData) = 0; virtual bool canExecute(std::shared_ptr source); - static void logAdminAction(std::shared_ptr source, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L""); - static void logAdminAction(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L""); + static void logAdminAction(std::shared_ptr source, ChatPacket::EChatPacketMessage messageType, const std::wstring& message = L"", int customData = -1, const std::wstring& additionalMessage = L""); + static void logAdminAction(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const std::wstring& message = L"", int customData = -1, const std::wstring& additionalMessage = L""); static void setLogger(AdminLogCommand *logger); protected: diff --git a/Minecraft.World/Commands/CommandSender.h b/Minecraft.World/Commands/CommandSender.h index 6886aa365..1484fec21 100644 --- a/Minecraft.World/Commands/CommandSender.h +++ b/Minecraft.World/Commands/CommandSender.h @@ -7,6 +7,6 @@ class CommandSender { public: //virtual int getUID() = 0; - virtual void sendMessage(const wstring& message, ChatPacket::EChatPacketMessage type = ChatPacket::e_ChatCustom, int customData = -1, const wstring& additionalMessage = L"") = 0; + virtual void sendMessage(const std::wstring& message, ChatPacket::EChatPacketMessage type = ChatPacket::e_ChatCustom, int customData = -1, const std::wstring& additionalMessage = L"") = 0; virtual bool hasPermission(EGameCommand command) = 0; }; \ No newline at end of file diff --git a/Minecraft.World/Commands/GameModeCommand.cpp b/Minecraft.World/Commands/GameModeCommand.cpp index 6c50a0fda..439cc2b62 100644 --- a/Minecraft.World/Commands/GameModeCommand.cpp +++ b/Minecraft.World/Commands/GameModeCommand.cpp @@ -26,7 +26,7 @@ void GameModeCommand::execute(std::shared_ptr source, byteArray c //} } -GameType *GameModeCommand::getModeForString(std::shared_ptr source, const wstring &name) +GameType *GameModeCommand::getModeForString(std::shared_ptr source, const std::wstring &name) { return NULL; //if (name.equalsIgnoreCase(GameType.SURVIVAL.getName()) || name.equalsIgnoreCase("s")) { diff --git a/Minecraft.World/Commands/GameModeCommand.h b/Minecraft.World/Commands/GameModeCommand.h index 7c08caabe..14a8490c8 100644 --- a/Minecraft.World/Commands/GameModeCommand.h +++ b/Minecraft.World/Commands/GameModeCommand.h @@ -11,6 +11,6 @@ public: virtual void execute(std::shared_ptr source, byteArray commandData); protected: - GameType *getModeForString(std::shared_ptr source, const wstring &name); + GameType *getModeForString(std::shared_ptr source, const std::wstring &name); std::shared_ptr getPlayer(PlayerUID playerId); }; \ No newline at end of file diff --git a/Minecraft.World/Commands/GiveItemCommand.cpp b/Minecraft.World/Commands/GiveItemCommand.cpp index 0463e7103..80b75df38 100644 --- a/Minecraft.World/Commands/GiveItemCommand.cpp +++ b/Minecraft.World/Commands/GiveItemCommand.cpp @@ -19,7 +19,7 @@ void GiveItemCommand::execute(std::shared_ptr source, byteArray c int item = dis.readInt(); int amount = dis.readInt(); int aux = dis.readInt(); - wstring tag = dis.readUTF(); + std::wstring tag = dis.readUTF(); bais.reset(); @@ -33,7 +33,7 @@ void GiveItemCommand::execute(std::shared_ptr source, byteArray c } } -std::shared_ptr GiveItemCommand::preparePacket(std::shared_ptr player, int item, int amount, int aux, const wstring &tag) +std::shared_ptr GiveItemCommand::preparePacket(std::shared_ptr player, int item, int amount, int aux, const std::wstring &tag) { if(player == NULL) return nullptr; diff --git a/Minecraft.World/Commands/GiveItemCommand.h b/Minecraft.World/Commands/GiveItemCommand.h index 0881d9f64..9297711f7 100644 --- a/Minecraft.World/Commands/GiveItemCommand.h +++ b/Minecraft.World/Commands/GiveItemCommand.h @@ -11,5 +11,5 @@ public: virtual void execute(std::shared_ptr source, byteArray commandData); public: - static std::shared_ptr preparePacket(std::shared_ptr player, int item, int amount = 1, int aux = 0, const wstring &tag = L""); + static std::shared_ptr preparePacket(std::shared_ptr player, int item, int amount = 1, int aux = 0, const std::wstring &tag = L""); }; \ No newline at end of file diff --git a/Minecraft.World/Containers/Inventory.cpp b/Minecraft.World/Containers/Inventory.cpp index ef8243963..93afbb2c5 100644 --- a/Minecraft.World/Containers/Inventory.cpp +++ b/Minecraft.World/Containers/Inventory.cpp @@ -428,7 +428,7 @@ void Inventory::setItem(unsigned int slot, std::shared_ptr item) #ifdef _DEBUG if(item!=NULL) { - wstring itemstring=item->toString(); + std::wstring itemstring=item->toString(); app.DebugPrintf("Inventory::setItem - slot = %d,\t item = %d ",slot,item->id); //OutputDebugStringW(itemstring.c_str()); app.DebugPrintf("\n"); diff --git a/Minecraft.World/Containers/RepairMenu.cpp b/Minecraft.World/Containers/RepairMenu.cpp index 7f9120a99..65c6432bf 100644 --- a/Minecraft.World/Containers/RepairMenu.cpp +++ b/Minecraft.World/Containers/RepairMenu.cpp @@ -392,7 +392,7 @@ std::shared_ptr RepairMenu::quickMoveStack(std::shared_ptr return clicked; } -void RepairMenu::setItemName(const wstring &name) +void RepairMenu::setItemName(const std::wstring &name) { this->itemName = name; if (getSlot(RESULT_SLOT)->hasItem()) diff --git a/Minecraft.World/Containers/RepairMenu.h b/Minecraft.World/Containers/RepairMenu.h index acd7dc37c..f47f01a5f 100644 --- a/Minecraft.World/Containers/RepairMenu.h +++ b/Minecraft.World/Containers/RepairMenu.h @@ -35,7 +35,7 @@ public: private: int repairItemCountCost; - wstring itemName; + std::wstring itemName; std::shared_ptr player; public: @@ -51,5 +51,5 @@ public: void removed(std::shared_ptr player); bool stillValid(std::shared_ptr player); std::shared_ptr quickMoveStack(std::shared_ptr player, int slotIndex); - void setItemName(const wstring &name); + void setItemName(const std::wstring &name); }; diff --git a/Minecraft.World/Enchantments/Enchantment.cpp b/Minecraft.World/Enchantments/Enchantment.cpp index 4c8c0383d..bf12d7f2b 100644 --- a/Minecraft.World/Enchantments/Enchantment.cpp +++ b/Minecraft.World/Enchantments/Enchantment.cpp @@ -150,7 +150,7 @@ int Enchantment::getDescriptionId() return descriptionId; } -wstring Enchantment::getFullname(int level,wstring &unformatted) +std::wstring Enchantment::getFullname(int level,std::wstring &unformatted) { wchar_t formatted[256]; swprintf(formatted,256,L"%ls %ls",app.GetString( getDescriptionId() ), getLevelString(level).c_str()); @@ -165,7 +165,7 @@ bool Enchantment::canEnchant(std::shared_ptr item) } // 4J Added -wstring Enchantment::getLevelString(int level) +std::wstring Enchantment::getLevelString(int level) { int stringId = IDS_ENCHANTMENT_LEVEL_1; switch(level) diff --git a/Minecraft.World/Enchantments/Enchantment.h b/Minecraft.World/Enchantments/Enchantment.h index 08c1ab0a2..1fe1a2f18 100644 --- a/Minecraft.World/Enchantments/Enchantment.h +++ b/Minecraft.World/Enchantments/Enchantment.h @@ -78,10 +78,10 @@ public: virtual bool isCompatibleWith(Enchantment *other) const; virtual Enchantment *setDescriptionId(int id); virtual int getDescriptionId(); - virtual wstring getFullname(int level,wstring &unformatted); // 4J Stu added unformatted + virtual std::wstring getFullname(int level,std::wstring &unformatted); // 4J Stu added unformatted virtual bool canEnchant(std::shared_ptr item); private: // 4J Added - wstring getLevelString(int level); + std::wstring getLevelString(int level); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/BossMobPart.cpp b/Minecraft.World/Entities/BossMobPart.cpp index 3c3100a87..a6750f601 100644 --- a/Minecraft.World/Entities/BossMobPart.cpp +++ b/Minecraft.World/Entities/BossMobPart.cpp @@ -4,7 +4,7 @@ -BossMobPart::BossMobPart(BossMob *bossMob, const wstring &id, float w, float h) : Entity(bossMob->level), bossMob( bossMob ), id( id ) +BossMobPart::BossMobPart(BossMob *bossMob, const std::wstring &id, float w, float h) : Entity(bossMob->level), bossMob( bossMob ), id( id ) { // 4J Stu - This function call had to be moved here from the Entity ctor to ensure that // the derived version of the function is called diff --git a/Minecraft.World/Entities/BossMobPart.h b/Minecraft.World/Entities/BossMobPart.h index 7b53126f2..cf003507f 100644 --- a/Minecraft.World/Entities/BossMobPart.h +++ b/Minecraft.World/Entities/BossMobPart.h @@ -11,9 +11,9 @@ public: eINSTANCEOF GetType() { return eTYPE_BOSS_MOB_PART; }; public: BossMob *bossMob; - const wstring id; + const std::wstring id; - BossMobPart(BossMob *bossMob, const wstring &id, float w, float h); + BossMobPart(BossMob *bossMob, const std::wstring &id, float w, float h); protected: virtual void defineSynchedData(); diff --git a/Minecraft.World/Entities/Entity.cpp b/Minecraft.World/Entities/Entity.cpp index f6710d8bf..a2dd67df1 100644 --- a/Minecraft.World/Entities/Entity.cpp +++ b/Minecraft.World/Entities/Entity.cpp @@ -1302,7 +1302,7 @@ bool Entity::shouldRenderAtSqrDistance(double distance) return distance < size * size; } -// 4J - used to be wstring return type, returning L"" +// 4J - used to be std::wstring return type, returning L"" int Entity::getTexture() { return -1; @@ -1315,7 +1315,7 @@ bool Entity::isCreativeModeAllowed() bool Entity::save(CompoundTag *entityTag) { - wstring id = getEncodeId(); + std::wstring id = getEncodeId(); if (removed || id.empty() ) { return false; @@ -1382,7 +1382,7 @@ void Entity::load(CompoundTag *tag) } -const wstring Entity::getEncodeId() +const std::wstring Entity::getEncodeId() { return EntityIO::getEncodeId( shared_from_this() ); } @@ -1889,9 +1889,9 @@ void Entity::makeStuckInWeb() fallDistance = 0; } -wstring Entity::getAName() +std::wstring Entity::getAName() { - wstring id = EntityIO::getEncodeId(shared_from_this()); + std::wstring id = EntityIO::getEncodeId(shared_from_this()); if (id.empty()) id = L"generic"; return L"entity." + id + _toString(entityId); //return I18n.get("entity." + id + ".name"); diff --git a/Minecraft.World/Entities/Entity.h b/Minecraft.World/Entities/Entity.h index 6e96bd8a6..4a86edfd9 100644 --- a/Minecraft.World/Entities/Entity.h +++ b/Minecraft.World/Entities/Entity.h @@ -112,8 +112,8 @@ private: bool firstTick; public: - wstring customTextureUrl; - wstring customTextureUrl2; + std::wstring customTextureUrl; + std::wstring customTextureUrl2; protected: bool fireImmune; @@ -265,14 +265,14 @@ public: virtual void awardKillScore(std::shared_ptr victim, int score); virtual bool shouldRender(Vec3 *c); virtual bool shouldRenderAtSqrDistance(double distance); - virtual int getTexture(); // 4J - changed from wstring to int + virtual int getTexture(); // 4J - changed from std::wstring to int virtual bool isCreativeModeAllowed(); bool save(CompoundTag *entityTag); void saveWithoutId(CompoundTag *entityTag); virtual void load(CompoundTag *tag); protected: - const wstring getEncodeId(); + const std::wstring getEncodeId(); public: virtual void readAdditionalSaveData(CompoundTag *tag) = 0; @@ -345,7 +345,7 @@ protected: public: virtual void makeStuckInWeb(); - virtual wstring getAName(); + virtual std::wstring getAName(); // TU9 bool skipAttackInteraction(std::shared_ptr source) {return false;} diff --git a/Minecraft.World/Entities/EntityDamageSource.cpp b/Minecraft.World/Entities/EntityDamageSource.cpp index cea252f07..918c8a371 100644 --- a/Minecraft.World/Entities/EntityDamageSource.cpp +++ b/Minecraft.World/Entities/EntityDamageSource.cpp @@ -4,7 +4,7 @@ #include "../Headers/net.minecraft.world.damagesource.h" #include "../Headers/net.minecraft.network.packet.h" -//EntityDamageSource::EntityDamageSource(const wstring &msgId, std::shared_ptr entity) : DamageSource(msgId) +//EntityDamageSource::EntityDamageSource(const std::wstring &msgId, std::shared_ptr entity) : DamageSource(msgId) EntityDamageSource::EntityDamageSource(ChatPacket::EChatPacketMessage msgId, std::shared_ptr entity) : DamageSource(msgId) { this->entity = entity; @@ -15,7 +15,7 @@ std::shared_ptr EntityDamageSource::getEntity() return entity; } -//wstring EntityDamageSource::getLocalizedDeathMessage(std::shared_ptr player) +//std::wstring EntityDamageSource::getLocalizedDeathMessage(std::shared_ptr player) //{ // return L"death." + msgId + player->name + entity->getAName(); // //return I18n.get("death." + msgId, player.name, entity.getAName()); @@ -23,7 +23,7 @@ std::shared_ptr EntityDamageSource::getEntity() std::shared_ptr EntityDamageSource::getDeathMessagePacket(std::shared_ptr player) { - wstring additional = L""; + std::wstring additional = L""; if(entity->GetType() == eTYPE_SERVERPLAYER) { std::shared_ptr sourcePlayer = dynamic_pointer_cast(entity); diff --git a/Minecraft.World/Entities/EntityDamageSource.h b/Minecraft.World/Entities/EntityDamageSource.h index 5c9fab190..e1d11598d 100644 --- a/Minecraft.World/Entities/EntityDamageSource.h +++ b/Minecraft.World/Entities/EntityDamageSource.h @@ -12,14 +12,14 @@ protected: std::shared_ptr entity; public: - //EntityDamageSource(const wstring &msgId, std::shared_ptr entity); + //EntityDamageSource(const std::wstring &msgId, std::shared_ptr entity); EntityDamageSource(ChatPacket::EChatPacketMessage msgId, std::shared_ptr entity); virtual ~EntityDamageSource() { } std::shared_ptr getEntity(); // 4J Stu - Made return a packet - //virtual wstring getLocalizedDeathMessage(std::shared_ptr player); + //virtual std::wstring getLocalizedDeathMessage(std::shared_ptr player); virtual std::shared_ptr getDeathMessagePacket(std::shared_ptr player); virtual bool scalesWithDifficulty(); diff --git a/Minecraft.World/Entities/IndirectEntityDamageSource.cpp b/Minecraft.World/Entities/IndirectEntityDamageSource.cpp index e5670c969..7f43e0331 100644 --- a/Minecraft.World/Entities/IndirectEntityDamageSource.cpp +++ b/Minecraft.World/Entities/IndirectEntityDamageSource.cpp @@ -4,7 +4,7 @@ #include "../Headers/net.minecraft.world.damagesource.h" #include "../Headers/net.minecraft.network.packet.h" -//IndirectEntityDamageSource::IndirectEntityDamageSource(const wstring &msgId, std::shared_ptr entity, std::shared_ptr owner) : EntityDamageSource(msgId, entity) +//IndirectEntityDamageSource::IndirectEntityDamageSource(const std::wstring &msgId, std::shared_ptr entity, std::shared_ptr owner) : EntityDamageSource(msgId, entity) IndirectEntityDamageSource::IndirectEntityDamageSource(ChatPacket::EChatPacketMessage msgId, std::shared_ptr entity, std::shared_ptr owner) : EntityDamageSource(msgId, entity) { this->owner = owner; @@ -21,7 +21,7 @@ std::shared_ptr IndirectEntityDamageSource::getEntity() return owner; } -//wstring IndirectEntityDamageSource::getLocalizedDeathMessage(std::shared_ptr player) +//std::wstring IndirectEntityDamageSource::getLocalizedDeathMessage(std::shared_ptr player) //{ // return L"death." + msgId + player->name + owner->getAName(); // //return I18n.get("death." + msgId, player.name, owner.getAName()); @@ -29,7 +29,7 @@ std::shared_ptr IndirectEntityDamageSource::getEntity() std::shared_ptr IndirectEntityDamageSource::getDeathMessagePacket(std::shared_ptr player) { - wstring additional = L""; + std::wstring additional = L""; int type; if(owner != NULL) { diff --git a/Minecraft.World/Entities/IndirectEntityDamageSource.h b/Minecraft.World/Entities/IndirectEntityDamageSource.h index 52848de1f..2c3094799 100644 --- a/Minecraft.World/Entities/IndirectEntityDamageSource.h +++ b/Minecraft.World/Entities/IndirectEntityDamageSource.h @@ -12,7 +12,7 @@ private: std::shared_ptr owner; public: - //IndirectEntityDamageSource(const wstring &msgId, std::shared_ptr entity, std::shared_ptr owner); + //IndirectEntityDamageSource(const std::wstring &msgId, std::shared_ptr entity, std::shared_ptr owner); IndirectEntityDamageSource(ChatPacket::EChatPacketMessage msgId, std::shared_ptr entity, std::shared_ptr owner); virtual ~IndirectEntityDamageSource() { } @@ -20,6 +20,6 @@ public: virtual std::shared_ptr getEntity(); // 4J Stu - Made return a packet - //virtual wstring getLocalizedDeathMessage(std::shared_ptr player); + //virtual std::wstring getLocalizedDeathMessage(std::shared_ptr player); virtual std::shared_ptr getDeathMessagePacket(std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/ItemEntity.cpp b/Minecraft.World/Entities/ItemEntity.cpp index c3210f930..ca558ff98 100644 --- a/Minecraft.World/Entities/ItemEntity.cpp +++ b/Minecraft.World/Entities/ItemEntity.cpp @@ -261,7 +261,7 @@ void ItemEntity::playerTouch(std::shared_ptr player) } } -wstring ItemEntity::getAName() +std::wstring ItemEntity::getAName() { return L"";//L"item." + getItem()->getDescriptionId(); //return I18n.get("item." + item.getDescriptionId()); @@ -295,12 +295,12 @@ bool ItemEntity::isAttackable() return false; } -void ItemEntity::setThrower(const wstring &thrower) +void ItemEntity::setThrower(const std::wstring &thrower) { this->thrower = thrower; } -wstring ItemEntity::getThrower() +std::wstring ItemEntity::getThrower() { return this->thrower; } diff --git a/Minecraft.World/Entities/ItemEntity.h b/Minecraft.World/Entities/ItemEntity.h index 6973497de..65c6fbe05 100644 --- a/Minecraft.World/Entities/ItemEntity.h +++ b/Minecraft.World/Entities/ItemEntity.h @@ -15,7 +15,7 @@ private: static const int LIFETIME = 5 * 60 * SharedConstants::TICKS_PER_SECOND; // Five miniutes. - wstring thrower; + std::wstring thrower; // 4J Added void _init(); @@ -63,12 +63,12 @@ public: virtual void readAdditionalSaveData(CompoundTag *tag); virtual void playerTouch(std::shared_ptr player); - virtual wstring getAName(); + virtual std::wstring getAName(); std::shared_ptr getItem(); void setItem(std::shared_ptr item); virtual bool isAttackable(); - void setThrower(const wstring &thrower); - wstring getThrower(); + void setThrower(const std::wstring &thrower); + std::wstring getThrower(); }; diff --git a/Minecraft.World/Entities/Mob.h b/Minecraft.World/Entities/Mob.h index d98438165..8936c67ab 100644 --- a/Minecraft.World/Entities/Mob.h +++ b/Minecraft.World/Entities/Mob.h @@ -55,11 +55,11 @@ protected: float oRun, run; float animStep, animStepO; bool hasHair; - // wstring textureName; - int textureIdx; // 4J changed from wstring textureName + // std::wstring textureName; + int textureIdx; // 4J changed from std::wstring textureName bool allowAlpha; float rotOffs; - wstring modelName; + std::wstring modelName; float bobStrength; int deathScore; float renderOffset; @@ -172,7 +172,7 @@ protected: public: bool canSee(std::shared_ptr target); - virtual int getTexture(); // 4J - changed from wstring to int + virtual int getTexture(); // 4J - changed from std::wstring to int virtual bool isPickable() ; virtual bool isPushable(); virtual float getHeadHeight(); diff --git a/Minecraft.World/Entities/MobEffect.cpp b/Minecraft.World/Entities/MobEffect.cpp index efb21889d..270e4f799 100644 --- a/Minecraft.World/Entities/MobEffect.cpp +++ b/Minecraft.World/Entities/MobEffect.cpp @@ -217,7 +217,7 @@ bool MobEffect::isHarmful() return _isHarmful; } -wstring MobEffect::formatDuration(MobEffectInstance *instance) +std::wstring MobEffect::formatDuration(MobEffectInstance *instance) { int duration = instance->getDuration(); diff --git a/Minecraft.World/Entities/MobEffect.h b/Minecraft.World/Entities/MobEffect.h index 94b9da8f1..7f42234eb 100644 --- a/Minecraft.World/Entities/MobEffect.h +++ b/Minecraft.World/Entities/MobEffect.h @@ -101,7 +101,7 @@ public: bool hasIcon(); EMobEffectIcon getIcon(); // 4J changed return type bool isHarmful(); - static wstring formatDuration(MobEffectInstance *instance); + static std::wstring formatDuration(MobEffectInstance *instance); protected: MobEffect *setDurationModifier(double durationModifier); diff --git a/Minecraft.World/Entities/MobEffectInstance.cpp b/Minecraft.World/Entities/MobEffectInstance.cpp index 6a438eef2..d0a0ecb07 100644 --- a/Minecraft.World/Entities/MobEffectInstance.cpp +++ b/Minecraft.World/Entities/MobEffectInstance.cpp @@ -113,10 +113,10 @@ int MobEffectInstance::hashCode() return (id & 0xff) | ( (amplifier & 0xff) << 8) | ( (duration & 0xffff) << 16); } -wstring MobEffectInstance::toString() +std::wstring MobEffectInstance::toString() { - wstring result = L"MobEffectInstance::toString - NON IMPLEMENTED OR LOCALISED FUNCTION"; - //wstring result = ""; + std::wstring result = L"MobEffectInstance::toString - NON IMPLEMENTED OR LOCALISED FUNCTION"; + //std::wstring result = ""; //if (getAmplifier() > 0) //{ // result = getDescriptionId() + " x " + (getAmplifier() + 1) + ", Duration: " + getDuration(); diff --git a/Minecraft.World/Entities/MobEffectInstance.h b/Minecraft.World/Entities/MobEffectInstance.h index bfecc6125..4f6b6ef00 100644 --- a/Minecraft.World/Entities/MobEffectInstance.h +++ b/Minecraft.World/Entities/MobEffectInstance.h @@ -35,7 +35,7 @@ public: int getPostfixDescriptionId(); // 4J Added int hashCode(); - wstring toString(); + std::wstring toString(); // Was bool equals(Object obj) bool equals(MobEffectInstance *obj); diff --git a/Minecraft.World/Entities/Mobs/Boat.cpp b/Minecraft.World/Entities/Mobs/Boat.cpp index b3480186b..397dd53dc 100644 --- a/Minecraft.World/Entities/Mobs/Boat.cpp +++ b/Minecraft.World/Entities/Mobs/Boat.cpp @@ -462,7 +462,7 @@ float Boat::getShadowHeightOffs() return 0; } -wstring Boat::getName() +std::wstring Boat::getName() { return L"Boat"; } diff --git a/Minecraft.World/Entities/Mobs/Boat.h b/Minecraft.World/Entities/Mobs/Boat.h index eb5f5fc1f..b4d147d37 100644 --- a/Minecraft.World/Entities/Mobs/Boat.h +++ b/Minecraft.World/Entities/Mobs/Boat.h @@ -68,7 +68,7 @@ protected: public: virtual float getShadowHeightOffs(); - wstring getName(); + std::wstring getName(); virtual bool interact(std::shared_ptr player); virtual void setDamage(int damage); diff --git a/Minecraft.World/Entities/Mobs/Ocelot.cpp b/Minecraft.World/Entities/Mobs/Ocelot.cpp index f6355f5dc..2243299e9 100644 --- a/Minecraft.World/Entities/Mobs/Ocelot.cpp +++ b/Minecraft.World/Entities/Mobs/Ocelot.cpp @@ -323,7 +323,7 @@ bool Ozelot::canSpawn() return false; } -wstring Ozelot::getAName() +std::wstring Ozelot::getAName() { if (isTame()) { diff --git a/Minecraft.World/Entities/Mobs/Ocelot.h b/Minecraft.World/Entities/Mobs/Ocelot.h index 8ca188331..bc557e317 100644 --- a/Minecraft.World/Entities/Mobs/Ocelot.h +++ b/Minecraft.World/Entities/Mobs/Ocelot.h @@ -72,5 +72,5 @@ public: virtual int getCatType(); virtual void setCatType(int type); virtual bool canSpawn(); - virtual wstring getAName(); + virtual std::wstring getAName(); }; \ No newline at end of file diff --git a/Minecraft.World/Entities/Mobs/Painting.cpp b/Minecraft.World/Entities/Mobs/Painting.cpp index ba31f5140..b04132bb0 100644 --- a/Minecraft.World/Entities/Mobs/Painting.cpp +++ b/Minecraft.World/Entities/Mobs/Painting.cpp @@ -93,7 +93,7 @@ void Painting::PaintingPostConstructor(int dir) setDir(dir); } -Painting::Painting(Level *level, int x, int y, int z, int dir, wstring motiveName) : HangingEntity( level , x, y, z, dir ) +Painting::Painting(Level *level, int x, int y, int z, int dir, std::wstring motiveName) : HangingEntity( level , x, y, z, dir ) { _init(level); @@ -118,7 +118,7 @@ void Painting::addAdditonalSaveData(CompoundTag *tag) void Painting::readAdditionalSaveData(CompoundTag *tag) { - wstring motiveName = tag->getString(L"Motive"); + std::wstring motiveName = tag->getString(L"Motive"); vector::iterator it; for (int i = 0 ; i < LAST_VALUE; i++) { diff --git a/Minecraft.World/Entities/Mobs/Painting.h b/Minecraft.World/Entities/Mobs/Painting.h index 7c986a01e..7ce1e60ef 100644 --- a/Minecraft.World/Entities/Mobs/Painting.h +++ b/Minecraft.World/Entities/Mobs/Painting.h @@ -63,12 +63,12 @@ public: static const int MAX_MOTIVE_NAME_LENGTH; - const wstring name; + const std::wstring name; const int w, h; const int uo, vo; //private: - Motive(wstring name, int w, int h, int uo, int vo) : name( name ), w( w ), h( h ), uo( uo ), vo( vo ) {}; + Motive(std::wstring name, int w, int h, int uo, int vo) : name( name ), w( w ), h( h ), uo( uo ), vo( vo ) {}; }; public: @@ -85,7 +85,7 @@ private: public: Painting(Level *level); Painting(Level *level, int xTile, int yTile, int zTile, int dir); - Painting(Level *level, int x, int y, int z, int dir, wstring motiveName); + Painting(Level *level, int x, int y, int z, int dir, std::wstring motiveName); // 4J Stu - Added this so that we can use some std::shared_ptr functions that were needed in the ctor void PaintingPostConstructor(int dir); diff --git a/Minecraft.World/Entities/Mobs/Villager.h b/Minecraft.World/Entities/Mobs/Villager.h index ae18ecfbb..bc0717375 100644 --- a/Minecraft.World/Entities/Mobs/Villager.h +++ b/Minecraft.World/Entities/Mobs/Villager.h @@ -39,7 +39,7 @@ private: int updateMerchantTimer; bool addRecipeOnUpdate; int riches; - wstring lastPlayerTradeName; + std::wstring lastPlayerTradeName; bool rewardPlayersOnFirstVillage; diff --git a/Minecraft.World/Entities/Mobs/Wolf.cpp b/Minecraft.World/Entities/Mobs/Wolf.cpp index b5c233a8b..f463aa784 100644 --- a/Minecraft.World/Entities/Mobs/Wolf.cpp +++ b/Minecraft.World/Entities/Mobs/Wolf.cpp @@ -308,7 +308,7 @@ bool Wolf::doHurtTarget(std::shared_ptr target) return target->hurt(DamageSource::mobAttack(dynamic_pointer_cast(shared_from_this())), damage); } -void Wolf::tame(const wstring &wsOwnerUUID, bool bDisplayTamingParticles, bool bSetSitting) +void Wolf::tame(const std::wstring &wsOwnerUUID, bool bDisplayTamingParticles, bool bSetSitting) { setTame(true); setPath(NULL); diff --git a/Minecraft.World/Entities/Mobs/Wolf.h b/Minecraft.World/Entities/Mobs/Wolf.h index 8b3e69c4a..c8fbf6c97 100644 --- a/Minecraft.World/Entities/Mobs/Wolf.h +++ b/Minecraft.World/Entities/Mobs/Wolf.h @@ -39,7 +39,7 @@ protected: virtual bool makeStepSound(); public: - virtual int getTexture(); // 4J - changed from wstring to ing + virtual int getTexture(); // 4J - changed from std::wstring to ing virtual void addAdditonalSaveData(CompoundTag *tag); virtual void readAdditionalSaveData(CompoundTag *tag); @@ -71,7 +71,7 @@ public: void setAngry(bool value); int getCollarColor(); void setCollarColor(int color); - void tame(const wstring &wsOwnerUUID, bool bDisplayTamingParticles, bool bSetSitting); + void tame(const std::wstring &wsOwnerUUID, bool bDisplayTamingParticles, bool bSetSitting); // For tooltips int GetSynchedHealth(); diff --git a/Minecraft.World/Entities/SyncedEntityData.cpp b/Minecraft.World/Entities/SyncedEntityData.cpp index 47012bd69..5bb72f3b9 100644 --- a/Minecraft.World/Entities/SyncedEntityData.cpp +++ b/Minecraft.World/Entities/SyncedEntityData.cpp @@ -46,7 +46,7 @@ void SynchedEntityData::define(int id, short value) m_isEmpty = false; } -void SynchedEntityData::define(int id, const wstring& value) +void SynchedEntityData::define(int id, const std::wstring& value) { MemSect(17); checkId(id); @@ -103,7 +103,7 @@ float SynchedEntityData::getFloat(int id) return 0; } -wstring SynchedEntityData::getString(int id) +std::wstring SynchedEntityData::getString(int id) { return itemsById[id]->getValue_wstring(); } @@ -159,7 +159,7 @@ void SynchedEntityData::set(int id, short value) } } -void SynchedEntityData::set(int id, const wstring& value) +void SynchedEntityData::set(int id, const std::wstring& value) { std::shared_ptr dataItem = itemsById[id]; @@ -474,7 +474,7 @@ SynchedEntityData::DataItem::DataItem(int type, int id, short value) : type( typ this->dirty = true; } -SynchedEntityData::DataItem::DataItem(int type, int id, const wstring& value) : type( type ), id( id ) +SynchedEntityData::DataItem::DataItem(int type, int id, const std::wstring& value) : type( type ), id( id ) { this->value_wstring = value; this->dirty = true; @@ -506,7 +506,7 @@ void SynchedEntityData::DataItem::setValue(short value) this->value_short = value; } -void SynchedEntityData::DataItem::setValue(const wstring& value) +void SynchedEntityData::DataItem::setValue(const std::wstring& value) { this->value_wstring = value; } @@ -531,7 +531,7 @@ uint8_t SynchedEntityData::DataItem::getValue_byte() return value_byte; } -wstring SynchedEntityData::DataItem::getValue_wstring() +std::wstring SynchedEntityData::DataItem::getValue_wstring() { return value_wstring; } diff --git a/Minecraft.World/Entities/SyncedEntityData.h b/Minecraft.World/Entities/SyncedEntityData.h index 404441b80..87008b4dd 100644 --- a/Minecraft.World/Entities/SyncedEntityData.h +++ b/Minecraft.World/Entities/SyncedEntityData.h @@ -18,7 +18,7 @@ public: uint8_t value_byte; int value_int; short value_short; - wstring value_wstring; + std::wstring value_wstring; std::shared_ptr value_itemInstance; bool dirty; @@ -26,7 +26,7 @@ public: // There was one type here that took a generic Object type, using overloading here instead DataItem(int type, int id, uint8_t value); DataItem(int type, int id, int value); - DataItem(int type, int id, const wstring& value); + DataItem(int type, int id, const std::wstring& value); DataItem(int type, int id, std::shared_ptr itemInstance); DataItem(int type, int id, short value); @@ -34,12 +34,12 @@ public: void setValue(uint8_t value); void setValue(int value); void setValue(short value); - void setValue(const wstring& value); + void setValue(const std::wstring& value); void setValue(std::shared_ptr value); uint8_t getValue_byte(); int getValue_int(); short getValue_short(); - wstring getValue_wstring(); + std::wstring getValue_wstring(); std::shared_ptr getValue_itemInstance(); int getType(); bool isDirty(); @@ -80,7 +80,7 @@ public: // 4J - this function used to be a template, but there's only 3 varieties of use I've found so just hard-coding now, as // the original had some automatic Class to type sort of conversion that's a real pain for us to actually do void define(int id, uint8_t value); - void define(int id, const wstring& value); + void define(int id, const std::wstring& value); void define(int id, int value); void define(int id, short value); void defineNULL(int id, void *pVal); @@ -90,14 +90,14 @@ public: short getShort(int id); int getInteger(int id); float getFloat(int id); - wstring getString(int id); + std::wstring getString(int id); std::shared_ptr getItemInstance(int id); Pos *getPos(int id); // 4J - using overloads rather than template here void set(int id, uint8_t value); void set(int id, int value); void set(int id, short value); - void set(int id, const wstring& value); + void set(int id, const std::wstring& value); void set(int id, std::shared_ptr); void markDirty(int id); bool isDirty(); diff --git a/Minecraft.World/Entities/TamableAnimal.cpp b/Minecraft.World/Entities/TamableAnimal.cpp index 0ab7bae27..d4d265691 100644 --- a/Minecraft.World/Entities/TamableAnimal.cpp +++ b/Minecraft.World/Entities/TamableAnimal.cpp @@ -54,13 +54,13 @@ void TamableAnimal::readAdditionalSaveData(CompoundTag *tag) Animal::readAdditionalSaveData(tag); #ifdef _XBOX_ONE // 4J Stu Added from later Java version to remove owners from save transfer saves. We will probably want this on other platforms in the future - wstring owner = L""; + std::wstring owner = L""; if(tag->contains(L"OwnerUUID") ) { owner = tag->getString(L"OwnerUUID"); } #else - wstring owner = tag->getString(L"Owner"); + std::wstring owner = tag->getString(L"Owner"); #endif if (owner.length() > 0) { @@ -138,12 +138,12 @@ void TamableAnimal::setSitting(bool value) } } -wstring TamableAnimal::getOwnerUUID() +std::wstring TamableAnimal::getOwnerUUID() { return entityData->getString(DATA_OWNERUUID_ID); } -void TamableAnimal::setOwnerUUID(const wstring &name) +void TamableAnimal::setOwnerUUID(const std::wstring &name) { entityData->set(DATA_OWNERUUID_ID, name); } diff --git a/Minecraft.World/Entities/TamableAnimal.h b/Minecraft.World/Entities/TamableAnimal.h index 644665da1..4955f0ff2 100644 --- a/Minecraft.World/Entities/TamableAnimal.h +++ b/Minecraft.World/Entities/TamableAnimal.h @@ -31,8 +31,8 @@ public: virtual void setTame(bool value); virtual bool isSitting(); virtual void setSitting(bool value); - virtual wstring getOwnerUUID(); - virtual void setOwnerUUID(const wstring &name); + virtual std::wstring getOwnerUUID(); + virtual void setOwnerUUID(const std::wstring &name); virtual std::shared_ptr getOwner(); virtual SitGoal *getSitGoal(); }; \ No newline at end of file diff --git a/Minecraft.World/IO/Files/ConsoleSaveFile.h b/Minecraft.World/IO/Files/ConsoleSaveFile.h index 39c1ec89c..508f9e603 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFile.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFile.h @@ -26,13 +26,13 @@ public: virtual void DebugFlushToFile(void *compressedData = NULL, unsigned int compressedDataSize = 0) = 0; #endif virtual unsigned int getSizeOnDisk() = 0; - virtual wstring getFilename() = 0; - virtual vector *getFilesWithPrefix(const wstring &prefix) = 0; + virtual std::wstring getFilename() = 0; + virtual vector *getFilesWithPrefix(const std::wstring &prefix) = 0; virtual vector *getRegionFilesByDimension(unsigned int dimensionIndex) = 0; #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - virtual wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID) = 0; - virtual wstring getPlayerDataFilenameForSave(const PlayerUID& pUID) = 0; + virtual std::wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID) = 0; + virtual std::wstring getPlayerDataFilenameForSave(const PlayerUID& pUID) = 0; virtual vector *getValidPlayerDatFiles() = 0; #endif //__PS3__ diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp index a4096ff4b..392998f99 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp @@ -59,7 +59,7 @@ void ConsoleSaveFileConverter::ProcessStandardRegionFile(ConsoleSaveFile *source void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile *sourceSave, ConsoleSaveFile *targetSave, ProgressListener *progress) { // Process level.dat - ConsoleSavePath ldatPath( wstring(L"level.dat") ); + ConsoleSavePath ldatPath( std::wstring(L"level.dat") ); FileEntry *sourceLdatFe = sourceSave->createFile( ldatPath ); FileEntry *targetLdatFe = targetSave->createFile( ldatPath ); printf("Processing level.dat\n"); @@ -267,14 +267,14 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile *sourceSave, ConsoleS #else // 4J Stu - Old version that just changes the compression of chunks, not usable for XboxOne style split saves or compressed tile formats // Process region files - vector *allFilesInSave = sourceSave->getFilesWithPrefix(wstring(L"")); + vector *allFilesInSave = sourceSave->getFilesWithPrefix(std::wstring(L"")); for(AUTO_VAR(it, allFilesInSave->begin()); it < allFilesInSave->end(); ++it) { FileEntry *fe = *it; if( fe != sourceLdatFe ) { - wstring fName( fe->data.filename ); - wstring suffix(L".mcr"); + std::wstring fName( fe->data.filename ); + std::wstring suffix(L".mcr"); if( fName.compare(fName.length() - suffix.length(), suffix.length(), suffix) == 0 ) { #ifndef _CONTENT_PACKAGE diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index 41f6777af..0023c146e 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -23,7 +23,7 @@ unsigned int ConsoleSaveFileOriginal::pagesCommitted = 0; void *ConsoleSaveFileOriginal::pvHeap = NULL; -ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID pvSaveData /*= NULL*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) +ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const std::wstring &fileName, LPVOID pvSaveData /*= NULL*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) { InitializeCriticalSectionAndSpinCount(&m_lock,5120); @@ -852,7 +852,7 @@ void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= NULL*/, //14 chars for the digits //11 chars for the separators + suffix //25 chars total - wstring cutFileName = m_fileName; + std::wstring cutFileName = m_fileName; if(m_fileName.length() > XCONTENT_MAX_FILENAME_LENGTH - 25) { cutFileName = m_fileName.substr(0, XCONTENT_MAX_FILENAME_LENGTH - 25); @@ -860,10 +860,10 @@ void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= NULL*/, swprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH+1, L"\\v%04d-%ls%02d.%02d.%02d.%02d.%02d.mcs",VER_PRODUCTBUILD,cutFileName.c_str(), t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond); #ifdef _UNICODE - wstring wtemp = targetFileDir.getPath() + wstring(fileName); + std::wstring wtemp = targetFileDir.getPath() + std::wstring(fileName); LPCWSTR lpFileName = wtemp.c_str(); #else - LPCSTR lpFileName = wstringtofilename( targetFileDir.getPath() + wstring(fileName) ); + LPCSTR lpFileName = wstringtofilename( targetFileDir.getPath() + std::wstring(fileName) ); #endif #ifndef __PSVITA__ HANDLE hSaveFile = CreateFile( lpFileName, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL); @@ -904,12 +904,12 @@ unsigned int ConsoleSaveFileOriginal::getSizeOnDisk() return header.GetFileSize(); } -wstring ConsoleSaveFileOriginal::getFilename() +std::wstring ConsoleSaveFileOriginal::getFilename() { return m_fileName; } -vector *ConsoleSaveFileOriginal::getFilesWithPrefix(const wstring &prefix) +vector *ConsoleSaveFileOriginal::getFilesWithPrefix(const std::wstring &prefix) { return header.getFilesWithPrefix( prefix ); } @@ -920,11 +920,11 @@ vector *ConsoleSaveFileOriginal::getRegionFilesByDimension(unsigned } #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) -wstring ConsoleSaveFileOriginal::getPlayerDataFilenameForLoad(const PlayerUID& pUID) +std::wstring ConsoleSaveFileOriginal::getPlayerDataFilenameForLoad(const PlayerUID& pUID) { return header.getPlayerDataFilenameForLoad( pUID ); } -wstring ConsoleSaveFileOriginal::getPlayerDataFilenameForSave(const PlayerUID& pUID) +std::wstring ConsoleSaveFileOriginal::getPlayerDataFilenameForSave(const PlayerUID& pUID) { return header.getPlayerDataFilenameForSave( pUID ); } @@ -1041,12 +1041,12 @@ void ConsoleSaveFileOriginal::ConvertToLocalPlatform() return; } // convert each of the region files to the local platform - vector *allFilesInSave = getFilesWithPrefix(wstring(L"")); + vector *allFilesInSave = getFilesWithPrefix(std::wstring(L"")); for(AUTO_VAR(it, allFilesInSave->begin()); it < allFilesInSave->end(); ++it) { FileEntry *fe = *it; - wstring fName( fe->data.filename ); - wstring suffix(L".mcr"); + std::wstring fName( fe->data.filename ); + std::wstring suffix(L".mcr"); if( fName.compare(fName.length() - suffix.length(), suffix.length(), suffix) == 0 ) { app.DebugPrintf("Processing a region file: %ls\n",fName.c_str()); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h index fd35aa1da..f8c7a106c 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h @@ -9,7 +9,7 @@ class ConsoleSaveFileOriginal : public ConsoleSaveFile private: FileHeader header; - wstring m_fileName; + std::wstring m_fileName; // HANDLE hHeap; static void *pvHeap; @@ -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 std::wstring &fileName, LPVOID pvSaveData = NULL, 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 @@ -60,14 +60,14 @@ public: #endif virtual unsigned int getSizeOnDisk(); - virtual wstring getFilename(); + virtual std::wstring getFilename(); - virtual vector *getFilesWithPrefix(const wstring &prefix); + virtual vector *getFilesWithPrefix(const std::wstring &prefix); virtual vector *getRegionFilesByDimension(unsigned int dimensionIndex); #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - virtual wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID); - virtual wstring getPlayerDataFilenameForSave(const PlayerUID& pUID); + virtual std::wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID); + virtual std::wstring getPlayerDataFilenameForSave(const PlayerUID& pUID); virtual vector *getValidPlayerDatFiles(); #endif //__PS3__ diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 111b741e7..ef5b671e8 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -379,7 +379,7 @@ FileEntry *ConsoleSaveFileSplit::GetRegionFileEntry(unsigned int regionIndex) return newRef->fileEntry; } -ConsoleSaveFileSplit::ConsoleSaveFileSplit(const wstring &fileName, LPVOID pvSaveData /*= NULL*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) +ConsoleSaveFileSplit::ConsoleSaveFileSplit(const std::wstring &fileName, LPVOID pvSaveData /*= NULL*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) { DWORD fileSize = dFileSize; @@ -437,7 +437,7 @@ ConsoleSaveFileSplit::ConsoleSaveFileSplit(ConsoleSaveFile *sourceSave, bool alr } } -void ConsoleSaveFileSplit::_init(const wstring &fileName, LPVOID pvSaveData, DWORD fileSize, ESavePlatform plat) +void ConsoleSaveFileSplit::_init(const std::wstring &fileName, LPVOID pvSaveData, DWORD fileSize, ESavePlatform plat) { InitializeCriticalSectionAndSpinCount(&m_lock,5120); @@ -1187,12 +1187,12 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesT // DIM-1r.x.z.mcr 00 01 xx zz // DIM1/r.x.z.mcr 00 02 xx zz -bool ConsoleSaveFileSplit::GetNumericIdentifierFromName(const wstring &fileName, unsigned int *idOut) +bool ConsoleSaveFileSplit::GetNumericIdentifierFromName(const std::wstring &fileName, unsigned int *idOut) { // Determine whether it is one of our region file names if the file extension is ".mbr" if( fileName.length() < 4 ) return false; - wstring extension = fileName.substr(fileName.length()-4,4); - if( extension != wstring(L".mcr") ) return false; + std::wstring extension = fileName.substr(fileName.length()-4,4); + if( extension != std::wstring(L".mcr") ) return false; unsigned int id = 0; int x, z; @@ -1231,9 +1231,9 @@ bool ConsoleSaveFileSplit::GetNumericIdentifierFromName(const wstring &fileName, // Convert a numeric file identifier (for region files) back into a normal filename. See comment above. -wstring ConsoleSaveFileSplit::GetNameFromNumericIdentifier(unsigned int idIn) +std::wstring ConsoleSaveFileSplit::GetNameFromNumericIdentifier(unsigned int idIn) { - wstring prefix; + std::wstring prefix; switch(idIn & 0x00ff0000 ) { @@ -1249,7 +1249,7 @@ wstring ConsoleSaveFileSplit::GetNameFromNumericIdentifier(unsigned int idIn) } signed char regionX = ( idIn >> 8 ) & 255; signed char regionZ = idIn & 255; - wstring region = ( prefix + wstring(L"r.") + _toString(regionX) + L"." + _toString(regionZ) + L".mcr" ); + std::wstring region = ( prefix + std::wstring(L"r.") + _toString(regionX) + L"." + _toString(regionZ) + L".mcr" ); return region; } @@ -1503,7 +1503,7 @@ void ConsoleSaveFileSplit::DebugFlushToFile(void *compressedData /*= NULL*/, uns //14 chars for the digits //11 chars for the separators + suffix //25 chars total - wstring cutFileName = m_fileName; + std::wstring cutFileName = m_fileName; if(m_fileName.length() > XCONTENT_MAX_FILENAME_LENGTH - 25) { cutFileName = m_fileName.substr(0, XCONTENT_MAX_FILENAME_LENGTH - 25); @@ -1511,10 +1511,10 @@ void ConsoleSaveFileSplit::DebugFlushToFile(void *compressedData /*= NULL*/, uns swprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH+1, L"\\v%04d-%ls%02d.%02d.%02d.%02d.%02d.mcs",VER_PRODUCTBUILD,cutFileName.c_str(), t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond); #ifdef _UNICODE - wstring wtemp = targetFileDir.getPath() + wstring(fileName); + std::wstring wtemp = targetFileDir.getPath() + std::wstring(fileName); LPCWSTR lpFileName = wtemp.c_str(); #else - LPCSTR lpFileName = wstringtofilename( targetFileDir.getPath() + wstring(fileName) ); + LPCSTR lpFileName = wstringtofilename( targetFileDir.getPath() + std::wstring(fileName) ); #endif HANDLE hSaveFile = CreateFile( lpFileName, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL); @@ -1542,12 +1542,12 @@ unsigned int ConsoleSaveFileSplit::getSizeOnDisk() return header.GetFileSize(); } -wstring ConsoleSaveFileSplit::getFilename() +std::wstring ConsoleSaveFileSplit::getFilename() { return m_fileName; } -vector *ConsoleSaveFileSplit::getFilesWithPrefix(const wstring &prefix) +vector *ConsoleSaveFileSplit::getFilesWithPrefix(const std::wstring &prefix) { return header.getFilesWithPrefix( prefix ); } @@ -1575,11 +1575,11 @@ vector *ConsoleSaveFileSplit::getRegionFilesByDimension(unsigned in } #if defined(__PS3__) || defined(__ORBIS__) -wstring ConsoleSaveFileSplit::getPlayerDataFilenameForLoad(const PlayerUID& pUID) +std::wstring ConsoleSaveFileSplit::getPlayerDataFilenameForLoad(const PlayerUID& pUID) { return header.getPlayerDataFilenameForLoad( pUID ); } -wstring ConsoleSaveFileSplit::getPlayerDataFilenameForSave(const PlayerUID& pUID) +std::wstring ConsoleSaveFileSplit::getPlayerDataFilenameForSave(const PlayerUID& pUID) { return header.getPlayerDataFilenameForSave( pUID ); } @@ -1690,12 +1690,12 @@ void ConsoleSaveFileSplit::ConvertToLocalPlatform() return; } // convert each of the region files to the local platform - vector *allFilesInSave = getFilesWithPrefix(wstring(L"")); + vector *allFilesInSave = getFilesWithPrefix(std::wstring(L"")); for(AUTO_VAR(it, allFilesInSave->begin()); it < allFilesInSave->end(); ++it) { FileEntry *fe = *it; - wstring fName( fe->data.filename ); - wstring suffix(L".mcr"); + std::wstring fName( fe->data.filename ); + std::wstring suffix(L".mcr"); if( fName.compare(fName.length() - suffix.length(), suffix.length(), suffix) == 0 ) { app.DebugPrintf("Processing a region file: %ls\n",fName.c_str()); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h index a35a5838b..41c0523fd 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h @@ -54,7 +54,7 @@ private: FileEntry *GetRegionFileEntry(unsigned int regionIndex); - wstring m_fileName; + std::wstring m_fileName; bool m_autosave; // HANDLE hHeap; @@ -74,8 +74,8 @@ private: void PrepareForWrite( FileEntry *file, DWORD nNumberOfBytesToWrite ); void MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesToWrite); - bool GetNumericIdentifierFromName(const wstring &fileName, unsigned int *idOut); - wstring GetNameFromNumericIdentifier(unsigned int idIn); + bool GetNumericIdentifierFromName(const std::wstring &fileName, unsigned int *idOut); + std::wstring GetNameFromNumericIdentifier(unsigned int idIn); void processSubfilesForWrite(); void processSubfilesAfterWrite(); public: @@ -83,10 +83,10 @@ public: static int SaveRegionFilesCallback(LPVOID lpParam,bool bRes); private: - void _init(const wstring &fileName, LPVOID pvSaveData, DWORD fileSize, ESavePlatform plat); + void _init(const std::wstring &fileName, LPVOID pvSaveData, DWORD fileSize, ESavePlatform plat); public: - ConsoleSaveFileSplit(const wstring &fileName, LPVOID pvSaveData = NULL, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); + ConsoleSaveFileSplit(const std::wstring &fileName, LPVOID pvSaveData = NULL, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); ConsoleSaveFileSplit(ConsoleSaveFile *sourceSave, bool alreadySmallRegions = true, ProgressListener *progress = NULL); virtual ~ConsoleSaveFileSplit(); @@ -113,14 +113,14 @@ public: #endif virtual unsigned int getSizeOnDisk(); - virtual wstring getFilename(); + virtual std::wstring getFilename(); - virtual vector *getFilesWithPrefix(const wstring &prefix); + virtual vector *getFilesWithPrefix(const std::wstring &prefix); virtual vector *getRegionFilesByDimension(unsigned int dimensionIndex); #if defined(__PS3__) || defined(__ORBIS__) - virtual wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID); - virtual wstring getPlayerDataFilenameForSave(const PlayerUID& pUID); + virtual std::wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID); + virtual std::wstring getPlayerDataFilenameForSave(const PlayerUID& pUID); virtual vector *getValidPlayerDatFiles(); #endif //__PS3__ diff --git a/Minecraft.World/IO/Files/ConsoleSavePath.h b/Minecraft.World/IO/Files/ConsoleSavePath.h index 321b89033..1c91ca14d 100644 --- a/Minecraft.World/IO/Files/ConsoleSavePath.h +++ b/Minecraft.World/IO/Files/ConsoleSavePath.h @@ -4,12 +4,12 @@ using namespace std; class ConsoleSavePath { private: - wstring path; + std::wstring path; public: - ConsoleSavePath( const wstring &newPath ) { path = newPath; } + ConsoleSavePath( const std::wstring &newPath ) { path = newPath; } - wstring getName() const { return path; } + std::wstring getName() const { return path; } - wstring operator+( wstring &b ) { return path + b; } + std::wstring operator+( std::wstring &b ) { return path + b; } }; \ No newline at end of file diff --git a/Minecraft.World/IO/Files/File.cpp b/Minecraft.World/IO/Files/File.cpp index 67adfe805..0f457dd21 100644 --- a/Minecraft.World/IO/Files/File.cpp +++ b/Minecraft.World/IO/Files/File.cpp @@ -12,19 +12,19 @@ const wchar_t File::pathSeparator = L'\\'; #ifdef _XBOX -const wstring File::pathRoot = L"GAME:"; // Path root after pathSeparator has been removed +const std::wstring File::pathRoot = L"GAME:"; // Path root after pathSeparator has been removed #else -const wstring File::pathRoot = L""; // Path root after pathSeparator has been removed +const std::wstring File::pathRoot = L""; // Path root after pathSeparator has been removed #endif //Creates a new File instance from a parent abstract pathname and a child pathname string. -File::File( const File &parent, const wstring& child ) +File::File( const File &parent, const std::wstring& child ) { m_abstractPathName = parent.getPath() + pathSeparator + 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 std::wstring& pathname ) //: parent( NULL ) { // #ifndef _CONTENT_PACKAGE // char buf[256]; @@ -32,7 +32,7 @@ File::File( const wstring& pathname ) //: parent( NULL ) // printf("File::File - %s\n",buf); // #endif if( pathname.empty() ) - m_abstractPathName = wstring( L"" ); + m_abstractPathName = std::wstring( L"" ); else m_abstractPathName = pathname; @@ -42,12 +42,12 @@ File::File( const wstring& pathname ) //: parent( NULL ) if(finalPath.size() == 0) finalPath = path; m_abstractPathName = convStringToWstring(finalPath); #elif defined(_DURANGO) - wstring finalPath = StorageManager.GetMountedPath(m_abstractPathName.c_str()); + std::wstring finalPath = StorageManager.GetMountedPath(m_abstractPathName.c_str()); if(finalPath.size() == 0) finalPath = m_abstractPathName; m_abstractPathName = finalPath; #endif /* - vector path = stringSplit( pathname, pathSeparator ); + vector path = stringSplit( pathname, pathSeparator ); if( path.back().compare( pathRoot ) != 0 ) m_abstractPathName = path.back(); @@ -67,7 +67,7 @@ File::File( const wstring& pathname ) //: parent( NULL ) */ } -File::File( const wstring& parent, const wstring& child ) //: m_abstractPathName( child ) +File::File( const std::wstring& parent, const std::wstring& child ) //: m_abstractPathName( child ) { m_abstractPathName = pathRoot + pathSeparator + parent + pathSeparator + child; //this->parent = new File( parent ); @@ -75,7 +75,7 @@ File::File( const wstring& parent, const wstring& child ) //: m_abstractPathNam //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( NULL ) { m_abstractPathName = path->back(); path->pop_back(); @@ -157,9 +157,9 @@ bool File::mkdir() const // bool File::mkdirs() const { - vector path = stringSplit( m_abstractPathName, pathSeparator ); + vector path = stringSplit( m_abstractPathName, pathSeparator ); - wstring pathToHere = L""; + std::wstring pathToHere = L""; AUTO_VAR(itEnd, path.end()); for( AUTO_VAR(it, path.begin()); it != itEnd; it++ ) { @@ -729,14 +729,14 @@ __int64 File::lastModified() #endif } -const wstring File::getPath() const +const std::wstring File::getPath() const { /* - wstring path; + std::wstring path; if ( parent != NULL) path = parent->getPath(); else - path = wstring(pathRoot); + path = std::wstring(pathRoot); path.push_back( pathSeparator ); path.append(m_abstractPathName); @@ -744,7 +744,7 @@ const wstring File::getPath() const return m_abstractPathName; } -wstring File::getName() const +std::wstring File::getName() const { unsigned int sep = (unsigned int )(m_abstractPathName.find_last_of( this->pathSeparator )); return m_abstractPathName.substr( sep + 1, m_abstractPathName.length() ); diff --git a/Minecraft.World/IO/Files/File.h b/Minecraft.World/IO/Files/File.h index adca156f2..c91b0c071 100644 --- a/Minecraft.World/IO/Files/File.h +++ b/Minecraft.World/IO/Files/File.h @@ -11,13 +11,13 @@ public: static const wchar_t pathSeparator; // 4J Jev, the start of the file root - static const wstring pathRoot; + static const std::wstring pathRoot; File() { m_abstractPathName = L""; } - File( const File &parent, const wstring& child ); - File( const wstring& pathname ); - File( const wstring& parent, const wstring& child ); + File( const File &parent, const std::wstring& child ); + File( const std::wstring& pathname ); + File( const std::wstring& parent, const std::wstring& child ); bool _delete(); bool mkdir() const; bool mkdirs() const; @@ -29,18 +29,18 @@ public: bool isDirectory() const; __int64 length(); __int64 lastModified(); - const wstring getPath() const; // 4J Jev: TODO - wstring getName() const; + const std::wstring getPath() const; // 4J Jev: TODO + std::wstring getName() const; static int hash_fnct(const File &k); static bool eq_test(const File &x, const File &y); private: void _init(); - wstring m_abstractPathName; + std::wstring m_abstractPathName; // 4J Jev, just helper functions, change between paths and vector - //File(vector *path); + //File(vector *path); }; struct FileKeyHash diff --git a/Minecraft.World/IO/Files/FileHeader.cpp b/Minecraft.World/IO/Files/FileHeader.cpp index 9ca4dd12b..aa4fb965a 100644 --- a/Minecraft.World/IO/Files/FileHeader.cpp +++ b/Minecraft.World/IO/Files/FileHeader.cpp @@ -24,7 +24,7 @@ FileHeader::~FileHeader() } } -FileEntry *FileHeader::AddFile( const wstring &name, unsigned int length /* = 0 */ ) +FileEntry *FileHeader::AddFile( const std::wstring &name, unsigned int length /* = 0 */ ) { assert( name.length() < 64 ); @@ -350,7 +350,7 @@ void FileHeader::AdjustStartOffsets(FileEntry *file, DWORD nNumberOfBytesToWrite } } -bool FileHeader::fileExists( const wstring &name ) +bool FileHeader::fileExists( const std::wstring &name ) { for( unsigned int i = 0; i < fileTable.size(); ++i ) { @@ -363,7 +363,7 @@ bool FileHeader::fileExists( const wstring &name ) return false; } -vector *FileHeader::getFilesWithPrefix(const wstring &prefix) +vector *FileHeader::getFilesWithPrefix(const std::wstring &prefix) { vector *files = NULL; @@ -428,9 +428,9 @@ static wchar_t* findFilenameStart(wchar_t* str) return filenameStart; } -wstring FileHeader::getPlayerDataFilenameForLoad(const PlayerUID& pUID) +std::wstring FileHeader::getPlayerDataFilenameForLoad(const PlayerUID& pUID) { - wstring retVal = L""; + std::wstring retVal = L""; vector* pFiles = getDatFilesWithOnlineID(pUID); if(!pFiles) { @@ -455,7 +455,7 @@ wstring FileHeader::getPlayerDataFilenameForLoad(const PlayerUID& pUID) return retVal; } -wstring FileHeader::getPlayerDataFilenameForSave(const PlayerUID& pUID) +std::wstring FileHeader::getPlayerDataFilenameForSave(const PlayerUID& pUID) { // check if we're online first if(pUID.isSignedIntoPSN() == false) @@ -466,14 +466,14 @@ wstring FileHeader::getPlayerDataFilenameForSave(const PlayerUID& pUID) { // we've found a previous save, use the filename from it, as it might have the online part too // assert(pFiles->size() == 1); - wstring retVal = pFiles->at(0)->data.filename; + std::wstring retVal = pFiles->at(0)->data.filename; delete pFiles; return retVal; } } // we're either online, or we can't find a previous save, so use the standard filename - wstring retVal = pUID.toString() + L".dat"; + std::wstring retVal = pUID.toString() + L".dat"; return retVal; } diff --git a/Minecraft.World/IO/Files/FileHeader.h b/Minecraft.World/IO/Files/FileHeader.h index 6a724e0a5..1a12d42ae 100644 --- a/Minecraft.World/IO/Files/FileHeader.h +++ b/Minecraft.World/IO/Files/FileHeader.h @@ -164,7 +164,7 @@ public: ~FileHeader(); protected: - FileEntry *AddFile( const wstring &name, unsigned int length = 0 ); + FileEntry *AddFile( const std::wstring &name, unsigned int length = 0 ); void RemoveFile( FileEntry * ); void WriteHeader( LPVOID saveMem ); void ReadHeader( LPVOID saveMem, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL ); @@ -175,15 +175,15 @@ protected: void AdjustStartOffsets(FileEntry *file, DWORD nNumberOfBytesToWrite, bool subtract = false); - bool fileExists( const wstring &name ); + bool fileExists( const std::wstring &name ); - vector *getFilesWithPrefix(const wstring &prefix); + vector *getFilesWithPrefix(const std::wstring &prefix); vector *getValidPlayerDatFiles(); #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID); - wstring getPlayerDataFilenameForSave(const PlayerUID& pUID); + std::wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID); + std::wstring getPlayerDataFilenameForSave(const PlayerUID& pUID); vector *getDatFilesWithOnlineID(const PlayerUID& pUID); vector *getDatFilesWithMacAndUserID(const PlayerUID& pUID); vector *getDatFilesWithPrimaryUser(); diff --git a/Minecraft.World/IO/Files/FilenameFilter.h b/Minecraft.World/IO/Files/FilenameFilter.h index f81534bd6..1f0339b5d 100644 --- a/Minecraft.World/IO/Files/FilenameFilter.h +++ b/Minecraft.World/IO/Files/FilenameFilter.h @@ -9,5 +9,5 @@ class File; class FilenameFilter { public: - virtual bool accept(File *dir, const wstring& name) = 0; + virtual bool accept(File *dir, const std::wstring& name) = 0; }; \ No newline at end of file diff --git a/Minecraft.World/IO/NBT/ByteArrayTag.h b/Minecraft.World/IO/NBT/ByteArrayTag.h index ef962d142..96827cd87 100644 --- a/Minecraft.World/IO/NBT/ByteArrayTag.h +++ b/Minecraft.World/IO/NBT/ByteArrayTag.h @@ -7,8 +7,8 @@ class ByteArrayTag : public Tag public: byteArray data; - ByteArrayTag(const wstring &name) : Tag(name) { } - ByteArrayTag(const wstring &name, byteArray data) : Tag(name) {this->data = data; } // 4J - added ownData param + ByteArrayTag(const std::wstring &name) : Tag(name) { } + ByteArrayTag(const std::wstring &name, byteArray data) : Tag(name) {this->data = data; } // 4J - added ownData param void write(DataOutput *dos) { @@ -27,11 +27,11 @@ public: uint8_t getId() { return TAG_Byte_Array; } - wstring toString() + std::wstring toString() { static wchar_t buf[32]; swprintf(buf, 32, L"[%d bytes]",data.length); - return wstring( buf ); + return std::wstring( buf ); } bool equals(Tag *obj) diff --git a/Minecraft.World/IO/NBT/ByteTag.h b/Minecraft.World/IO/NBT/ByteTag.h index a2274a6be..2e54755c9 100644 --- a/Minecraft.World/IO/NBT/ByteTag.h +++ b/Minecraft.World/IO/NBT/ByteTag.h @@ -5,18 +5,18 @@ class ByteTag : public Tag { public: uint8_t data; - ByteTag(const wstring &name) : Tag(name) {} - ByteTag(const wstring &name, uint8_t data) : Tag(name) {this->data = data; } + ByteTag(const std::wstring &name) : Tag(name) {} + ByteTag(const std::wstring &name, uint8_t data) : Tag(name) {this->data = data; } void write(DataOutput *dos) { dos->writeByte(data); } void load(DataInput *dis) { data = dis->readByte(); } uint8_t getId() { return TAG_Byte; } - wstring toString() + std::wstring toString() { static wchar_t buf[32]; swprintf(buf,32,L"%d",data); - return wstring( buf ); + return std::wstring( buf ); } bool equals(Tag *obj) diff --git a/Minecraft.World/IO/NBT/CompoundTag.h b/Minecraft.World/IO/NBT/CompoundTag.h index 244de5179..d6399fdec 100644 --- a/Minecraft.World/IO/NBT/CompoundTag.h +++ b/Minecraft.World/IO/NBT/CompoundTag.h @@ -14,16 +14,16 @@ class CompoundTag : public Tag { private: - std::unordered_map tags; + std::unordered_map tags; public: CompoundTag() : Tag(L"") {} - CompoundTag(const wstring &name) : Tag(name) {} + CompoundTag(const std::wstring &name) : Tag(name) {} void write(DataOutput *dos) { AUTO_VAR(itEnd, tags.end()); - for( std::unordered_map::iterator it = tags.begin(); it != itEnd; it++ ) + for( std::unordered_map::iterator it = tags.begin(); it != itEnd; it++ ) { Tag::writeNamedTag(it->second, dos); } @@ -48,7 +48,7 @@ public: vector *ret = new vector; AUTO_VAR(itEnd, tags.end()); - for( std::unordered_map::iterator it = tags.begin(); it != itEnd; it++ ) + for( std::unordered_map::iterator it = tags.begin(); it != itEnd; it++ ) { ret->push_back(it->second); } @@ -62,7 +62,7 @@ public: void put(const wchar_t *name, Tag *tag) { - tags[name] = tag->setName(wstring( name )); + tags[name] = tag->setName(std::wstring( name )); } void putByte(const wchar_t * name, uint8_t value) @@ -95,7 +95,7 @@ public: tags[name] = (new DoubleTag(name,value)); } - void putString(const wchar_t *name, const wstring& value) + void putString(const wchar_t *name, const std::wstring& value) { tags[name] = (new StringTag(name,value)); } @@ -112,7 +112,7 @@ public: void putCompound(const wchar_t * name, CompoundTag *value) { - tags[name] = value->setName( wstring( name ) ); + tags[name] = value->setName( std::wstring( name ) ); } void putBoolean(const wchar_t * string, bool val) @@ -168,9 +168,9 @@ public: return ((DoubleTag *) tags[name])->data; } - wstring getString(const wchar_t * name) + std::wstring getString(const wchar_t * name) { - if (tags.find(name) == tags.end()) return wstring( L"" ); + if (tags.find(name) == tags.end()) return std::wstring( L"" ); return ((StringTag *) tags[name])->data; } @@ -203,19 +203,19 @@ public: return getByte(string) != static_cast(0); } - void remove(const wstring &name) + void remove(const std::wstring &name) { AUTO_VAR(it, tags.find(name)); if(it != tags.end()) tags.erase(it); //tags.remove(name); } - wstring toString() + std::wstring toString() { static const int bufSize = 32; static wchar_t buf[bufSize]; swprintf(buf,bufSize,L"%d entries",tags.size()); - return wstring( buf ); + return std::wstring( buf ); } void print(char *prefix, ostream out) diff --git a/Minecraft.World/IO/NBT/DoubleTag.h b/Minecraft.World/IO/NBT/DoubleTag.h index 6a2104798..35e2713ac 100644 --- a/Minecraft.World/IO/NBT/DoubleTag.h +++ b/Minecraft.World/IO/NBT/DoubleTag.h @@ -6,18 +6,18 @@ class DoubleTag : public Tag { public: double data; - DoubleTag(const wstring &name) : Tag(name) {} - DoubleTag(const wstring &name, double data) : Tag(name) {this->data = data; } + DoubleTag(const std::wstring &name) : Tag(name) {} + DoubleTag(const std::wstring &name, double data) : Tag(name) {this->data = data; } void write(DataOutput *dos) { dos->writeDouble(data); } void load(DataInput *dis) { data = dis->readDouble(); } uint8_t getId() { return TAG_Double; } - wstring toString() + std::wstring toString() { static wchar_t buf[32]; swprintf(buf,32,L"%f",data); - return wstring( buf ); + return std::wstring( buf ); } Tag *copy() diff --git a/Minecraft.World/IO/NBT/EndTag.h b/Minecraft.World/IO/NBT/EndTag.h index 6ff27d535..105c8c8fa 100644 --- a/Minecraft.World/IO/NBT/EndTag.h +++ b/Minecraft.World/IO/NBT/EndTag.h @@ -5,13 +5,13 @@ class EndTag : public Tag { public: EndTag() : Tag(L"") {} - EndTag(const wstring &name) : Tag(name) {} + EndTag(const std::wstring &name) : Tag(name) {} void load(DataInput *dis) {}; void write(DataOutput *dos) {}; uint8_t getId() { return TAG_End; } - wstring toString() { return wstring( L"END" ); } + std::wstring toString() { return std::wstring( L"END" ); } Tag *copy() { diff --git a/Minecraft.World/IO/NBT/FloatTag.h b/Minecraft.World/IO/NBT/FloatTag.h index 60698bcaa..738f7e2ff 100644 --- a/Minecraft.World/IO/NBT/FloatTag.h +++ b/Minecraft.World/IO/NBT/FloatTag.h @@ -6,18 +6,18 @@ class FloatTag : public Tag { public: float data; - FloatTag(const wstring &name) : Tag(name) {} - FloatTag(const wstring &name, float data) : Tag(name) {this->data = data; } + FloatTag(const std::wstring &name) : Tag(name) {} + FloatTag(const std::wstring &name, float data) : Tag(name) {this->data = data; } void write(DataOutput *dos) { dos->writeFloat(data); } void load(DataInput *dis) { data = dis->readFloat(); } uint8_t getId() { return TAG_Float; } - wstring toString() + std::wstring toString() { static wchar_t buf[32]; swprintf(buf, 32, L"%f",data); - return wstring( buf ); + return std::wstring( buf ); } Tag *copy() diff --git a/Minecraft.World/IO/NBT/IntArrayTag.h b/Minecraft.World/IO/NBT/IntArrayTag.h index 1e7f60502..7520186fc 100644 --- a/Minecraft.World/IO/NBT/IntArrayTag.h +++ b/Minecraft.World/IO/NBT/IntArrayTag.h @@ -8,11 +8,11 @@ class IntArrayTag : public Tag public: intArray data; - IntArrayTag(const wstring &name) : Tag(name) + IntArrayTag(const std::wstring &name) : Tag(name) { } - IntArrayTag(const wstring &name, intArray data) : Tag(name) + IntArrayTag(const std::wstring &name, intArray data) : Tag(name) { this->data = data; } @@ -40,11 +40,11 @@ public: uint8_t getId() { return TAG_Int_Array; } - wstring toString() + std::wstring toString() { static wchar_t buf[32]; swprintf(buf, 32, L"[%d bytes]",data.length); - return wstring( buf ); + return std::wstring( buf ); } bool equals(Tag *obj) diff --git a/Minecraft.World/IO/NBT/IntTag.h b/Minecraft.World/IO/NBT/IntTag.h index 6694f2e0a..9dc9aaf25 100644 --- a/Minecraft.World/IO/NBT/IntTag.h +++ b/Minecraft.World/IO/NBT/IntTag.h @@ -5,18 +5,18 @@ class IntTag : public Tag { public: int data; - IntTag(const wstring &name) : Tag(name) {} - IntTag(const wstring &name, int data) : Tag(name) {this->data = data; } + IntTag(const std::wstring &name) : Tag(name) {} + IntTag(const std::wstring &name, int data) : Tag(name) {this->data = data; } void write(DataOutput *dos) { dos->writeInt(data); } void load(DataInput *dis) { data = dis->readInt(); } uint8_t getId() { return TAG_Int; } - wstring toString() + std::wstring toString() { static wchar_t buf[32]; swprintf(buf, 32, L"%d", data); - return wstring( buf ); + return std::wstring( buf ); } Tag *copy() diff --git a/Minecraft.World/IO/NBT/ListTag.h b/Minecraft.World/IO/NBT/ListTag.h index fd077328d..4ab8938fd 100644 --- a/Minecraft.World/IO/NBT/ListTag.h +++ b/Minecraft.World/IO/NBT/ListTag.h @@ -10,7 +10,7 @@ private: public: ListTag() : Tag(L"") {} - ListTag(const wstring &name) : Tag(name) {} + ListTag(const std::wstring &name) : Tag(name) {} void write(DataOutput *dos) { @@ -40,11 +40,11 @@ public: uint8_t getId() { return TAG_List; } - wstring toString() + std::wstring toString() { static wchar_t buf[64]; swprintf(buf,64,L"%d entries of type %ls",list.size(),Tag::getTagName(type)); - return wstring( buf ); + return std::wstring( buf ); } void print(char *prefix, ostream out) diff --git a/Minecraft.World/IO/NBT/LongTag.h b/Minecraft.World/IO/NBT/LongTag.h index a5bc079fc..126a102f2 100644 --- a/Minecraft.World/IO/NBT/LongTag.h +++ b/Minecraft.World/IO/NBT/LongTag.h @@ -5,18 +5,18 @@ class LongTag : public Tag { public: __int64 data; - LongTag(const wstring &name) : Tag(name) {} - LongTag(const wstring &name, __int64 data) : Tag(name) {this->data = data; } + LongTag(const std::wstring &name) : Tag(name) {} + LongTag(const std::wstring &name, __int64 data) : Tag(name) {this->data = data; } void write(DataOutput *dos) { dos->writeLong(data); } void load(DataInput *dis) { data = dis->readLong(); } uint8_t getId() { return TAG_Long; } - wstring toString() + std::wstring toString() { static wchar_t buf[32]; swprintf(buf,32,L"%I64d",data); - return wstring(buf); + return std::wstring(buf); } Tag *copy() diff --git a/Minecraft.World/IO/NBT/ShortTag.h b/Minecraft.World/IO/NBT/ShortTag.h index 285a287b4..2f04501d6 100644 --- a/Minecraft.World/IO/NBT/ShortTag.h +++ b/Minecraft.World/IO/NBT/ShortTag.h @@ -5,18 +5,18 @@ class ShortTag : public Tag { public: short data; - ShortTag(const wstring &name) : Tag(name) {} - ShortTag(const wstring &name, int data) : Tag(name) {this->data = data; } + ShortTag(const std::wstring &name) : Tag(name) {} + ShortTag(const std::wstring &name, int data) : Tag(name) {this->data = data; } void write(DataOutput *dos) { dos->writeShort(data); } void load(DataInput *dis) { data = dis->readShort(); } uint8_t getId() { return TAG_Short; } - wstring toString() + std::wstring toString() { static wchar_t buf[32]; swprintf(buf,32,L"%d",data); - return wstring( buf ); + return std::wstring( buf ); } Tag *copy() diff --git a/Minecraft.World/IO/NBT/StringTag.h b/Minecraft.World/IO/NBT/StringTag.h index a1dad58f5..17a4a286b 100644 --- a/Minecraft.World/IO/NBT/StringTag.h +++ b/Minecraft.World/IO/NBT/StringTag.h @@ -4,9 +4,9 @@ class StringTag : public Tag { public: - wstring data; - StringTag(const wstring &name) : Tag(name) {} - StringTag(const wstring &name, const wstring& data) : Tag(name) {this->data = data; } + std::wstring data; + StringTag(const std::wstring &name) : Tag(name) {} + StringTag(const std::wstring &name, const std::wstring& data) : Tag(name) {this->data = data; } void write(DataOutput *dos) { @@ -20,7 +20,7 @@ public: uint8_t getId() { return TAG_String; } - wstring toString() + std::wstring toString() { return data; } diff --git a/Minecraft.World/IO/NBT/Tag.cpp b/Minecraft.World/IO/NBT/Tag.cpp index a09a9958f..28cfcdf11 100644 --- a/Minecraft.World/IO/NBT/Tag.cpp +++ b/Minecraft.World/IO/NBT/Tag.cpp @@ -12,7 +12,7 @@ #include "ListTag.h" #include "CompoundTag.h" -Tag::Tag(const wstring &name) +Tag::Tag(const std::wstring &name) { if (name.empty()) { @@ -54,7 +54,7 @@ void Tag::print(ostream out) void Tag::print(char *prefix, wostream out) { - wstring name = getName(); + std::wstring name = getName(); out << prefix; out << getTagName(getId()); @@ -66,12 +66,12 @@ void Tag::print(char *prefix, wostream out) out << toString() << endl; } -wstring Tag::getName() +std::wstring Tag::getName() { return name; } -Tag *Tag::setName(const wstring& name) +Tag *Tag::setName(const std::wstring& name) { this->name = name; return this; @@ -92,7 +92,7 @@ Tag *Tag::readNamedTag(DataInput *dis) return new EndTag(); } - wstring name = dis->readUTF();//new String(bytes, "UTF-8"); + std::wstring name = dis->readUTF();//new String(bytes, "UTF-8"); Tag *tag = newTag(type, name); // short length = dis.readShort(); @@ -116,7 +116,7 @@ void Tag::writeNamedTag(Tag *tag, DataOutput *dos) tag->write(dos); } -Tag *Tag::newTag(uint8_t type, const wstring &name) +Tag *Tag::newTag(uint8_t type, const std::wstring &name) { switch (type) { diff --git a/Minecraft.World/IO/NBT/Tag.h b/Minecraft.World/IO/NBT/Tag.h index a2e0b2af6..2c00d4e88 100644 --- a/Minecraft.World/IO/NBT/Tag.h +++ b/Minecraft.World/IO/NBT/Tag.h @@ -21,23 +21,23 @@ public: static const uint8_t TAG_Int_Array = static_cast(11); private: - wstring name; + std::wstring name; protected: - Tag(const wstring &name); + Tag(const std::wstring &name); public: virtual void write(DataOutput *dos) = 0; virtual void load(DataInput *dis) = 0; - virtual wstring toString() = 0; + virtual std::wstring toString() = 0; virtual uint8_t getId() = 0; void print(ostream out); void print(char *prefix, wostream out); - wstring getName(); - Tag *setName(const wstring& name); + std::wstring getName(); + Tag *setName(const std::wstring& name); static Tag *readNamedTag(DataInput *dis); static void writeNamedTag(Tag *tag, DataOutput *dos); - static Tag *newTag(uint8_t type, const wstring &name); + static Tag *newTag(uint8_t type, const std::wstring &name); static const wchar_t *getTagName(uint8_t type); virtual ~Tag() {} virtual bool equals(Tag *obj); // 4J Brought forward from 1.2 diff --git a/Minecraft.World/IO/Streams/BufferedReader.cpp b/Minecraft.World/IO/Streams/BufferedReader.cpp index 25f98cd45..5e2871057 100644 --- a/Minecraft.World/IO/Streams/BufferedReader.cpp +++ b/Minecraft.World/IO/Streams/BufferedReader.cpp @@ -136,9 +136,9 @@ int BufferedReader::read(wchar_t cbuf[], unsigned int off, unsigned int len) //or a carriage return followed immediately by a linefeed. //Returns: //A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached -wstring BufferedReader::readLine() +std::wstring BufferedReader::readLine() { - wstring output = L""; + std::wstring output = L""; bool newLineCharFound = false; while( readMark < bufferedMark ) diff --git a/Minecraft.World/IO/Streams/BufferedReader.h b/Minecraft.World/IO/Streams/BufferedReader.h index b2f7fc676..780a76b09 100644 --- a/Minecraft.World/IO/Streams/BufferedReader.h +++ b/Minecraft.World/IO/Streams/BufferedReader.h @@ -23,5 +23,5 @@ public: virtual void close(); virtual int read(); virtual int read(wchar_t cbuf[], unsigned int off, unsigned int len); - wstring readLine(); + std::wstring readLine(); }; \ No newline at end of file diff --git a/Minecraft.World/IO/Streams/DataInput.h b/Minecraft.World/IO/Streams/DataInput.h index 2b2e341c0..76a8075bc 100644 --- a/Minecraft.World/IO/Streams/DataInput.h +++ b/Minecraft.World/IO/Streams/DataInput.h @@ -16,7 +16,7 @@ public: virtual __int64 readLong() = 0; virtual short readShort() = 0; virtual wchar_t readChar() = 0; - virtual wstring readUTF() = 0; + virtual std::wstring readUTF() = 0; virtual PlayerUID readPlayerUID() = 0; // 4J Added virtual int skipBytes(int n) = 0; }; diff --git a/Minecraft.World/IO/Streams/DataInputStream.cpp b/Minecraft.World/IO/Streams/DataInputStream.cpp index 9aa78a335..00c948fcd 100644 --- a/Minecraft.World/IO/Streams/DataInputStream.cpp +++ b/Minecraft.World/IO/Streams/DataInputStream.cpp @@ -354,9 +354,9 @@ short DataInputStream::readShort() // //Returns: //a Unicode string. -wstring DataInputStream::readUTF() +std::wstring DataInputStream::readUTF() { - wstring outputString; + std::wstring outputString; if (stream == NULL) { app.DebugPrintf("DataInputStream::readUTF() but underlying stream is NULL\n"); diff --git a/Minecraft.World/IO/Streams/DataInputStream.h b/Minecraft.World/IO/Streams/DataInputStream.h index a70b16907..fd039177e 100644 --- a/Minecraft.World/IO/Streams/DataInputStream.h +++ b/Minecraft.World/IO/Streams/DataInputStream.h @@ -26,7 +26,7 @@ public: virtual int readInt(); virtual __int64 readLong(); virtual short readShort(); - virtual wstring readUTF(); + virtual std::wstring readUTF(); void deleteChildStream(); virtual int readUTFChar(); virtual PlayerUID readPlayerUID(); // 4J Added diff --git a/Minecraft.World/IO/Streams/DataOutput.h b/Minecraft.World/IO/Streams/DataOutput.h index 9df3dd957..183aa62ad 100644 --- a/Minecraft.World/IO/Streams/DataOutput.h +++ b/Minecraft.World/IO/Streams/DataOutput.h @@ -14,7 +14,7 @@ public: virtual void writeShort(short a) = 0; virtual void writeBoolean(bool v) = 0; virtual void writeChar(wchar_t v) = 0; - virtual void writeChars(const wstring& s) = 0; - virtual void writeUTF(const wstring& a) = 0; + virtual void writeChars(const std::wstring& s) = 0; + virtual void writeUTF(const std::wstring& a) = 0; virtual void writePlayerUID(PlayerUID player) = 0; // 4J Added }; \ No newline at end of file diff --git a/Minecraft.World/IO/Streams/DataOutputStream.cpp b/Minecraft.World/IO/Streams/DataOutputStream.cpp index 41feda0be..f7e9585b2 100644 --- a/Minecraft.World/IO/Streams/DataOutputStream.cpp +++ b/Minecraft.World/IO/Streams/DataOutputStream.cpp @@ -159,7 +159,7 @@ void DataOutputStream::writeChar( wchar_t v ) //If no exception is thrown, the counter written is incremented by twice the length of s. //Parameters: //s - a String value to be written. -void DataOutputStream::writeChars(const wstring& str) +void DataOutputStream::writeChars(const std::wstring& str) { for( unsigned int i = 0; i < str.length(); i++) { @@ -189,7 +189,7 @@ void DataOutputStream::writeBoolean(bool b) //This will be at least two plus the length of str, and at most two plus thrice the length of str. //Parameters: //str - a string to be written. -void DataOutputStream::writeUTF(const wstring& str) +void DataOutputStream::writeUTF(const std::wstring& str) { int strlen = (int)str.length(); int utflen = 0; diff --git a/Minecraft.World/IO/Streams/DataOutputStream.h b/Minecraft.World/IO/Streams/DataOutputStream.h index dcb81cd6d..60163701c 100644 --- a/Minecraft.World/IO/Streams/DataOutputStream.h +++ b/Minecraft.World/IO/Streams/DataOutputStream.h @@ -29,9 +29,9 @@ public: virtual void writeLong(__int64 a); virtual void writeShort(short a); virtual void writeChar(wchar_t a); - virtual void writeChars(const wstring& a); + virtual void writeChars(const std::wstring& a); virtual void writeBoolean(bool b); - virtual void writeUTF(const wstring& a); + virtual void writeUTF(const std::wstring& a); virtual void writePlayerUID(PlayerUID player); virtual void flush(); }; \ No newline at end of file diff --git a/Minecraft.World/IO/Streams/InputStream.cpp b/Minecraft.World/IO/Streams/InputStream.cpp index 2605cd365..15d621007 100644 --- a/Minecraft.World/IO/Streams/InputStream.cpp +++ b/Minecraft.World/IO/Streams/InputStream.cpp @@ -3,7 +3,7 @@ #include "InputOutputStream.h" #include "InputStream.h" -InputStream *InputStream::getResourceAsStream(const wstring &fileName) +InputStream *InputStream::getResourceAsStream(const std::wstring &fileName) { return new FileInputStream( File( fileName ) ); } \ No newline at end of file diff --git a/Minecraft.World/IO/Streams/InputStream.h b/Minecraft.World/IO/Streams/InputStream.h index af0ff5934..477d52df8 100644 --- a/Minecraft.World/IO/Streams/InputStream.h +++ b/Minecraft.World/IO/Streams/InputStream.h @@ -13,5 +13,5 @@ public: virtual void close() = 0; virtual __int64 skip(__int64 n) = 0; - static InputStream *getResourceAsStream(const wstring &fileName); + static InputStream *getResourceAsStream(const std::wstring &fileName); }; \ No newline at end of file diff --git a/Minecraft.World/Items/ArmorItem.cpp b/Minecraft.World/Items/ArmorItem.cpp index 71ac4b01d..ba634db13 100644 --- a/Minecraft.World/Items/ArmorItem.cpp +++ b/Minecraft.World/Items/ArmorItem.cpp @@ -9,11 +9,11 @@ const int ArmorItem::healthPerSlot[] = { 11, 16, 15, 13 }; -const wstring ArmorItem::LEATHER_OVERLAYS[] = { +const std::wstring ArmorItem::LEATHER_OVERLAYS[] = { L"helmetCloth_overlay", L"chestplateCloth_overlay", L"leggingsCloth_overlay", L"bootsCloth_overlay" }; -const wstring ArmorItem::TEXTURE_EMPTY_SLOTS[] = { +const std::wstring ArmorItem::TEXTURE_EMPTY_SLOTS[] = { L"slot_empty_helmet", L"slot_empty_chestplate", L"slot_empty_leggings", L"slot_empty_boots" }; diff --git a/Minecraft.World/Items/ArmorItem.h b/Minecraft.World/Items/ArmorItem.h index 04b483e25..ed5746c7c 100644 --- a/Minecraft.World/Items/ArmorItem.h +++ b/Minecraft.World/Items/ArmorItem.h @@ -13,10 +13,10 @@ public: private: static const int healthPerSlot[]; - static const wstring LEATHER_OVERLAYS[] ; + static const std::wstring LEATHER_OVERLAYS[] ; public: - static const wstring TEXTURE_EMPTY_SLOTS[]; + static const std::wstring TEXTURE_EMPTY_SLOTS[]; public: class ArmorMaterial diff --git a/Minecraft.World/Items/BowItem.cpp b/Minecraft.World/Items/BowItem.cpp index d052b2f87..06c52c670 100644 --- a/Minecraft.World/Items/BowItem.cpp +++ b/Minecraft.World/Items/BowItem.cpp @@ -8,7 +8,7 @@ #include "BowItem.h" #include "../Util/SoundTypes.h" -const wstring BowItem::TEXTURE_PULL[] = {L"bow_pull_0", L"bow_pull_1", L"bow_pull_2"}; +const std::wstring BowItem::TEXTURE_PULL[] = {L"bow_pull_0", L"bow_pull_1", L"bow_pull_2"}; BowItem::BowItem(int id) : Item( id ) { diff --git a/Minecraft.World/Items/BowItem.h b/Minecraft.World/Items/BowItem.h index 76b795f98..1c28494ca 100644 --- a/Minecraft.World/Items/BowItem.h +++ b/Minecraft.World/Items/BowItem.h @@ -8,7 +8,7 @@ class Level; class BowItem : public Item { public: - static const wstring TEXTURE_PULL[]; + static const std::wstring TEXTURE_PULL[]; static const int MAX_DRAW_DURATION = 20 * 1; private: diff --git a/Minecraft.World/Items/ClockItem.cpp b/Minecraft.World/Items/ClockItem.cpp index 33c249906..9e8a6d551 100644 --- a/Minecraft.World/Items/ClockItem.cpp +++ b/Minecraft.World/Items/ClockItem.cpp @@ -5,9 +5,9 @@ #include "../Headers/net.minecraft.world.h" #ifdef __PSVITA__ -const wstring ClockItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"clockP0"}; +const std::wstring ClockItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"clockP0"}; #else -const wstring ClockItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"clockP0",L"clockP1",L"clockP2",L"clockP3"}; +const std::wstring ClockItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"clockP0",L"clockP1",L"clockP2",L"clockP3"}; #endif ClockItem::ClockItem(int id) : Item(id) diff --git a/Minecraft.World/Items/ClockItem.h b/Minecraft.World/Items/ClockItem.h index 3ee4b5a46..3b268422b 100644 --- a/Minecraft.World/Items/ClockItem.h +++ b/Minecraft.World/Items/ClockItem.h @@ -7,7 +7,7 @@ class ClockItem : public Item { private: Icon **icons; - static const wstring TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT]; + static const std::wstring TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT]; public: ClockItem(int id); diff --git a/Minecraft.World/Items/CompassItem.cpp b/Minecraft.World/Items/CompassItem.cpp index d81646d25..20b1d9d3d 100644 --- a/Minecraft.World/Items/CompassItem.cpp +++ b/Minecraft.World/Items/CompassItem.cpp @@ -5,9 +5,9 @@ #include "../Headers/net.minecraft.world.h" #ifdef __PSVITA__ -const wstring CompassItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"compassP0"}; +const std::wstring CompassItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"compassP0"}; #else -const wstring CompassItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"compassP0",L"compassP1",L"compassP2",L"compassP3"}; +const std::wstring CompassItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"compassP0",L"compassP1",L"compassP2",L"compassP3"}; #endif CompassItem::CompassItem(int id) : Item(id) diff --git a/Minecraft.World/Items/CompassItem.h b/Minecraft.World/Items/CompassItem.h index b975144ac..83399f609 100644 --- a/Minecraft.World/Items/CompassItem.h +++ b/Minecraft.World/Items/CompassItem.h @@ -7,7 +7,7 @@ class CompassItem : public Item { private: Icon **icons; - static const wstring TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT]; + static const std::wstring TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT]; public: CompassItem(int id); diff --git a/Minecraft.World/Items/DyePowderItem.cpp b/Minecraft.World/Items/DyePowderItem.cpp index f9a038033..0251593fb 100644 --- a/Minecraft.World/Items/DyePowderItem.cpp +++ b/Minecraft.World/Items/DyePowderItem.cpp @@ -61,7 +61,7 @@ const unsigned int DyePowderItem::COLOR_USE_DESCS[] = IDS_DESC_DYE_WHITE }; -const wstring DyePowderItem::COLOR_TEXTURES[] = +const std::wstring DyePowderItem::COLOR_TEXTURES[] = { L"dyePowder_black", L"dyePowder_red", L"dyePowder_green", L"dyePowder_brown", L"dyePowder_blue", L"dyePowder_purple", L"dyePowder_cyan", L"dyePowder_silver", L"dyePowder_gray", L"dyePowder_pink", L"dyePowder_lime", L"dyePowder_yellow", L"dyePowder_lightBlue", L"dyePowder_magenta", L"dyePowder_orange", L"dyePowder_white"}; diff --git a/Minecraft.World/Items/DyePowderItem.h b/Minecraft.World/Items/DyePowderItem.h index df6147b90..694960663 100644 --- a/Minecraft.World/Items/DyePowderItem.h +++ b/Minecraft.World/Items/DyePowderItem.h @@ -12,7 +12,7 @@ class DyePowderItem : public Item public: static const unsigned int COLOR_DESCS[]; static const unsigned int COLOR_USE_DESCS[]; - static const wstring COLOR_TEXTURES[]; + static const std::wstring COLOR_TEXTURES[]; static const int COLOR_RGB[]; static const int BLACK; diff --git a/Minecraft.World/Items/EnchantedBookItem.cpp b/Minecraft.World/Items/EnchantedBookItem.cpp index 963646a89..3ca10d75e 100644 --- a/Minecraft.World/Items/EnchantedBookItem.cpp +++ b/Minecraft.World/Items/EnchantedBookItem.cpp @@ -4,7 +4,7 @@ #include "../Util/WeighedTreasure.h" #include "EnchantedBookItem.h" -const wstring EnchantedBookItem::TAG_STORED_ENCHANTMENTS = L"StoredEnchantments"; +const std::wstring EnchantedBookItem::TAG_STORED_ENCHANTMENTS = L"StoredEnchantments"; EnchantedBookItem::EnchantedBookItem(int id) : Item(id) { @@ -43,7 +43,7 @@ ListTag *EnchantedBookItem::getEnchantments(std::shared_ptr *) item->tag->get((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str()); } -void EnchantedBookItem::appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) +void EnchantedBookItem::appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) { Item::appendHoverText(itemInstance, player, lines, advanced, unformattedStrings); @@ -51,7 +51,7 @@ void EnchantedBookItem::appendHoverText(std::shared_ptr itemInstan if (list != NULL) { - wstring unformatted = L""; + std::wstring unformatted = L""; for (int i = 0; i < list->size(); i++) { int type = list->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_ID); diff --git a/Minecraft.World/Items/EnchantedBookItem.h b/Minecraft.World/Items/EnchantedBookItem.h index 5b642b72c..e16adc9ba 100644 --- a/Minecraft.World/Items/EnchantedBookItem.h +++ b/Minecraft.World/Items/EnchantedBookItem.h @@ -7,7 +7,7 @@ class EnchantmentInstance; class EnchantedBookItem : public Item { public: - static const wstring TAG_STORED_ENCHANTMENTS; + static const std::wstring TAG_STORED_ENCHANTMENTS; EnchantedBookItem(int id); @@ -15,7 +15,7 @@ public: bool isEnchantable(std::shared_ptr itemInstance); const Rarity *getRarity(std::shared_ptr itemInstance); ListTag *getEnchantments(std::shared_ptr item); - void appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); + void appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); void addEnchantment(std::shared_ptr item, EnchantmentInstance *enchantment); std::shared_ptr createForEnchantment(EnchantmentInstance *enchant); void createForEnchantment(Enchantment *enchant, vector > *items); diff --git a/Minecraft.World/Items/FishingRodItem.cpp b/Minecraft.World/Items/FishingRodItem.cpp index b9d4f49ea..a709bf81f 100644 --- a/Minecraft.World/Items/FishingRodItem.cpp +++ b/Minecraft.World/Items/FishingRodItem.cpp @@ -13,7 +13,7 @@ #include "FishingRodItem.h" #include "../Util/SoundTypes.h" -const wstring FishingRodItem::TEXTURE_EMPTY = L"fishingRod_empty"; +const std::wstring FishingRodItem::TEXTURE_EMPTY = L"fishingRod_empty"; FishingRodItem::FishingRodItem(int id) : Item(id) { diff --git a/Minecraft.World/Items/FishingRodItem.h b/Minecraft.World/Items/FishingRodItem.h index 42c02eb55..2d16d6b1e 100644 --- a/Minecraft.World/Items/FishingRodItem.h +++ b/Minecraft.World/Items/FishingRodItem.h @@ -9,7 +9,7 @@ class Level; class FishingRodItem : public Item { public: - static const wstring TEXTURE_EMPTY; + static const std::wstring TEXTURE_EMPTY; private: Icon *emptyIcon; diff --git a/Minecraft.World/Items/Item.cpp b/Minecraft.World/Items/Item.cpp index 84c42ebc8..14b841f6e 100644 --- a/Minecraft.World/Items/Item.cpp +++ b/Minecraft.World/Items/Item.cpp @@ -17,7 +17,7 @@ typedef Item::Tier _Tier; -wstring Item::ICON_DESCRIPTION_PREFIX = L"item."; +std::wstring Item::ICON_DESCRIPTION_PREFIX = L"item."; const _Tier *_Tier::WOOD = new _Tier(0, 59, 2, 0, 15); // const _Tier *_Tier::STONE = new _Tier(1, 131, 4, 1, 5); // @@ -582,7 +582,7 @@ int Item::getMaterial() return this->m_iMaterial; } -Item *Item::setTextureName(const wstring &name) +Item *Item::setTextureName(const std::wstring &name) { m_textureName = name; @@ -812,7 +812,7 @@ bool Item::hasCraftingRemainingItem() return craftingRemainingItem != NULL; } -wstring Item::getName() +std::wstring Item::getName() { return L"";//I18n::get(getDescriptionId() + L".name"); } @@ -848,13 +848,13 @@ void Item::releaseUsing(std::shared_ptr itemInstance, Level *level { } -Item *Item::setPotionBrewingFormula(const wstring &potionBrewingFormula) +Item *Item::setPotionBrewingFormula(const std::wstring &potionBrewingFormula) { this->potionBrewingFormula = potionBrewingFormula; return this; } -wstring Item::getPotionBrewingFormula() +std::wstring Item::getPotionBrewingFormula() { return potionBrewingFormula; } @@ -864,11 +864,11 @@ bool Item::hasPotionBrewingFormula() return !potionBrewingFormula.empty(); } -void Item::appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) +void Item::appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) { } -wstring Item::getHoverName(std::shared_ptr itemInstance) +std::wstring Item::getHoverName(std::shared_ptr itemInstance) { //String elementName = ("" + Language.getInstance().getElementName(getDescription(itemInstance))).trim(); //return elementName; diff --git a/Minecraft.World/Items/Item.h b/Minecraft.World/Items/Item.h index 8cd7ac846..80a5a9fd0 100644 --- a/Minecraft.World/Items/Item.h +++ b/Minecraft.World/Items/Item.h @@ -129,7 +129,7 @@ public: protected: static const int ICON_COLUMNS = ITEM_ICON_COLUMNS; - static wstring ICON_DESCRIPTION_PREFIX; // 4J Stu - Was const but we have to static initialise it outside of this class + static std::wstring ICON_DESCRIPTION_PREFIX; // 4J Stu - Was const but we have to static initialise it outside of this class public: @@ -595,7 +595,7 @@ protected: private: Item *craftingRemainingItem; - wstring potionBrewingFormula; + std::wstring potionBrewingFormula; // 4J Stu - A value from strings.h, that is the name of the item unsigned int descriptionId; @@ -603,14 +603,14 @@ private: // 4J Stu - A value from strings.h that says what this does unsigned int useDescriptionId; - wstring m_textureName; + std::wstring m_textureName; protected: Item(int id); public: // 4J Using per-item textures now - Item *setTextureName(const wstring &name); + Item *setTextureName(const std::wstring &name); Item *setMaxStackSize(int max); Item *setBaseItemTypeAndMaterial(int iType,int iMaterial); int getBaseItemType(); @@ -695,13 +695,13 @@ public: virtual void releaseUsing(std::shared_ptr itemInstance, Level *level, std::shared_ptr player, int durationLeft); protected: - virtual Item *setPotionBrewingFormula(const wstring &potionBrewingFormula); + virtual Item *setPotionBrewingFormula(const std::wstring &potionBrewingFormula); public: - virtual wstring getPotionBrewingFormula(); + virtual std::wstring getPotionBrewingFormula(); virtual bool hasPotionBrewingFormula(); - virtual void appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); // 4J Added unformattedStrings - virtual wstring getHoverName(std::shared_ptr itemInstance); + virtual void appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); // 4J Added unformattedStrings + virtual std::wstring getHoverName(std::shared_ptr itemInstance); virtual bool isFoil(std::shared_ptr itemInstance); virtual const Rarity *getRarity(std::shared_ptr itemInstance); virtual bool isEnchantable(std::shared_ptr itemInstance); diff --git a/Minecraft.World/Items/ItemInstance.cpp b/Minecraft.World/Items/ItemInstance.cpp index 8b091b5de..fbafb34b8 100644 --- a/Minecraft.World/Items/ItemInstance.cpp +++ b/Minecraft.World/Items/ItemInstance.cpp @@ -389,7 +389,7 @@ std::shared_ptr ItemInstance::clone(std::shared_ptr return item == NULL ? nullptr : item->copy(); } -wstring ItemInstance::toString() +std::wstring ItemInstance::toString() { //return count + "x" + Item::items[id]->getDescriptionId() + "@" + auxValue; @@ -470,9 +470,9 @@ void ItemInstance::setTag(CompoundTag *tag) this->tag = tag; } -wstring ItemInstance::getHoverName() +std::wstring ItemInstance::getHoverName() { - wstring title = getItem()->getHoverName(shared_from_this()); + std::wstring title = getItem()->getHoverName(shared_from_this()); if (tag != NULL && tag->contains(L"display")) { @@ -487,7 +487,7 @@ wstring ItemInstance::getHoverName() return title; } -void ItemInstance::setHoverName(const wstring &name) +void ItemInstance::setHoverName(const std::wstring &name) { if (tag == NULL) tag = new CompoundTag(); if (!tag->contains(L"display")) tag->putCompound(L"display", new CompoundTag()); @@ -501,11 +501,11 @@ bool ItemInstance::hasCustomHoverName() return tag->getCompound(L"display")->contains(L"Name"); } -vector *ItemInstance::getHoverText(std::shared_ptr player, bool advanced, vector &unformattedStrings) +vector *ItemInstance::getHoverText(std::shared_ptr player, bool advanced, vector &unformattedStrings) { - vector *lines = new vector(); + vector *lines = new vector(); Item *item = Item::items[id]; - wstring title = getHoverName(); + std::wstring title = getHoverName(); // 4J Stu - We don't do italics, but do change colour. But handle this later in the process due to text length measuring on the Xbox360 //if (hasCustomHoverName()) @@ -557,7 +557,7 @@ vector *ItemInstance::getHoverText(std::shared_ptr player, bool if (Enchantment::enchantments[type] != NULL) { - wstring unformatted = L""; + std::wstring unformatted = L""; lines->push_back(Enchantment::enchantments[type]->getFullname(level, unformatted)); unformattedStrings.push_back(unformatted); } @@ -568,9 +568,9 @@ vector *ItemInstance::getHoverText(std::shared_ptr player, bool } // 4J Added -vector *ItemInstance::getHoverTextOnly(std::shared_ptr player, bool advanced, vector &unformattedStrings) +vector *ItemInstance::getHoverTextOnly(std::shared_ptr player, bool advanced, vector &unformattedStrings) { - vector *lines = new vector(); + vector *lines = new vector(); Item *item = Item::items[id]; item->appendHoverText(shared_from_this(), player, lines, advanced, unformattedStrings); @@ -587,7 +587,7 @@ vector *ItemInstance::getHoverTextOnly(std::shared_ptr player, if (Enchantment::enchantments[type] != NULL) { - wstring unformatted = L""; + std::wstring unformatted = L""; lines->push_back(Enchantment::enchantments[type]->getFullname(level,unformatted)); unformattedStrings.push_back(unformatted); } @@ -632,7 +632,7 @@ bool ItemInstance::isEnchanted() return false; } -void ItemInstance::addTagElement(wstring name, Tag *tag) +void ItemInstance::addTagElement(std::wstring name, Tag *tag) { if (this->tag == NULL) { diff --git a/Minecraft.World/Items/ItemInstance.h b/Minecraft.World/Items/ItemInstance.h index 82f6e4a53..e04901312 100644 --- a/Minecraft.World/Items/ItemInstance.h +++ b/Minecraft.World/Items/ItemInstance.h @@ -112,7 +112,7 @@ public: virtual unsigned int getDescriptionId(int iData = -1); virtual ItemInstance *setDescriptionId(unsigned int id); static std::shared_ptr clone(std::shared_ptr item); - wstring toString(); + std::wstring toString(); void inventoryTick(Level *level, std::shared_ptr owner, int slot, bool selected); void onCraftedBy(Level *level, std::shared_ptr player, int craftCount); bool equals(std::shared_ptr ii); @@ -126,17 +126,17 @@ public: CompoundTag *getTag(); ListTag *getEnchantmentTags(); void setTag(CompoundTag *tag); - wstring getHoverName(); - void setHoverName(const wstring &name); + std::wstring getHoverName(); + void setHoverName(const std::wstring &name); bool hasCustomHoverName(); - vector *getHoverText(std::shared_ptr player, bool advanced, vector &unformattedStrings); - vector *getHoverTextOnly(std::shared_ptr player, bool advanced, vector &unformattedStrings); // 4J Added + vector *getHoverText(std::shared_ptr player, bool advanced, vector &unformattedStrings); + vector *getHoverTextOnly(std::shared_ptr player, bool advanced, vector &unformattedStrings); // 4J Added bool isFoil(); const Rarity *getRarity(); bool isEnchantable(); void enchant(const Enchantment *enchantment, int level); bool isEnchanted(); - void addTagElement(wstring name, Tag *tag); + void addTagElement(std::wstring name, Tag *tag); // 4J Added void set4JData(int data); diff --git a/Minecraft.World/Items/MapItem.cpp b/Minecraft.World/Items/MapItem.cpp index e15558f8e..805a99259 100644 --- a/Minecraft.World/Items/MapItem.cpp +++ b/Minecraft.World/Items/MapItem.cpp @@ -21,7 +21,7 @@ MapItem::MapItem(int id) : ComplexItem(id) std::shared_ptr MapItem::getSavedData(short idNum, Level *level) { - std::wstring id = wstring( L"map_" ) + _toString(idNum); + std::wstring id = std::wstring( L"map_" ) + _toString(idNum); std::shared_ptr mapItemSavedData = dynamic_pointer_cast(level->getSavedData(typeid(MapItemSavedData), id)); if (mapItemSavedData == NULL) @@ -31,7 +31,7 @@ std::shared_ptr MapItem::getSavedData(short idNum, Level *leve //int aux = level->getFreeAuxValueFor(L"map"); int aux = idNum; - id = wstring( L"map_" ) + _toString(aux); + id = std::wstring( L"map_" ) + _toString(aux); mapItemSavedData = std::shared_ptr( new MapItemSavedData(id) ); level->setSavedData(id, (std::shared_ptr ) mapItemSavedData); @@ -43,7 +43,7 @@ std::shared_ptr MapItem::getSavedData(short idNum, Level *leve std::shared_ptr MapItem::getSavedData(std::shared_ptr itemInstance, Level *level) { MemSect(31); - std::wstring id = wstring( L"map_" ) + _toString(itemInstance->getAuxValue() ); + std::wstring id = std::wstring( L"map_" ) + _toString(itemInstance->getAuxValue() ); MemSect(0); std::shared_ptr mapItemSavedData = dynamic_pointer_cast( level->getSavedData(typeid(MapItemSavedData), id ) ); @@ -54,7 +54,7 @@ std::shared_ptr MapItem::getSavedData(std::shared_ptrsetAuxValue(level->getFreeAuxValueFor(L"map")); - id = wstring( L"map_" ) + _toString(itemInstance->getAuxValue() ); + id = std::wstring( L"map_" ) + _toString(itemInstance->getAuxValue() ); mapItemSavedData = std::shared_ptr( new MapItemSavedData(id) ); newData = true; @@ -316,7 +316,7 @@ void MapItem::onCraftedBy(std::shared_ptr itemInstance, Level *lev itemInstance->setAuxValue(level->getAuxValueForMap(player->getXuid(), player->dimension, centreXC, centreZC, mapScale)); swprintf(buf,64,L"map_%d", itemInstance->getAuxValue()); - std::wstring id = wstring(buf); + std::wstring id = std::wstring(buf); std::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 diff --git a/Minecraft.World/Items/MonsterPlacerItem.cpp b/Minecraft.World/Items/MonsterPlacerItem.cpp index bdfea35c1..ed4c4435b 100644 --- a/Minecraft.World/Items/MonsterPlacerItem.cpp +++ b/Minecraft.World/Items/MonsterPlacerItem.cpp @@ -18,9 +18,9 @@ MonsterPlacerItem::MonsterPlacerItem(int id) : Item(id) overlay = NULL; } -wstring MonsterPlacerItem::getHoverName(std::shared_ptr itemInstance) +std::wstring MonsterPlacerItem::getHoverName(std::shared_ptr itemInstance) { - wstring elementName = getDescription(); + std::wstring elementName = getDescription(); int nameId = EntityIO::getNameId(itemInstance->getAuxValue()); if (nameId >= 0) diff --git a/Minecraft.World/Items/MonsterPlacerItem.h b/Minecraft.World/Items/MonsterPlacerItem.h index bccca9150..9f4c5a7e4 100644 --- a/Minecraft.World/Items/MonsterPlacerItem.h +++ b/Minecraft.World/Items/MonsterPlacerItem.h @@ -27,7 +27,7 @@ public: MonsterPlacerItem(int id); - virtual wstring getHoverName(std::shared_ptr itemInstance); + virtual std::wstring getHoverName(std::shared_ptr itemInstance); virtual int getColor(std::shared_ptr item, int spriteLayer); virtual bool hasMultipleSpriteLayers(); virtual Icon *getLayerIcon(int auxValue, int spriteLayer); diff --git a/Minecraft.World/Items/PotionItem.cpp b/Minecraft.World/Items/PotionItem.cpp index af185e0a7..83cf92552 100644 --- a/Minecraft.World/Items/PotionItem.cpp +++ b/Minecraft.World/Items/PotionItem.cpp @@ -12,9 +12,9 @@ #include "PotionItem.h" #include "../Util/SoundTypes.h" -const wstring PotionItem::DEFAULT_ICON = L"potion"; -const wstring PotionItem::THROWABLE_ICON = L"potion_splash"; -const wstring PotionItem::CONTENTS_ICON = L"potion_contents"; +const std::wstring PotionItem::DEFAULT_ICON = L"potion"; +const std::wstring PotionItem::THROWABLE_ICON = L"potion_splash"; +const std::wstring PotionItem::CONTENTS_ICON = L"potion_contents"; // 4J Added vector > PotionItem::s_uniquePotionValues; @@ -173,14 +173,14 @@ bool PotionItem::hasInstantenousEffects(int itemAuxValue) return false; } -wstring PotionItem::getHoverName(std::shared_ptr itemInstance) +std::wstring PotionItem::getHoverName(std::shared_ptr itemInstance) { if (itemInstance->getAuxValue() == 0) { return app.GetString(IDS_ITEM_WATER_BOTTLE); // I18n.get("item.emptyPotion.name").trim(); } - wstring elementName = Item::getHoverName(itemInstance); + std::wstring elementName = Item::getHoverName(itemInstance); if (isThrowable(itemInstance->getAuxValue())) { //elementName = I18n.get("potion.prefix.grenade").trim() + " " + elementName; @@ -212,7 +212,7 @@ wstring PotionItem::getHoverName(std::shared_ptr itemInstance) return elementName; } -void PotionItem::appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) +void PotionItem::appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) { if (itemInstance->getAuxValue() == 0) { @@ -225,10 +225,10 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, std for(AUTO_VAR(it, effects->begin()); it != effects->end(); ++it) { MobEffectInstance *effect = *it; - wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim(); + std::wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim(); if (effect->getAmplifier() > 0) { - wstring potencyString = L""; + std::wstring potencyString = L""; switch(effect->getAmplifier()) { case 1: @@ -273,7 +273,7 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, std } else { - wstring effectString = app.GetString(IDS_POTION_EMPTY); //I18n.get("potion.empty").trim(); + std::wstring effectString = app.GetString(IDS_POTION_EMPTY); //I18n.get("potion.empty").trim(); //eHTMLColor_7 wchar_t formatted[256]; swprintf(formatted,256,L"%ls",app.GetHTMLColour(eHTMLColor_7),effectString.c_str()); @@ -317,7 +317,7 @@ void PotionItem::registerIcons(IconRegister *iconRegister) iconOverlay = iconRegister->registerIcon(CONTENTS_ICON); } -Icon *PotionItem::getTexture(const wstring &name) +Icon *PotionItem::getTexture(const std::wstring &name) { if (name.compare(DEFAULT_ICON) == 0) return Item::potion->iconDrinkable; if (name.compare(THROWABLE_ICON) == 0) return Item::potion->iconThrowable; diff --git a/Minecraft.World/Items/PotionItem.h b/Minecraft.World/Items/PotionItem.h index 02f39e974..89dce512c 100644 --- a/Minecraft.World/Items/PotionItem.h +++ b/Minecraft.World/Items/PotionItem.h @@ -10,9 +10,9 @@ private: static const int DRINK_DURATION = (int) (20 * 1.6); public: - static const wstring DEFAULT_ICON; - static const wstring THROWABLE_ICON; - static const wstring CONTENTS_ICON; + static const std::wstring DEFAULT_ICON; + static const std::wstring THROWABLE_ICON; + static const std::wstring CONTENTS_ICON; private: std::unordered_map *> cachedMobEffects; @@ -39,15 +39,15 @@ public: virtual int getColor(std::shared_ptr item, int spriteLayer); virtual bool hasMultipleSpriteLayers(); virtual bool hasInstantenousEffects(int itemAuxValue); - virtual wstring getHoverName(std::shared_ptr itemInstance); - virtual void appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); + virtual std::wstring getHoverName(std::shared_ptr itemInstance); + virtual void appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); virtual bool isFoil(std::shared_ptr itemInstance); virtual unsigned int getUseDescriptionId(std::shared_ptr instance); //@Override void registerIcons(IconRegister *iconRegister); - static Icon *getTexture(const wstring &name); + static Icon *getTexture(const std::wstring &name); // 4J Stu - Based loosely on a function that gets added in java much later on (1.3) static vector > *getUniquePotionValues(); diff --git a/Minecraft.World/Items/RecordingItem.cpp b/Minecraft.World/Items/RecordingItem.cpp index b2f3a50b3..b40f5fddc 100644 --- a/Minecraft.World/Items/RecordingItem.cpp +++ b/Minecraft.World/Items/RecordingItem.cpp @@ -7,7 +7,7 @@ #include "RecordingItem.h" #include "../Stats/GenericStats.h" -RecordingItem::RecordingItem(int id, const wstring& recording) : Item(id), recording( recording ) +RecordingItem::RecordingItem(int id, const std::wstring& recording) : Item(id), recording( recording ) { this->maxStackSize = 1; } @@ -40,7 +40,7 @@ bool RecordingItem::useOn(std::shared_ptr itemInstance, std::share return false; } -void RecordingItem::appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) +void RecordingItem::appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings) { eMinecraftColour rarityColour = getRarity(std::shared_ptr())->color; int colour = app.GetHTMLColour(rarityColour); diff --git a/Minecraft.World/Items/RecordingItem.h b/Minecraft.World/Items/RecordingItem.h index 5aba0b51d..41f672a55 100644 --- a/Minecraft.World/Items/RecordingItem.h +++ b/Minecraft.World/Items/RecordingItem.h @@ -9,13 +9,13 @@ public: const std::wstring recording; public: // 4J Stu - Was protected in Java, but the can't access it where we need - RecordingItem(int id, const wstring& recording); + RecordingItem(int id, const std::wstring& recording); //@Override Icon *getIcon(int auxValue); virtual bool useOn(std::shared_ptr itemInstance, std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); - virtual void appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); + virtual void appendHoverText(std::shared_ptr itemInstance, std::shared_ptr player, vector *lines, bool advanced, vector &unformattedStrings); virtual const Rarity *getRarity(std::shared_ptr itemInstance); //@Override diff --git a/Minecraft.World/Items/TileItems/SkullItem.cpp b/Minecraft.World/Items/TileItems/SkullItem.cpp index 18972c409..668a3f92b 100644 --- a/Minecraft.World/Items/TileItems/SkullItem.cpp +++ b/Minecraft.World/Items/TileItems/SkullItem.cpp @@ -9,7 +9,7 @@ const unsigned int SkullItem::NAMES[SKULL_COUNT] = {IDS_ITEM_SKULL_SKELETON, IDS_ITEM_SKULL_WITHER, IDS_ITEM_SKULL_ZOMBIE, IDS_ITEM_SKULL_CHARACTER, IDS_ITEM_SKULL_CREEPER}; -wstring SkullItem::ICON_NAMES[SKULL_COUNT] = {L"skull_skeleton", L"skull_wither", L"skull_zombie", L"skull_char", L"skull_creeper"}; +std::wstring SkullItem::ICON_NAMES[SKULL_COUNT] = {L"skull_skeleton", L"skull_wither", L"skull_zombie", L"skull_char", L"skull_creeper"}; SkullItem::SkullItem(int id) : Item(id) { @@ -50,7 +50,7 @@ bool SkullItem::useOn(std::shared_ptr instance, std::shared_ptrhasTag() && instance->getTag()->contains(L"SkullOwner")) { extra = instance->getTag()->getString(L"SkullOwner"); @@ -118,7 +118,7 @@ unsigned int SkullItem::getDescriptionId(std::shared_ptr instance) return NAMES[auxValue]; } -wstring SkullItem::getHoverName(std::shared_ptr itemInstance) +std::wstring SkullItem::getHoverName(std::shared_ptr itemInstance) { #if 0 if (itemInstance->getAuxValue() == SkullTileEntity::TYPE_CHAR && itemInstance->hasTag() && itemInstance->getTag()->contains(L"SkullOwner")) diff --git a/Minecraft.World/Items/TileItems/SkullItem.h b/Minecraft.World/Items/TileItems/SkullItem.h index d95ce1692..24d65472e 100644 --- a/Minecraft.World/Items/TileItems/SkullItem.h +++ b/Minecraft.World/Items/TileItems/SkullItem.h @@ -10,7 +10,7 @@ private: static const unsigned int NAMES[SKULL_COUNT]; public: - static wstring ICON_NAMES[SKULL_COUNT]; + static std::wstring ICON_NAMES[SKULL_COUNT]; private: Icon *icons[SKULL_COUNT]; @@ -24,6 +24,6 @@ public: int getLevelDataForAuxValue(int auxValue); virtual unsigned int getDescriptionId(int iData = -1); unsigned int getDescriptionId(std::shared_ptr instance); - wstring getHoverName(std::shared_ptr itemInstance); + std::wstring getHoverName(std::shared_ptr itemInstance); void registerIcons(IconRegister *iconRegister); }; \ No newline at end of file diff --git a/Minecraft.World/Items/TileItems/TileItem.cpp b/Minecraft.World/Items/TileItems/TileItem.cpp index e01188e2b..5ada62c31 100644 --- a/Minecraft.World/Items/TileItems/TileItem.cpp +++ b/Minecraft.World/Items/TileItems/TileItem.cpp @@ -213,7 +213,7 @@ unsigned int TileItem::getUseDescriptionId() void TileItem::registerIcons(IconRegister *iconRegister) { - wstring iconName = Tile::tiles[tileId]->getTileItemIconName(); + std::wstring iconName = Tile::tiles[tileId]->getTileItemIconName(); if (!iconName.empty()) { itemIcon = iconRegister->registerIcon(iconName); diff --git a/Minecraft.World/Level/ChunkPos.cpp b/Minecraft.World/Level/ChunkPos.cpp index fcc58cbc1..5f6026443 100644 --- a/Minecraft.World/Level/ChunkPos.cpp +++ b/Minecraft.World/Level/ChunkPos.cpp @@ -58,7 +58,7 @@ TilePos ChunkPos::getMiddleBlockPosition(int y) return TilePos(getMiddleBlockX(), y, getMiddleBlockZ()); } -wstring ChunkPos::toString() +std::wstring ChunkPos::toString() { return L"[" + _toString(x) + L", " + _toString(z) + L"]"; } diff --git a/Minecraft.World/Level/ChunkPos.h b/Minecraft.World/Level/ChunkPos.h index 8a9cb4f61..d5adaa20b 100644 --- a/Minecraft.World/Level/ChunkPos.h +++ b/Minecraft.World/Level/ChunkPos.h @@ -20,7 +20,7 @@ public: int getMiddleBlockZ(); TilePos getMiddleBlockPosition(int y); - wstring toString(); + std::wstring toString(); static __int64 hash_fnct(const ChunkPos &k); static bool eq_test(const ChunkPos &x, const ChunkPos &y); diff --git a/Minecraft.World/Level/ChunkSource.h b/Minecraft.World/Level/ChunkSource.h index 1c09feb22..766ba1efb 100644 --- a/Minecraft.World/Level/ChunkSource.h +++ b/Minecraft.World/Level/ChunkSource.h @@ -60,8 +60,8 @@ public: /** * Returns some stats that are rendered when the user holds F3. */ - virtual wstring gatherStats() = 0; + virtual std::wstring gatherStats() = 0; virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z) = 0; - virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) = 0; + virtual TilePos *findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z) = 0; }; diff --git a/Minecraft.World/Level/CustomLevelSource.cpp b/Minecraft.World/Level/CustomLevelSource.cpp index 01aebc2f1..39f25aa25 100644 --- a/Minecraft.World/Level/CustomLevelSource.cpp +++ b/Minecraft.World/Level/CustomLevelSource.cpp @@ -20,7 +20,7 @@ CustomLevelSource::CustomLevelSource(Level *level, __int64 seed, bool generateSt m_heightmapOverride = byteArray( (m_XZSize*16) * (m_XZSize*16) ); #ifdef _UNICODE - wstring path = L"GAME:\\GameRules\\heightmap.bin"; + std::wstring path = L"GAME:\\GameRules\\heightmap.bin"; #else #ifdef _WINDOWS64 @@ -62,7 +62,7 @@ CustomLevelSource::CustomLevelSource(Level *level, __int64 seed, bool generateSt m_waterheightOverride = byteArray( (m_XZSize*16) * (m_XZSize*16) ); #ifdef _UNICODE - wstring waterHeightPath = L"GAME:\\GameRules\\waterheight.bin"; + std::wstring waterHeightPath = L"GAME:\\GameRules\\waterheight.bin"; #else #ifdef _WINDOWS64 @@ -609,7 +609,7 @@ bool CustomLevelSource::shouldSave() return true; } -wstring CustomLevelSource::gatherStats() +std::wstring CustomLevelSource::gatherStats() { return L"CustomLevelSource"; } @@ -628,7 +628,7 @@ vector *CustomLevelSource::getMobsAt(MobCategory *mobCa #endif } -TilePos *CustomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) +TilePos *CustomLevelSource::findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z) { #ifdef _OVERRIDE_HEIGHTMAP if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != NULL) diff --git a/Minecraft.World/Level/CustomLevelSource.h b/Minecraft.World/Level/CustomLevelSource.h index af01a478a..390e038da 100644 --- a/Minecraft.World/Level/CustomLevelSource.h +++ b/Minecraft.World/Level/CustomLevelSource.h @@ -71,9 +71,9 @@ public: virtual bool save(bool force, ProgressListener *progressListener); virtual bool tick(); virtual bool shouldSave(); - virtual wstring gatherStats(); + virtual std::wstring gatherStats(); public: virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z); }; diff --git a/Minecraft.World/Level/DerivedLevelData.cpp b/Minecraft.World/Level/DerivedLevelData.cpp index e167e4407..23e01bd93 100644 --- a/Minecraft.World/Level/DerivedLevelData.cpp +++ b/Minecraft.World/Level/DerivedLevelData.cpp @@ -58,7 +58,7 @@ CompoundTag *DerivedLevelData::getLoadedPlayerTag() return wrapped->getLoadedPlayerTag(); } -wstring DerivedLevelData::getLevelName() +std::wstring DerivedLevelData::getLevelName() { return wrapped->getLevelName(); } @@ -134,7 +134,7 @@ void DerivedLevelData::setSpawn(int xSpawn, int ySpawn, int zSpawn) { } -void DerivedLevelData::setLevelName(const wstring &levelName) +void DerivedLevelData::setLevelName(const std::wstring &levelName) { } diff --git a/Minecraft.World/Level/DerivedLevelData.h b/Minecraft.World/Level/DerivedLevelData.h index c3ab42630..a5664398c 100644 --- a/Minecraft.World/Level/DerivedLevelData.h +++ b/Minecraft.World/Level/DerivedLevelData.h @@ -23,7 +23,7 @@ public: __int64 getTime(); __int64 getSizeOnDisk(); CompoundTag *getLoadedPlayerTag(); - wstring getLevelName(); + std::wstring getLevelName(); int getVersion(); __int64 getLastPlayed(); bool isThundering(); @@ -40,7 +40,7 @@ public: void setLoadedPlayerTag(CompoundTag *loadedPlayerTag); void setDimension(int dimension); void setSpawn(int xSpawn, int ySpawn, int zSpawn); - void setLevelName(const wstring &levelName); + void setLevelName(const std::wstring &levelName); void setVersion(int version); void setThundering(bool thundering); void setThunderTime(int thunderTime); diff --git a/Minecraft.World/Level/Events/LevelListener.h b/Minecraft.World/Level/Events/LevelListener.h index 671df0d17..1776fb21a 100644 --- a/Minecraft.World/Level/Events/LevelListener.h +++ b/Minecraft.World/Level/Events/LevelListener.h @@ -16,11 +16,11 @@ public: virtual void allChanged() = 0; - //virtual void playSound(const wstring& name, double x, double y, double z, float volume, float pitch) = 0; + //virtual void playSound(const std::wstring& name, double x, double y, double z, float volume, float pitch) = 0; virtual void playSound(int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f) = 0; virtual void playSound(std::shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f) = 0; - // 4J removed - virtual void addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za) = 0; + // 4J removed - virtual void addParticle(const std::wstring& name, double x, double y, double z, double xa, double ya, double za) = 0; virtual void addParticle(ePARTICLE_TYPE name, double x, double y, double z, double xa, double ya, double za) = 0; // 4J added @@ -32,7 +32,7 @@ public: virtual void skyColorChanged() = 0; - virtual void playStreamingMusic(const wstring& name, int x, int y, int z) = 0; + virtual void playStreamingMusic(const std::wstring& name, int x, int y, int z) = 0; virtual void levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data) = 0; diff --git a/Minecraft.World/Level/Level.cpp b/Minecraft.World/Level/Level.cpp index ea71b36de..039f68d84 100644 --- a/Minecraft.World/Level/Level.cpp +++ b/Minecraft.World/Level/Level.cpp @@ -558,7 +558,7 @@ BiomeSource *Level::getBiomeSource() return dimension->biomeSource; } -Level::Level(std::shared_ptr levelStorage, const wstring& name, Dimension *dimension, LevelSettings *levelSettings, bool doCreateChunkSource) +Level::Level(std::shared_ptr levelStorage, const std::wstring& name, Dimension *dimension, LevelSettings *levelSettings, bool doCreateChunkSource) : seaLevel(constSeaLevel) { _init(); @@ -617,20 +617,20 @@ Level::Level(Level *level, Dimension *dimension) } -Level::Level(std::shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings) +Level::Level(std::shared_ptrlevelStorage, const std::wstring& levelName, LevelSettings *levelSettings) : seaLevel( constSeaLevel ) { _init(levelStorage, levelName, levelSettings, NULL, true); } -Level::Level(std::shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource) +Level::Level(std::shared_ptrlevelStorage, const std::wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource) : seaLevel( constSeaLevel ) { _init( levelStorage, levelName, levelSettings, fixedDimension, doCreateChunkSource ); } -void Level::_init(std::shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource) +void Level::_init(std::shared_ptrlevelStorage, const std::wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource) { _init(); this->levelStorage = levelStorage;//std::shared_ptr(levelStorage); @@ -1602,7 +1602,7 @@ void Level::playSound(std::shared_ptr entity, int iSound, float volume, } -//void Level::playSound(double x, double y, double z, const wstring& name, float volume, float pitch) +//void Level::playSound(double x, double y, double z, const std::wstring& name, float volume, float pitch) void Level::playSound(double x, double y, double z, int iSound, float volume, float pitch, float fClipSoundDist) { AUTO_VAR(itEnd, listeners.end()); @@ -1616,7 +1616,7 @@ void Level::playLocalSound(double x, double y, double z, int iSound, float volum { } -void Level::playStreamingMusic(const wstring& name, int x, int y, int z) +void Level::playStreamingMusic(const std::wstring& name, int x, int y, int z) { AUTO_VAR(itEnd, listeners.end()); for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) @@ -1626,13 +1626,13 @@ void Level::playStreamingMusic(const wstring& name, int x, int y, int z) } -void Level::playMusic(double x, double y, double z, const wstring& string, float volume) +void Level::playMusic(double x, double y, double z, const std::wstring& string, float volume) { } // 4J removed - /* -void Level::addParticle(const wstring& id, double x, double y, double z, double xd, double yd, double zd) +void Level::addParticle(const std::wstring& id, double x, double y, double z, double xd, double yd, double zd) { AUTO_VAR(itEnd, listeners.end()); for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) @@ -2825,17 +2825,17 @@ std::shared_ptr Level::findSubclassOf(Entity::Class *entityClass) */ -wstring Level::gatherStats() +std::wstring Level::gatherStats() { wchar_t buf[64]; EnterCriticalSection(&m_entitiesCS); swprintf(buf,64,L"All:%d",this->entities.size()); LeaveCriticalSection(&m_entitiesCS); - return wstring(buf); + return std::wstring(buf); } -wstring Level::gatherChunkSourceStats() +std::wstring Level::gatherChunkSourceStats() { return chunkSource->gatherStats(); } @@ -4190,7 +4190,7 @@ std::shared_ptr Level::getNearestAttackablePlayer(double x, double y, do return result; } -std::shared_ptr Level::getPlayerByName(const wstring& name) +std::shared_ptr Level::getPlayerByName(const std::wstring& name) { AUTO_VAR(itEnd, players.end()); for (AUTO_VAR(it, players.begin()); it != itEnd; it++) @@ -4203,7 +4203,7 @@ std::shared_ptr Level::getPlayerByName(const wstring& name) return std::shared_ptr(); } -std::shared_ptr Level::getPlayerByUUID(const wstring& name) +std::shared_ptr Level::getPlayerByUUID(const std::wstring& name) { AUTO_VAR(itEnd, players.end()); for (AUTO_VAR(it, players.begin()); it != itEnd; it++) @@ -4506,19 +4506,19 @@ bool Level::isHumidAt(int x, int y, int z) } -void Level::setSavedData(const wstring& id, std::shared_ptr data) +void Level::setSavedData(const std::wstring& id, std::shared_ptr data) { savedDataStorage->set(id, data); } -std::shared_ptr Level::getSavedData(const type_info& clazz, const wstring& id) +std::shared_ptr Level::getSavedData(const type_info& clazz, const std::wstring& id) { return savedDataStorage->get(clazz, id); } -int Level::getFreeAuxValueFor(const wstring& id) +int Level::getFreeAuxValueFor(const std::wstring& id) { return savedDataStorage->getFreeAuxValueFor(id); } @@ -4575,7 +4575,7 @@ bool Level::updateLights() return false; } -TilePos *Level::findNearestMapFeature(const wstring& featureName, int x, int y, int z) +TilePos *Level::findNearestMapFeature(const std::wstring& featureName, int x, int y, int z) { return getChunkSource()->findNearestMapFeature(this, featureName, x, y, z); } diff --git a/Minecraft.World/Level/Level.h b/Minecraft.World/Level/Level.h index 47a974770..afeee6cca 100644 --- a/Minecraft.World/Level/Level.h +++ b/Minecraft.World/Level/Level.h @@ -160,13 +160,13 @@ private: // 4J Stu - Added these ctors to handle init of member variables void _init(); - void _init(std::shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource = true); + void _init(std::shared_ptrlevelStorage, const std::wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource = true); public: - Level(std::shared_ptrlevelStorage, const wstring& name, Dimension *dimension, LevelSettings *levelSettings, bool doCreateChunkSource = true); + Level(std::shared_ptrlevelStorage, const std::wstring& name, Dimension *dimension, LevelSettings *levelSettings, bool doCreateChunkSource = true); Level(Level *level, Dimension *dimension); - Level(std::shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings); - Level(std::shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource = true); + Level(std::shared_ptrlevelStorage, const std::wstring& levelName, LevelSettings *levelSettings); + Level(std::shared_ptrlevelStorage, const std::wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource = true); virtual ~Level(); @@ -283,9 +283,9 @@ public: virtual void playLocalSound(double x, double y, double z, int iSound, float volume, float pitch, float fClipSoundDist=16.0f); - void playStreamingMusic(const wstring& name, int x, int y, int z); - void playMusic(double x, double y, double z, const wstring& string, float volume); - // 4J removed - void addParticle(const wstring& id, double x, double y, double z, double xd, double yd, double zd); + void playStreamingMusic(const std::wstring& name, int x, int y, int z); + void playMusic(double x, double y, double z, const std::wstring& string, float volume); + // 4J removed - void addParticle(const std::wstring& id, double x, double y, double z, double xd, double yd, double zd); void addParticle(ePARTICLE_TYPE id, double x, double y, double z, double xd, double yd, double zd); // 4J added virtual bool addGlobalEntity(std::shared_ptr e); virtual bool addEntity(std::shared_ptr e); @@ -341,8 +341,8 @@ public: virtual std::shared_ptr explode(std::shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks); float getSeenPercent(Vec3 *center, AABB *bb); bool extinguishFire(std::shared_ptr player, int x, int y, int z, int face); - wstring gatherStats(); - wstring gatherChunkSourceStats(); + std::wstring gatherStats(); + std::wstring gatherChunkSourceStats(); virtual std::shared_ptr getTileEntity(int x, int y, int z); void setTileEntity(int x, int y, int z, std::shared_ptr tileEntity); void removeTileEntity(int x, int y, int z); @@ -443,8 +443,8 @@ public: std::shared_ptr getNearestAttackablePlayer(std::shared_ptr source, double maxDist); std::shared_ptr getNearestAttackablePlayer(double x, double y, double z, double maxDist); - std::shared_ptr getPlayerByName(const wstring& name); - std::shared_ptr getPlayerByUUID(const wstring& name); // 4J Added + std::shared_ptr getPlayerByName(const std::wstring& name); + std::shared_ptr getPlayerByUUID(const std::wstring& name); // 4J Added byteArray getBlocksAndData(int x, int y, int z, int xs, int ys, int zs, bool includeLighting = true); void setBlocksAndData(int x, int y, int z, int xs, int ys, int zs, byteArray data, bool includeLighting = true); virtual void disconnect(bool sendDisconnect = true); @@ -476,9 +476,9 @@ public: bool isRaining(); bool isRainingAt(int x, int y, int z); bool isHumidAt(int x, int y, int z); - void setSavedData(const wstring& id, std::shared_ptr data); - std::shared_ptr getSavedData(const type_info& clazz, const wstring& id); - int getFreeAuxValueFor(const wstring& id); + void setSavedData(const std::wstring& id, std::shared_ptr data); + std::shared_ptr getSavedData(const type_info& clazz, const std::wstring& id); + int getFreeAuxValueFor(const std::wstring& id); void levelEvent(int type, int x, int y, int z, int data); void levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data); int getMaxBuildHeight(); @@ -488,7 +488,7 @@ public: virtual bool isAllEmpty(); double getHorizonHeight() ; void destroyTileProgress(int id, int x, int y, int z, int progress); - TilePos *findNearestMapFeature(const wstring& featureName, int x, int y, int z); + TilePos *findNearestMapFeature(const std::wstring& featureName, int x, int y, int z); // 4J Added int getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, int centreZC, int scale); diff --git a/Minecraft.World/Level/LevelConflictException.cpp b/Minecraft.World/Level/LevelConflictException.cpp index 35a04e9e4..76cd1cbdc 100644 --- a/Minecraft.World/Level/LevelConflictException.cpp +++ b/Minecraft.World/Level/LevelConflictException.cpp @@ -1,6 +1,6 @@ #include "../Build/stdafx.h" #include "LevelConflictException.h" -LevelConflictException::LevelConflictException(const wstring& msg) : RuntimeException(msg) +LevelConflictException::LevelConflictException(const std::wstring& msg) : RuntimeException(msg) { } \ No newline at end of file diff --git a/Minecraft.World/Level/LevelConflictException.h b/Minecraft.World/Level/LevelConflictException.h index cde4fc56d..dfa668ae1 100644 --- a/Minecraft.World/Level/LevelConflictException.h +++ b/Minecraft.World/Level/LevelConflictException.h @@ -9,5 +9,5 @@ private: static const __int32 serialVersionUID = 1L; public: - LevelConflictException(const wstring& msg); + LevelConflictException(const std::wstring& msg); }; \ No newline at end of file diff --git a/Minecraft.World/Level/LevelData.cpp b/Minecraft.World/Level/LevelData.cpp index c4a435a62..ee86ea516 100644 --- a/Minecraft.World/Level/LevelData.cpp +++ b/Minecraft.World/Level/LevelData.cpp @@ -16,7 +16,7 @@ LevelData::LevelData(CompoundTag *tag) m_pGenerator = LevelType::lvl_normal; if (tag->contains(L"generatorName")) { - wstring generatorName = tag->getString(L"generatorName"); + std::wstring generatorName = tag->getString(L"generatorName"); m_pGenerator = LevelType::getLevelType(generatorName); if (m_pGenerator == NULL) { @@ -139,7 +139,7 @@ LevelData::LevelData(CompoundTag *tag) dimension = 0; } -LevelData::LevelData(LevelSettings *levelSettings, const wstring& levelName) +LevelData::LevelData(LevelSettings *levelSettings, const std::wstring& levelName) { this->seed = levelSettings->getSeed(); this->gameType = levelSettings->getGameType(); @@ -440,12 +440,12 @@ void LevelData::setSpawn(int xSpawn, int ySpawn, int zSpawn) this->zSpawn = zSpawn; } -wstring LevelData::getLevelName() +std::wstring LevelData::getLevelName() { return levelName; } -void LevelData::setLevelName(const wstring& levelName) +void LevelData::setLevelName(const std::wstring& levelName) { this->levelName = levelName; } diff --git a/Minecraft.World/Level/LevelData.h b/Minecraft.World/Level/LevelData.h index 9b837f074..f7bc87d8e 100644 --- a/Minecraft.World/Level/LevelData.h +++ b/Minecraft.World/Level/LevelData.h @@ -21,7 +21,7 @@ private: __int64 sizeOnDisk; // CompoundTag *loadedPlayerTag; // 4J removed int dimension; - wstring levelName; + std::wstring levelName; int version; bool raining; @@ -55,7 +55,7 @@ protected: public: LevelData(CompoundTag *tag); - LevelData(LevelSettings *levelSettings, const wstring& levelName); + LevelData(LevelSettings *levelSettings, const std::wstring& levelName); LevelData(LevelData *copy); CompoundTag *createTag(); CompoundTag *createTag(vector > *players); @@ -101,8 +101,8 @@ public: virtual void setLoadedPlayerTag(CompoundTag *loadedPlayerTag); //void setDimension(int dimension); // 4J Removed TU 9 as it's never used virtual void setSpawn(int xSpawn, int ySpawn, int zSpawn); - virtual wstring getLevelName(); - virtual void setLevelName(const wstring& levelName); + virtual std::wstring getLevelName(); + virtual void setLevelName(const std::wstring& levelName); virtual int getVersion(); virtual void setVersion(int version); virtual __int64 getLastPlayed(); diff --git a/Minecraft.World/Level/RandomLevelSource.cpp b/Minecraft.World/Level/RandomLevelSource.cpp index 75d8c4377..ffa1a547b 100644 --- a/Minecraft.World/Level/RandomLevelSource.cpp +++ b/Minecraft.World/Level/RandomLevelSource.cpp @@ -755,7 +755,7 @@ bool RandomLevelSource::shouldSave() return true; } -wstring RandomLevelSource::gatherStats() +std::wstring RandomLevelSource::gatherStats() { return L"RandomLevelSource"; } @@ -770,7 +770,7 @@ vector *RandomLevelSource::getMobsAt(MobCategory *mobCa return biome->getMobs(mobCategory); } -TilePos *RandomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) +TilePos *RandomLevelSource::findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z) { if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != NULL) { diff --git a/Minecraft.World/Level/RandomLevelSource.h b/Minecraft.World/Level/RandomLevelSource.h index d71028b1f..b9b08e568 100644 --- a/Minecraft.World/Level/RandomLevelSource.h +++ b/Minecraft.World/Level/RandomLevelSource.h @@ -84,9 +84,9 @@ public: virtual bool save(bool force, ProgressListener *progressListener); virtual bool tick(); virtual bool shouldSave(); - virtual wstring gatherStats(); + virtual std::wstring gatherStats(); public: virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z); }; diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp index e08d675c0..390371658 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp @@ -12,7 +12,7 @@ #include "DirectoryLevelStorage.h" #include "../../IO/Files/ConsoleSaveFileIO.h" -const wstring DirectoryLevelStorage::sc_szPlayerDir(L"players/"); +const std::wstring DirectoryLevelStorage::sc_szPlayerDir(L"players/"); _MapDataMappings::_MapDataMappings() { @@ -159,8 +159,8 @@ void DirectoryLevelStorage::PlayerMappings::readMappings(DataInputStream *dis) } #endif -DirectoryLevelStorage::DirectoryLevelStorage(ConsoleSaveFile *saveFile, const File dir, const wstring& levelId, bool createPlayerDir) : sessionId( System::currentTimeMillis() ), - dir( L"" ), playerDir( sc_szPlayerDir ), dataDir( wstring(L"data/") ), levelId(levelId) +DirectoryLevelStorage::DirectoryLevelStorage(ConsoleSaveFile *saveFile, const File dir, const std::wstring& levelId, bool createPlayerDir) : sessionId( System::currentTimeMillis() ), + dir( L"" ), playerDir( sc_szPlayerDir ), dataDir( std::wstring(L"data/") ), levelId(levelId) { m_saveFile = saveFile; m_bHasLoadedMapDataMappings = false; @@ -188,7 +188,7 @@ void DirectoryLevelStorage::initiateSession() { // 4J Jev, removed try/catch. - File dataFile = File( dir, wstring(L"session.lock") ); + File dataFile = File( dir, std::wstring(L"session.lock") ); FileOutputStream fos = FileOutputStream(dataFile); DataOutputStream dos = DataOutputStream(&fos); dos.writeLong(sessionId); @@ -206,7 +206,7 @@ void DirectoryLevelStorage::checkSession() // 4J-PB - Not in the Xbox game /* - File dataFile = File( dir, wstring(L"session.lock")); + File dataFile = File( dir, std::wstring(L"session.lock")); FileInputStream fis = FileInputStream(dataFile); DataInputStream dis = DataInputStream(&fis); dis.close(); @@ -336,7 +336,7 @@ LevelData *DirectoryLevelStorage::prepareLevel() // 4J Jev, removed try/catch - ConsoleSavePath dataFile = ConsoleSavePath( wstring( L"level.dat" ) ); + ConsoleSavePath dataFile = ConsoleSavePath( std::wstring( L"level.dat" ) ); if ( m_saveFile->doesFileExist( dataFile ) ) { @@ -360,7 +360,7 @@ void DirectoryLevelStorage::saveLevelData(LevelData *levelData, vectorput(L"Data", dataTag); - ConsoleSavePath currentFile = ConsoleSavePath( wstring( L"level.dat" ) ); + ConsoleSavePath currentFile = ConsoleSavePath( std::wstring( L"level.dat" ) ); ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream( m_saveFile, currentFile ); NbtIo::writeCompressed(root, &fos); @@ -377,7 +377,7 @@ void DirectoryLevelStorage::saveLevelData(LevelData *levelData) CompoundTag *root = new CompoundTag(); root->put(L"Data", dataTag); - ConsoleSavePath currentFile = ConsoleSavePath( wstring( L"level.dat" ) ); + ConsoleSavePath currentFile = ConsoleSavePath( std::wstring( L"level.dat" ) ); ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream( m_saveFile, currentFile ); NbtIo::writeCompressed(root, &fos); @@ -493,7 +493,7 @@ void DirectoryLevelStorage::clearOldPlayerFiles() for(unsigned int i = 0; i < playerFiles->size(); ++i ) { FileEntry *file = playerFiles->at(i); - wstring xuidStr = replaceAll( replaceAll(file->data.filename,playerDir.getName(),L""),L".dat",L""); + std::wstring xuidStr = replaceAll( replaceAll(file->data.filename,playerDir.getName(),L""),L".dat",L""); #if defined(__PS3__) || defined(__ORBIS__) || defined(_DURANGO) PlayerUID xuid(xuidStr); #else @@ -512,7 +512,7 @@ void DirectoryLevelStorage::clearOldPlayerFiles() for(unsigned int i = MAX_PLAYER_DATA_SAVES; i < playerFiles->size(); ++i ) { FileEntry *file = playerFiles->at(i); - wstring xuidStr = replaceAll( replaceAll(file->data.filename,playerDir.getName(),L""),L".dat",L""); + std::wstring xuidStr = replaceAll( replaceAll(file->data.filename,playerDir.getName(),L""),L".dat",L""); #if defined(__PS3__) || defined(__ORBIS__) || defined(_DURANGO) PlayerUID xuid(xuidStr); #else @@ -536,12 +536,12 @@ void DirectoryLevelStorage::closeAll() { } -ConsoleSavePath DirectoryLevelStorage::getDataFile(const wstring& id) +ConsoleSavePath DirectoryLevelStorage::getDataFile(const std::wstring& id) { return ConsoleSavePath( dataDir.getName() + id + L".dat" ); } -wstring DirectoryLevelStorage::getLevelId() +std::wstring DirectoryLevelStorage::getLevelId() { return levelId; } @@ -654,7 +654,7 @@ int DirectoryLevelStorage::getAuxValueForMap(PlayerUID xuid, int dimension, int m_saveableMapDataMappings.setMapping(mapId, xuid, dimension); // If we had an old map file for a mapping that is no longer valid, delete it - std::wstring id = wstring( L"map_" ) + _toString(mapId); + std::wstring id = std::wstring( L"map_" ) + _toString(mapId); ConsoleSavePath file = getDataFile(id); if(m_saveFile->doesFileExist(file) ) @@ -760,7 +760,7 @@ void DirectoryLevelStorage::deleteMapFilesForPlayer(PlayerUID xuid) { for(AUTO_VAR(itMap, it->second.m_mappings.begin()); itMap != it->second.m_mappings.end(); ++itMap) { - std::wstring id = wstring( L"map_" ) + _toString(itMap->second); + std::wstring id = std::wstring( L"map_" ) + _toString(itMap->second); ConsoleSavePath file = getDataFile(id); if(m_saveFile->doesFileExist(file) ) @@ -784,7 +784,7 @@ void DirectoryLevelStorage::deleteMapFilesForPlayer(PlayerUID xuid) { changed = true; - std::wstring id = wstring( L"map_" ) + _toString(i); + std::wstring id = std::wstring( L"map_" ) + _toString(i); ConsoleSavePath file = getDataFile(id); if(m_saveFile->doesFileExist(file) ) @@ -821,7 +821,7 @@ void DirectoryLevelStorage::saveAllCachedData() for(AUTO_VAR(it, m_mapFilesToDelete.begin()); it != m_mapFilesToDelete.end(); ++it) { - std::wstring id = wstring( L"map_" ) + _toString(*it); + std::wstring id = std::wstring( L"map_" ) + _toString(*it); ConsoleSavePath file = getDataFile(id); if(m_saveFile->doesFileExist(file) ) { diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorage.h b/Minecraft.World/Level/Storage/DirectoryLevelStorage.h index 74d7f829d..bd1c312f9 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorage.h +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorage.h @@ -66,9 +66,9 @@ private: //const File dataDir; const ConsoleSavePath dataDir; const __int64 sessionId; - const wstring levelId; + const std::wstring levelId; - static const wstring sc_szPlayerDir; + static const std::wstring sc_szPlayerDir; // 4J Added #ifdef _LARGE_WORLDS class PlayerMappings @@ -95,7 +95,7 @@ private: #endif bool m_bHasLoadedMapDataMappings; - std::unordered_map m_cachedSaveData; + std::unordered_map m_cachedSaveData; vector m_mapFilesToDelete; // Temp list of files that couldn't be deleted immediately due to saving being disabled protected: @@ -106,7 +106,7 @@ public: virtual void flushSaveFile(bool autosave); public: - DirectoryLevelStorage(ConsoleSaveFile *saveFile, const File dir, const wstring& levelId, bool createPlayerDir); + DirectoryLevelStorage(ConsoleSaveFile *saveFile, const File dir, const std::wstring& levelId, bool createPlayerDir); ~DirectoryLevelStorage(); private: @@ -127,8 +127,8 @@ public: virtual void clearOldPlayerFiles(); // 4J Added PlayerIO *getPlayerIO(); virtual void closeAll(); - ConsoleSavePath getDataFile(const wstring& id); - wstring getLevelId(); + ConsoleSavePath getDataFile(const std::wstring& id); + std::wstring getLevelId(); // 4J Added virtual int getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, int centreZC, int scale); @@ -136,7 +136,7 @@ public: virtual void deleteMapFilesForPlayer(std::shared_ptr player); virtual void saveAllCachedData(); void resetNetherPlayerPositions(); // 4J Added - static wstring getPlayerDir() { return sc_szPlayerDir; } + static std::wstring getPlayerDir() { return sc_szPlayerDir; } private: void dontSaveMapMappingForPlayer(PlayerUID xuid); diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.cpp b/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.cpp index 6a1c31a37..4396ec437 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.cpp +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.cpp @@ -17,7 +17,7 @@ DirectoryLevelStorageSource::DirectoryLevelStorageSource(const File dir) : baseD //this->baseDir = dir; } -wstring DirectoryLevelStorageSource::getName() +std::wstring DirectoryLevelStorageSource::getName() { return L"Old Format"; } @@ -29,7 +29,7 @@ vector *DirectoryLevelStorageSource::getLevelList() #if 0 for (int i = 0; i < 5; i++) { - wstring levelId = wstring(L"World").append( _toString( (i+1) ) ); + std::wstring levelId = std::wstring(L"World").append( _toString( (i+1) ) ); LevelData *levelData = getDataTagFor(saveFile, levelId); if (levelData != NULL) @@ -45,10 +45,10 @@ void DirectoryLevelStorageSource::clearAll() { } -LevelData *DirectoryLevelStorageSource::getDataTagFor(ConsoleSaveFile *saveFile, const wstring& levelId) +LevelData *DirectoryLevelStorageSource::getDataTagFor(ConsoleSaveFile *saveFile, const std::wstring& levelId) { //File dataFile(dir, L"level.dat"); - ConsoleSavePath dataFile = ConsoleSavePath( wstring( L"level.dat" ) ); + ConsoleSavePath dataFile = ConsoleSavePath( std::wstring( L"level.dat" ) ); if ( saveFile->doesFileExist( dataFile ) ) { ConsoleSaveFileInputStream fis = ConsoleSaveFileInputStream(saveFile, dataFile); @@ -62,12 +62,12 @@ LevelData *DirectoryLevelStorageSource::getDataTagFor(ConsoleSaveFile *saveFile, return NULL; } -void DirectoryLevelStorageSource::renameLevel(const wstring& levelId, const wstring& newLevelName) +void DirectoryLevelStorageSource::renameLevel(const std::wstring& levelId, const std::wstring& newLevelName) { ConsoleSaveFileOriginal tempSave(levelId); //File dataFile = File(dir, L"level.dat"); - ConsoleSavePath dataFile = ConsoleSavePath( wstring( L"level.dat" ) ); + ConsoleSavePath dataFile = ConsoleSavePath( std::wstring( L"level.dat" ) ); if ( tempSave.doesFileExist( dataFile ) ) { ConsoleSaveFileInputStream fis = ConsoleSaveFileInputStream(&tempSave, dataFile); @@ -80,7 +80,7 @@ void DirectoryLevelStorageSource::renameLevel(const wstring& levelId, const wstr } } -bool DirectoryLevelStorageSource::isNewLevelIdAcceptable(const wstring& levelId) +bool DirectoryLevelStorageSource::isNewLevelIdAcceptable(const std::wstring& levelId) { // 4J Jev, removed try/catch. @@ -95,7 +95,7 @@ bool DirectoryLevelStorageSource::isNewLevelIdAcceptable(const wstring& levelId) return true; } -void DirectoryLevelStorageSource::deleteLevel(const wstring& levelId) +void DirectoryLevelStorageSource::deleteLevel(const std::wstring& levelId) { File dir = File(baseDir, levelId); if (!dir.exists()) return; @@ -118,22 +118,22 @@ void DirectoryLevelStorageSource::deleteRecursive(vector *files) } } -std::shared_ptr DirectoryLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) +std::shared_ptr DirectoryLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, bool createPlayerDir) { return std::shared_ptr (new DirectoryLevelStorage(saveFile, baseDir, levelId, createPlayerDir)); } -bool DirectoryLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId) +bool DirectoryLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const std::wstring& levelId) { return false; } -bool DirectoryLevelStorageSource::requiresConversion(ConsoleSaveFile *saveFile, const wstring& levelId) +bool DirectoryLevelStorageSource::requiresConversion(ConsoleSaveFile *saveFile, const std::wstring& levelId) { return false; } -bool DirectoryLevelStorageSource::convertLevel(ConsoleSaveFile *saveFile, const wstring& levelId, ProgressListener *progress) +bool DirectoryLevelStorageSource::convertLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, ProgressListener *progress) { return false; } diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.h b/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.h index 929982fa6..92eba4922 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.h +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.h @@ -15,20 +15,20 @@ protected: public: DirectoryLevelStorageSource(const File dir); - virtual wstring getName(); + virtual std::wstring getName(); virtual vector *getLevelList(); virtual void clearAll(); - virtual LevelData *getDataTagFor(ConsoleSaveFile *saveFile, const wstring& levelId); - virtual void renameLevel(const wstring& levelId, const wstring& newLevelName); - virtual bool isNewLevelIdAcceptable(const wstring& levelId); - virtual void deleteLevel(const wstring& levelId); + virtual LevelData *getDataTagFor(ConsoleSaveFile *saveFile, const std::wstring& levelId); + virtual void renameLevel(const std::wstring& levelId, const std::wstring& newLevelName); + virtual bool isNewLevelIdAcceptable(const std::wstring& levelId); + virtual void deleteLevel(const std::wstring& levelId); protected: static void deleteRecursive(vector *files); public: - virtual std::shared_ptr selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir); - virtual bool isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId); - virtual bool requiresConversion(ConsoleSaveFile *saveFile, const wstring& levelId); - virtual bool convertLevel(ConsoleSaveFile *saveFile, const wstring& levelId, ProgressListener *progress); + virtual std::shared_ptr selectLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, bool createPlayerDir); + virtual bool isConvertible(ConsoleSaveFile *saveFile, const std::wstring& levelId); + virtual bool requiresConversion(ConsoleSaveFile *saveFile, const std::wstring& levelId); + virtual bool convertLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, ProgressListener *progress); }; \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/EntityIO.cpp b/Minecraft.World/Level/Storage/EntityIO.cpp index 1ae6226c1..e2c35e336 100644 --- a/Minecraft.World/Level/Storage/EntityIO.cpp +++ b/Minecraft.World/Level/Storage/EntityIO.cpp @@ -14,25 +14,25 @@ #include "../../Headers/com.mojang.nbt.h" #include "EntityIO.h" -std::unordered_map *EntityIO::idCreateMap = new std::unordered_map; -std::unordered_map *EntityIO::classIdMap = new std::unordered_map; +std::unordered_map *EntityIO::idCreateMap = new std::unordered_map; +std::unordered_map *EntityIO::classIdMap = new std::unordered_map; std::unordered_map *EntityIO::numCreateMap = new std::unordered_map; std::unordered_map *EntityIO::numClassMap = new std::unordered_map; std::unordered_map *EntityIO::classNumMap = new std::unordered_map; -std::unordered_map *EntityIO::idNumMap = new std::unordered_map; +std::unordered_map *EntityIO::idNumMap = new std::unordered_map; std::unordered_map EntityIO::idsSpawnableInCreative; -void EntityIO::setId(entityCreateFn createFn, eINSTANCEOF clas, const wstring &id, int idNum) +void EntityIO::setId(entityCreateFn createFn, eINSTANCEOF clas, const std::wstring &id, int idNum) { - idCreateMap->insert( std::unordered_map::value_type(id, createFn) ); - classIdMap->insert( std::unordered_map::value_type(clas,id ) ); + idCreateMap->insert( std::unordered_map::value_type(id, createFn) ); + classIdMap->insert( std::unordered_map::value_type(clas,id ) ); numCreateMap->insert( std::unordered_map::value_type(idNum, createFn) ); numClassMap->insert( std::unordered_map::value_type(idNum, clas) ); classNumMap->insert( std::unordered_map::value_type(clas, idNum) ); - idNumMap->insert( std::unordered_map::value_type(id, idNum) ); + idNumMap->insert( std::unordered_map::value_type(id, idNum) ); } -void EntityIO::setId(entityCreateFn createFn, eINSTANCEOF clas, const wstring &id, int idNum, eMinecraftColour color1, eMinecraftColour color2, int nameId) +void EntityIO::setId(entityCreateFn createFn, eINSTANCEOF clas, const std::wstring &id, int idNum, eMinecraftColour color1, eMinecraftColour color2, int nameId) { setId(createFn, clas, id, idNum); @@ -98,7 +98,7 @@ void EntityIO::staticCtor() setId(DragonFireball::create, eTYPE_DRAGON_FIREBALL, L"DragonFireball", 1000); } -std::shared_ptr EntityIO::newEntity(const wstring& id, Level *level) +std::shared_ptr EntityIO::newEntity(const std::wstring& id, Level *level) { std::shared_ptr entity; @@ -181,16 +181,16 @@ int EntityIO::getId(std::shared_ptr entity) return (*it).second; } -wstring EntityIO::getEncodeId(std::shared_ptr entity) +std::wstring EntityIO::getEncodeId(std::shared_ptr entity) { - std::unordered_map::iterator it = classIdMap->find( entity->GetType() ); + std::unordered_map::iterator it = classIdMap->find( entity->GetType() ); if( it != classIdMap->end() ) return (*it).second; else return L""; } -int EntityIO::getId(const wstring &encodeId) +int EntityIO::getId(const std::wstring &encodeId) { AUTO_VAR(it, idNumMap->find(encodeId)); if (it == idNumMap->end()) @@ -201,7 +201,7 @@ int EntityIO::getId(const wstring &encodeId) return it->second; } -wstring EntityIO::getEncodeId(int entityIoValue) +std::wstring EntityIO::getEncodeId(int entityIoValue) { //Class class1 = numClassMap.get(entityIoValue); //if (class1 != null) @@ -212,7 +212,7 @@ wstring EntityIO::getEncodeId(int entityIoValue) AUTO_VAR(it, numClassMap->find(entityIoValue)); if(it != numClassMap->end() ) { - std::unordered_map::iterator classIdIt = classIdMap->find( it->second ); + std::unordered_map::iterator classIdIt = classIdMap->find( it->second ); if( classIdIt != classIdMap->end() ) return (*classIdIt).second; else @@ -235,7 +235,7 @@ int EntityIO::getNameId(int entityIoValue) return id; } -eINSTANCEOF EntityIO::getType(const wstring &idString) +eINSTANCEOF EntityIO::getType(const std::wstring &idString) { AUTO_VAR(it, numClassMap->find(getId(idString))); if(it != numClassMap->end() ) diff --git a/Minecraft.World/Level/Storage/EntityIO.h b/Minecraft.World/Level/Storage/EntityIO.h index b5e87b5e2..c96bcb8e8 100644 --- a/Minecraft.World/Level/Storage/EntityIO.h +++ b/Minecraft.World/Level/Storage/EntityIO.h @@ -28,32 +28,32 @@ public: }; private: - static std::unordered_map *idCreateMap; - static std::unordered_map *classIdMap; + static std::unordered_map *idCreateMap; + static std::unordered_map *classIdMap; static std::unordered_map *numCreateMap; static std::unordered_map *numClassMap; static std::unordered_map *classNumMap; - static std::unordered_map *idNumMap; + static std::unordered_map *idNumMap; public: static std::unordered_map idsSpawnableInCreative; private: - static void setId(entityCreateFn createFn, eINSTANCEOF clas, const wstring &id, int idNum); - static void setId(entityCreateFn createFn, eINSTANCEOF clas, const wstring &id, int idNum, eMinecraftColour color1, eMinecraftColour color2, int nameId); + static void setId(entityCreateFn createFn, eINSTANCEOF clas, const std::wstring &id, int idNum); + static void setId(entityCreateFn createFn, eINSTANCEOF clas, const std::wstring &id, int idNum, eMinecraftColour color1, eMinecraftColour color2, int nameId); public: static void staticCtor(); - static std::shared_ptr newEntity(const wstring& id, Level *level); + static std::shared_ptr newEntity(const std::wstring& id, Level *level); static std::shared_ptr loadStatic(CompoundTag *tag, Level *level); static std::shared_ptr newById(int id, Level *level); static std::shared_ptr newByEnumType(eINSTANCEOF eType, Level *level); static int getId(std::shared_ptr entity); - static wstring getEncodeId(std::shared_ptr entity); - static int getId(const wstring &encodeId); - static wstring getEncodeId(int entityIoValue); + static std::wstring getEncodeId(std::shared_ptr entity); + static int getId(const std::wstring &encodeId); + static std::wstring getEncodeId(int entityIoValue); static int getNameId(int entityIoValue); - static eINSTANCEOF getType(const wstring &idString); + static eINSTANCEOF getType(const std::wstring &idString); static eINSTANCEOF getClass(int id); // 4J-JEV, added for enumerating mobs. diff --git a/Minecraft.World/Level/Storage/LevelSettings.cpp b/Minecraft.World/Level/Storage/LevelSettings.cpp index 4f6729038..71fc56bb0 100644 --- a/Minecraft.World/Level/Storage/LevelSettings.cpp +++ b/Minecraft.World/Level/Storage/LevelSettings.cpp @@ -16,7 +16,7 @@ void GameType::staticCtor() ADVENTURE = new GameType(2, L"adventure"); } -GameType::GameType(int id, const wstring &name) +GameType::GameType(int id, const std::wstring &name) { this->id = id; this->name = name; @@ -27,7 +27,7 @@ int GameType::getId() return id; } -wstring GameType::getName() +std::wstring GameType::getName() { return name; } @@ -75,7 +75,7 @@ GameType *GameType::byId(int id) return SURVIVAL; } -GameType *GameType::byName(const wstring &name) +GameType *GameType::byName(const std::wstring &name) { if(name.compare(NOT_SET->name) == 0) return NOT_SET; else if(name.compare(SURVIVAL->name) == 0) return SURVIVAL; diff --git a/Minecraft.World/Level/Storage/LevelSettings.h b/Minecraft.World/Level/Storage/LevelSettings.h index c183df8c1..dd3d26a66 100644 --- a/Minecraft.World/Level/Storage/LevelSettings.h +++ b/Minecraft.World/Level/Storage/LevelSettings.h @@ -17,19 +17,19 @@ public: private: int id; - wstring name; + std::wstring name; - GameType(int id, const wstring &name); + GameType(int id, const std::wstring &name); public: int getId(); - wstring getName(); + std::wstring getName(); void updatePlayerAbilities(Abilities *abilities); bool isReadOnly(); bool isCreative(); bool isSurvival(); static GameType *byId(int id); - static GameType *byName(const wstring &name); + static GameType *byName(const std::wstring &name); }; class LevelSettings diff --git a/Minecraft.World/Level/Storage/LevelStorage.cpp b/Minecraft.World/Level/Storage/LevelStorage.cpp index c04f11324..e6d45e7ca 100644 --- a/Minecraft.World/Level/Storage/LevelStorage.cpp +++ b/Minecraft.World/Level/Storage/LevelStorage.cpp @@ -2,5 +2,5 @@ #include "LevelStorage.h" -const wstring LevelStorage::NETHER_FOLDER = L"DIM-1"; -const wstring LevelStorage::ENDER_FOLDER = L"DIM1/"; \ No newline at end of file +const std::wstring LevelStorage::NETHER_FOLDER = L"DIM-1"; +const std::wstring LevelStorage::ENDER_FOLDER = L"DIM1/"; \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/LevelStorage.h b/Minecraft.World/Level/Storage/LevelStorage.h index 487be5662..485dbe4ff 100644 --- a/Minecraft.World/Level/Storage/LevelStorage.h +++ b/Minecraft.World/Level/Storage/LevelStorage.h @@ -15,8 +15,8 @@ class ConsoleSaveFile; class LevelStorage { public: - static const wstring NETHER_FOLDER; - static const wstring ENDER_FOLDER; + static const std::wstring NETHER_FOLDER; + static const std::wstring ENDER_FOLDER; virtual LevelData *prepareLevel() = 0; virtual void checkSession() = 0; @@ -25,8 +25,8 @@ public: virtual void saveLevelData(LevelData *levelData) = 0; virtual PlayerIO *getPlayerIO() = 0; virtual void closeAll() = 0; - virtual ConsoleSavePath getDataFile(const wstring& id) = 0; - virtual wstring getLevelId() = 0; + virtual ConsoleSavePath getDataFile(const std::wstring& id) = 0; + virtual std::wstring getLevelId() = 0; public: virtual ConsoleSaveFile *getSaveFile() { return NULL; } diff --git a/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.cpp b/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.cpp index a2d9cca5c..154efd666 100644 --- a/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.cpp +++ b/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.cpp @@ -46,12 +46,12 @@ void LevelStorageProfilerDecorator::closeAll() capsulated->closeAll(); } -ConsoleSavePath LevelStorageProfilerDecorator::getDataFile(const wstring& id) +ConsoleSavePath LevelStorageProfilerDecorator::getDataFile(const std::wstring& id) { return capsulated->getDataFile(id); } -wstring LevelStorageProfilerDecorator::getLevelId() +std::wstring LevelStorageProfilerDecorator::getLevelId() { return capsulated->getLevelId(); } \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.h b/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.h index bd1751cca..0f697caf4 100644 --- a/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.h +++ b/Minecraft.World/Level/Storage/LevelStorageProfilerDecorator.h @@ -22,6 +22,6 @@ public: void saveLevelData(LevelData *levelData); PlayerIO *getPlayerIO(); void closeAll(); - ConsoleSavePath getDataFile(const wstring& id); - wstring getLevelId(); + ConsoleSavePath getDataFile(const std::wstring& id); + std::wstring getLevelId(); }; \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/LevelStorageSource.h b/Minecraft.World/Level/Storage/LevelStorageSource.h index 9b6db3946..d6eb86387 100644 --- a/Minecraft.World/Level/Storage/LevelStorageSource.h +++ b/Minecraft.World/Level/Storage/LevelStorageSource.h @@ -12,11 +12,11 @@ class ConsoleSaveFile; class LevelStorageSource { public: - virtual wstring getName() = 0; - virtual std::shared_ptr selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) = 0; + virtual std::wstring getName() = 0; + virtual std::shared_ptr selectLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, bool createPlayerDir) = 0; virtual vector *getLevelList() = 0; virtual void clearAll() = 0; - virtual LevelData *getDataTagFor(ConsoleSaveFile *saveFile, const wstring& levelId) = 0; + virtual LevelData *getDataTagFor(ConsoleSaveFile *saveFile, const std::wstring& levelId) = 0; /** * Tests if a levelId can be used to store a level. For example, a levelId @@ -28,10 +28,10 @@ public: * @param levelId * @return */ - virtual bool isNewLevelIdAcceptable(const wstring& levelId) = 0; - virtual void deleteLevel(const wstring& levelId) = 0; - virtual void renameLevel(const wstring& levelId, const wstring& newLevelName) = 0; - virtual bool isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId) = 0; - virtual bool requiresConversion(ConsoleSaveFile *saveFile, const wstring& levelId) = 0; - virtual bool convertLevel(ConsoleSaveFile *saveFile, const wstring &levelId, ProgressListener *progress) = 0; + virtual bool isNewLevelIdAcceptable(const std::wstring& levelId) = 0; + virtual void deleteLevel(const std::wstring& levelId) = 0; + virtual void renameLevel(const std::wstring& levelId, const std::wstring& newLevelName) = 0; + virtual bool isConvertible(ConsoleSaveFile *saveFile, const std::wstring& levelId) = 0; + virtual bool requiresConversion(ConsoleSaveFile *saveFile, const std::wstring& levelId) = 0; + virtual bool convertLevel(ConsoleSaveFile *saveFile, const std::wstring &levelId, ProgressListener *progress) = 0; }; \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/LevelSummary.cpp b/Minecraft.World/Level/Storage/LevelSummary.cpp index 5b8948676..7e37acee1 100644 --- a/Minecraft.World/Level/Storage/LevelSummary.cpp +++ b/Minecraft.World/Level/Storage/LevelSummary.cpp @@ -1,7 +1,7 @@ #include "../../Build/stdafx.h" #include "LevelSummary.h" -LevelSummary::LevelSummary(const wstring& levelId, const wstring& levelName, __int64 lastPlayed, __int64 sizeOnDisk, GameType *gameMode, bool requiresConversion, bool hardcore, bool hasCheats) : +LevelSummary::LevelSummary(const std::wstring& levelId, const std::wstring& levelName, __int64 lastPlayed, __int64 sizeOnDisk, GameType *gameMode, bool requiresConversion, bool hardcore, bool hasCheats) : levelId( levelId ), levelName( levelName ), lastPlayed( lastPlayed ), @@ -13,12 +13,12 @@ LevelSummary::LevelSummary(const wstring& levelId, const wstring& levelName, __i { } -wstring LevelSummary::getLevelId() +std::wstring LevelSummary::getLevelId() { return levelId; } -wstring LevelSummary::getLevelName() +std::wstring LevelSummary::getLevelName() { return levelName; } diff --git a/Minecraft.World/Level/Storage/LevelSummary.h b/Minecraft.World/Level/Storage/LevelSummary.h index bbf391ff6..b8eaee32e 100644 --- a/Minecraft.World/Level/Storage/LevelSummary.h +++ b/Minecraft.World/Level/Storage/LevelSummary.h @@ -5,8 +5,8 @@ class GameType; class LevelSummary { - const wstring levelId; - const wstring levelName; + const std::wstring levelId; + const std::wstring levelName; const __int64 lastPlayed; const __int64 sizeOnDisk; const bool requiresConversion; @@ -15,9 +15,9 @@ class LevelSummary const bool _hasCheats; public: - LevelSummary(const wstring& levelId, const wstring& levelName, __int64 lastPlayed, __int64 sizeOnDisk, GameType *gameMode, bool requiresConversion, bool hardcore, bool hasCheats); - wstring getLevelId(); - wstring getLevelName(); + LevelSummary(const std::wstring& levelId, const std::wstring& levelName, __int64 lastPlayed, __int64 sizeOnDisk, GameType *gameMode, bool requiresConversion, bool hardcore, bool hasCheats); + std::wstring getLevelId(); + std::wstring getLevelName(); __int64 getSizeOnDisk(); bool isRequiresConversion(); __int64 getLastPlayed(); diff --git a/Minecraft.World/Level/Storage/LevelType.cpp b/Minecraft.World/Level/Storage/LevelType.cpp index ac272d3e6..b7a67f3b3 100644 --- a/Minecraft.World/Level/Storage/LevelType.cpp +++ b/Minecraft.World/Level/Storage/LevelType.cpp @@ -30,12 +30,12 @@ void LevelType::staticCtor() lvl_normal_1_1->setSelectableByUser(false); } -LevelType::LevelType(int id, wstring generatorName) +LevelType::LevelType(int id, std::wstring generatorName) { init(id, generatorName, 0); } -LevelType::LevelType(int id, wstring generatorName, int version) +LevelType::LevelType(int id, std::wstring generatorName, int version) { m_generatorName = generatorName; m_version = version; @@ -44,7 +44,7 @@ LevelType::LevelType(int id, wstring generatorName, int version) } -void LevelType::init(int id, wstring generatorName, int version) +void LevelType::init(int id, std::wstring generatorName, int version) { m_generatorName = generatorName; m_version = version; @@ -52,12 +52,12 @@ void LevelType::init(int id, wstring generatorName, int version) levelTypes[id] = this; } -wstring LevelType::getGeneratorName() +std::wstring LevelType::getGeneratorName() { return m_generatorName; } -wstring LevelType::getDescriptionId() +std::wstring LevelType::getDescriptionId() { return L"generator." + m_generatorName; } @@ -98,7 +98,7 @@ bool LevelType::hasReplacement() return m_replacement; } -LevelType *LevelType::getLevelType(wstring name) +LevelType *LevelType::getLevelType(std::wstring name) { if(name.length()>0) { diff --git a/Minecraft.World/Level/Storage/LevelType.h b/Minecraft.World/Level/Storage/LevelType.h index 7d5b41293..5689c90ba 100644 --- a/Minecraft.World/Level/Storage/LevelType.h +++ b/Minecraft.World/Level/Storage/LevelType.h @@ -14,17 +14,17 @@ public: static void staticCtor(); private: - wstring m_generatorName; + std::wstring m_generatorName; int m_version; bool m_selectable; bool m_replacement; - LevelType(int id, wstring generatorName); - LevelType(int id, wstring generatorName, int version); - void init(int id, wstring generatorName, int version); + LevelType(int id, std::wstring generatorName); + LevelType(int id, std::wstring generatorName, int version); + void init(int id, std::wstring generatorName, int version); public: - wstring getGeneratorName(); - wstring getDescriptionId(); + std::wstring getGeneratorName(); + std::wstring getDescriptionId(); int getVersion(); LevelType *getReplacementForVersion(int oldVersion); private: @@ -35,5 +35,5 @@ private: LevelType *setHasReplacement(); public: bool hasReplacement(); - static LevelType *getLevelType(wstring name); + static LevelType *getLevelType(std::wstring name); }; diff --git a/Minecraft.World/Level/Storage/MapItemSavedData.cpp b/Minecraft.World/Level/Storage/MapItemSavedData.cpp index 03d320c51..8e1dc10f9 100644 --- a/Minecraft.World/Level/Storage/MapItemSavedData.cpp +++ b/Minecraft.World/Level/Storage/MapItemSavedData.cpp @@ -153,7 +153,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(std::shared_ptrdoesFileExist(currentFile)) { @@ -293,7 +293,7 @@ void McRegionChunkStorage::flush() { #ifdef SPLIT_SAVES PIXBeginNamedEvent(0, "Flushing entity data"); - ConsoleSavePath currentFile = ConsoleSavePath( m_prefix + wstring( L"entities.dat" ) ); + ConsoleSavePath currentFile = ConsoleSavePath( m_prefix + std::wstring( L"entities.dat" ) ); ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream( m_saveFile, currentFile ); BufferedOutputStream bos(&fos, 1024*1024); DataOutputStream dos(&bos); diff --git a/Minecraft.World/Level/Storage/McRegionChunkStorage.h b/Minecraft.World/Level/Storage/McRegionChunkStorage.h index e63bc3957..9cd1b00b5 100644 --- a/Minecraft.World/Level/Storage/McRegionChunkStorage.h +++ b/Minecraft.World/Level/Storage/McRegionChunkStorage.h @@ -12,7 +12,7 @@ class ConsoleSaveFile; class McRegionChunkStorage : public ChunkStorage { private: - const wstring m_prefix; + const std::wstring m_prefix; ConsoleSaveFile *m_saveFile; static CRITICAL_SECTION cs_memory; @@ -23,7 +23,7 @@ private: static C4JThread *s_saveThreads[3]; public: - McRegionChunkStorage(ConsoleSaveFile *saveFile, const wstring &prefix); + McRegionChunkStorage(ConsoleSaveFile *saveFile, const std::wstring &prefix); ~McRegionChunkStorage(); static void staticCtor(); diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp b/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp index 6fd3b310f..eb0fc03b1 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp @@ -7,7 +7,7 @@ #include "../../IO/Files/File.h" #include "McRegionLevelStorage.h" -McRegionLevelStorage::McRegionLevelStorage(ConsoleSaveFile *saveFile, File dir, const wstring& levelName, bool createPlayerDir) +McRegionLevelStorage::McRegionLevelStorage(ConsoleSaveFile *saveFile, File dir, const std::wstring& levelName, bool createPlayerDir) : DirectoryLevelStorage(saveFile, dir, levelName, createPlayerDir) { RegionFileCache::clear(); diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorage.h b/Minecraft.World/Level/Storage/McRegionLevelStorage.h index 72d5cc07f..ccc0b514b 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorage.h +++ b/Minecraft.World/Level/Storage/McRegionLevelStorage.h @@ -13,7 +13,7 @@ protected: static const int MCREGION_VERSION_ID = 0x4abc; public: - McRegionLevelStorage(ConsoleSaveFile *saveFile, File dir, const wstring& levelName, bool createPlayerDir); + McRegionLevelStorage(ConsoleSaveFile *saveFile, File dir, const std::wstring& levelName, bool createPlayerDir); ~McRegionLevelStorage(); virtual ChunkStorage *createChunkStorage(Dimension *dimension); diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp b/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp index c49fb9fa8..b6e5b4ba6 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp +++ b/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp @@ -27,7 +27,7 @@ McRegionLevelStorageSource::McRegionLevelStorageSource(File dir) : DirectoryLeve { } -wstring McRegionLevelStorageSource::getName() +std::wstring McRegionLevelStorageSource::getName() { return L"Scaevolus' McRegion"; } @@ -49,13 +49,13 @@ vector *McRegionLevelStorageSource::getLevelList() continue; } - wstring levelId = file->getName(); + std::wstring levelId = file->getName(); LevelData *levelData = getDataTagFor(levelId); if (levelData != NULL) { bool requiresConversion = levelData->getVersion() != McRegionLevelStorage::MCREGION_VERSION_ID; - wstring levelName = levelData->getLevelName(); + std::wstring levelName = levelData->getLevelName(); if (levelName.empty()) // 4J Jev TODO: levelName can't be NULL? if (levelName == NULL || isEmpty(levelName)) { @@ -74,13 +74,13 @@ void McRegionLevelStorageSource::clearAll() { } -std::shared_ptr McRegionLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) +std::shared_ptr McRegionLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, bool createPlayerDir) { // return new LevelStorageProfilerDecorator(new McRegionLevelStorage(baseDir, levelId, createPlayerDir)); return std::shared_ptr(new McRegionLevelStorage(saveFile, baseDir, levelId, createPlayerDir)); } -bool McRegionLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId) +bool McRegionLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const std::wstring& levelId) { // check if there is old file format level data LevelData *levelData = getDataTagFor(saveFile, levelId); @@ -94,7 +94,7 @@ bool McRegionLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const return true; } -bool McRegionLevelStorageSource::requiresConversion(ConsoleSaveFile *saveFile, const wstring& levelId) +bool McRegionLevelStorageSource::requiresConversion(ConsoleSaveFile *saveFile, const std::wstring& levelId) { LevelData *levelData = getDataTagFor(saveFile, levelId); if (levelData == NULL || levelData->getVersion() != 0) @@ -107,7 +107,7 @@ bool McRegionLevelStorageSource::requiresConversion(ConsoleSaveFile *saveFile, c return true; } -bool McRegionLevelStorageSource::convertLevel(ConsoleSaveFile *saveFile, const wstring& levelId, ProgressListener *progress) +bool McRegionLevelStorageSource::convertLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, ProgressListener *progress) { assert(false); // I removed this while updating the saves to use the single save file @@ -300,7 +300,7 @@ bool McRegionLevelStorageSource::FolderFilter::accept(File *file) } -bool McRegionLevelStorageSource::ChunkFilter::accept(File *dir, const wstring& name) +bool McRegionLevelStorageSource::ChunkFilter::accept(File *dir, const std::wstring& name) { Matcher matcher( chunkFilePattern, name ); return matcher.matches(); diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorageSource.h b/Minecraft.World/Level/Storage/McRegionLevelStorageSource.h index f4bc23788..e6da7adb4 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorageSource.h +++ b/Minecraft.World/Level/Storage/McRegionLevelStorageSource.h @@ -14,13 +14,13 @@ public: class ChunkFile; McRegionLevelStorageSource(File dir); - virtual wstring getName(); + virtual std::wstring getName(); virtual vector *getLevelList(); virtual void clearAll(); - virtual std::shared_ptr selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir); - virtual bool isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId); - virtual bool requiresConversion(ConsoleSaveFile *saveFile, const wstring& levelId); - virtual bool convertLevel(ConsoleSaveFile *saveFile, const wstring& levelId, ProgressListener *progress); + virtual std::shared_ptr selectLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, bool createPlayerDir); + virtual bool isConvertible(ConsoleSaveFile *saveFile, const std::wstring& levelId); + virtual bool requiresConversion(ConsoleSaveFile *saveFile, const std::wstring& levelId); + virtual bool convertLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, ProgressListener *progress); private: #if 0 @@ -44,7 +44,7 @@ public: { public: static const std::tr1::wregex chunkFilePattern; // was Pattern - bool accept(File *dir, const wstring& name); + bool accept(File *dir, const std::wstring& name); }; static class ChunkFile // implements Comparable diff --git a/Minecraft.World/Level/Storage/MemoryLevelStorage.cpp b/Minecraft.World/Level/Storage/MemoryLevelStorage.cpp index 68c3c453a..d6df23444 100644 --- a/Minecraft.World/Level/Storage/MemoryLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/MemoryLevelStorage.cpp @@ -52,12 +52,12 @@ bool MemoryLevelStorage::load(std::shared_ptr player) return false; } -CompoundTag *MemoryLevelStorage::loadPlayerDataTag(const wstring& playerName) +CompoundTag *MemoryLevelStorage::loadPlayerDataTag(const std::wstring& playerName) { return NULL; } -ConsoleSavePath MemoryLevelStorage::getDataFile(const wstring& id) +ConsoleSavePath MemoryLevelStorage::getDataFile(const std::wstring& id) { - return ConsoleSaveFile(wstring(L"")); + return ConsoleSaveFile(std::wstring(L"")); } \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/MemoryLevelStorage.h b/Minecraft.World/Level/Storage/MemoryLevelStorage.h index 93eff457d..980a18171 100644 --- a/Minecraft.World/Level/Storage/MemoryLevelStorage.h +++ b/Minecraft.World/Level/Storage/MemoryLevelStorage.h @@ -26,6 +26,6 @@ public: virtual void closeAll(); virtual void save(std::shared_ptr player); virtual bool load(std::shared_ptr player); - virtual CompoundTag *loadPlayerDataTag(const wstring& playerName); - virtual ConsoleSavePath getDataFile(const wstring& id); + virtual CompoundTag *loadPlayerDataTag(const std::wstring& playerName); + virtual ConsoleSavePath getDataFile(const std::wstring& id); }; \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/MemoryLevelStorageSource.cpp b/Minecraft.World/Level/Storage/MemoryLevelStorageSource.cpp index 46c549bc9..398052cc6 100644 --- a/Minecraft.World/Level/Storage/MemoryLevelStorageSource.cpp +++ b/Minecraft.World/Level/Storage/MemoryLevelStorageSource.cpp @@ -8,12 +8,12 @@ MemoryLevelStorageSource::MemoryLevelStorageSource() { } -wstring MemoryLevelStorageSource::getName() +std::wstring MemoryLevelStorageSource::getName() { return L"Memory Storage"; } -std::shared_ptr MemoryLevelStorageSource::selectLevel(const wstring& levelId, bool createPlayerDir) +std::shared_ptr MemoryLevelStorageSource::selectLevel(const std::wstring& levelId, bool createPlayerDir) { return std::shared_ptr () new MemoryLevelStorage()); } @@ -27,35 +27,35 @@ void MemoryLevelStorageSource::clearAll() { } -LevelData *MemoryLevelStorageSource::getDataTagFor(const wstring& levelId) +LevelData *MemoryLevelStorageSource::getDataTagFor(const std::wstring& levelId) { return NULL; } -bool MemoryLevelStorageSource::isNewLevelIdAcceptable(const wstring& levelId) +bool MemoryLevelStorageSource::isNewLevelIdAcceptable(const std::wstring& levelId) { return true; } -void MemoryLevelStorageSource::deleteLevel(const wstring& levelId) +void MemoryLevelStorageSource::deleteLevel(const std::wstring& levelId) { } -void MemoryLevelStorageSource::renameLevel(const wstring& levelId, const wstring& newLevelName) +void MemoryLevelStorageSource::renameLevel(const std::wstring& levelId, const std::wstring& newLevelName) { } -bool MemoryLevelStorageSource::isConvertible(const wstring& levelId) +bool MemoryLevelStorageSource::isConvertible(const std::wstring& levelId) { return false; } -bool MemoryLevelStorageSource::requiresConversion(const wstring& levelId) +bool MemoryLevelStorageSource::requiresConversion(const std::wstring& levelId) { return false; } -bool MemoryLevelStorageSource::convertLevel(const wstring& levelId, ProgressListener *progress) +bool MemoryLevelStorageSource::convertLevel(const std::wstring& levelId, ProgressListener *progress) { return false; } \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/MemoryLevelStorageSource.h b/Minecraft.World/Level/Storage/MemoryLevelStorageSource.h index 2d3de863b..734f8c81e 100644 --- a/Minecraft.World/Level/Storage/MemoryLevelStorageSource.h +++ b/Minecraft.World/Level/Storage/MemoryLevelStorageSource.h @@ -7,15 +7,15 @@ class MemoryLevelStorageSource : public LevelStorageSource { public: MemoryLevelStorageSource(); - wstring getName(); - std::shared_ptr selectLevel(const wstring& levelId, bool createPlayerDir); + std::wstring getName(); + std::shared_ptr selectLevel(const std::wstring& levelId, bool createPlayerDir); vector *getLevelList(); void clearAll(); - LevelData *getDataTagFor(const wstring& levelId); - bool isNewLevelIdAcceptable(const wstring& levelId); - void deleteLevel(const wstring& levelId); - void renameLevel(const wstring& levelId, const wstring& newLevelName); - bool isConvertible(const wstring& levelId); - bool requiresConversion(const wstring& levelId); - bool convertLevel(const wstring& levelId, ProgressListener *progress); + LevelData *getDataTagFor(const std::wstring& levelId); + bool isNewLevelIdAcceptable(const std::wstring& levelId); + void deleteLevel(const std::wstring& levelId); + void renameLevel(const std::wstring& levelId, const std::wstring& newLevelName); + bool isConvertible(const std::wstring& levelId); + bool requiresConversion(const std::wstring& levelId); + bool convertLevel(const std::wstring& levelId, ProgressListener *progress); }; \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/MockedLevelStorage.cpp b/Minecraft.World/Level/Storage/MockedLevelStorage.cpp index 46e1c0d1f..18dcd9e4a 100644 --- a/Minecraft.World/Level/Storage/MockedLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/MockedLevelStorage.cpp @@ -38,12 +38,12 @@ void MockedLevelStorage::closeAll() { } -ConsoleSavePath MockedLevelStorage::getDataFile(const wstring& id) +ConsoleSavePath MockedLevelStorage::getDataFile(const std::wstring& id) { - return ConsoleSavePath(wstring(L"")); + return ConsoleSavePath(std::wstring(L"")); } -wstring MockedLevelStorage::getLevelId() +std::wstring MockedLevelStorage::getLevelId() { return L"none"; } \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/MockedLevelStorage.h b/Minecraft.World/Level/Storage/MockedLevelStorage.h index e045b03a9..da80d37e0 100644 --- a/Minecraft.World/Level/Storage/MockedLevelStorage.h +++ b/Minecraft.World/Level/Storage/MockedLevelStorage.h @@ -15,8 +15,8 @@ public: virtual void saveLevelData(LevelData *levelData); virtual PlayerIO *getPlayerIO(); virtual void closeAll(); - virtual ConsoleSavePath getDataFile(const wstring& id); - virtual wstring getLevelId(); + virtual ConsoleSavePath getDataFile(const std::wstring& id); + virtual std::wstring getLevelId(); public: virtual ConsoleSaveFile *getSaveFile() { return NULL; } }; \ No newline at end of file diff --git a/Minecraft.World/Level/Storage/OldChunkStorage.cpp b/Minecraft.World/Level/Storage/OldChunkStorage.cpp index 5d49c7ddd..ce89aef11 100644 --- a/Minecraft.World/Level/Storage/OldChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/OldChunkStorage.cpp @@ -75,7 +75,7 @@ File OldChunkStorage::getFile(int x, int z) _itow(z & 63,path2,36); #endif //sprintf(file,"%s\\%s",dir,path1); - File file( dir, wstring( path1 ) ); + File file( dir, std::wstring( path1 ) ); if( !file.exists() ) { if(create) file.mkdir(); @@ -87,7 +87,7 @@ File OldChunkStorage::getFile(int x, int z) //strcat(file,"\\"); //strcat(file,path2); - file = File( file, wstring( path2 ) ); + file = File( file, std::wstring( path2 ) ); if( !file.exists() ) { if(create) file.mkdir(); @@ -100,7 +100,7 @@ File OldChunkStorage::getFile(int x, int z) //strcat(file,"\\"); //strcat(file,name); //sprintf(file,"%s\\%s",file,name); - file = File( file, wstring( name ) ); + file = File( file, std::wstring( name ) ); if ( !file.exists() ) { if (!create) diff --git a/Minecraft.World/Level/Storage/ReadOnlyChunkCache.cpp b/Minecraft.World/Level/Storage/ReadOnlyChunkCache.cpp index 76ebb55dd..2232faf78 100644 --- a/Minecraft.World/Level/Storage/ReadOnlyChunkCache.cpp +++ b/Minecraft.World/Level/Storage/ReadOnlyChunkCache.cpp @@ -84,7 +84,7 @@ bool ReadOnlyChunkCache::shouldSave() return false; } -wstring ReadOnlyChunkCache::gatherStats() +std::wstring ReadOnlyChunkCache::gatherStats() { return L"ReadOnlyChunkCache"; } @@ -94,7 +94,7 @@ vector *ReadOnlyChunkCache::getMobsAt(MobCategory *mobC return NULL; } -TilePos *ReadOnlyChunkCache::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) +TilePos *ReadOnlyChunkCache::findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z) { return NULL; } diff --git a/Minecraft.World/Level/Storage/ReadOnlyChunkCache.h b/Minecraft.World/Level/Storage/ReadOnlyChunkCache.h index dea121cf0..745725e09 100644 --- a/Minecraft.World/Level/Storage/ReadOnlyChunkCache.h +++ b/Minecraft.World/Level/Storage/ReadOnlyChunkCache.h @@ -32,8 +32,8 @@ public: virtual bool save(bool force, ProgressListener *progressListener); virtual bool tick(); virtual bool shouldSave(); - virtual wstring gatherStats(); + virtual std::wstring gatherStats(); virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z); }; diff --git a/Minecraft.World/Level/Storage/RegionFileCache.cpp b/Minecraft.World/Level/Storage/RegionFileCache.cpp index 9f75c1841..0f9ae968e 100644 --- a/Minecraft.World/Level/Storage/RegionFileCache.cpp +++ b/Minecraft.World/Level/Storage/RegionFileCache.cpp @@ -17,7 +17,7 @@ bool RegionFileCache::useSplitSaves(ESavePlatform platform) }; } -RegionFile *RegionFileCache::_getRegionFile(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) // 4J - TODO was synchronized +RegionFile *RegionFileCache::_getRegionFile(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) // 4J - TODO was synchronized { // 4J Jev - changed back to use of the File class. //char file[MAX_PATH_SIZE]; @@ -25,16 +25,16 @@ RegionFile *RegionFileCache::_getRegionFile(ConsoleSaveFile *saveFile, const wst //File regionDir(basePath, L"region"); - //File file(regionDir, wstring(L"r.") + _toString(chunkX>>5) + L"." + _toString(chunkZ>>5) + L".mcr" ); + //File file(regionDir, std::wstring(L"r.") + _toString(chunkX>>5) + L"." + _toString(chunkZ>>5) + L".mcr" ); MemSect(31); File file; if(useSplitSaves(saveFile->getSavePlatform())) { - file = File( prefix + wstring(L"r.") + _toString(chunkX>>4) + L"." + _toString(chunkZ>>4) + L".mcr" ); + file = File( prefix + std::wstring(L"r.") + _toString(chunkX>>4) + L"." + _toString(chunkZ>>4) + L".mcr" ); } else { - file = File( prefix + wstring(L"r.") + _toString(chunkX>>5) + L"." + _toString(chunkZ>>5) + L".mcr" ); + file = File( prefix + std::wstring(L"r.") + _toString(chunkX>>5) + L"." + _toString(chunkZ>>5) + L".mcr" ); } MemSect(0); @@ -87,13 +87,13 @@ void RegionFileCache::_clear() // 4J - TODO was synchronized cache.clear(); } -int RegionFileCache::_getSizeDelta(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) +int RegionFileCache::_getSizeDelta(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) { RegionFile *r = _getRegionFile(saveFile, prefix, chunkX, chunkZ); return r->getSizeDelta(); } -DataInputStream *RegionFileCache::_getChunkDataInputStream(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) +DataInputStream *RegionFileCache::_getChunkDataInputStream(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) { RegionFile* r = _getRegionFile(saveFile, prefix, chunkX, chunkZ); if(useSplitSaves(saveFile->getSavePlatform())) @@ -107,7 +107,7 @@ DataInputStream *RegionFileCache::_getChunkDataInputStream(ConsoleSaveFile *save } } -DataOutputStream *RegionFileCache::_getChunkDataOutputStream(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) +DataOutputStream *RegionFileCache::_getChunkDataOutputStream(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) { RegionFile* r = _getRegionFile(saveFile, prefix, chunkX, chunkZ); if(useSplitSaves(saveFile->getSavePlatform())) diff --git a/Minecraft.World/Level/Storage/RegionFileCache.h b/Minecraft.World/Level/Storage/RegionFileCache.h index abad6b060..2115f9cf6 100644 --- a/Minecraft.World/Level/Storage/RegionFileCache.h +++ b/Minecraft.World/Level/Storage/RegionFileCache.h @@ -17,18 +17,18 @@ public: // Made public and non-static so we can have a cache for input and output files RegionFileCache() {} - RegionFile *_getRegionFile(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ); // 4J - TODO was synchronized + RegionFile *_getRegionFile(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ); // 4J - TODO was synchronized void _clear(); // 4J - TODO was synchronized - int _getSizeDelta(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ); - DataInputStream *_getChunkDataInputStream(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ); - DataOutputStream *_getChunkDataOutputStream(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ); + int _getSizeDelta(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ); + DataInputStream *_getChunkDataInputStream(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ); + DataOutputStream *_getChunkDataOutputStream(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ); // Keep static version for general game usage - static RegionFile *getRegionFile(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getRegionFile(saveFile, prefix, chunkX, chunkZ); } + static RegionFile *getRegionFile(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getRegionFile(saveFile, prefix, chunkX, chunkZ); } static void clear() { s_defaultCache._clear(); } - static int getSizeDelta(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getSizeDelta(saveFile, prefix, chunkX, chunkZ); } - static DataInputStream *getChunkDataInputStream(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getChunkDataInputStream(saveFile, prefix, chunkX, chunkZ); } - static DataOutputStream *getChunkDataOutputStream(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getChunkDataOutputStream(saveFile, prefix, chunkX, chunkZ); } + static int getSizeDelta(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getSizeDelta(saveFile, prefix, chunkX, chunkZ); } + static DataInputStream *getChunkDataInputStream(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getChunkDataInputStream(saveFile, prefix, chunkX, chunkZ); } + static DataOutputStream *getChunkDataOutputStream(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getChunkDataOutputStream(saveFile, prefix, chunkX, chunkZ); } private: bool useSplitSaves(ESavePlatform platform); diff --git a/Minecraft.World/Level/Storage/SavedData.cpp b/Minecraft.World/Level/Storage/SavedData.cpp index 63ba1567d..74b51d67a 100644 --- a/Minecraft.World/Level/Storage/SavedData.cpp +++ b/Minecraft.World/Level/Storage/SavedData.cpp @@ -3,7 +3,7 @@ -SavedData::SavedData(const wstring& id) : id( id ) +SavedData::SavedData(const std::wstring& id) : id( id ) { dirty = false; } diff --git a/Minecraft.World/Level/Storage/SavedData.h b/Minecraft.World/Level/Storage/SavedData.h index e4d0ba3f7..6a57aec25 100644 --- a/Minecraft.World/Level/Storage/SavedData.h +++ b/Minecraft.World/Level/Storage/SavedData.h @@ -8,13 +8,13 @@ class CompoundTag; class SavedData : public enable_shared_from_this { public: - const wstring id; + const std::wstring id; private: bool dirty; public: - SavedData(const wstring& id); + SavedData(const std::wstring& id); virtual void load(CompoundTag *tag) = 0; virtual void save(CompoundTag *tag) = 0; diff --git a/Minecraft.World/Level/Storage/SavedDataStorage.cpp b/Minecraft.World/Level/Storage/SavedDataStorage.cpp index e52d058e6..1303e36ee 100644 --- a/Minecraft.World/Level/Storage/SavedDataStorage.cpp +++ b/Minecraft.World/Level/Storage/SavedDataStorage.cpp @@ -11,16 +11,16 @@ SavedDataStorage::SavedDataStorage(LevelStorage *levelStorage) { /* - cache = new std::unordered_map >; + cache = new std::unordered_map >; savedDatas = new vector >; - usedAuxIds = new std::unordered_map; + usedAuxIds = new std::unordered_map; */ this->levelStorage = levelStorage; loadAuxValues(); } -std::shared_ptr SavedDataStorage::get(const type_info& clazz, const wstring& id) +std::shared_ptr SavedDataStorage::get(const type_info& clazz, const std::wstring& id) { AUTO_VAR(it, cache.find( id )); if (it != cache.end()) return (*it).second; @@ -59,13 +59,13 @@ std::shared_ptr SavedDataStorage::get(const type_info& clazz, const w if (data != NULL) { - cache.insert( std::unordered_map >::value_type( id , data ) ); + cache.insert( std::unordered_map >::value_type( id , data ) ); savedDatas.push_back(data); } return data; } -void SavedDataStorage::set(const wstring& id, std::shared_ptr data) +void SavedDataStorage::set(const std::wstring& id, std::shared_ptr data) { if (data == NULL) { @@ -145,7 +145,7 @@ void SavedDataStorage::loadAuxValues() if (dynamic_cast(tag) != NULL) { ShortTag *sTag = (ShortTag *) tag; - wstring id = sTag->getName(); + std::wstring id = sTag->getName(); short val = sTag->data; usedAuxIds.insert( uaiMapType::value_type( id, val ) ); } @@ -154,7 +154,7 @@ void SavedDataStorage::loadAuxValues() } } -int SavedDataStorage::getFreeAuxValueFor(const wstring& id) +int SavedDataStorage::getFreeAuxValueFor(const std::wstring& id) { AUTO_VAR(it, usedAuxIds.find( id )); short val = 0; diff --git a/Minecraft.World/Level/Storage/SavedDataStorage.h b/Minecraft.World/Level/Storage/SavedDataStorage.h index 16128040e..599a0de98 100644 --- a/Minecraft.World/Level/Storage/SavedDataStorage.h +++ b/Minecraft.World/Level/Storage/SavedDataStorage.h @@ -9,18 +9,18 @@ class SavedDataStorage private: LevelStorage *levelStorage; - typedef std::unordered_map > cacheMapType; + typedef std::unordered_map > cacheMapType; cacheMapType cache; vector > savedDatas; - typedef std::unordered_map uaiMapType; + typedef std::unordered_map uaiMapType; uaiMapType usedAuxIds; public: SavedDataStorage(LevelStorage *); - std::shared_ptr get(const type_info& clazz, const wstring& id); - void set(const wstring& id, std::shared_ptr data); + std::shared_ptr get(const type_info& clazz, const std::wstring& id); + void set(const std::wstring& id, std::shared_ptr data); void save(); private: @@ -28,7 +28,7 @@ private: void loadAuxValues(); public: - int getFreeAuxValueFor(const wstring& id); + int getFreeAuxValueFor(const std::wstring& id); // 4J Added int getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, int centreZC, int scale); diff --git a/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp b/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp index 4adadbb7f..b4c76ebbd 100644 --- a/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp @@ -29,7 +29,7 @@ ZonedChunkStorage::ZonedChunkStorage(File dir) tickCount = 0; //this->dir = dir; - this->dir = File( dir, wstring( L"data" ) ); + this->dir = File( dir, std::wstring( L"data" ) ); if( !this->dir.exists() ) this->dir.mkdirs(); } @@ -58,7 +58,7 @@ ZoneFile *ZonedChunkStorage::getZoneFile(int x, int z, bool create) wchar_t zRadix36[64]; _itow(x,xRadix36,36); _itow(z,zRadix36,36); - File file = File(dir, wstring( L"zone_") + _toString( xRadix36 ) + L"_" + _toString( zRadix36 ) + L".dat" ); + File file = File(dir, std::wstring( L"zone_") + _toString( xRadix36 ) + L"_" + _toString( zRadix36 ) + L".dat" ); if ( !file.exists() ) { @@ -67,7 +67,7 @@ ZoneFile *ZonedChunkStorage::getZoneFile(int x, int z, bool create) CloseHandle(ch); } - File entityFile = File(dir, wstring( L"entities_") + _toString( xRadix36 ) + L"_" + _toString( zRadix36 ) + L".dat" ); + File entityFile = File(dir, std::wstring( L"entities_") + _toString( xRadix36 ) + L"_" + _toString( zRadix36 ) + L".dat" ); zoneFiles[key] = new ZoneFile(key, file, entityFile); } diff --git a/Minecraft.World/Network/Connection.cpp b/Minecraft.World/Network/Connection.cpp index 2627c23ee..d8839a279 100644 --- a/Minecraft.World/Network/Connection.cpp +++ b/Minecraft.World/Network/Connection.cpp @@ -70,7 +70,7 @@ Connection::~Connection() dis = NULL; } -Connection::Connection(Socket *socket, const wstring& id, PacketListener *packetListener) // throws IOException +Connection::Connection(Socket *socket, const std::wstring& id, PacketListener *packetListener) // throws IOException { _init(); @@ -121,7 +121,7 @@ Connection::Connection(Socket *socket, const wstring& id, PacketListener *packet /* 4J JEV, java: - new Thread(wstring(id).append(L" read thread")) { + new Thread(std::wstring(id).append(L" read thread")) { }; @@ -347,7 +347,7 @@ void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) va_list input; va_start( input, reason ); - disconnectReason = reason;//va_arg( input, const wstring ); + disconnectReason = reason;//va_arg( input, const std::wstring ); vector objs = vector(); void *i = NULL; diff --git a/Minecraft.World/Network/Connection.h b/Minecraft.World/Network/Connection.h index 1a39dea96..6cb92e912 100644 --- a/Minecraft.World/Network/Connection.h +++ b/Minecraft.World/Network/Connection.h @@ -95,7 +95,7 @@ private: public: // 4J Jev, need to delete the critical section. ~Connection(); - Connection(Socket *socket, const wstring& id, PacketListener *packetListener); // throws IOException + Connection(Socket *socket, const std::wstring& id, PacketListener *packetListener); // throws IOException void setListener(PacketListener *packetListener); void send(std::shared_ptr packet); diff --git a/Minecraft.World/Network/Packets/AddPaintingPacket.h b/Minecraft.World/Network/Packets/AddPaintingPacket.h index 0a002ddb5..0ec0c73f9 100644 --- a/Minecraft.World/Network/Packets/AddPaintingPacket.h +++ b/Minecraft.World/Network/Packets/AddPaintingPacket.h @@ -11,7 +11,7 @@ public: int id; int x, y, z; int dir; - wstring motive; + std::wstring motive; public: AddPaintingPacket(); diff --git a/Minecraft.World/Network/Packets/AddPlayerPacket.h b/Minecraft.World/Network/Packets/AddPlayerPacket.h index 909cfee9c..b1a39e1b5 100644 --- a/Minecraft.World/Network/Packets/AddPlayerPacket.h +++ b/Minecraft.World/Network/Packets/AddPlayerPacket.h @@ -15,7 +15,7 @@ private: public: int id; - wstring name; + std::wstring name; int x, y, z; char yRot, xRot; int carriedItem; diff --git a/Minecraft.World/Network/Packets/ChatPacket.cpp b/Minecraft.World/Network/Packets/ChatPacket.cpp index 227fd2d7c..a21bb1df0 100644 --- a/Minecraft.World/Network/Packets/ChatPacket.cpp +++ b/Minecraft.World/Network/Packets/ChatPacket.cpp @@ -14,7 +14,7 @@ ChatPacket::ChatPacket() } // Old chat packet constructor, adds message, custom data and additional message to arg vectors -ChatPacket::ChatPacket(const wstring& message, EChatPacketMessage type /*= e_ChatCustom*/, int customData /*= -1*/, const wstring& additionalMessage /*= L""*/) +ChatPacket::ChatPacket(const std::wstring& message, EChatPacketMessage type /*= e_ChatCustom*/, int customData /*= -1*/, const std::wstring& additionalMessage /*= L""*/) { m_messageType = type; if (customData != -1) m_intArgs.push_back(customData); diff --git a/Minecraft.World/Network/Packets/ChatPacket.h b/Minecraft.World/Network/Packets/ChatPacket.h index 2481e903a..10af4c3f5 100644 --- a/Minecraft.World/Network/Packets/ChatPacket.h +++ b/Minecraft.World/Network/Packets/ChatPacket.h @@ -79,12 +79,12 @@ public: }; public: - vector m_stringArgs; + vector m_stringArgs; vector m_intArgs; EChatPacketMessage m_messageType; ChatPacket(); - ChatPacket(const wstring& message, EChatPacketMessage type = e_ChatCustom, int customData = -1, const wstring& additionalMessage = L""); + ChatPacket(const std::wstring& message, EChatPacketMessage type = e_ChatCustom, int customData = -1, const std::wstring& additionalMessage = L""); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); diff --git a/Minecraft.World/Network/Packets/CustomPayloadPacket.cpp b/Minecraft.World/Network/Packets/CustomPayloadPacket.cpp index 236f2fc3e..2419eadda 100644 --- a/Minecraft.World/Network/Packets/CustomPayloadPacket.cpp +++ b/Minecraft.World/Network/Packets/CustomPayloadPacket.cpp @@ -5,20 +5,20 @@ #include "CustomPayloadPacket.h" // Mojang-defined custom packets -const wstring CustomPayloadPacket::CUSTOM_BOOK_PACKET = L"MC|BEdit"; -const wstring CustomPayloadPacket::CUSTOM_BOOK_SIGN_PACKET = L"MC|BSign"; -const wstring CustomPayloadPacket::TEXTURE_PACK_PACKET = L"MC|TPack"; -const wstring CustomPayloadPacket::TRADER_LIST_PACKET = L"MC|TrList"; -const wstring CustomPayloadPacket::TRADER_SELECTION_PACKET = L"MC|TrSel"; -const wstring CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET = L"MC|AdvCdm"; -const wstring CustomPayloadPacket::SET_BEACON_PACKET = L"MC|Beacon"; -const wstring CustomPayloadPacket::SET_ITEM_NAME_PACKET = L"MC|ItemName"; +const std::wstring CustomPayloadPacket::CUSTOM_BOOK_PACKET = L"MC|BEdit"; +const std::wstring CustomPayloadPacket::CUSTOM_BOOK_SIGN_PACKET = L"MC|BSign"; +const std::wstring CustomPayloadPacket::TEXTURE_PACK_PACKET = L"MC|TPack"; +const std::wstring CustomPayloadPacket::TRADER_LIST_PACKET = L"MC|TrList"; +const std::wstring CustomPayloadPacket::TRADER_SELECTION_PACKET = L"MC|TrSel"; +const std::wstring CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET = L"MC|AdvCdm"; +const std::wstring CustomPayloadPacket::SET_BEACON_PACKET = L"MC|Beacon"; +const std::wstring CustomPayloadPacket::SET_ITEM_NAME_PACKET = L"MC|ItemName"; CustomPayloadPacket::CustomPayloadPacket() { } -CustomPayloadPacket::CustomPayloadPacket(const wstring &identifier, byteArray data) +CustomPayloadPacket::CustomPayloadPacket(const std::wstring &identifier, byteArray data) { this->identifier = identifier; this->data = data; diff --git a/Minecraft.World/Network/Packets/CustomPayloadPacket.h b/Minecraft.World/Network/Packets/CustomPayloadPacket.h index b794631bd..7c199ce27 100644 --- a/Minecraft.World/Network/Packets/CustomPayloadPacket.h +++ b/Minecraft.World/Network/Packets/CustomPayloadPacket.h @@ -8,21 +8,21 @@ class CustomPayloadPacket : public Packet, public enable_shared_from_this Server -LoginPacket::LoginPacket(const wstring& userName, int clientVersion, PlayerUID offlineXuid, PlayerUID onlineXuid, bool friendsOnlyUGC, DWORD ugcPlayersVersion, DWORD skinId, DWORD capeId, bool isGuest) +LoginPacket::LoginPacket(const std::wstring& userName, int clientVersion, PlayerUID offlineXuid, PlayerUID onlineXuid, bool friendsOnlyUGC, DWORD ugcPlayersVersion, DWORD skinId, DWORD capeId, bool isGuest) { this->userName = userName; this->clientVersion = clientVersion; @@ -65,7 +65,7 @@ LoginPacket::LoginPacket(const wstring& userName, int clientVersion, PlayerUID o } // Server -> Client -LoginPacket::LoginPacket(const wstring& userName, int clientVersion, LevelType *pLevelType, __int64 seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale) +LoginPacket::LoginPacket(const std::wstring& userName, int clientVersion, LevelType *pLevelType, __int64 seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale) { this->userName = userName; this->clientVersion = clientVersion; @@ -97,7 +97,7 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException { clientVersion = dis->readInt(); userName = readUtf(dis, Player::MAX_NAME_LENGTH); - wstring typeName = readUtf(dis, 16); + std::wstring typeName = readUtf(dis, 16); m_pLevelType = LevelType::getLevelType(typeName); if (m_pLevelType == NULL) { diff --git a/Minecraft.World/Network/Packets/LoginPacket.h b/Minecraft.World/Network/Packets/LoginPacket.h index 682270455..08709fbee 100644 --- a/Minecraft.World/Network/Packets/LoginPacket.h +++ b/Minecraft.World/Network/Packets/LoginPacket.h @@ -8,7 +8,7 @@ class LoginPacket : public Packet, public enable_shared_from_this { public: int clientVersion; - wstring userName; + std::wstring userName; __int64 seed; char dimension; PlayerUID m_offlineXuid, m_onlineXuid; // 4J Added @@ -31,8 +31,8 @@ public: BYTE maxPlayers; LoginPacket(); - LoginPacket(const wstring& userName, int clientVersion, LevelType *pLevelType, __int64 seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT m_multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale); // Server -> Client - LoginPacket(const wstring& userName, int clientVersion, PlayerUID offlineXuid, PlayerUID onlineXuid, bool friendsOnlyUGC, DWORD ugcPlayersVersion, DWORD skinId, DWORD capeId, bool isGuest); // Client -> Server + LoginPacket(const std::wstring& userName, int clientVersion, LevelType *pLevelType, __int64 seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT m_multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale); // Server -> Client + LoginPacket(const std::wstring& userName, int clientVersion, PlayerUID offlineXuid, PlayerUID onlineXuid, bool friendsOnlyUGC, DWORD ugcPlayersVersion, DWORD skinId, DWORD capeId, bool isGuest); // Client -> Server virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); diff --git a/Minecraft.World/Network/Packets/Packet.cpp b/Minecraft.World/Network/Packets/Packet.cpp index 74da9b782..5208a991d 100644 --- a/Minecraft.World/Network/Packets/Packet.cpp +++ b/Minecraft.World/Network/Packets/Packet.cpp @@ -144,17 +144,17 @@ void Packet::staticCtor() map(255, true, true, true, false, typeid(DisconnectPacket), DisconnectPacket::create); } -IllegalArgumentException::IllegalArgumentException(const wstring& information) +IllegalArgumentException::IllegalArgumentException(const std::wstring& information) { this->information = information; } -IOException::IOException(const wstring& information) +IOException::IOException(const std::wstring& information) { this->information = information; } -RuntimeException::RuntimeException(const wstring& /*information*/) +RuntimeException::RuntimeException(const std::wstring& /*information*/) { } @@ -178,7 +178,7 @@ int Packet::renderPos = 0; void Packet::map(int id, bool receiveOnClient, bool receiveOnServer, bool sendToAnyClient, bool renderStats, const type_info& clazz, packetCreateFn createFn) { #if 0 - if (idToClassMap.count(id) > 0) throw new IllegalArgumentException(wstring(L"Duplicate packet id:") + _toString(id)); + if (idToClassMap.count(id) > 0) throw new IllegalArgumentException(std::wstring(L"Duplicate packet id:") + _toString(id)); if (classToIdMap.count(clazz) > 0) throw new IllegalArgumentException(L"Duplicate packet class:"); // TODO + clazz); #endif @@ -389,7 +389,7 @@ std::shared_ptr Packet::readPacket(DataInputStream *dis, bool isServer) // Close the stream to prevent further reads on a desynced stream dis->close(); return nullptr; - // throw new IOException(wstring(L"Bad packet id ") + _toString(id)); + // throw new IOException(std::wstring(L"Bad packet id ") + _toString(id)); } // Record successfully read packet ID @@ -437,7 +437,7 @@ void Packet::writePacket(std::shared_ptr packet, DataOutputStream *dos) packet->write(dos); } -void Packet::writeUtf(const wstring& value, DataOutputStream *dos) // throws IOException TODO 4J JEV, should this declare a throws? +void Packet::writeUtf(const std::wstring& value, DataOutputStream *dos) // throws IOException TODO 4J JEV, should this declare a throws? { #if 0 if (value.length() > Short::MAX_VALUE) @@ -450,7 +450,7 @@ void Packet::writeUtf(const wstring& value, DataOutputStream *dos) // throws IOE dos->writeChars(value); } -wstring Packet::readUtf(DataInputStream *dis, int maxLength) // throws IOException TODO 4J JEV, should this declare a throws? +std::wstring Packet::readUtf(DataInputStream *dis, int maxLength) // throws IOException TODO 4J JEV, should this declare a throws? { short stringLength = dis->readShort(); @@ -465,7 +465,7 @@ wstring Packet::readUtf(DataInputStream *dis, int maxLength) // throws IOExcepti return L""; } - wstring builder = L""; + std::wstring builder = L""; for (int i = 0; i < stringLength; i++) { wchar_t rc = dis->readChar(); @@ -530,7 +530,7 @@ __int64 Packet::PacketStatistics::getCountSample(int samplePos) return countSamples[samplePos] * 10; } -wstring Packet::PacketStatistics::getLegendString() +std::wstring Packet::PacketStatistics::getLegendString() { static wchar_t string[128]; double bps = 0.0; diff --git a/Minecraft.World/Network/Packets/Packet.h b/Minecraft.World/Network/Packets/Packet.h index d4bd38525..2e4d0e441 100644 --- a/Minecraft.World/Network/Packets/Packet.h +++ b/Minecraft.World/Network/Packets/Packet.h @@ -40,7 +40,7 @@ public: // 4J Added void renderStats(); __int64 getCountSample(int samplePos); - wstring getLegendString(); + std::wstring getLegendString(); }; // 4J JEV, replaces the static blocks. @@ -93,8 +93,8 @@ private : public: static std::shared_ptr readPacket(DataInputStream *dis, bool isServer); static void writePacket(std::shared_ptr packet, DataOutputStream *dos); - static void writeUtf(const wstring& value, DataOutputStream *dos); - static wstring readUtf(DataInputStream *dis, int maxLength); + static void writeUtf(const std::wstring& value, DataOutputStream *dos); + static std::wstring readUtf(DataInputStream *dis, int maxLength); virtual void read(DataInputStream *dis) = 0; // throws IOException = 0; TODO 4J JEV, should this declare a throws? virtual void write(DataOutputStream *dos) = 0; // throws IOException = 0; TODO 4J JEV, should this declare a throws? virtual void handle(PacketListener *listener) = 0; diff --git a/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.cpp b/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.cpp index dd3e33a3c..4b132a14a 100644 --- a/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.cpp +++ b/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.cpp @@ -61,7 +61,7 @@ int PlayerAbilitiesPacket::getEstimatedSize() return 2; } -//wstring getDebugInfo() +//std::wstring getDebugInfo() //{ // return String.format("invuln=%b, flying=%b, canfly=%b, instabuild=%b, flyspeed=%.4f, walkspped=%.4f", isInvulnerable(), isFlying(), canFly(), canInstabuild(), getFlyingSpeed(), getWalkingSpeed()); //} diff --git a/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.h b/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.h index 8a6e43a37..42f82a5dd 100644 --- a/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.h +++ b/Minecraft.World/Network/Packets/PlayerAbilitiesPacket.h @@ -28,7 +28,7 @@ public: void write(DataOutputStream *dos); void handle(PacketListener *listener); int getEstimatedSize(); - //wstring getDebugInfo(); + //std::wstring getDebugInfo(); bool isInvulnerable(); void setInvulnerable(bool invulnerable); bool isFlying(); diff --git a/Minecraft.World/Network/Packets/PlayerInfoPacket.h b/Minecraft.World/Network/Packets/PlayerInfoPacket.h index f4ad972fa..d7724e83a 100644 --- a/Minecraft.World/Network/Packets/PlayerInfoPacket.h +++ b/Minecraft.World/Network/Packets/PlayerInfoPacket.h @@ -8,7 +8,7 @@ class PlayerInfoPacket : public Packet, public enable_shared_from_this player); diff --git a/Minecraft.World/Network/Packets/PreLoginPacket.cpp b/Minecraft.World/Network/Packets/PreLoginPacket.cpp index 1087e3967..bea92ebaa 100644 --- a/Minecraft.World/Network/Packets/PreLoginPacket.cpp +++ b/Minecraft.World/Network/Packets/PreLoginPacket.cpp @@ -18,7 +18,7 @@ PreLoginPacket::PreLoginPacket() m_netcodeVersion = 0; } -PreLoginPacket::PreLoginPacket(wstring userName) +PreLoginPacket::PreLoginPacket(std::wstring userName) { this->loginKey = userName; m_playerXuids = NULL; @@ -32,7 +32,7 @@ PreLoginPacket::PreLoginPacket(wstring userName) m_netcodeVersion = 0; } -PreLoginPacket::PreLoginPacket(wstring userName, PlayerUID *playerXuids, DWORD playerCount, BYTE friendsOnlyBits, DWORD ugcPlayersVersion,char *pszUniqueSaveName, DWORD serverSettings, BYTE hostIndex, DWORD texturePackId) +PreLoginPacket::PreLoginPacket(std::wstring userName, PlayerUID *playerXuids, DWORD playerCount, BYTE friendsOnlyBits, DWORD ugcPlayersVersion,char *pszUniqueSaveName, DWORD serverSettings, BYTE hostIndex, DWORD texturePackId) { this->loginKey = userName; m_playerXuids = playerXuids; diff --git a/Minecraft.World/Network/Packets/PreLoginPacket.h b/Minecraft.World/Network/Packets/PreLoginPacket.h index 2d73d6300..9b12d78b7 100644 --- a/Minecraft.World/Network/Packets/PreLoginPacket.h +++ b/Minecraft.World/Network/Packets/PreLoginPacket.h @@ -21,11 +21,11 @@ public: DWORD m_texturePackId; SHORT m_netcodeVersion; - wstring loginKey; + std::wstring loginKey; PreLoginPacket(); - PreLoginPacket(wstring userName); - PreLoginPacket(wstring userName, PlayerUID *playerXuids, DWORD playerCount, BYTE friendsOnlyBits, DWORD ugcPlayersVersion,char *pszUniqueSaveName, DWORD serverSettings, BYTE hostIndex, DWORD texturePackId); + PreLoginPacket(std::wstring userName); + PreLoginPacket(std::wstring userName, PlayerUID *playerXuids, DWORD playerCount, BYTE friendsOnlyBits, DWORD ugcPlayersVersion,char *pszUniqueSaveName, DWORD serverSettings, BYTE hostIndex, DWORD texturePackId); ~PreLoginPacket(); virtual void read(DataInputStream *dis); diff --git a/Minecraft.World/Network/Packets/RespawnPacket.cpp b/Minecraft.World/Network/Packets/RespawnPacket.cpp index b3eb778b4..e02684cd8 100644 --- a/Minecraft.World/Network/Packets/RespawnPacket.cpp +++ b/Minecraft.World/Network/Packets/RespawnPacket.cpp @@ -45,7 +45,7 @@ void RespawnPacket::read(DataInputStream *dis) //throws IOException dimension = dis->readByte(); playerGameType = GameType::byId(dis->readByte()); mapHeight = dis->readShort(); - wstring typeName = readUtf(dis, 16); + std::wstring typeName = readUtf(dis, 16); m_pLevelType = LevelType::getLevelType(typeName); if (m_pLevelType == NULL) { diff --git a/Minecraft.World/Network/Packets/SignUpdatePacket.cpp b/Minecraft.World/Network/Packets/SignUpdatePacket.cpp index c8a0ae158..be3ffd001 100644 --- a/Minecraft.World/Network/Packets/SignUpdatePacket.cpp +++ b/Minecraft.World/Network/Packets/SignUpdatePacket.cpp @@ -18,7 +18,7 @@ SignUpdatePacket::SignUpdatePacket() } -SignUpdatePacket::SignUpdatePacket(int x, int y, int z, bool bVerified, bool bCensored, wstring lines[]) +SignUpdatePacket::SignUpdatePacket(int x, int y, int z, bool bVerified, bool bCensored, std::wstring lines[]) { shouldDelay = true; this->m_bVerified=bVerified; diff --git a/Minecraft.World/Network/Packets/SignUpdatePacket.h b/Minecraft.World/Network/Packets/SignUpdatePacket.h index e3284ab1f..339fd46fc 100644 --- a/Minecraft.World/Network/Packets/SignUpdatePacket.h +++ b/Minecraft.World/Network/Packets/SignUpdatePacket.h @@ -9,10 +9,10 @@ public: int x, y, z; bool m_bVerified; bool m_bCensored; - wstring lines[4]; + std::wstring lines[4]; SignUpdatePacket(); - SignUpdatePacket(int x, int y, int z, bool bVerified, bool bCensored, wstring lines[]); + SignUpdatePacket(int x, int y, int z, bool bVerified, bool bCensored, std::wstring lines[]); bool GetVerified() {return m_bVerified;} bool GetCensored() {return m_bCensored;} virtual void read(DataInputStream *dis); diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp index a2ebf9b49..d38fe8908 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp +++ b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp @@ -15,11 +15,11 @@ TextureAndGeometryChangePacket::TextureAndGeometryChangePacket() dwSkinID = 0; } -TextureAndGeometryChangePacket::TextureAndGeometryChangePacket(std::shared_ptr e, const wstring &path) +TextureAndGeometryChangePacket::TextureAndGeometryChangePacket(std::shared_ptr e, const std::wstring &path) { id = e->entityId; this->path = path; - wstring skinValue = path.substr(7,path.size()); + std::wstring skinValue = path.substr(7,path.size()); skinValue = skinValue.substr(0,skinValue.find_first_of(L'.')); std::wstringstream ss; ss << std::dec << skinValue.c_str(); diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h index e13b547e8..1a83be0a8 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h +++ b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h @@ -8,11 +8,11 @@ class TextureAndGeometryChangePacket : public Packet, public enable_shared_from_ public: int id; - wstring path; + std::wstring path; DWORD dwSkinID; TextureAndGeometryChangePacket(); - TextureAndGeometryChangePacket(std::shared_ptr e, const wstring &path); + TextureAndGeometryChangePacket(std::shared_ptr e, const std::wstring &path); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp index 10e243dab..f39ee8f43 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp +++ b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp @@ -30,11 +30,11 @@ TextureAndGeometryPacket::~TextureAndGeometryPacket() // } } -TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes) +TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes) { this->textureName = textureName; - wstring skinValue = textureName.substr(7,textureName.size()); + std::wstring skinValue = textureName.substr(7,textureName.size()); skinValue = skinValue.substr(0,skinValue.find_first_of(L'.')); std::wstringstream ss; ss << std::dec << skinValue.c_str(); @@ -47,11 +47,11 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P this->uiAnimOverrideBitmask=0; } -TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes, DLCSkinFile *pDLCSkinFile) +TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes, DLCSkinFile *pDLCSkinFile) { this->textureName = textureName; - wstring skinValue = textureName.substr(7,textureName.size()); + std::wstring skinValue = textureName.substr(7,textureName.size()); skinValue = skinValue.substr(0,skinValue.find_first_of(L'.')); std::wstringstream ss; ss << std::dec << skinValue.c_str(); @@ -80,11 +80,11 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P } } -TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes,vector *pvSkinBoxes, unsigned int uiAnimOverrideBitmask) +TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes,vector *pvSkinBoxes, unsigned int uiAnimOverrideBitmask) { this->textureName = textureName; - wstring skinValue = textureName.substr(7,textureName.size()); + std::wstring skinValue = textureName.substr(7,textureName.size()); skinValue = skinValue.substr(0,skinValue.find_first_of(L'.')); std::wstringstream ss; ss << std::dec << skinValue.c_str(); diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.h b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.h index e5ac02705..016291f88 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.h +++ b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.h @@ -10,7 +10,7 @@ class DLCSkinFile; class TextureAndGeometryPacket : public Packet, public enable_shared_from_this { public: - wstring textureName; + std::wstring textureName; DWORD dwSkinID; PBYTE pbData; DWORD dwTextureBytes; @@ -20,9 +20,9 @@ public: TextureAndGeometryPacket(); ~TextureAndGeometryPacket(); - TextureAndGeometryPacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes); - TextureAndGeometryPacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes, DLCSkinFile *pDLCSkinFile); - TextureAndGeometryPacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes, vector *pvSkinBoxes, unsigned int uiAnimOverrideBitmask); + TextureAndGeometryPacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes); + TextureAndGeometryPacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes, DLCSkinFile *pDLCSkinFile); + TextureAndGeometryPacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes, vector *pvSkinBoxes, unsigned int uiAnimOverrideBitmask); virtual void handle(PacketListener *listener); virtual void read(DataInputStream *dis); diff --git a/Minecraft.World/Network/Packets/TextureChangePacket.cpp b/Minecraft.World/Network/Packets/TextureChangePacket.cpp index 649d25fd7..c7c0d85b7 100644 --- a/Minecraft.World/Network/Packets/TextureChangePacket.cpp +++ b/Minecraft.World/Network/Packets/TextureChangePacket.cpp @@ -14,7 +14,7 @@ TextureChangePacket::TextureChangePacket() path = L""; } -TextureChangePacket::TextureChangePacket(std::shared_ptr e, ETextureChangeType action, const wstring &path) +TextureChangePacket::TextureChangePacket(std::shared_ptr e, ETextureChangeType action, const std::wstring &path) { id = e->entityId; this->action = action; diff --git a/Minecraft.World/Network/Packets/TextureChangePacket.h b/Minecraft.World/Network/Packets/TextureChangePacket.h index 7d99b3b32..9fa86418a 100644 --- a/Minecraft.World/Network/Packets/TextureChangePacket.h +++ b/Minecraft.World/Network/Packets/TextureChangePacket.h @@ -14,10 +14,10 @@ public: int id; ETextureChangeType action; - wstring path; + std::wstring path; TextureChangePacket(); - TextureChangePacket(std::shared_ptr e, ETextureChangeType action, const wstring &path); + TextureChangePacket(std::shared_ptr e, ETextureChangeType action, const std::wstring &path); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); diff --git a/Minecraft.World/Network/Packets/TexturePacket.cpp b/Minecraft.World/Network/Packets/TexturePacket.cpp index 5d0593123..730c588d9 100644 --- a/Minecraft.World/Network/Packets/TexturePacket.cpp +++ b/Minecraft.World/Network/Packets/TexturePacket.cpp @@ -22,7 +22,7 @@ TexturePacket::~TexturePacket() // } } -TexturePacket::TexturePacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes) +TexturePacket::TexturePacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes) { this->textureName = textureName; this->pbData = pbData; diff --git a/Minecraft.World/Network/Packets/TexturePacket.h b/Minecraft.World/Network/Packets/TexturePacket.h index 6f8b36bc1..2aee039bf 100644 --- a/Minecraft.World/Network/Packets/TexturePacket.h +++ b/Minecraft.World/Network/Packets/TexturePacket.h @@ -6,13 +6,13 @@ using namespace std; class TexturePacket : public Packet, public enable_shared_from_this { public: - wstring textureName; + std::wstring textureName; PBYTE pbData; DWORD dwBytes; TexturePacket(); ~TexturePacket(); - TexturePacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes); + TexturePacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes); virtual void handle(PacketListener *listener); virtual void read(DataInputStream *dis); diff --git a/Minecraft.World/Network/Packets/UpdateGameRuleProgressPacket.cpp b/Minecraft.World/Network/Packets/UpdateGameRuleProgressPacket.cpp index e796623d2..665d2ae2c 100644 --- a/Minecraft.World/Network/Packets/UpdateGameRuleProgressPacket.cpp +++ b/Minecraft.World/Network/Packets/UpdateGameRuleProgressPacket.cpp @@ -14,7 +14,7 @@ UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket() m_dataTag = 0; } -UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket(ConsoleGameRules::EGameRuleType definitionType, const wstring &messageId, int icon, int auxValue, int dataTag, void *data, int dataLength) +UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket(ConsoleGameRules::EGameRuleType definitionType, const std::wstring &messageId, int icon, int auxValue, int dataTag, void *data, int dataLength) { m_definitionType = definitionType; m_messageId = messageId; diff --git a/Minecraft.World/Network/Packets/UpdateGameRuleProgressPacket.h b/Minecraft.World/Network/Packets/UpdateGameRuleProgressPacket.h index 65df6dfe6..c68edd9af 100644 --- a/Minecraft.World/Network/Packets/UpdateGameRuleProgressPacket.h +++ b/Minecraft.World/Network/Packets/UpdateGameRuleProgressPacket.h @@ -7,13 +7,13 @@ class UpdateGameRuleProgressPacket : public Packet, public enable_shared_from_th { public: ConsoleGameRules::EGameRuleType m_definitionType; - wstring m_messageId; + std::wstring m_messageId; int m_icon, m_auxValue; int m_dataTag; byteArray m_data; UpdateGameRuleProgressPacket(); - UpdateGameRuleProgressPacket(ConsoleGameRules::EGameRuleType definitionType, const wstring &messageId, int icon, int auxValue, int dataTag, void *data, int dataLength); + UpdateGameRuleProgressPacket(ConsoleGameRules::EGameRuleType definitionType, const std::wstring &messageId, int icon, int auxValue, int dataTag, void *data, int dataLength); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); diff --git a/Minecraft.World/Player/Player.cpp b/Minecraft.World/Player/Player.cpp index 4c998d7fa..ae41306a2 100644 --- a/Minecraft.World/Player/Player.cpp +++ b/Minecraft.World/Player/Player.cpp @@ -777,11 +777,11 @@ void Player::setCustomCape(DWORD capeId) { if(app.DefaultCapeExists()) { - this->customTextureUrl2= wstring(L"Special_Cape.png"); + this->customTextureUrl2= std::wstring(L"Special_Cape.png"); } else { - this->customTextureUrl2= wstring(L""); + this->customTextureUrl2= std::wstring(L""); } } @@ -791,17 +791,17 @@ void Player::setCustomCape(DWORD capeId) // if there is a custom default cloak, then set it here if(app.DefaultCapeExists()) { - this->customTextureUrl2= wstring(L"Special_Cape.png"); + this->customTextureUrl2= std::wstring(L"Special_Cape.png"); } else { - this->customTextureUrl2 =wstring(L""); + this->customTextureUrl2 =std::wstring(L""); } } } } -DWORD Player::getCapeIdFromPath(const wstring &cape) +DWORD Player::getCapeIdFromPath(const std::wstring &cape) { bool dlcCape = false; unsigned int capeId = 0; @@ -810,7 +810,7 @@ DWORD Player::getCapeIdFromPath(const wstring &cape) { dlcCape = cape.substr(0,3).compare(L"dlc") == 0; - wstring capeValue = cape.substr(7,cape.size()); + std::wstring capeValue = cape.substr(7,cape.size()); capeValue = capeValue.substr(0,capeValue.find_first_of(L'.')); std::wstringstream ss; @@ -827,7 +827,7 @@ DWORD Player::getCapeIdFromPath(const wstring &cape) return capeId; } -wstring Player::getCapePathFromId(DWORD capeId) +std::wstring Player::getCapePathFromId(DWORD capeId) { // 4J Stu - This function maps the encoded DWORD we store in the player profile // to a filename that is stored as a memory texture and shared between systems in game @@ -899,11 +899,11 @@ void Player::prepareCustomTextures() //{ // if(app.DefaultCapeExists()) // { - // this->customTextureUrl2= wstring(L"Default_Cape.png"); + // this->customTextureUrl2= std::wstring(L"Default_Cape.png"); // } // else // { - // this->customTextureUrl2= wstring(L""); + // this->customTextureUrl2= std::wstring(L""); // } //} @@ -914,15 +914,15 @@ void Player::prepareCustomTextures() // if there is a custom default cloak, then set it here //if(app.DefaultCapeExists()) //{ - // this->customTextureUrl2= wstring(L"Default_Cape.png"); + // this->customTextureUrl2= std::wstring(L"Default_Cape.png"); //} //else //{ - // this->customTextureUrl2 =wstring(L""); + // this->customTextureUrl2 =std::wstring(L""); //} } - /*cloakTexture = wstring(L"http://s3.amazonaws.com/MinecraftCloaks/").append( name ).append( L".png" );*/ + /*cloakTexture = std::wstring(L"http://s3.amazonaws.com/MinecraftCloaks/").append( name ).append( L".png" );*/ //this->customTextureUrl2 = cloakTexture; } @@ -2455,7 +2455,7 @@ bool Player::isAlwaysExperienceDropper() return true; } -wstring Player::getAName() +std::wstring Player::getAName() { return name; } @@ -2502,12 +2502,12 @@ void Player::setGameMode(GameType *mode) { } -wstring Player::getName() +std::wstring Player::getName() { return name; } -wstring Player::getDisplayName() +std::wstring Player::getDisplayName() { return displayName; } diff --git a/Minecraft.World/Player/Player.h b/Minecraft.World/Player/Player.h index 087f78e9b..39275541e 100644 --- a/Minecraft.World/Player/Player.h +++ b/Minecraft.World/Player/Player.h @@ -70,7 +70,7 @@ public: bool swinging; int swingTime; - wstring name; + std::wstring name; int dimension; int takeXpDelay; @@ -78,13 +78,13 @@ public: unsigned int m_uiPlayerCurrentSkin; void ChangePlayerSkin(); - // 4J-PB - not needed, since cutomtextureurl2 is the same thing wstring cloakTexture; + // 4J-PB - not needed, since cutomtextureurl2 is the same thing std::wstring cloakTexture; double xCloakO, yCloakO, zCloakO; double xCloak, yCloak, zCloak; // 4J-HEG - store display name, added for Xbox One - wstring displayName; + std::wstring displayName; protected: // player sleeping in bed? @@ -361,7 +361,7 @@ protected: virtual bool isAlwaysExperienceDropper(); public: - virtual wstring getAName(); + virtual std::wstring getAName(); virtual void changeDimension(int i); virtual void restoreFrom(std::shared_ptr oldPlayer, bool restoreAll); @@ -372,8 +372,8 @@ protected: public: void onUpdateAbilities(); void setGameMode(GameType *mode); - wstring getName(); - wstring getDisplayName(); // 4J added + std::wstring getName(); + std::wstring getDisplayName(); // 4J added //Language getLanguage() { return Language.getInstance(); } //String localize(String key, Object... args) { return getLanguage().getElement(key, args); } @@ -393,7 +393,7 @@ public: virtual void onCrafted(std::shared_ptr item) {} // 4J Overriding this so that we can have some different default skins - virtual int getTexture(); // 4J changed from wstring to int + virtual int getTexture(); // 4J changed from std::wstring to int void setPlayerDefaultSkin(EDefaultSkins skin); EDefaultSkins getPlayerDefaultSkin() { return m_skinIndex; } virtual void setCustomSkin(DWORD skinId); @@ -401,8 +401,8 @@ public: virtual void setCustomCape(DWORD capeId); DWORD getCustomCape() {return m_dwCapeId; } - static DWORD getCapeIdFromPath(const wstring &cape); - static wstring getCapePathFromId(DWORD capeId); + static DWORD getCapeIdFromPath(const std::wstring &cape); + static std::wstring getCapePathFromId(DWORD capeId); static unsigned int getSkinAnimOverrideBitmask(DWORD skinId); // 4J Added @@ -410,8 +410,8 @@ public: PlayerUID getXuid() { return m_xuid; } void setOnlineXuid(PlayerUID xuid) { m_OnlineXuid = xuid; } PlayerUID getOnlineXuid() { return m_OnlineXuid; } - void setUUID(const wstring &UUID) { m_UUID = UUID; } - wstring getUUID() { return m_UUID; } + void setUUID(const std::wstring &UUID) { m_UUID = UUID; } + std::wstring getUUID() { return m_UUID; } void setPlayerIndex(DWORD dwIndex) { m_playerIndex = dwIndex; } DWORD getPlayerIndex() { return m_playerIndex; } @@ -422,13 +422,13 @@ public: void setShowOnMaps(bool bVal) { m_bShownOnMaps = bVal; } bool canShowOnMaps() { return m_bShownOnMaps && !getPlayerGamePrivilege(ePlayerGamePrivilege_Invisible); } - virtual void sendMessage(const wstring& message, ChatPacket::EChatPacketMessage type = ChatPacket::e_ChatCustom, int customData = -1, const wstring& additionalMessage = L"") { } + virtual void sendMessage(const std::wstring& message, ChatPacket::EChatPacketMessage type = ChatPacket::e_ChatCustom, int customData = -1, const std::wstring& additionalMessage = L"") { } private: PlayerUID m_xuid; PlayerUID m_OnlineXuid; protected: - wstring m_UUID; // 4J Added + std::wstring m_UUID; // 4J Added bool m_bShownOnMaps; diff --git a/Minecraft.World/Recipes/ArmorRecipes.cpp b/Minecraft.World/Recipes/ArmorRecipes.cpp index 2604e4561..6d837a7c0 100644 --- a/Minecraft.World/Recipes/ArmorRecipes.cpp +++ b/Minecraft.World/Recipes/ArmorRecipes.cpp @@ -10,7 +10,7 @@ #include "ArmorRecipes.h" // 4J-PB - adding "" on the end of these so we can detect it -wstring ArmorRecipes::shapes[][4] = +std::wstring ArmorRecipes::shapes[][4] = { {L"XXX", // L"X X",L""},// diff --git a/Minecraft.World/Recipes/ArmorRecipes.h b/Minecraft.World/Recipes/ArmorRecipes.h index b6a693727..0ab9321bb 100644 --- a/Minecraft.World/Recipes/ArmorRecipes.h +++ b/Minecraft.World/Recipes/ArmorRecipes.h @@ -23,7 +23,7 @@ public: ArmorRecipes() {_init();} private: // 4J-PB - this wasn't static in java, so might not be right - static wstring shapes[][4]; + static std::wstring shapes[][4]; private: vector *map; diff --git a/Minecraft.World/Recipes/Recipes.cpp b/Minecraft.World/Recipes/Recipes.cpp index 2c96ddbb5..ca1a6c82d 100644 --- a/Minecraft.World/Recipes/Recipes.cpp +++ b/Minecraft.World/Recipes/Recipes.cpp @@ -925,7 +925,7 @@ Recipes::Recipes() // 4J-PB - this function has been substantially changed due to the differences with a va_list of classes in C++ and Java ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) { - wstring map = L""; + std::wstring map = L""; int p = 0; int width = 0; int height = 0; @@ -933,8 +933,8 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) va_list vl; wchar_t *wchTypes; wchar_t *pwchString; - wstring wString; - wstring *wStringA; + std::wstring wString; + std::wstring *wStringA; ItemInstance *pItemInstance; Tile *pTile; Item *pItem; @@ -981,7 +981,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) map += wString; break; case L'w': - wStringA=va_arg(vl,wstring *); + wStringA=va_arg(vl,std::wstring *); iCount=0; do { @@ -1077,7 +1077,7 @@ void Recipes::addShapelessRecipy(ItemInstance *result,... ) { va_list vl; wchar_t *szTypes; - wstring String; + std::wstring String; ItemInstance *pItemInstance; Tile *pTile; Item *pItem; diff --git a/Minecraft.World/Recipes/ToolRecipes.cpp b/Minecraft.World/Recipes/ToolRecipes.cpp index e4958fcb5..d9a1b56e3 100644 --- a/Minecraft.World/Recipes/ToolRecipes.cpp +++ b/Minecraft.World/Recipes/ToolRecipes.cpp @@ -10,7 +10,7 @@ #include "ToolRecipes.h" // 4J-PB - adding "" on the end of these so we can detect it -wstring ToolRecipies::shapes[][4] = +std::wstring ToolRecipies::shapes[][4] = { {L"XXX", // L" # ",// diff --git a/Minecraft.World/Recipes/ToolRecipes.h b/Minecraft.World/Recipes/ToolRecipes.h index 7c433b4c0..5b3ddfdb0 100644 --- a/Minecraft.World/Recipes/ToolRecipes.h +++ b/Minecraft.World/Recipes/ToolRecipes.h @@ -16,7 +16,7 @@ public: ToolRecipies() {_init();} private: - static wstring shapes[][4]; + static std::wstring shapes[][4]; vector *map; public: diff --git a/Minecraft.World/Recipes/WeaponRecipes.cpp b/Minecraft.World/Recipes/WeaponRecipes.cpp index 1cd8433d8..32169a352 100644 --- a/Minecraft.World/Recipes/WeaponRecipes.cpp +++ b/Minecraft.World/Recipes/WeaponRecipes.cpp @@ -7,7 +7,7 @@ #include "WeaponRecipes.h" // 4J-PB - adding "" on the end of these so we can detect it -wstring WeaponRecipies::shapes[][4] = +std::wstring WeaponRecipies::shapes[][4] = { {L"X", // L"X",// diff --git a/Minecraft.World/Recipes/WeaponRecipes.h b/Minecraft.World/Recipes/WeaponRecipes.h index 105fba450..d8793a917 100644 --- a/Minecraft.World/Recipes/WeaponRecipes.h +++ b/Minecraft.World/Recipes/WeaponRecipes.h @@ -14,7 +14,7 @@ public: WeaponRecipies() {_init();} private: - static wstring shapes[][4]; + static std::wstring shapes[][4]; vector *map; public: diff --git a/Minecraft.World/Stats/Achievement.cpp b/Minecraft.World/Stats/Achievement.cpp index 514f9276f..e2a228028 100644 --- a/Minecraft.World/Stats/Achievement.cpp +++ b/Minecraft.World/Stats/Achievement.cpp @@ -15,18 +15,18 @@ void Achievement::_init() if (y > Achievements::yMax) Achievements::yMax = y; } -Achievement::Achievement(int id, const wstring& name, int x, int y, Item *icon, Achievement *requires) - : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon( new ItemInstance(icon) ), x(x), y(y), requires(requires) +Achievement::Achievement(int id, const std::wstring& name, int x, int y, Item *icon, Achievement *requires) + : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::wstring(L"achievement.").append(name)) ), desc( I18n::get(std::wstring(L"achievement.").append(name).append(L".desc"))), icon( new ItemInstance(icon) ), x(x), y(y), requires(requires) { } -Achievement::Achievement(int id, const wstring& name, int x, int y, Tile *icon, Achievement *requires) - : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon( new ItemInstance(icon) ), x(x), y(y), requires(requires) +Achievement::Achievement(int id, const std::wstring& name, int x, int y, Tile *icon, Achievement *requires) + : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::wstring(L"achievement.").append(name)) ), desc( I18n::get(std::wstring(L"achievement.").append(name).append(L".desc"))), icon( new ItemInstance(icon) ), x(x), y(y), requires(requires) { } -Achievement::Achievement(int id, const wstring& name, int x, int y, std::shared_ptr icon, Achievement *requires) - : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon(icon), x(x), y(y), requires(requires) +Achievement::Achievement(int id, const std::wstring& name, int x, int y, std::shared_ptr icon, Achievement *requires) + : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::wstring(L"achievement.").append(name)) ), desc( I18n::get(std::wstring(L"achievement.").append(name).append(L".desc"))), icon(icon), x(x), y(y), requires(requires) { } @@ -56,7 +56,7 @@ bool Achievement::isAchievement() return true; } -wstring Achievement::getDescription() +std::wstring Achievement::getDescription() { if (descFormatter != NULL) { diff --git a/Minecraft.World/Stats/Achievement.h b/Minecraft.World/Stats/Achievement.h index 057147372..2c51f709f 100644 --- a/Minecraft.World/Stats/Achievement.h +++ b/Minecraft.World/Stats/Achievement.h @@ -12,7 +12,7 @@ public: Achievement *requires; private: - const wstring desc; + const std::wstring desc; DescFormatter *descFormatter; public: @@ -23,15 +23,15 @@ private: void _init(); public: - Achievement(int id, const wstring& name, int x, int y, Item *icon, Achievement *requires); - Achievement(int id, const wstring& name, int x, int y, Tile *icon, Achievement *requires); - Achievement(int id, const wstring& name, int x, int y, std::shared_ptr icon, Achievement *requires); + Achievement(int id, const std::wstring& name, int x, int y, Item *icon, Achievement *requires); + Achievement(int id, const std::wstring& name, int x, int y, Tile *icon, Achievement *requires); + Achievement(int id, const std::wstring& name, int x, int y, std::shared_ptr icon, Achievement *requires); Achievement *setAwardLocallyOnly(); Achievement *setGolden(); Achievement *postConstruct(); bool isAchievement(); - wstring getDescription(); + std::wstring getDescription(); Achievement *setDescFormatter(DescFormatter *descFormatter); bool isGolden(); int getAchievementID(); diff --git a/Minecraft.World/Stats/DurangoStats.cpp b/Minecraft.World/Stats/DurangoStats.cpp index 9f4cba22f..eb5c9f370 100644 --- a/Minecraft.World/Stats/DurangoStats.cpp +++ b/Minecraft.World/Stats/DurangoStats.cpp @@ -35,7 +35,7 @@ string DsItemEvent::nameMethods[] = { "itemBought", "itemSmithed", "blockMined", "blockPlaced", "MAX" }; -DsItemEvent::DsItemEvent(int id, const wstring &name) : Stat(id,name) {} +DsItemEvent::DsItemEvent(int id, const std::wstring &name) : Stat(id,name) {} bool DsItemEvent::onLeaderboard(ELeaderboardId leaderboard, eAcquisitionMethod methodId, Param *param) { @@ -203,7 +203,7 @@ byteArray DsItemEvent::createParamBlob(eAcquisitionMethod eMethod, int itemId, i // Ds Mob Killed // /////////////////// -DsMobKilled::DsMobKilled(int id, const wstring &name) : Stat(id,name) {} +DsMobKilled::DsMobKilled(int id, const std::wstring &name) : Stat(id,name) {} void DsMobKilled::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { @@ -321,7 +321,7 @@ string DsMobInteract::nameInteract[] = { "unknownMobInteraction", "mobBred", "mobTamed", "mobCured", "mobCrafted", "mobSheared" }; -DsMobInteract::DsMobInteract(int id, const wstring &name) : Stat(id,name) {} +DsMobInteract::DsMobInteract(int id, const std::wstring &name) : Stat(id,name) {} void DsMobInteract::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { @@ -373,7 +373,7 @@ unsigned int DsTravel::CACHE_SIZES[eMethod_MAX] = 20*60*5, // TIME - GameTicks (20*60*5 ~ 5 mins) }; -DsTravel::DsTravel(int id, const wstring &name) : Stat(id,name) +DsTravel::DsTravel(int id, const std::wstring &name) : Stat(id,name) { ZeroMemory(¶m_cache, sizeof(unsigned int)*eMethod_MAX*MAX_LOCAL_PLAYERS); } @@ -475,7 +475,7 @@ void DsTravel::write(std::shared_ptr player, eMethod method, int di // Ds Item Used // ////////////////// -DsItemUsed::DsItemUsed(int id, const wstring &name) : Stat(id,name) {} +DsItemUsed::DsItemUsed(int id, const std::wstring &name) : Stat(id,name) {} void DsItemUsed::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { @@ -518,7 +518,7 @@ byteArray DsItemUsed::createParamBlob(int itemId, int aux, int count, int health // Ds Achievement // //////////////////// -DsAchievement::DsAchievement(int id, const wstring &name) : Stat(id,name) {} +DsAchievement::DsAchievement(int id, const std::wstring &name) : Stat(id,name) {} void DsAchievement::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { @@ -614,7 +614,7 @@ byteArray DsAchievement::createLargeParamBlob(eAward award, int count) // Ds Changed Dimension // ////////////////////////// -DsChangedDimension::DsChangedDimension(int id, const wstring &name) : Stat(id,name) {} +DsChangedDimension::DsChangedDimension(int id, const std::wstring &name) : Stat(id,name) {} void DsChangedDimension::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { @@ -642,7 +642,7 @@ byteArray DsChangedDimension::createParamBlob(int fromDimId, int toDimId) // Ds Entered Biome // ////////////////////// -DsEnteredBiome::DsEnteredBiome(int id, const wstring &name) : Stat(id,name) {} +DsEnteredBiome::DsEnteredBiome(int id, const std::wstring &name) : Stat(id,name) {} void DsEnteredBiome::handleParamBlob(std::shared_ptr player, byteArray paramBlob) { @@ -1121,7 +1121,7 @@ LPCWSTR DurangoStats::getUserId(std::shared_ptr player) LPCWSTR DurangoStats::getUserId(int iPad) { - static wstring cache = L""; + static std::wstring cache = L""; PlayerUID uid = INVALID_XUID; ProfileManager.GetXUID(iPad, &uid, true); cache = uid.toString(); diff --git a/Minecraft.World/Stats/DurangoStats.h b/Minecraft.World/Stats/DurangoStats.h index bea8c2d91..ee95a8c10 100644 --- a/Minecraft.World/Stats/DurangoStats.h +++ b/Minecraft.World/Stats/DurangoStats.h @@ -39,7 +39,7 @@ public: int methodId, itemId, itemAux, itemCount; } Param; - DsItemEvent(int id, const wstring &name); + DsItemEvent(int id, const std::wstring &name); bool onLeaderboard(ELeaderboardId leaderboard, eAcquisitionMethod methodId, Param *param); int mergeIds(int itemId); @@ -56,7 +56,7 @@ public: static const int SPIDER_JOCKEY_ID = 49; - DsMobKilled(int id, const wstring &name); + DsMobKilled(int id, const std::wstring &name); typedef struct { bool isRanged; int mobType, weaponId, distance, damage; } Param; virtual void handleParamBlob(std::shared_ptr plr, byteArray param); @@ -79,7 +79,7 @@ public: eInteract_Sheared }; - DsMobInteract(int id, const wstring &name); + DsMobInteract(int id, const std::wstring &name); typedef struct { int interactionType, mobId; } Param; virtual void handleParamBlob(std::shared_ptr plr, byteArray param); @@ -107,7 +107,7 @@ public: static unsigned int CACHE_SIZES[eMethod_MAX]; - DsTravel(int id, const wstring &name); + DsTravel(int id, const std::wstring &name); typedef struct { eMethod method; int distance; } Param; virtual void handleParamBlob(std::shared_ptr plr, byteArray paramBlob); @@ -124,7 +124,7 @@ protected: class DsItemUsed : public Stat { public: - DsItemUsed(int id, const wstring &name); + DsItemUsed(int id, const std::wstring &name); typedef struct { int itemId, aux, count, health, hunger; } Param; virtual void handleParamBlob(std::shared_ptr plr, byteArray paramBlob); static byteArray createParamBlob(int itemId, int aux, int count, int health, int hunger); @@ -133,7 +133,7 @@ public: class DsAchievement : public Stat { public: - DsAchievement(int id, const wstring &name); + DsAchievement(int id, const std::wstring &name); virtual void handleParamBlob(std::shared_ptr plr, byteArray paramBlob); @@ -147,7 +147,7 @@ public: class DsChangedDimension : public Stat { public: - DsChangedDimension(int id, const wstring &name); + DsChangedDimension(int id, const std::wstring &name); typedef struct { int fromDimId, toDimId; } Param; virtual void handleParamBlob(std::shared_ptr plr, byteArray paramBlob); static byteArray createParamBlob(int fromDimId, int toDimId); @@ -156,7 +156,7 @@ public: class DsEnteredBiome : public Stat { public: - DsEnteredBiome(int id, const wstring &name); + DsEnteredBiome(int id, const std::wstring &name); typedef struct { int biomeId; } Param; virtual void handleParamBlob(std::shared_ptr plr, byteArray paramBlob); static byteArray createParamBlob(int biomeId); diff --git a/Minecraft.World/Stats/GeneralStat.cpp b/Minecraft.World/Stats/GeneralStat.cpp index 0307645cd..eade3d693 100644 --- a/Minecraft.World/Stats/GeneralStat.cpp +++ b/Minecraft.World/Stats/GeneralStat.cpp @@ -2,11 +2,11 @@ #include "../Headers/net.minecraft.stats.h" #include "GeneralStat.h" -GeneralStat::GeneralStat(int id, const wstring& name, StatFormatter *formatter) : Stat(id, name, formatter) +GeneralStat::GeneralStat(int id, const std::wstring& name, StatFormatter *formatter) : Stat(id, name, formatter) { } -GeneralStat::GeneralStat(int id, const wstring& name) : Stat(id, name) +GeneralStat::GeneralStat(int id, const std::wstring& name) : Stat(id, name) { } diff --git a/Minecraft.World/Stats/GeneralStat.h b/Minecraft.World/Stats/GeneralStat.h index 27fe1b549..6d49c1a7f 100644 --- a/Minecraft.World/Stats/GeneralStat.h +++ b/Minecraft.World/Stats/GeneralStat.h @@ -6,7 +6,7 @@ using namespace std; class GeneralStat : public Stat { public: - GeneralStat(int id, const wstring& name, StatFormatter *formatter); - GeneralStat(int id, const wstring& name); + GeneralStat(int id, const std::wstring& name, StatFormatter *formatter); + GeneralStat(int id, const std::wstring& name); Stat *postConstruct(); }; diff --git a/Minecraft.World/Stats/ItemStat.cpp b/Minecraft.World/Stats/ItemStat.cpp index 9e2db9777..81d31748b 100644 --- a/Minecraft.World/Stats/ItemStat.cpp +++ b/Minecraft.World/Stats/ItemStat.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "ItemStat.h" -ItemStat::ItemStat(int id, const wstring& name, int itemId) : Stat( id, name ), itemId(itemId) +ItemStat::ItemStat(int id, const std::wstring& name, int itemId) : Stat( id, name ), itemId(itemId) { } diff --git a/Minecraft.World/Stats/ItemStat.h b/Minecraft.World/Stats/ItemStat.h index 80e4d8634..80fbe861a 100644 --- a/Minecraft.World/Stats/ItemStat.h +++ b/Minecraft.World/Stats/ItemStat.h @@ -9,6 +9,6 @@ private: const int itemId; public: - ItemStat(int id, const wstring& name, int itemId); + ItemStat(int id, const std::wstring& name, int itemId); int getItemId(); }; diff --git a/Minecraft.World/Stats/Stat.cpp b/Minecraft.World/Stats/Stat.cpp index 987919f52..ff44e3811 100644 --- a/Minecraft.World/Stats/Stat.cpp +++ b/Minecraft.World/Stats/Stat.cpp @@ -16,12 +16,12 @@ void Stat::_init() awardLocallyOnly = false; } -Stat::Stat(int id, const wstring& name, StatFormatter *formatter) : id(id), name(name), formatter(formatter) +Stat::Stat(int id, const std::wstring& name, StatFormatter *formatter) : id(id), name(name), formatter(formatter) { _init(); } -Stat::Stat(int id, const wstring& name) : id(id), name(name), formatter(defaultFormatter) +Stat::Stat(int id, const std::wstring& name) : id(id), name(name), formatter(defaultFormatter) { _init(); } @@ -55,17 +55,17 @@ bool Stat::isAchievement() return false; } -wstring Stat::format(int value) +std::wstring Stat::format(int value) { return ((StatFormatter *)formatter)->format(value); } -wstring Stat::toString() +std::wstring Stat::toString() { return name; } -wstring Stat::TimeFormatter::format(int value) +std::wstring Stat::TimeFormatter::format(int value) { double seconds = value / 20.0; double minutes = seconds / 60.0; @@ -93,12 +93,12 @@ wstring Stat::TimeFormatter::format(int value) return _toString(seconds) + L" s"; } -wstring Stat::DefaultFormat::format(int value) +std::wstring Stat::DefaultFormat::format(int value) { return NumberFormat::format( value ); //numberFormat->format(value); } -wstring Stat::DistanceFormatter::format(int cm) +std::wstring Stat::DistanceFormatter::format(int cm) { double meters = cm / 100.0; double kilometers = meters / 1000.0; diff --git a/Minecraft.World/Stats/Stat.h b/Minecraft.World/Stats/Stat.h index c9751d1c4..e6c29afb2 100644 --- a/Minecraft.World/Stats/Stat.h +++ b/Minecraft.World/Stats/Stat.h @@ -10,7 +10,7 @@ class Stat { public: const int id; - const wstring name; + const std::wstring name; bool awardLocallyOnly; private: @@ -18,13 +18,13 @@ private: void _init(); public: - Stat(int id, const wstring& name, StatFormatter *formatter); - Stat(int id, const wstring& name); + Stat(int id, const std::wstring& name, StatFormatter *formatter); + Stat(int id, const std::wstring& name); Stat *setAwardLocallyOnly(); virtual Stat *postConstruct(); virtual bool isAchievement(); - wstring format(int value); + std::wstring format(int value); private: //static NumberFormat *numberFormat; @@ -33,7 +33,7 @@ public: class DefaultFormat : public StatFormatter { public: - wstring format(int value); + std::wstring format(int value); } static *defaultFormatter; private: @@ -44,16 +44,16 @@ public: class TimeFormatter : public StatFormatter { public: - wstring format(int value); + std::wstring format(int value); } static *timeFormatter; class DistanceFormatter : public StatFormatter { public: - wstring format(int cm); + std::wstring format(int cm); } static *distanceFormatter; - wstring toString(); + std::wstring toString(); public: // 4J-JEV, for Durango stats diff --git a/Minecraft.World/Stats/StatFormatter.h b/Minecraft.World/Stats/StatFormatter.h index bc502c27a..118651cf9 100644 --- a/Minecraft.World/Stats/StatFormatter.h +++ b/Minecraft.World/Stats/StatFormatter.h @@ -4,5 +4,5 @@ using namespace std; class StatFormatter { public: - virtual wstring format(int value) = 0; + virtual std::wstring format(int value) = 0; }; diff --git a/Minecraft.World/Util/AABB.cpp b/Minecraft.World/Util/AABB.cpp index b6b28023e..f12834eec 100644 --- a/Minecraft.World/Util/AABB.cpp +++ b/Minecraft.World/Util/AABB.cpp @@ -334,7 +334,7 @@ void AABB::set(AABB *b) this->z1 = b->z1; } -wstring AABB::toString() +std::wstring AABB::toString() { return L"box[" + _toString(x0) + L", " + _toString(y0) + L", " + _toString(z0) + L" -> " + _toString(x1) + L", " + _toString(y1) + L", " + _toString(z1) + L"]"; diff --git a/Minecraft.World/Util/AABB.h b/Minecraft.World/Util/AABB.h index 81405ea1c..36bc15f5c 100644 --- a/Minecraft.World/Util/AABB.h +++ b/Minecraft.World/Util/AABB.h @@ -61,5 +61,5 @@ public: bool containsY(Vec3 *v); bool containsZ(Vec3 *v); void set(AABB *b); - wstring toString(); + std::wstring toString(); }; diff --git a/Minecraft.World/Util/BasicTypeContainers.cpp b/Minecraft.World/Util/BasicTypeContainers.cpp index 73ad2a13c..93f96e187 100644 --- a/Minecraft.World/Util/BasicTypeContainers.cpp +++ b/Minecraft.World/Util/BasicTypeContainers.cpp @@ -14,7 +14,7 @@ const float Float::MAX_VALUE = FLT_MAX; const double Double::MAX_VALUE = DBL_MAX; -int Integer::parseInt(wstring &str, int radix /* = 10*/) +int Integer::parseInt(std::wstring &str, int radix /* = 10*/) { return wcstol( str.c_str(), NULL, radix ); } \ No newline at end of file diff --git a/Minecraft.World/Util/BasicTypeContainers.h b/Minecraft.World/Util/BasicTypeContainers.h index 6f72ab593..aa24e0bc1 100644 --- a/Minecraft.World/Util/BasicTypeContainers.h +++ b/Minecraft.World/Util/BasicTypeContainers.h @@ -22,7 +22,7 @@ class Integer { public: static const int MAX_VALUE = INT_MAX; - static int parseInt(wstring &str, int radix = 10); + static int parseInt(std::wstring &str, int radix = 10); }; class Float diff --git a/Minecraft.World/Util/BoundingBox.cpp b/Minecraft.World/Util/BoundingBox.cpp index 8e9d75169..3e281cdc4 100644 --- a/Minecraft.World/Util/BoundingBox.cpp +++ b/Minecraft.World/Util/BoundingBox.cpp @@ -160,7 +160,7 @@ int BoundingBox::getZCenter() return z0 + (z1 - z0 + 1) / 2; } -wstring BoundingBox::toString() +std::wstring BoundingBox::toString() { return L"(" + _toString(x0) + L", " + _toString(y0) + L", " + _toString(z0) + L"; " + _toString(x1) + L", " + _toString(y1) + L", " + _toString(z1) + L")"; } \ No newline at end of file diff --git a/Minecraft.World/Util/BoundingBox.h b/Minecraft.World/Util/BoundingBox.h index 23abd66dc..7f3480dec 100644 --- a/Minecraft.World/Util/BoundingBox.h +++ b/Minecraft.World/Util/BoundingBox.h @@ -27,5 +27,5 @@ public: int getYCenter(); int getZCenter(); - wstring toString(); + std::wstring toString(); }; \ No newline at end of file diff --git a/Minecraft.World/Util/DamageSource.cpp b/Minecraft.World/Util/DamageSource.cpp index 4a7454a76..3b063b7ad 100644 --- a/Minecraft.World/Util/DamageSource.cpp +++ b/Minecraft.World/Util/DamageSource.cpp @@ -90,7 +90,7 @@ bool DamageSource::isBypassInvul() } -//DamageSource::DamageSource(const wstring &msgId) +//DamageSource::DamageSource(const std::wstring &msgId) DamageSource::DamageSource(ChatPacket::EChatPacketMessage msgId) { // 4J added initialisors @@ -158,7 +158,7 @@ DamageSource *DamageSource::setMagic() return this; } -//wstring DamageSource::getLocalizedDeathMessage(std::shared_ptr player) +//std::wstring DamageSource::getLocalizedDeathMessage(std::shared_ptr player) //{ // return L"death." + msgId + player->name; // //return I18n.get(L"death." + msgId, player.name); diff --git a/Minecraft.World/Util/DamageSource.h b/Minecraft.World/Util/DamageSource.h index 9047c2396..40436df23 100644 --- a/Minecraft.World/Util/DamageSource.h +++ b/Minecraft.World/Util/DamageSource.h @@ -56,11 +56,11 @@ public: float getFoodExhaustion(); bool isBypassInvul(); - //wstring msgId; + //std::wstring msgId; ChatPacket::EChatPacketMessage m_msgId; // 4J Made int so we can localise protected: - //DamageSource(const wstring &msgId); + //DamageSource(const std::wstring &msgId); DamageSource(ChatPacket::EChatPacketMessage msgId); public: @@ -82,7 +82,7 @@ public: DamageSource *setMagic(); // 4J Stu - Made return a packet - //virtual wstring getLocalizedDeathMessage(std::shared_ptr player); + //virtual std::wstring getLocalizedDeathMessage(std::shared_ptr player); virtual std::shared_ptr getDeathMessagePacket(std::shared_ptr player); bool isFire(); diff --git a/Minecraft.World/Util/DescFormatter.h b/Minecraft.World/Util/DescFormatter.h index 5682f910e..6ab9f2250 100644 --- a/Minecraft.World/Util/DescFormatter.h +++ b/Minecraft.World/Util/DescFormatter.h @@ -4,5 +4,5 @@ using namespace std; class DescFormatter { public: - virtual wstring format(const wstring& i18nValue); + virtual std::wstring format(const std::wstring& i18nValue); }; \ No newline at end of file diff --git a/Minecraft.World/Util/Exceptions.h b/Minecraft.World/Util/Exceptions.h index 6f3ba75e6..098aa817d 100644 --- a/Minecraft.World/Util/Exceptions.h +++ b/Minecraft.World/Util/Exceptions.h @@ -9,21 +9,21 @@ class EOFException : public std::exception class IllegalArgumentException : public std::exception { public: - wstring information; + std::wstring information; - IllegalArgumentException(const wstring& information); + IllegalArgumentException(const std::wstring& information); }; class IOException : public std::exception { public: - wstring information; + std::wstring information; - IOException(const wstring& information); + IOException(const std::wstring& information); }; class RuntimeException : public std::exception { public: - RuntimeException(const wstring& information); + RuntimeException(const std::wstring& information); }; \ No newline at end of file diff --git a/Minecraft.World/Util/FlippedIcon.cpp b/Minecraft.World/Util/FlippedIcon.cpp index 38f18e3a2..4f0e3b3d4 100644 --- a/Minecraft.World/Util/FlippedIcon.cpp +++ b/Minecraft.World/Util/FlippedIcon.cpp @@ -62,7 +62,7 @@ float FlippedIcon::getV(double offset, bool adjust/*=false*/) const return getV0(adjust) + (diff * ((float) offset / SharedConstants::WORLD_RESOLUTION)); } -wstring FlippedIcon::getName() const +std::wstring FlippedIcon::getName() const { return base->getName(); } diff --git a/Minecraft.World/Util/FlippedIcon.h b/Minecraft.World/Util/FlippedIcon.h index 169ceafc8..3c46a3e49 100644 --- a/Minecraft.World/Util/FlippedIcon.h +++ b/Minecraft.World/Util/FlippedIcon.h @@ -23,7 +23,7 @@ public: float getV0(bool adjust = false) const; float getV1(bool adjust = false) const; float getV(double offset, bool adjust = false) const; - wstring getName() const; + std::wstring getName() const; int getSourceWidth() const; int getSourceHeight() const; int getFlags() const; // 4J added diff --git a/Minecraft.World/Util/Hasher.cpp b/Minecraft.World/Util/Hasher.cpp index 83df5dbd9..5a143b6d7 100644 --- a/Minecraft.World/Util/Hasher.cpp +++ b/Minecraft.World/Util/Hasher.cpp @@ -9,17 +9,17 @@ #endif // _WIN32 #include "Hasher.h" -Hasher::Hasher(wstring &salt) +Hasher::Hasher(std::wstring &salt) { this->salt = salt; } -wstring Hasher::getHash(wstring &name) +std::wstring Hasher::getHash(std::wstring &name) { #if defined(_WIN32) // 4J Stu - Removed try/catch //try { - wstring s = wstring( salt ).append( name ); + std::wstring s = std::wstring( salt ).append( name ); //MessageDigest m; //m = MessageDigest.getInstance("MD5"); //m.update(s.getBytes(), 0, s.length()); diff --git a/Minecraft.World/Util/Hasher.h b/Minecraft.World/Util/Hasher.h index 325a95b87..5229bf7f0 100644 --- a/Minecraft.World/Util/Hasher.h +++ b/Minecraft.World/Util/Hasher.h @@ -4,9 +4,9 @@ using namespace std; class Hasher { private: - wstring salt; + std::wstring salt; public: - Hasher(wstring &salt); - wstring getHash(wstring &name); + Hasher(std::wstring &salt); + std::wstring getHash(std::wstring &name); }; \ No newline at end of file diff --git a/Minecraft.World/Util/I18n.cpp b/Minecraft.World/Util/I18n.cpp index 1da2fc5b0..743305170 100644 --- a/Minecraft.World/Util/I18n.cpp +++ b/Minecraft.World/Util/I18n.cpp @@ -3,7 +3,7 @@ #include "I18n.h" Language *I18n::lang = Language::getInstance(); -wstring I18n::get(const wstring& id, ...) +std::wstring I18n::get(const std::wstring& id, ...) { #ifdef __PSVITA__ // 4J - vita doesn't like having a reference type as the last parameter passed to va_start - we shouldn't need this method anyway return L""; @@ -14,7 +14,7 @@ wstring I18n::get(const wstring& id, ...) #endif } -wstring I18n::get(const wstring& id, va_list args) +std::wstring I18n::get(const std::wstring& id, va_list args) { return lang->getElement(id, args); } diff --git a/Minecraft.World/Util/I18n.h b/Minecraft.World/Util/I18n.h index a39ab1331..1e6b063ef 100644 --- a/Minecraft.World/Util/I18n.h +++ b/Minecraft.World/Util/I18n.h @@ -10,6 +10,6 @@ private: static Language *lang; public: - static wstring get(const wstring& id, ...); - static wstring get(const wstring& id, va_list args); + static std::wstring get(const std::wstring& id, ...); + static std::wstring get(const std::wstring& id, va_list args); }; \ No newline at end of file diff --git a/Minecraft.World/Util/Icon.h b/Minecraft.World/Util/Icon.h index 1435c7b0e..3d1f7c030 100644 --- a/Minecraft.World/Util/Icon.h +++ b/Minecraft.World/Util/Icon.h @@ -26,7 +26,7 @@ public: virtual float getV0(bool adjust = false) const = 0; virtual float getV1(bool adjust = false) const = 0; virtual float getV(double offset, bool adjust = false) const = 0; - virtual wstring getName() const = 0; + virtual std::wstring getName() const = 0; virtual int getSourceWidth() const = 0; virtual int getSourceHeight() const = 0; virtual int getFlags() const = 0; // 4J added diff --git a/Minecraft.World/Util/IconRegister.h b/Minecraft.World/Util/IconRegister.h index 3ea80bb86..5deece75e 100644 --- a/Minecraft.World/Util/IconRegister.h +++ b/Minecraft.World/Util/IconRegister.h @@ -7,6 +7,6 @@ class IconRegister { public: // 4J Stu - register is a reserved keyword in C++ - virtual Icon *registerIcon(const wstring &name) = 0; + virtual Icon *registerIcon(const std::wstring &name) = 0; virtual int getIconType() = 0; }; \ No newline at end of file diff --git a/Minecraft.World/Util/Language.cpp b/Minecraft.World/Util/Language.cpp index 2679918e1..bf2921bc7 100644 --- a/Minecraft.World/Util/Language.cpp +++ b/Minecraft.World/Util/Language.cpp @@ -15,12 +15,12 @@ Language *Language::getInstance() } /* 4J Jev, creates 2 identical functions. -wstring Language::getElement(const wstring& elementId) +std::wstring Language::getElement(const std::wstring& elementId) { return elementId; } */ -wstring Language::getElement(const wstring& elementId, ...) +std::wstring Language::getElement(const std::wstring& elementId, ...) { #ifdef __PSVITA__ // 4J - vita doesn't like having a reference type as the last parameter passed to va_start - we shouldn't need this method anyway return L""; @@ -31,18 +31,18 @@ wstring Language::getElement(const wstring& elementId, ...) #endif } -wstring Language::getElement(const wstring& elementId, va_list args) +std::wstring Language::getElement(const std::wstring& elementId, va_list args) { // 4J TODO return elementId; } -wstring Language::getElementName(const wstring& elementId) +std::wstring Language::getElementName(const std::wstring& elementId) { return elementId; } -wstring Language::getElementDescription(const wstring& elementId) +std::wstring Language::getElementDescription(const std::wstring& elementId) { return elementId; } \ No newline at end of file diff --git a/Minecraft.World/Util/Language.h b/Minecraft.World/Util/Language.h index 10e2951f2..3720258b4 100644 --- a/Minecraft.World/Util/Language.h +++ b/Minecraft.World/Util/Language.h @@ -7,8 +7,8 @@ private: public: Language(); static Language *getInstance(); - wstring getElement(const wstring& elementId, ...); - wstring getElement(const wstring& elementId, va_list args); - wstring getElementName(const wstring& elementId); - wstring getElementDescription(const wstring& elementId); + std::wstring getElement(const std::wstring& elementId, ...); + std::wstring getElement(const std::wstring& elementId, va_list args); + std::wstring getElementName(const std::wstring& elementId); + std::wstring getElementDescription(const std::wstring& elementId); }; \ No newline at end of file diff --git a/Minecraft.World/Util/NumberFormatters.h b/Minecraft.World/Util/NumberFormatters.h index 5f641819f..6d3f658b8 100644 --- a/Minecraft.World/Util/NumberFormatters.h +++ b/Minecraft.World/Util/NumberFormatters.h @@ -5,12 +5,12 @@ using namespace std; class NumberFormat { public: - static wstring format(int value) + static std::wstring format(int value) { // TODO 4J Stu - Change the length of the formatted number wchar_t output[256]; swprintf( output, 256, L"%d", value); - wstring result = wstring( output ); + std::wstring result = std::wstring( output ); return result; } }; @@ -19,17 +19,17 @@ public: class DecimalFormat { private: - const wstring formatString; + const std::wstring formatString; public: - wstring format(double value) + std::wstring format(double value) { // TODO 4J Stu - Change the length of the formatted number wchar_t output[256]; swprintf( output, 256, formatString.c_str(), value); - wstring result = wstring( output ); + std::wstring result = std::wstring( output ); return result; } // 4J Stu - The java code took a string format, we take a printf format string - DecimalFormat(wstring x) : formatString( x ) {}; + DecimalFormat(std::wstring x) : formatString( x ) {}; }; \ No newline at end of file diff --git a/Minecraft.World/Util/PerformanceTimer.cpp b/Minecraft.World/Util/PerformanceTimer.cpp index 6a4c3fb8f..f577a3174 100644 --- a/Minecraft.World/Util/PerformanceTimer.cpp +++ b/Minecraft.World/Util/PerformanceTimer.cpp @@ -20,7 +20,7 @@ void PerformanceTimer::Reset() #endif } -void PerformanceTimer::PrintElapsedTime(const wstring &description) +void PerformanceTimer::PrintElapsedTime(const std::wstring &description) { #if !defined (__linux__) LARGE_INTEGER qwNewTime, qwDeltaTime; diff --git a/Minecraft.World/Util/PerformanceTimer.h b/Minecraft.World/Util/PerformanceTimer.h index 04a36949d..5ceaa2480 100644 --- a/Minecraft.World/Util/PerformanceTimer.h +++ b/Minecraft.World/Util/PerformanceTimer.h @@ -9,5 +9,5 @@ private: public: PerformanceTimer(); void Reset(); - void PrintElapsedTime(const wstring &description); + void PrintElapsedTime(const std::wstring &description); }; \ No newline at end of file diff --git a/Minecraft.World/Util/ProgressListener.h b/Minecraft.World/Util/ProgressListener.h index f0148ce7e..328914d1e 100644 --- a/Minecraft.World/Util/ProgressListener.h +++ b/Minecraft.World/Util/ProgressListener.h @@ -11,5 +11,5 @@ public: virtual void progressStage(int stringId) = 0; // 4J-PB - added to display bytes retrieved of a save transfer - virtual void progressStage(wstring &wstrText) = 0; + virtual void progressStage(std::wstring &wstrText) = 0; }; \ No newline at end of file diff --git a/Minecraft.World/Util/Rarity.cpp b/Minecraft.World/Util/Rarity.cpp index 2f9ba0690..a4892d3ee 100644 --- a/Minecraft.World/Util/Rarity.cpp +++ b/Minecraft.World/Util/Rarity.cpp @@ -7,6 +7,6 @@ const Rarity *Rarity::uncommon = new Rarity(eHTMLColor_e, L"Uncommon"); const Rarity *Rarity::rare = new Rarity(eHTMLColor_b, L"Rare"); const Rarity *Rarity::epic = new Rarity(eHTMLColor_d, L"Epic"); -Rarity::Rarity(eMinecraftColour color, const wstring &name) : color(color), name(name) +Rarity::Rarity(eMinecraftColour color, const std::wstring &name) : color(color), name(name) { } \ No newline at end of file diff --git a/Minecraft.World/Util/Rarity.h b/Minecraft.World/Util/Rarity.h index 8b0164ac0..d53c1b4ff 100644 --- a/Minecraft.World/Util/Rarity.h +++ b/Minecraft.World/Util/Rarity.h @@ -9,7 +9,7 @@ public: static const Rarity *epic; const eMinecraftColour color; - const wstring name; + const std::wstring name; - Rarity(eMinecraftColour color, const wstring &name); + Rarity(eMinecraftColour color, const std::wstring &name); }; \ No newline at end of file diff --git a/Minecraft.World/Util/SharedConstants.cpp b/Minecraft.World/Util/SharedConstants.cpp index 66cbfec2b..cae6265e7 100644 --- a/Minecraft.World/Util/SharedConstants.cpp +++ b/Minecraft.World/Util/SharedConstants.cpp @@ -3,18 +3,18 @@ #include "../IO/Streams/InputOutputStream.h" #include "SharedConstants.h" -const wstring SharedConstants::VERSION_STRING = L"1.2.3"; +const std::wstring SharedConstants::VERSION_STRING = L"1.2.3"; const bool SharedConstants::TEXTURE_LIGHTING = true; -wstring SharedConstants::readAcceptableChars() +std::wstring SharedConstants::readAcceptableChars() { // 4J-PB - I've added ã in (for Portuguese in bed string) and added the character at the same place in the default.png font - wstring result = L" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'abcdefghijklmnopqrstuvwxyz{|}~ ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñѪº¿®¬½¼¡«»ã"; + std::wstring result = L" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'abcdefghijklmnopqrstuvwxyz{|}~ ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñѪº¿®¬½¼¡«»ã"; #if 0 // 4J - do we actually really need to get this from a file? //try { //BufferedReader br = new BufferedReader(new InputStreamReader(SharedConstants.class.getResourceAsStream("/font.txt"), "UTF-8")); - BufferedReader *br = new BufferedReader(new InputStreamReader( new FileInputStream( new File( wstring(L"/font.txt") ) ) ) ); - wstring line; + BufferedReader *br = new BufferedReader(new InputStreamReader( new FileInputStream( new File( std::wstring(L"/font.txt") ) ) ) ); + std::wstring line; while ( !(line = br->readLine()).empty()) { if (!( wcscmp( &line[0], L"#") == 0 ) ) @@ -37,7 +37,7 @@ bool SharedConstants::isAllowedChatCharacter(char ch) return true; } -wstring SharedConstants::acceptableLetters = SharedConstants::readAcceptableChars(); +std::wstring SharedConstants::acceptableLetters = SharedConstants::readAcceptableChars(); void SharedConstants::staticCtor() { diff --git a/Minecraft.World/Util/SharedConstants.h b/Minecraft.World/Util/SharedConstants.h index 80751d6d8..998f03829 100644 --- a/Minecraft.World/Util/SharedConstants.h +++ b/Minecraft.World/Util/SharedConstants.h @@ -6,7 +6,7 @@ class SharedConstants { public: static void staticCtor(); - static const wstring VERSION_STRING; + static const std::wstring VERSION_STRING; static const int NETWORK_PROTOCOL_VERSION = 39; // NOT texture resolution. How many sub-blocks each block face is made up of. @@ -15,11 +15,11 @@ class SharedConstants static bool isAllowedChatCharacter(char ch); // why private?????????? - static wstring readAcceptableChars(); + static std::wstring readAcceptableChars(); public: static const int maxChatLength = 100; - static wstring acceptableLetters; + static std::wstring acceptableLetters; static const int ILLEGAL_FILE_CHARACTERS_LENGTH = 15; static const wchar_t ILLEGAL_FILE_CHARACTERS[ILLEGAL_FILE_CHARACTERS_LENGTH]; diff --git a/Minecraft.World/Util/StringHelpers.cpp b/Minecraft.World/Util/StringHelpers.cpp index 30512764e..f91f8dac2 100644 --- a/Minecraft.World/Util/StringHelpers.cpp +++ b/Minecraft.World/Util/StringHelpers.cpp @@ -1,28 +1,28 @@ #include "../Build/stdafx.h" -wstring toLower(const wstring& a) +std::wstring toLower(const std::wstring& a) { - wstring out = wstring(a); + std::wstring out = std::wstring(a); std::transform(out.begin(), out.end(), out.begin(), ::tolower); return out; } -wstring trimString(const wstring& a) +std::wstring trimString(const std::wstring& a) { - wstring b; + std::wstring b; int start = (int)a.find_first_not_of(L" \t\n\r"); int end = (int)a.find_last_not_of(L" \t\n\r"); - if( start == wstring::npos ) start = 0; - if( end == wstring::npos ) end = (int)a.size()-1; + if( start == std::wstring::npos ) start = 0; + if( end == std::wstring::npos ) end = (int)a.size()-1; b = a.substr(start,(end-start)+1); return b; } -wstring replaceAll(const wstring& in, const wstring& replace, const wstring& with) +std::wstring replaceAll(const std::wstring& in, const std::wstring& replace, const std::wstring& with) { - wstring out = in; + std::wstring out = in; size_t pos = 0; - while( ( pos = out.find(replace, pos) ) != wstring::npos ) + while( ( pos = out.find(replace, pos) ) != std::wstring::npos ) { out.replace( pos, replace.length(), with ); pos++; @@ -30,26 +30,26 @@ wstring replaceAll(const wstring& in, const wstring& replace, const wstring& wit return out; } -bool equalsIgnoreCase(const wstring& a, const wstring& b) +bool equalsIgnoreCase(const std::wstring& a, const std::wstring& b) { bool out; - wstring c = toLower(a); - wstring d = toLower(b); + std::wstring c = toLower(a); + std::wstring d = toLower(b); out = c.compare(d) == 0; return out; } -wstring convStringToWstring(const string& converting) +std::wstring convStringToWstring(const string& converting) { - wstring converted(converting.length(), L' '); + std::wstring converted(converting.length(), L' '); copy(converting.begin(), converting.end(), converted.begin()); return converted; } -// Convert for filename wstrings to a straight character pointer for Xbox APIs. The returned string is only valid until +// Convert for filename std::wstrings to a straight character pointer for Xbox APIs. The returned string is only valid until // this function is called again, and it isn't thread-safe etc. as I'm just storing the returned name in a local static // to save having to clear it up everywhere this is used. -const char *wstringtofilename(const wstring& name) +const char *wstringtofilename(const std::wstring& name) { static char buf[256]; assert(name.length()<256); @@ -68,7 +68,7 @@ const char *wstringtofilename(const wstring& name) return buf; } -wstring filenametowstring(const char *name) +std::wstring filenametowstring(const char *name) { return convStringToWstring(name); } @@ -93,7 +93,7 @@ std::vector stringSplit(const std::wstring &s, wchar_t delim) bool BothAreSpaces(wchar_t lhs, wchar_t rhs) { return (lhs == rhs) && (lhs == L' '); } -void stripWhitespaceForHtml(wstring &string, bool bRemoveNewline) +void stripWhitespaceForHtml(std::wstring &string, bool bRemoveNewline) { // Strip newline chars if(bRemoveNewline) @@ -110,9 +110,9 @@ void stripWhitespaceForHtml(wstring &string, bool bRemoveNewline) string = trimString(string); } -wstring escapeXML(const wstring &in) +std::wstring escapeXML(const std::wstring &in) { - wstring out = in; + std::wstring out = in; out = replaceAll(out, L"&", L"&"); //out = replaceAll(out, L"\"", L"""); //out = replaceAll(out, L"'", L"'"); @@ -121,9 +121,9 @@ wstring escapeXML(const wstring &in) return out; } -wstring parseXMLSpecials(const wstring &in) +std::wstring parseXMLSpecials(const std::wstring &in) { - wstring out = in; + std::wstring out = in; out = replaceAll(out, L"&", L"&"); //out = replaceAll(out, L"\"", L"""); //out = replaceAll(out, L"'", L"'"); diff --git a/Minecraft.World/Util/StringHelpers.h b/Minecraft.World/Util/StringHelpers.h index 609fdf5af..439e3bda6 100644 --- a/Minecraft.World/Util/StringHelpers.h +++ b/Minecraft.World/Util/StringHelpers.h @@ -1,11 +1,11 @@ #pragma once using namespace std; -wstring toLower(const wstring& a); -wstring trimString(const wstring& a); -wstring replaceAll(const wstring& in, const wstring& replace, const wstring& with); +std::wstring toLower(const std::wstring& a); +std::wstring trimString(const std::wstring& a); +std::wstring replaceAll(const std::wstring& in, const std::wstring& replace, const std::wstring& with); -bool equalsIgnoreCase(const wstring& a, const wstring& b); +bool equalsIgnoreCase(const std::wstring& a, const std::wstring& b); // 4J-PB - for use in the ::toString template std::wstring _toString(T t) { @@ -28,13 +28,13 @@ template T _fromHEXString(const std::wstring& s) return t; } -wstring convStringToWstring(const string& converting); -const char *wstringtofilename(const wstring& name); -wstring filenametowstring(const char *name); +std::wstring convStringToWstring(const string& converting); +const char *wstringtofilename(const std::wstring& name); +std::wstring filenametowstring(const char *name); std::vector &stringSplit(const std::wstring &s, wchar_t delim, std::vector &elems); std::vector stringSplit(const std::wstring &s, wchar_t delim); -void stripWhitespaceForHtml(wstring &string, bool bRemoveNewline=true); -wstring escapeXML(const wstring &in); -wstring parseXMLSpecials(const wstring &in); +void stripWhitespaceForHtml(std::wstring &string, bool bRemoveNewline=true); +std::wstring escapeXML(const std::wstring &in); +std::wstring parseXMLSpecials(const std::wstring &in); diff --git a/Minecraft.World/Util/Vec3.cpp b/Minecraft.World/Util/Vec3.cpp index dce9ee75e..f96155e14 100644 --- a/Minecraft.World/Util/Vec3.cpp +++ b/Minecraft.World/Util/Vec3.cpp @@ -190,11 +190,11 @@ Vec3 *Vec3::clipZ(Vec3 *b, double zt) return Vec3::newTemp(x + xd * d, y + yd * d, z + zd * d); } -wstring Vec3::toString() +std::wstring Vec3::toString() { static wchar_t buf[128]; swprintf(buf, 128, L"(%f,%f,%f)",x,y,z); - return wstring(buf); + return std::wstring(buf); } Vec3 *Vec3::lerp(Vec3 *v, double a) diff --git a/Minecraft.World/Util/Vec3.h b/Minecraft.World/Util/Vec3.h index 00a741039..f7131f0bd 100644 --- a/Minecraft.World/Util/Vec3.h +++ b/Minecraft.World/Util/Vec3.h @@ -48,7 +48,7 @@ public: Vec3 *clipX(Vec3 *b, double xt); Vec3 *clipY(Vec3 *b, double yt); Vec3 *clipZ(Vec3 *b, double zt); - wstring toString(); + std::wstring toString(); Vec3 *lerp(Vec3 *v, double a); void xRot(float degs); void yRot(float degs); diff --git a/Minecraft.World/WorldGen/Biomes/Biome.cpp b/Minecraft.World/WorldGen/Biomes/Biome.cpp index 7259639f2..d26e47907 100644 --- a/Minecraft.World/WorldGen/Biomes/Biome.cpp +++ b/Minecraft.World/WorldGen/Biomes/Biome.cpp @@ -188,7 +188,7 @@ Biome *Biome::setSnowCovered() return this; } -Biome *Biome::setName(const wstring &name) +Biome *Biome::setName(const std::wstring &name) { this->m_name = name; return this; diff --git a/Minecraft.World/WorldGen/Biomes/Biome.h b/Minecraft.World/WorldGen/Biomes/Biome.h index 018b0d389..38a48cfc9 100644 --- a/Minecraft.World/WorldGen/Biomes/Biome.h +++ b/Minecraft.World/WorldGen/Biomes/Biome.h @@ -50,7 +50,7 @@ public: static const int BIOME_COUNT = 23; // 4J Stu added public: - wstring m_name; + std::wstring m_name; int color; uint8_t topMaterial; uint8_t material; @@ -122,7 +122,7 @@ public: protected: Biome *setSnowCovered(); - Biome *setName(const wstring &name); + Biome *setName(const std::wstring &name); Biome *setLeafColor(int leafColor); Biome *setColor(int color); diff --git a/Minecraft.World/WorldGen/Features/LargeFeature.cpp b/Minecraft.World/WorldGen/Features/LargeFeature.cpp index fcfbeb8f6..3d0cd76da 100644 --- a/Minecraft.World/WorldGen/Features/LargeFeature.cpp +++ b/Minecraft.World/WorldGen/Features/LargeFeature.cpp @@ -2,7 +2,7 @@ #include "../../Headers/net.minecraft.world.level.h" #include "LargeFeature.h" -const wstring LargeFeature::STRONGHOLD = L"StrongHold"; +const std::wstring LargeFeature::STRONGHOLD = L"StrongHold"; LargeFeature::LargeFeature() { diff --git a/Minecraft.World/WorldGen/Features/LargeFeature.h b/Minecraft.World/WorldGen/Features/LargeFeature.h index c79c5dc58..0bbce2c92 100644 --- a/Minecraft.World/WorldGen/Features/LargeFeature.h +++ b/Minecraft.World/WorldGen/Features/LargeFeature.h @@ -6,7 +6,7 @@ class Level; class LargeFeature { public: - static const wstring STRONGHOLD; + static const std::wstring STRONGHOLD; protected: int radius; Random *random; diff --git a/Minecraft.World/WorldGen/Features/MonsterRoomFeature.cpp b/Minecraft.World/WorldGen/Features/MonsterRoomFeature.cpp index 3204b7adf..44e68f1b1 100644 --- a/Minecraft.World/WorldGen/Features/MonsterRoomFeature.cpp +++ b/Minecraft.World/WorldGen/Features/MonsterRoomFeature.cpp @@ -129,12 +129,12 @@ std::shared_ptr MonsterRoomFeature::randomItem(Random *random) return std::shared_ptr(); } -wstring MonsterRoomFeature::randomEntityId(Random *random) +std::wstring MonsterRoomFeature::randomEntityId(Random *random) { int id = random->nextInt(4); - if (id == 0) return wstring(L"Skeleton"); - if (id == 1) return wstring(L"Zombie"); - if (id == 2) return wstring(L"Zombie"); - if (id == 3) return wstring(L"Spider"); - return wstring(L""); + if (id == 0) return std::wstring(L"Skeleton"); + if (id == 1) return std::wstring(L"Zombie"); + if (id == 2) return std::wstring(L"Zombie"); + if (id == 3) return std::wstring(L"Spider"); + return std::wstring(L""); } \ No newline at end of file diff --git a/Minecraft.World/WorldGen/Features/MonsterRoomFeature.h b/Minecraft.World/WorldGen/Features/MonsterRoomFeature.h index add5e413d..d2b90de5b 100644 --- a/Minecraft.World/WorldGen/Features/MonsterRoomFeature.h +++ b/Minecraft.World/WorldGen/Features/MonsterRoomFeature.h @@ -12,5 +12,5 @@ public: private: std::shared_ptr randomItem(Random *random); - wstring randomEntityId(Random *random); + std::wstring randomEntityId(Random *random); }; diff --git a/Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp b/Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp index 5a29b2eb9..acfb4e7f3 100644 --- a/Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp @@ -10,7 +10,7 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) m_biomeOverride = byteArray( width * height ); #ifdef _UNICODE - wstring path = L"GAME:\\GameRules\\biomemap.bin"; + std::wstring path = L"GAME:\\GameRules\\biomemap.bin"; HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #else #ifdef _WINDOWS64 diff --git a/Minecraft.World/WorldGen/Sources/FlatLevelSource.cpp b/Minecraft.World/WorldGen/Sources/FlatLevelSource.cpp index e1110ab93..382cbd700 100644 --- a/Minecraft.World/WorldGen/Sources/FlatLevelSource.cpp +++ b/Minecraft.World/WorldGen/Sources/FlatLevelSource.cpp @@ -132,7 +132,7 @@ bool FlatLevelSource::shouldSave() return true; } -wstring FlatLevelSource::gatherStats() +std::wstring FlatLevelSource::gatherStats() { return L"FlatLevelSource"; } @@ -147,7 +147,7 @@ vector *FlatLevelSource::getMobsAt(MobCategory *mobCate return biome->getMobs(mobCategory); } -TilePos *FlatLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) +TilePos *FlatLevelSource::findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z) { return NULL; } diff --git a/Minecraft.World/WorldGen/Sources/FlatLevelSource.h b/Minecraft.World/WorldGen/Sources/FlatLevelSource.h index 069cb1d39..0f735a758 100644 --- a/Minecraft.World/WorldGen/Sources/FlatLevelSource.h +++ b/Minecraft.World/WorldGen/Sources/FlatLevelSource.h @@ -38,7 +38,7 @@ public: virtual bool save(bool force, ProgressListener *progressListener); virtual bool tick(); virtual bool shouldSave(); - virtual wstring gatherStats(); + virtual std::wstring gatherStats(); virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z); }; diff --git a/Minecraft.World/WorldGen/Sources/HellFlatLevelSource.cpp b/Minecraft.World/WorldGen/Sources/HellFlatLevelSource.cpp index 10b6811b8..f3eebf014 100644 --- a/Minecraft.World/WorldGen/Sources/HellFlatLevelSource.cpp +++ b/Minecraft.World/WorldGen/Sources/HellFlatLevelSource.cpp @@ -203,7 +203,7 @@ bool HellFlatLevelSource::shouldSave() return true; } -wstring HellFlatLevelSource::gatherStats() +std::wstring HellFlatLevelSource::gatherStats() { return L"HellFlatLevelSource"; } @@ -218,7 +218,7 @@ vector *HellFlatLevelSource::getMobsAt(MobCategory *mob return biome->getMobs(mobCategory); } -TilePos *HellFlatLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) +TilePos *HellFlatLevelSource::findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z) { return NULL; } diff --git a/Minecraft.World/WorldGen/Sources/HellFlatLevelSource.h b/Minecraft.World/WorldGen/Sources/HellFlatLevelSource.h index 405f196ba..4d677f6bb 100644 --- a/Minecraft.World/WorldGen/Sources/HellFlatLevelSource.h +++ b/Minecraft.World/WorldGen/Sources/HellFlatLevelSource.h @@ -45,7 +45,7 @@ public: bool save(bool force, ProgressListener *progressListener); bool tick(); bool shouldSave(); - wstring gatherStats(); + std::wstring gatherStats(); virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z); }; diff --git a/Minecraft.World/WorldGen/Sources/HellRandomLevelSource.cpp b/Minecraft.World/WorldGen/Sources/HellRandomLevelSource.cpp index 2194ce47d..090090f90 100644 --- a/Minecraft.World/WorldGen/Sources/HellRandomLevelSource.cpp +++ b/Minecraft.World/WorldGen/Sources/HellRandomLevelSource.cpp @@ -517,7 +517,7 @@ bool HellRandomLevelSource::shouldSave() return true; } -wstring HellRandomLevelSource::gatherStats() +std::wstring HellRandomLevelSource::gatherStats() { return L"HellRandomLevelSource"; } @@ -538,7 +538,7 @@ vector *HellRandomLevelSource::getMobsAt(MobCategory *m return biome->getMobs(mobCategory); } -TilePos *HellRandomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) +TilePos *HellRandomLevelSource::findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z) { return NULL; } diff --git a/Minecraft.World/WorldGen/Sources/HellRandomLevelSource.h b/Minecraft.World/WorldGen/Sources/HellRandomLevelSource.h index b1aa2b2ba..fcb7ab046 100644 --- a/Minecraft.World/WorldGen/Sources/HellRandomLevelSource.h +++ b/Minecraft.World/WorldGen/Sources/HellRandomLevelSource.h @@ -65,8 +65,8 @@ public: bool save(bool force, ProgressListener *progressListener); bool tick(); bool shouldSave(); - wstring gatherStats(); + std::wstring gatherStats(); virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z); }; diff --git a/Minecraft.World/WorldGen/Sources/TheEndLevelRandomLevelSource.cpp b/Minecraft.World/WorldGen/Sources/TheEndLevelRandomLevelSource.cpp index 3c3632f2f..e65a637e7 100644 --- a/Minecraft.World/WorldGen/Sources/TheEndLevelRandomLevelSource.cpp +++ b/Minecraft.World/WorldGen/Sources/TheEndLevelRandomLevelSource.cpp @@ -399,7 +399,7 @@ bool TheEndLevelRandomLevelSource::shouldSave() return true; } -wstring TheEndLevelRandomLevelSource::gatherStats() +std::wstring TheEndLevelRandomLevelSource::gatherStats() { return L"RandomLevelSource"; } @@ -414,7 +414,7 @@ vector *TheEndLevelRandomLevelSource::getMobsAt(MobCate return biome->getMobs(mobCategory); } -TilePos *TheEndLevelRandomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) +TilePos *TheEndLevelRandomLevelSource::findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z) { return NULL; } diff --git a/Minecraft.World/WorldGen/Sources/TheEndLevelRandomLevelSource.h b/Minecraft.World/WorldGen/Sources/TheEndLevelRandomLevelSource.h index 86e78c211..c2e7d7b48 100644 --- a/Minecraft.World/WorldGen/Sources/TheEndLevelRandomLevelSource.h +++ b/Minecraft.World/WorldGen/Sources/TheEndLevelRandomLevelSource.h @@ -52,9 +52,9 @@ public: virtual bool save(bool force, ProgressListener *progressListener); virtual bool tick(); virtual bool shouldSave(); - virtual wstring gatherStats(); + virtual std::wstring gatherStats(); public: virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const std::wstring& featureName, int x, int y, int z); }; diff --git a/Minecraft.World/WorldGen/Structures/Village.cpp b/Minecraft.World/WorldGen/Structures/Village.cpp index 61f34606e..afd21fba5 100644 --- a/Minecraft.World/WorldGen/Structures/Village.cpp +++ b/Minecraft.World/WorldGen/Structures/Village.cpp @@ -287,7 +287,7 @@ std::shared_ptr Village::getClosestBadStandingPlayer(std::shared_ptrfirst; + std::wstring player = it->first; if (isVeryBadStanding(player)) { std::shared_ptr mob = level->getPlayerByName(player); @@ -380,7 +380,7 @@ void Village::calcInfo() radius = max(doorDist, (int) sqrt((float)maxRadiusSqr) + 1); } -int Village::getStanding(const wstring &playerName) +int Village::getStanding(const std::wstring &playerName) { AUTO_VAR(it,playerStanding.find(playerName)); if (it != playerStanding.end()) @@ -390,25 +390,25 @@ int Village::getStanding(const wstring &playerName) return 0; } -int Village::modifyStanding(const wstring &playerName, int delta) +int Village::modifyStanding(const std::wstring &playerName, int delta) { int current = getStanding(playerName); int newValue = Mth::clamp(current + delta, -30, 10); - playerStanding.insert(pair(playerName, newValue)); + playerStanding.insert(pair(playerName, newValue)); return newValue; } -bool Village::isGoodStanding(const wstring &playerName) +bool Village::isGoodStanding(const std::wstring &playerName) { return getStanding(playerName) >= 0; } -bool Village::isBadStanding(const wstring &playerName) +bool Village::isBadStanding(const std::wstring &playerName) { return getStanding(playerName) <= -5; } -bool Village::isVeryBadStanding(const wstring playerName) +bool Village::isVeryBadStanding(const std::wstring playerName) { return getStanding(playerName) <= -15; } @@ -441,7 +441,7 @@ void Village::readAdditionalSaveData(CompoundTag *tag) for (int i = 0; i < playerTags->size(); i++) { CompoundTag *pTag = playerTags->get(i); - playerStanding.insert(pair(pTag->getString(L"Name"), pTag->getInt(L"S"))); + playerStanding.insert(pair(pTag->getString(L"Name"), pTag->getInt(L"S"))); } } @@ -480,7 +480,7 @@ void Village::addAdditonalSaveData(CompoundTag *tag) //for (String player : playerStanding.keySet()) for(AUTO_VAR(it, playerStanding.begin()); it != playerStanding.end(); ++it) { - wstring player = it->first; + std::wstring player = it->first; CompoundTag *playerTag = new CompoundTag(player); playerTag->putString(L"Name", player); playerTag->putInt(L"S", it->second); diff --git a/Minecraft.World/WorldGen/Structures/Village.h b/Minecraft.World/WorldGen/Structures/Village.h index 2ab17f4bb..f3fd5e6c7 100644 --- a/Minecraft.World/WorldGen/Structures/Village.h +++ b/Minecraft.World/WorldGen/Structures/Village.h @@ -14,7 +14,7 @@ private: int populationSize; int noBreedTimer; - std::unordered_map playerStanding; + std::unordered_map playerStanding; class Aggressor { @@ -68,11 +68,11 @@ private: void calcInfo(); public: - int getStanding(const wstring &playerName); - int modifyStanding(const wstring &playerName, int delta); - bool isGoodStanding(const wstring &playerName); - bool isBadStanding(const wstring &playerName); - bool isVeryBadStanding(const wstring playerName); + int getStanding(const std::wstring &playerName); + int modifyStanding(const std::wstring &playerName, int delta); + bool isGoodStanding(const std::wstring &playerName); + bool isBadStanding(const std::wstring &playerName); + bool isVeryBadStanding(const std::wstring playerName); void readAdditionalSaveData(CompoundTag *tag); void addAdditonalSaveData(CompoundTag *tag); void resetNoBreedTimer(); diff --git a/Minecraft.World/WorldGen/Structures/Villages.cpp b/Minecraft.World/WorldGen/Structures/Villages.cpp index 30038072f..7483f2d8d 100644 --- a/Minecraft.World/WorldGen/Structures/Villages.cpp +++ b/Minecraft.World/WorldGen/Structures/Villages.cpp @@ -6,9 +6,9 @@ #include "../../Util/BasicTypeContainers.h" #include "Villages.h" -const wstring Villages::VILLAGE_FILE_ID = L"villages"; +const std::wstring Villages::VILLAGE_FILE_ID = L"villages"; -Villages::Villages(const wstring &id) : SavedData(id) +Villages::Villages(const std::wstring &id) : SavedData(id) { _tick = 0; level = NULL; diff --git a/Minecraft.World/WorldGen/Structures/Villages.h b/Minecraft.World/WorldGen/Structures/Villages.h index 6e8b0ddeb..e25afc2cd 100644 --- a/Minecraft.World/WorldGen/Structures/Villages.h +++ b/Minecraft.World/WorldGen/Structures/Villages.h @@ -5,7 +5,7 @@ class Villages : public SavedData { public: - static const wstring VILLAGE_FILE_ID; + static const std::wstring VILLAGE_FILE_ID; static const int MaxDoorDist = 32; @@ -17,7 +17,7 @@ private: int _tick; public: - Villages(const wstring &id); + Villages(const std::wstring &id); Villages(Level *level); ~Villages(); From ac9f3cbca3e37c8e5d4f9038d231d4e5ab21f40a Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 6 Mar 2026 11:55:28 -0600 Subject: [PATCH 04/24] chore: resolve some void* memset cast warnings --- Minecraft.Client/Build/Common/UI/UIStructs.h | 2 +- Minecraft.World/Util/ArrayWithLength.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/Build/Common/UI/UIStructs.h b/Minecraft.Client/Build/Common/UI/UIStructs.h index ea57b3a1f..611dd9ed3 100644 --- a/Minecraft.Client/Build/Common/UI/UIStructs.h +++ b/Minecraft.Client/Build/Common/UI/UIStructs.h @@ -265,7 +265,7 @@ typedef struct _LaunchMoreOptionsMenuInitData _LaunchMoreOptionsMenuInitData() { - memset(this,0,sizeof(_LaunchMoreOptionsMenuInitData)); + memset((void*)this,0,sizeof(_LaunchMoreOptionsMenuInitData)); bOnlineGame = TRUE; bAllowFriendsOfFriends = TRUE; bPVP = TRUE; diff --git a/Minecraft.World/Util/ArrayWithLength.h b/Minecraft.World/Util/ArrayWithLength.h index 5ac619a5d..f2e268766 100644 --- a/Minecraft.World/Util/ArrayWithLength.h +++ b/Minecraft.World/Util/ArrayWithLength.h @@ -11,7 +11,7 @@ public: T *data; unsigned int length; arrayWithLength() { data = NULL; 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; } + arrayWithLength(unsigned int elements, bool bClearArray=true) { assert(elements!=0); data = new T[elements]; if(bClearArray){ memset( (void*)data,0,sizeof(T)*elements); } this->length = elements; } // 4J Stu Added this ctor so I static init arrays in the Item derivation tree arrayWithLength( T data[], unsigned int elements) { this->data = data; this->length = elements; } @@ -22,7 +22,7 @@ public: { assert( elements > length ); T *temp = new T[elements]; - memset( temp,0,sizeof(T)*elements); + memset( (void*)temp,0,sizeof(T)*elements); if( data != NULL ) { From 7c95bfc0bde8b833c289d82eebad45db0915bd94 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 6 Mar 2026 11:58:11 -0600 Subject: [PATCH 05/24] refactor: begin unglobbing `std::vector` --- Minecraft.Client/GameState/StatsCounter.cpp | 12 ++--- Minecraft.Client/Level/MultiPlayerLevel.cpp | 6 +-- Minecraft.Client/Level/MultiPlayerLevel.h | 6 +-- Minecraft.Client/Level/ServerLevel.cpp | 30 ++++++------ Minecraft.Client/Level/ServerLevel.h | 8 ++-- Minecraft.Client/Minecraft.h | 4 +- Minecraft.Client/MinecraftServer.cpp | 2 +- Minecraft.Client/MinecraftServer.h | 6 +-- Minecraft.Client/Network/ClientConnection.cpp | 8 ++-- .../Network/MultiPlayerChunkCache.cpp | 2 +- .../Network/MultiPlayerChunkCache.h | 4 +- Minecraft.Client/Network/PlayerChunkMap.cpp | 4 +- Minecraft.Client/Network/PlayerChunkMap.h | 8 ++-- Minecraft.Client/Network/PlayerConnection.cpp | 10 ++-- Minecraft.Client/Network/PlayerConnection.h | 2 +- Minecraft.Client/Network/PlayerList.cpp | 6 +-- Minecraft.Client/Network/PlayerList.h | 6 +-- Minecraft.Client/Network/ServerChunkCache.cpp | 8 ++-- Minecraft.Client/Network/ServerChunkCache.h | 6 +-- Minecraft.Client/Network/ServerConnection.cpp | 2 +- Minecraft.Client/Network/ServerConnection.h | 6 +-- .../Platform/Durango/Durango_App.cpp | 2 +- .../DurangoLeaderboardManager.cpp | 4 +- .../Leaderboards/DurangoStatsDebugger.cpp | 16 +++---- .../Leaderboards/DurangoStatsDebugger.h | 12 ++--- .../Durango/Network/ChatIntegrationLayer.h | 2 +- .../Durango/Network/DQRNetworkManager.cpp | 8 ++-- .../Durango/Network/DQRNetworkManager.h | 2 +- .../DQRNetworkManager_FriendSessions.cpp | 26 +++++----- .../Durango/Network/PartyController.cpp | 2 +- .../Network/PlatformNetworkManagerDurango.cpp | 4 +- .../Network/PlatformNetworkManagerDurango.h | 10 ++-- .../Platform/Linux/Linux_Minecraft.cpp | 2 +- .../Platform/Orbis/Orbis_Minecraft.cpp | 2 +- .../Platform/PS3/PS3Extras/Ps3Stubs.cpp | 2 +- .../Platform/PS3/PS3_Minecraft.cpp | 2 +- .../LevelRenderer_FindNearestChunk.h | 2 +- .../Platform/PSVita/PSVita_App.cpp | 4 +- .../Platform/PSVita/PSVita_Minecraft.cpp | 2 +- .../Platform/Xbox/Audio/SoundEngine.cpp | 2 +- .../Platform/Xbox/Audio/SoundEngine.h | 2 +- .../Network/PlatformNetworkManagerXbox.cpp | 4 +- .../Xbox/Network/PlatformNetworkManagerXbox.h | 10 ++-- Minecraft.Client/Player/EntityTracker.cpp | 2 +- Minecraft.Client/Player/LocalPlayer.cpp | 2 +- Minecraft.Client/Player/LocalPlayer.h | 4 +- Minecraft.Client/Player/ServerPlayer.cpp | 6 +-- Minecraft.Client/Player/ServerPlayer.h | 4 +- Minecraft.Client/Player/TrackedEntity.cpp | 10 ++-- Minecraft.Client/Player/TrackedEntity.h | 4 +- Minecraft.Client/Player/User.cpp | 2 +- Minecraft.Client/Player/User.h | 2 +- Minecraft.Client/Rendering/Chunk.cpp | 12 ++--- Minecraft.Client/Rendering/Chunk.h | 2 +- .../EntityRenderers/PlayerRenderer.cpp | 2 +- Minecraft.Client/Rendering/GameRenderer.cpp | 10 ++-- Minecraft.Client/Rendering/GameRenderer.h | 8 ++-- Minecraft.Client/Rendering/LevelRenderer.cpp | 4 +- Minecraft.Client/Rendering/LevelRenderer.h | 10 ++-- Minecraft.Client/Rendering/Minimap.cpp | 4 +- Minecraft.Client/Rendering/Models/Model.h | 2 +- .../Rendering/Particles/GuiParticles.h | 2 +- .../Textures/Packs/TexturePackRepository.cpp | 20 ++++---- .../Textures/Packs/TexturePackRepository.h | 10 ++-- .../Stitching/PreStitchedTextureMap.cpp | 4 +- .../Stitching/PreStitchedTextureMap.h | 4 +- .../Textures/Stitching/StitchSlot.cpp | 4 +- .../Textures/Stitching/StitchSlot.h | 4 +- .../Textures/Stitching/StitchedTexture.cpp | 2 +- .../Textures/Stitching/StitchedTexture.h | 6 +-- .../Textures/Stitching/Stitcher.cpp | 6 +-- .../Textures/Stitching/Stitcher.h | 4 +- .../Textures/Stitching/TextureMap.cpp | 12 ++--- .../Textures/Stitching/TextureMap.h | 2 +- Minecraft.Client/Textures/TextureManager.cpp | 4 +- Minecraft.Client/Textures/TextureManager.h | 2 +- Minecraft.Client/UI/Font.cpp | 8 ++-- Minecraft.Client/UI/Gui.h | 2 +- Minecraft.Client/UI/Screen.h | 2 +- .../UI/Screens/JoinMultiplayerScreen.cpp | 2 +- .../UI/Screens/SelectWorldScreen.h | 2 +- Minecraft.Client/UI/Screens/StatsScreen.cpp | 4 +- Minecraft.Client/UI/Screens/StatsScreen.h | 2 +- Minecraft.Client/UI/Screens/TitleScreen.cpp | 2 +- Minecraft.Client/UI/ScrolledSelectionList.cpp | 2 +- Minecraft.Client/UI/ScrolledSelectionList.h | 2 +- Minecraft.Client/Utils/ArchiveFile.cpp | 4 +- Minecraft.Client/Utils/ArchiveFile.h | 2 +- Minecraft.Client/Utils/MemoryTracker.cpp | 2 +- Minecraft.Client/Utils/MemoryTracker.h | 2 +- Minecraft.Client/Utils/StringTable.cpp | 6 +-- Minecraft.Client/Utils/StringTable.h | 2 +- Minecraft.Client/Utils/WstringLookup.h | 2 +- Minecraft.World/AI/Control/Sensing.h | 4 +- Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp | 2 +- Minecraft.World/AI/Goals/BreedGoal.cpp | 2 +- Minecraft.World/AI/Goals/FollowParentGoal.cpp | 2 +- Minecraft.World/AI/Goals/GoalSelector.cpp | 4 +- Minecraft.World/AI/Goals/GoalSelector.h | 6 +-- Minecraft.World/AI/Goals/HurtByTargetGoal.cpp | 2 +- .../AI/Goals/MoveThroughVillageGoal.cpp | 2 +- .../AI/Goals/MoveThroughVillageGoal.h | 2 +- .../AI/Goals/NearestAttackableTargetGoal.cpp | 2 +- Minecraft.World/AI/Goals/PlayGoal.cpp | 2 +- Minecraft.World/AI/Goals/TakeFlowerGoal.cpp | 2 +- Minecraft.World/Blocks/ButtonTile.cpp | 2 +- Minecraft.World/Blocks/ChestTile.cpp | 2 +- Minecraft.World/Blocks/DetectorRailTile.cpp | 2 +- Minecraft.World/Blocks/FallingTile.cpp | 2 +- Minecraft.World/Blocks/MobSpawner.cpp | 6 +-- Minecraft.World/Blocks/MobSpawner.h | 2 +- Minecraft.World/Blocks/PressurePlateTile.cpp | 2 +- Minecraft.World/Blocks/RailTile.h | 2 +- Minecraft.World/Blocks/RedStoneDustTile.cpp | 2 +- .../TileEntities/BrewingStandTileEntity.cpp | 8 ++-- .../TileEntities/MobSpawnerTileEntity.cpp | 4 +- .../TileEntities/PistonPieceTileEntity.cpp | 4 +- .../Blocks/TileEntities/PotionBrewing.cpp | 10 ++-- .../Blocks/TileEntities/PotionBrewing.h | 4 +- Minecraft.World/Blocks/TripWireTile.cpp | 2 +- .../Containers/AbstractContainerMenu.cpp | 12 ++--- .../Containers/AbstractContainerMenu.h | 8 ++-- .../Containers/EnchantmentMenu.cpp | 2 +- .../Containers/SimpleContainer.cpp | 6 +-- Minecraft.World/Containers/SimpleContainer.h | 2 +- Minecraft.World/Enchantments/Enchantment.cpp | 2 +- Minecraft.World/Enchantments/Enchantment.h | 2 +- .../Enchantments/EnchantmentHelper.cpp | 10 ++-- .../Enchantments/EnchantmentHelper.h | 2 +- Minecraft.World/Entities/Entity.cpp | 2 +- Minecraft.World/Entities/Entity.h | 2 +- Minecraft.World/Entities/HangingEntity.cpp | 2 +- Minecraft.World/Entities/ItemEntity.cpp | 2 +- Minecraft.World/Entities/Mob.cpp | 8 ++-- Minecraft.World/Entities/Mob.h | 2 +- Minecraft.World/Entities/Mobs/Animal.cpp | 6 +-- Minecraft.World/Entities/Mobs/Arrow.cpp | 2 +- Minecraft.World/Entities/Mobs/Boat.cpp | 2 +- .../Entities/Mobs/DragonFireball.cpp | 2 +- .../Entities/Mobs/EnderCrystal.cpp | 2 +- Minecraft.World/Entities/Mobs/EnderDragon.cpp | 12 ++--- Minecraft.World/Entities/Mobs/EnderDragon.h | 8 ++-- Minecraft.World/Entities/Mobs/Fireball.cpp | 2 +- Minecraft.World/Entities/Mobs/FishingHook.cpp | 2 +- .../Entities/Mobs/LightningBolt.cpp | 2 +- Minecraft.World/Entities/Mobs/Minecart.cpp | 2 +- Minecraft.World/Entities/Mobs/Painting.cpp | 4 +- Minecraft.World/Entities/Mobs/PigZombie.cpp | 2 +- .../Entities/Mobs/ThrownPotion.cpp | 4 +- Minecraft.World/Entities/SyncedEntityData.cpp | 22 ++++----- Minecraft.World/Entities/SyncedEntityData.h | 10 ++-- Minecraft.World/Entities/Throwable.cpp | 2 +- ...ecraft.world.inventory.ContainerListener.h | 2 +- Minecraft.World/IO/Files/ConsoleSaveFile.h | 6 +-- .../IO/Files/ConsoleSaveFileConverter.cpp | 6 +-- .../IO/Files/ConsoleSaveFileOriginal.cpp | 8 ++-- .../IO/Files/ConsoleSaveFileOriginal.h | 6 +-- .../IO/Files/ConsoleSaveFileSplit.cpp | 16 +++---- .../IO/Files/ConsoleSaveFileSplit.h | 8 ++-- Minecraft.World/IO/Files/File.cpp | 14 +++--- Minecraft.World/IO/Files/File.h | 8 ++-- Minecraft.World/IO/Files/FileHeader.cpp | 40 ++++++++-------- Minecraft.World/IO/Files/FileHeader.h | 12 ++--- Minecraft.World/IO/NBT/CompoundTag.h | 4 +- Minecraft.World/IO/NBT/ListTag.h | 2 +- Minecraft.World/IO/NBT/NbtSlotFile.cpp | 14 +++--- Minecraft.World/IO/NBT/NbtSlotFile.h | 10 ++-- Minecraft.World/Items/BoatItem.cpp | 2 +- Minecraft.World/Items/EnchantedBookItem.cpp | 4 +- Minecraft.World/Items/EnchantedBookItem.h | 4 +- Minecraft.World/Items/Item.cpp | 2 +- Minecraft.World/Items/Item.h | 2 +- Minecraft.World/Items/ItemInstance.cpp | 8 ++-- Minecraft.World/Items/ItemInstance.h | 4 +- Minecraft.World/Items/PotionItem.cpp | 26 +++++----- Minecraft.World/Items/PotionItem.h | 12 ++--- Minecraft.World/Items/RecordingItem.cpp | 2 +- Minecraft.World/Items/RecordingItem.h | 2 +- Minecraft.World/Level/ChunkSource.h | 2 +- Minecraft.World/Level/CustomLevelSource.cpp | 2 +- Minecraft.World/Level/CustomLevelSource.h | 2 +- Minecraft.World/Level/DerivedLevelData.cpp | 2 +- Minecraft.World/Level/DerivedLevelData.h | 2 +- Minecraft.World/Level/EmptyLevelChunk.cpp | 4 +- Minecraft.World/Level/EmptyLevelChunk.h | 4 +- Minecraft.World/Level/Events/VillageSiege.cpp | 4 +- Minecraft.World/Level/Explosion.cpp | 8 ++-- Minecraft.World/Level/Explosion.h | 2 +- Minecraft.World/Level/Level.cpp | 48 +++++++++---------- Minecraft.World/Level/Level.h | 32 ++++++------- Minecraft.World/Level/LevelChunk.cpp | 18 +++---- Minecraft.World/Level/LevelChunk.h | 6 +-- Minecraft.World/Level/LevelData.cpp | 2 +- Minecraft.World/Level/LevelData.h | 2 +- Minecraft.World/Level/RandomLevelSource.cpp | 2 +- Minecraft.World/Level/RandomLevelSource.h | 2 +- .../Level/Storage/DirectoryLevelStorage.cpp | 10 ++-- .../Level/Storage/DirectoryLevelStorage.h | 4 +- .../Storage/DirectoryLevelStorageSource.cpp | 6 +-- .../Storage/DirectoryLevelStorageSource.h | 4 +- Minecraft.World/Level/Storage/LevelStorage.h | 2 +- .../Storage/LevelStorageProfilerDecorator.cpp | 2 +- .../Storage/LevelStorageProfilerDecorator.h | 2 +- .../Level/Storage/LevelStorageSource.h | 2 +- .../Level/Storage/MapItemSavedData.h | 4 +- .../Level/Storage/McRegionLevelStorage.cpp | 8 ++-- .../Level/Storage/McRegionLevelStorage.h | 2 +- .../Storage/McRegionLevelStorageSource.cpp | 28 +++++------ .../Storage/McRegionLevelStorageSource.h | 8 ++-- .../Level/Storage/MemoryLevelStorage.cpp | 2 +- .../Level/Storage/MemoryLevelStorage.h | 2 +- .../Storage/MemoryLevelStorageSource.cpp | 4 +- .../Level/Storage/MemoryLevelStorageSource.h | 2 +- .../Level/Storage/MockedLevelStorage.cpp | 2 +- .../Level/Storage/MockedLevelStorage.h | 2 +- .../Level/Storage/OldChunkStorage.cpp | 6 +-- .../Level/Storage/ReadOnlyChunkCache.cpp | 2 +- .../Level/Storage/ReadOnlyChunkCache.h | 2 +- Minecraft.World/Level/Storage/RegionFile.cpp | 2 +- Minecraft.World/Level/Storage/RegionFile.h | 2 +- .../Level/Storage/SavedDataStorage.cpp | 4 +- .../Level/Storage/SavedDataStorage.h | 2 +- .../Level/Storage/ZonedChunkStorage.cpp | 8 ++-- Minecraft.World/Level/WaterLevelChunk.cpp | 4 +- Minecraft.World/Level/WaterLevelChunk.h | 4 +- Minecraft.World/Network/Connection.cpp | 2 +- .../Network/Packets/AddMobPacket.cpp | 2 +- .../Network/Packets/AddMobPacket.h | 4 +- .../Network/Packets/AddPlayerPacket.cpp | 2 +- .../Network/Packets/AddPlayerPacket.h | 4 +- Minecraft.World/Network/Packets/ChatPacket.h | 4 +- .../Packets/ContainerSetContentPacket.cpp | 2 +- .../Packets/ContainerSetContentPacket.h | 2 +- .../Network/Packets/ExplodePacket.h | 2 +- Minecraft.World/Network/Packets/Packet.cpp | 2 +- Minecraft.World/Network/Packets/Packet.h | 2 +- .../Network/Packets/SetEntityDataPacket.cpp | 2 +- .../Network/Packets/SetEntityDataPacket.h | 4 +- .../Packets/TextureAndGeometryPacket.cpp | 4 +- .../Packets/TextureAndGeometryPacket.h | 2 +- Minecraft.World/Player/Player.cpp | 12 ++--- Minecraft.World/Player/Player.h | 6 +-- Minecraft.World/Recipes/ArmorDyeRecipe.cpp | 4 +- Minecraft.World/Recipes/Recipes.cpp | 2 +- Minecraft.World/Recipes/ShapelessRecipy.cpp | 8 ++-- Minecraft.World/Recipes/ShapelessRecipy.h | 4 +- Minecraft.World/Stats/Achievements.cpp | 2 +- Minecraft.World/Stats/Achievements.h | 2 +- Minecraft.World/Stats/Stats.cpp | 12 ++--- Minecraft.World/Stats/Stats.h | 12 ++--- Minecraft.World/Util/IntCache.h | 10 ++-- Minecraft.World/Util/WeighedRandom.cpp | 6 +-- Minecraft.World/Util/WeighedRandom.h | 6 +-- Minecraft.World/WorldGen/Biomes/Biome.cpp | 2 +- Minecraft.World/WorldGen/Biomes/Biome.h | 14 +++--- Minecraft.World/WorldGen/Biomes/BiomeCache.h | 2 +- .../WorldGen/Biomes/BiomeSource.cpp | 4 +- Minecraft.World/WorldGen/Biomes/BiomeSource.h | 8 ++-- .../WorldGen/Biomes/FixedBiomeSource.cpp | 4 +- .../WorldGen/Biomes/FixedBiomeSource.h | 4 +- .../WorldGen/Features/CaveFeature.cpp | 2 +- .../WorldGen/Features/NetherBridgeFeature.cpp | 4 +- .../WorldGen/Features/NetherBridgeFeature.h | 4 +- .../Features/RandomScatteredLargeFeature.cpp | 2 +- .../Features/RandomScatteredLargeFeature.h | 2 +- .../WorldGen/Features/StrongholdFeature.cpp | 8 ++-- .../WorldGen/Features/StrongholdFeature.h | 4 +- .../WorldGen/Features/StructureFeature.cpp | 4 +- .../WorldGen/Features/StructureFeature.h | 2 +- .../WorldGen/Features/VillageFeature.cpp | 6 +-- .../WorldGen/Features/VillageFeature.h | 2 +- .../WorldGen/Sources/FlatLevelSource.cpp | 2 +- .../WorldGen/Sources/FlatLevelSource.h | 2 +- .../WorldGen/Sources/HellFlatLevelSource.cpp | 2 +- .../WorldGen/Sources/HellFlatLevelSource.h | 2 +- .../Sources/HellRandomLevelSource.cpp | 2 +- .../WorldGen/Sources/HellRandomLevelSource.h | 2 +- .../Sources/TheEndLevelRandomLevelSource.cpp | 2 +- .../Sources/TheEndLevelRandomLevelSource.h | 2 +- .../WorldGen/Structures/NetherBridgePieces.h | 2 +- .../WorldGen/Structures/StrongholdPieces.h | 2 +- .../WorldGen/Structures/Village.cpp | 6 +-- Minecraft.World/WorldGen/Structures/Village.h | 6 +-- .../WorldGen/Structures/VillagePieces.h | 4 +- .../WorldGen/Structures/Villages.cpp | 2 +- .../WorldGen/Structures/Villages.h | 6 +-- 286 files changed, 738 insertions(+), 738 deletions(-) diff --git a/Minecraft.Client/GameState/StatsCounter.cpp b/Minecraft.Client/GameState/StatsCounter.cpp index e36db9b1c..ac4d5d07a 100644 --- a/Minecraft.Client/GameState/StatsCounter.cpp +++ b/Minecraft.Client/GameState/StatsCounter.cpp @@ -150,8 +150,8 @@ void StatsCounter::parse(void* data) StatContainer newVal; //For each stat - vector::iterator end = Stats::all->end(); - for( vector::iterator iter = Stats::all->begin() ; iter != end ; ++iter ) + std::vector::iterator end = Stats::all->end(); + for( std::vector::iterator iter = Stats::all->begin() ; iter != end ; ++iter ) { if( !(*iter)->isAchievement() ) { @@ -230,8 +230,8 @@ void StatsCounter::save(int player, bool force) //For each stat StatsMap::iterator val; - vector::iterator end = Stats::all->end(); - for( vector::iterator iter = Stats::all->begin() ; iter != end ; ++iter ) + std::vector::iterator end = Stats::all->end(); + for( std::vector::iterator iter = Stats::all->begin() ; iter != end ; ++iter ) { //If the stat is in the map write out it's value val = stats.find(*iter); @@ -1283,8 +1283,8 @@ bool StatsCounter::isLargeStat(Stat* stat) void StatsCounter::dumpStatsToTTY() { - vector::iterator statsEnd = Stats::all->end(); - for( vector::iterator statsIter = Stats::all->begin() ; statsIter!=statsEnd ; ++statsIter ) + std::vector::iterator statsEnd = Stats::all->end(); + for( std::vector::iterator statsIter = Stats::all->begin() ; statsIter!=statsEnd ; ++statsIter ) { app.DebugPrintf("%ls\t\t%u\t%u\t%u\t%u\n", (*statsIter)->name.c_str(), diff --git a/Minecraft.Client/Level/MultiPlayerLevel.cpp b/Minecraft.Client/Level/MultiPlayerLevel.cpp index 86e7a5317..02542972d 100644 --- a/Minecraft.Client/Level/MultiPlayerLevel.cpp +++ b/Minecraft.Client/Level/MultiPlayerLevel.cpp @@ -117,7 +117,7 @@ void MultiPlayerLevel::tick() PIXBeginNamedEvent(0,"Connection ticking"); // 4J HEG - Copy the connections vector to prevent crash when moving to Nether - vector connectionsTemp = connections; + std::vector connectionsTemp = connections; for(AUTO_VAR(connection, connectionsTemp.begin()); connection < connectionsTemp.end(); ++connection ) { (*connection)->tick(); @@ -493,7 +493,7 @@ std::shared_ptr MultiPlayerLevel::removeEntity(int id) // 4J Added to remove the entities from the forced list // This gets called when a chunk is unloaded, but we only do half an unload to remove entities slightly differently -void MultiPlayerLevel::removeEntities(vector > *list) +void MultiPlayerLevel::removeEntities(std::vector > *list) { for(AUTO_VAR(it, list->begin()); it < list->end(); ++it) { @@ -809,7 +809,7 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() //for (int i = 0; i < entities.size(); i++) EnterCriticalSection(&m_entitiesCS); - vector >::iterator it = entities.begin(); + std::vector >::iterator it = entities.begin(); while( it != entities.end() ) { std::shared_ptr e = *it;//entities.at(i); diff --git a/Minecraft.Client/Level/MultiPlayerLevel.h b/Minecraft.Client/Level/MultiPlayerLevel.h index bd84b0c48..84f4d9527 100644 --- a/Minecraft.Client/Level/MultiPlayerLevel.h +++ b/Minecraft.Client/Level/MultiPlayerLevel.h @@ -22,7 +22,7 @@ private: ResetInfo(int x, int y, int z, int tile, int data); }; - vector updatesToReset; // 4J - was linked list but vector seems more appropriate + std::vector updatesToReset; // 4J - was linked list but vector seems more appropriate bool m_bEnableResetChanges; // 4J Added public: void unshareChunkAt(int x, int z); // 4J - added @@ -34,7 +34,7 @@ private: int unshareCheckZ; // 4J - added int compressCheckX; // 4J - added int compressCheckZ; // 4J - added - vector connections; // 4J Stu - Made this a vector as we can have more than one local connection + std::vector connections; // 4J Stu - Made this a vector as we can have more than one local connection MultiPlayerChunkCache *chunkCache; Minecraft *minecraft; @@ -68,7 +68,7 @@ public: void putEntity(int id, std::shared_ptr e); std::shared_ptr getEntity(int id); std::shared_ptr removeEntity(int id); - virtual void removeEntities(vector > *list); // 4J Added override + virtual void removeEntities(std::vector > *list); // 4J Added override virtual bool setDataNoUpdate(int x, int y, int z, int data); virtual bool setTileAndDataNoUpdate(int x, int y, int z, int tile, int data); virtual bool setTileNoUpdate(int x, int y, int z, int tile); diff --git a/Minecraft.Client/Level/ServerLevel.cpp b/Minecraft.Client/Level/ServerLevel.cpp index 7cfa5b743..7952bd87f 100644 --- a/Minecraft.Client/Level/ServerLevel.cpp +++ b/Minecraft.Client/Level/ServerLevel.cpp @@ -277,10 +277,10 @@ void ServerLevel::tick() Biome::MobSpawnerData *ServerLevel::getRandomMobSpawnAt(MobCategory *mobCategory, int x, int y, int z) { - vector *mobList = getChunkSource()->getMobsAt(mobCategory, x, y, z); + std::vector *mobList = getChunkSource()->getMobsAt(mobCategory, x, y, z); if (mobList == NULL || mobList->empty()) return NULL; - return (Biome::MobSpawnerData *) WeighedRandom::getRandomItem(random, (vector *)mobList); + return (Biome::MobSpawnerData *) WeighedRandom::getRandomItem(random, (std::vector *)mobList); } void ServerLevel::updateSleepingPlayerList() @@ -289,7 +289,7 @@ void ServerLevel::updateSleepingPlayerList() m_bAtLeastOnePlayerSleeping = false; AUTO_VAR(itEnd, players.end()); - for (vector >::iterator it = players.begin(); it != itEnd; it++) + for (std::vector >::iterator it = players.begin(); it != itEnd; it++) { if (!(*it)->isSleeping()) { @@ -310,7 +310,7 @@ void ServerLevel::awakenAllPlayers() m_bAtLeastOnePlayerSleeping = false; AUTO_VAR(itEnd, players.end()); - for (vector >::iterator it = players.begin(); it != itEnd; it++) + for (std::vector >::iterator it = players.begin(); it != itEnd; it++) { if ((*it)->isSleeping()) { @@ -335,7 +335,7 @@ bool ServerLevel::allPlayersAreSleeping() { // all players are sleeping, but have they slept long enough? AUTO_VAR(itEnd, players.end()); - for (vector >::iterator it = players.begin(); it != itEnd; it++ ) + for (std::vector >::iterator it = players.begin(); it != itEnd; it++ ) { // System.out.println(player->entityId + ": " + player->getSleepTimer()); if (! (*it)->isSleepingLongEnough()) @@ -625,10 +625,10 @@ bool ServerLevel::tickPendingTicks(bool force) return retval; } -vector *ServerLevel::fetchTicksInChunk(LevelChunk *chunk, bool remove) +std::vector *ServerLevel::fetchTicksInChunk(LevelChunk *chunk, bool remove) { EnterCriticalSection(&m_tickNextTickCS); - vector *results = new vector; + std::vector *results = new std::vector; ChunkPos *pos = chunk->getPos(); int west = pos->x << 4; @@ -693,9 +693,9 @@ ChunkSource *ServerLevel::createChunkSource() return cache; } -vector > *ServerLevel::getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1) +std::vector > *ServerLevel::getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1) { - vector > *result = new vector >; + std::vector > *result = new std::vector >; for (unsigned int i = 0; i < tileEntityList.size(); i++) { std::shared_ptr te = tileEntityList[i]; @@ -750,7 +750,7 @@ void ServerLevel::setInitialSpawn(LevelSettings *levelSettings) isFindingSpawn = true; BiomeSource *biomeSource = dimension->biomeSource; - vector playerSpawnBiomes = biomeSource->getPlayerSpawnBiomes(); + std::vector playerSpawnBiomes = biomeSource->getPlayerSpawnBiomes(); Random random(getSeed()); TilePos *findBiome = biomeSource->findBiome(0, 0, 16 * 16, playerSpawnBiomes, &random); @@ -896,7 +896,7 @@ void ServerLevel::save(bool force, ProgressListener *progressListener, bool bAut { // 4J Stu - This will come in a later change anyway // clean cache - vector *loadedChunkList = cache->getLoadedChunkList(); + std::vector *loadedChunkList = cache->getLoadedChunkList(); for (AUTO_VAR(it, loadedChunkList->begin()); it != loadedChunkList->end(); ++it) { LevelChunk *lc = *it; @@ -952,7 +952,7 @@ void ServerLevel::entityAdded(std::shared_ptr e) { Level::entityAdded(e); entitiesById[e->entityId] = e; - vector > *es = e->getSubEntities(); + std::vector > *es = e->getSubEntities(); if (es != NULL) { //for (int i = 0; i < es.length; i++) @@ -968,7 +968,7 @@ void ServerLevel::entityRemoved(std::shared_ptr e) { Level::entityRemoved(e); entitiesById.erase(e->entityId); - vector > *es = e->getSubEntities(); + std::vector > *es = e->getSubEntities(); if (es != NULL) { //for (int i = 0; i < es.length; i++) @@ -1016,7 +1016,7 @@ std::shared_ptr ServerLevel::explode(std::shared_ptr source, explosion->toBlow.clear(); } - vector > sentTo; + std::vector > sentTo; for(AUTO_VAR(it, players.begin()); it != players.end(); ++it) { std::shared_ptr player = dynamic_pointer_cast(*it); @@ -1144,7 +1144,7 @@ void ServerLevel::setTimeAndAdjustTileTicks(__int64 newTime) __int64 delta = newTime - levelData->getTime(); // 4J - can't directly adjust m_delay in a set as it has a const interator, since changing values in here might change the ordering of the elements in the set. // Instead move to a vector, do the adjustment, put back in the set. - vector temp; + std::vector temp; for(AUTO_VAR(it, tickNextTickList.begin()); it != tickNextTickList.end(); ++it) { temp.push_back(*it); diff --git a/Minecraft.Client/Level/ServerLevel.h b/Minecraft.Client/Level/ServerLevel.h index 93fe297a4..b0beea260 100644 --- a/Minecraft.Client/Level/ServerLevel.h +++ b/Minecraft.Client/Level/ServerLevel.h @@ -21,7 +21,7 @@ private: set tickNextTickList; // 4J Was TreeSet unordered_set tickNextTickSet; // 4J Was HashSet - vector m_queuedSendTileUpdates; // 4J added + std::vector m_queuedSendTileUpdates; // 4J added CRITICAL_SECTION m_csQueueSendTileUpdates; protected: @@ -37,7 +37,7 @@ private: bool m_bAtLeastOnePlayerSleeping; // 4J Added static WeighedTreasureArray RANDOM_BONUS_ITEMS; // 4J - brought forward from 1.3.2 - vector tileEvents[2]; + std::vector tileEvents[2]; int activeTileEventsList; public: static void staticCtor(); @@ -64,7 +64,7 @@ public: void forceAddTileTick(int x, int y, int z, int tileId, int tickDelay); void tickEntities(); bool tickPendingTicks(bool force); - vector *fetchTicksInChunk(LevelChunk *chunk, bool remove); + std::vector *fetchTicksInChunk(LevelChunk *chunk, bool remove); virtual void tick(std::shared_ptr e, bool actual); void forceTick(std::shared_ptr e, bool actual); bool AllPlayersAreSleeping() { return allPlayersSleeping;} // 4J added for a message to other players @@ -72,7 +72,7 @@ public: protected: ChunkSource *createChunkSource(); // 4J - was virtual, but was called from parent ctor public: - vector > *getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1); + std::vector > *getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1); virtual bool mayInteract(std::shared_ptr player, int xt, int yt, int zt, int id); protected: virtual void initializeLevel(LevelSettings *settings); diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index 58106a326..dfc3be494 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -331,8 +331,8 @@ public: Level *animateTickLevel; // 4J added // 4J - When a client requests a texture, it should add it to here while we are waiting for it - vector m_pendingTextureRequests; - vector m_pendingGeometryRequests; // additional skin box geometry + std::vector m_pendingTextureRequests; + std::vector m_pendingGeometryRequests; // additional skin box geometry // 4J Added bool addPendingClientTextureRequest(const std::wstring &textureName); diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 4256cffff..b02ee009c 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -1440,7 +1440,7 @@ void MinecraftServer::broadcastStopSavingPacket() void MinecraftServer::tick() { - vector toRemove; + std::vector toRemove; for (AUTO_VAR(it, ironTimers.begin()); it != ironTimers.end(); it++ ) { int t = it->second; diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index 944b9775a..9a9ec08c1 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -96,9 +96,9 @@ public: std::wstring progressStatus; int progress; private: -// vector tickables = new ArrayList(); // 4J - removed +// std::vector tickables = new ArrayList(); // 4J - removed CommandDispatcher *commandDispatcher; - vector consoleInput; // 4J - was synchronizedList - TODO - investigate + std::vector consoleInput; // 4J - was synchronizedList - TODO - investigate public: bool onlineMode; bool animals; @@ -204,7 +204,7 @@ private: ChunkSource *chunkSource; postProcessRequest(int x, int z, ChunkSource *chunkSource) : x(x), z(z), chunkSource(chunkSource) {} }; - vector m_postProcessRequests; + std::vector m_postProcessRequests; CRITICAL_SECTION m_postProcessCS; public: void addPostProcessRequest(ChunkSource *chunkSource, int x, int z); diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index 8d36a103e..da6dd0995 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -609,7 +609,7 @@ void ClientConnection::handleAddEntity(std::shared_ptr packet) e->xRot = 0.0f; } - vector > *subEntities = e->getSubEntities(); + std::vector > *subEntities = e->getSubEntities(); if (subEntities != NULL) { int offs = packet->id - e->entityId; @@ -811,7 +811,7 @@ void ClientConnection::handleAddPlayer(std::shared_ptr packet) level->putEntity(packet->id, player); - vector > *unpackedData = packet->getUnpackedData(); + std::vector > *unpackedData = packet->getUnpackedData(); if (unpackedData != NULL) { player->getEntityData()->assignValues(unpackedData); @@ -2118,7 +2118,7 @@ void ClientConnection::handleAddMob(std::shared_ptr packet) mob->yRotp = packet->yRot; mob->xRotp = packet->xRot; - vector > *subEntities = mob->getSubEntities(); + std::vector > *subEntities = mob->getSubEntities(); if (subEntities != NULL) { int offs = packet->id - mob->entityId; @@ -2140,7 +2140,7 @@ void ClientConnection::handleAddMob(std::shared_ptr packet) mob->zd = packet->zd / 8000.0f; level->putEntity(packet->id, mob); - vector > *unpackedData = packet->getUnpackedData(); + std::vector > *unpackedData = packet->getUnpackedData(); if (unpackedData != NULL) { mob->getEntityData()->assignValues(unpackedData); diff --git a/Minecraft.Client/Network/MultiPlayerChunkCache.cpp b/Minecraft.Client/Network/MultiPlayerChunkCache.cpp index acbef3521..a2d3df880 100644 --- a/Minecraft.Client/Network/MultiPlayerChunkCache.cpp +++ b/Minecraft.Client/Network/MultiPlayerChunkCache.cpp @@ -275,7 +275,7 @@ void MultiPlayerChunkCache::postProcess(ChunkSource *parent, int x, int z) { } -vector *MultiPlayerChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z) +std::vector *MultiPlayerChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { return NULL; } diff --git a/Minecraft.Client/Network/MultiPlayerChunkCache.h b/Minecraft.Client/Network/MultiPlayerChunkCache.h index c557cd5d8..e49255b06 100644 --- a/Minecraft.Client/Network/MultiPlayerChunkCache.h +++ b/Minecraft.Client/Network/MultiPlayerChunkCache.h @@ -14,7 +14,7 @@ private: LevelChunk *emptyChunk; LevelChunk *waterChunk; - vector loadedChunkList; + std::vector loadedChunkList; LevelChunk **cache; // 4J - added for multithreaded support @@ -39,7 +39,7 @@ public: virtual bool shouldSave(); virtual void postProcess(ChunkSource *parent, int x, int z); virtual std::wstring gatherStats(); - virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); + virtual std::vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); virtual TilePos *findNearestMapFeature(Level *level, const std::wstring &featureName, int x, int y, int z); virtual void dataReceived(int x, int z); // 4J added diff --git a/Minecraft.Client/Network/PlayerChunkMap.cpp b/Minecraft.Client/Network/PlayerChunkMap.cpp index edbe18c88..b4d85d048 100644 --- a/Minecraft.Client/Network/PlayerChunkMap.cpp +++ b/Minecraft.Client/Network/PlayerChunkMap.cpp @@ -183,7 +183,7 @@ void PlayerChunkMap::PlayerChunk::prioritiseTileChanges() void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr packet) { - vector< std::shared_ptr > sentTo; + std::vector< std::shared_ptr > sentTo; for (unsigned int i = 0; i < players.size(); i++) { std::shared_ptr player = players[i]; @@ -330,7 +330,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) if( ys > 256 ) ys = 256; broadcast( std::shared_ptr( new BlockRegionUpdatePacket(xp, yp, zp, xs, ys, zs, level) ) ); - vector > *tes = level->getTileEntitiesInRegion(xp, yp, zp, xp + xs, yp + ys, zp + zs); + std::vector > *tes = level->getTileEntitiesInRegion(xp, yp, zp, xp + xs, yp + ys, zp + zs); for (unsigned int i = 0; i < tes->size(); i++) { broadcast(tes->at(i)); diff --git a/Minecraft.Client/Network/PlayerChunkMap.h b/Minecraft.Client/Network/PlayerChunkMap.h index 2b7f9a767..d9efdb2c6 100644 --- a/Minecraft.Client/Network/PlayerChunkMap.h +++ b/Minecraft.Client/Network/PlayerChunkMap.h @@ -34,7 +34,7 @@ public: friend class PlayerChunkMap; private: PlayerChunkMap *parent; // 4J added - vector > players; + std::vector > players; //int x, z; ChunkPos pos; @@ -63,12 +63,12 @@ public: }; public: - vector > players; + std::vector > players; void flagEntitiesToBeRemoved(unsigned int *flags, bool *removedFound); // 4J added private: std::unordered_map<__int64,PlayerChunk *,LongKeyHash,LongKeyEq> chunks; // 4J - was LongHashMap - vector changedChunks; - vector addRequests; // 4J added + std::vector changedChunks; + std::vector addRequests; // 4J added void tickAddRequests(std::shared_ptr player); // 4J added ServerLevel *level; diff --git a/Minecraft.Client/Network/PlayerConnection.cpp b/Minecraft.Client/Network/PlayerConnection.cpp index f5b40adc9..d16e8da47 100644 --- a/Minecraft.Client/Network/PlayerConnection.cpp +++ b/Minecraft.Client/Network/PlayerConnection.cpp @@ -858,7 +858,7 @@ void PlayerConnection::handleTextureAndGeometry(std::shared_ptr *pvSkinBoxes = app.GetAdditionalSkinBoxes(packet->dwSkinID); + std::vector *pvSkinBoxes = app.GetAdditionalSkinBoxes(packet->dwSkinID); unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID); send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pvSkinBoxes,uiAnimOverrideBitmask) ) ); @@ -933,7 +933,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(const std::wstring &text { // get the data from the app DWORD dwSkinID = app.getSkinIdFromPath(textureName); - vector *pvSkinBoxes = app.GetAdditionalSkinBoxes(dwSkinID); + std::vector *pvSkinBoxes = app.GetAdditionalSkinBoxes(dwSkinID); unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(dwSkinID); send( std::shared_ptr( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask) ) ); @@ -1146,7 +1146,7 @@ void PlayerConnection::handleContainerClick(std::shared_ptrconnection->send( std::shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, false) ) ); player->containerMenu->setSynched(player, false); - vector > items; + std::vector > items; for (unsigned int i = 0; i < player->containerMenu->slots->size(); i++) { items.push_back(player->containerMenu->slots->at(i)->getItem()); @@ -1244,7 +1244,7 @@ void PlayerConnection::handleSetCreativeModeSlot(std::shared_ptr > items; + std::vector > items; for (unsigned int i = 0; i < player->inventoryMenu->slots->size(); i++) { items.push_back(player->inventoryMenu->slots->at(i)->getItem()); @@ -1586,7 +1586,7 @@ void PlayerConnection::handleCraftItem(std::shared_ptr packet) { // 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 - vector > items; + std::vector > items; for (unsigned int i = 0; i < player->containerMenu->slots->size(); i++) { items.push_back(player->containerMenu->slots->at(i)->getItem()); diff --git a/Minecraft.Client/Network/PlayerConnection.h b/Minecraft.Client/Network/PlayerConnection.h index 0b8a74dc9..c0e94d37f 100644 --- a/Minecraft.Client/Network/PlayerConnection.h +++ b/Minecraft.Client/Network/PlayerConnection.h @@ -133,7 +133,7 @@ public: private: bool m_bCloseOnTick; - vector m_texturesRequested; + std::vector m_texturesRequested; bool m_bWasKicked; }; diff --git a/Minecraft.Client/Network/PlayerList.cpp b/Minecraft.Client/Network/PlayerList.cpp index 6b2bd0cc8..8219264a0 100644 --- a/Minecraft.Client/Network/PlayerList.cpp +++ b/Minecraft.Client/Network/PlayerList.cpp @@ -618,7 +618,7 @@ std::shared_ptr PlayerList::respawn(std::shared_ptr if(keepAllPlayerData) { - vector *activeEffects = player->getActiveEffects(); + std::vector *activeEffects = player->getActiveEffects(); for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it) { MobEffectInstance *effect = *it; @@ -811,7 +811,7 @@ void PlayerList::toggleDimension(std::shared_ptr player, int targe player->connection->teleport(player->x, player->y, player->z, player->yRot, player->xRot); // 4J Stu - Fix for #64683 - Customer Encountered: TU7: Content: Gameplay: Potion effects are removed after using the Nether Portal - vector *activeEffects = player->getActiveEffects(); + std::vector *activeEffects = player->getActiveEffects(); for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it) { MobEffectInstance *effect = *it; @@ -1034,7 +1034,7 @@ void PlayerList::broadcast(std::shared_ptr except, double x, double y, d { // 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< std::shared_ptr > sentTo; + std::vector< std::shared_ptr > sentTo; if( except != NULL ) { sentTo.push_back(dynamic_pointer_cast(except)); diff --git a/Minecraft.Client/Network/PlayerList.h b/Minecraft.Client/Network/PlayerList.h index 58ccd3641..495adf16b 100644 --- a/Minecraft.Client/Network/PlayerList.h +++ b/Minecraft.Client/Network/PlayerList.h @@ -22,14 +22,14 @@ private: static const int SEND_PLAYER_INFO_INTERVAL = 20 * 10; // 4J - brought forward from 1.2.3 // public static Logger logger = Logger.getLogger("Minecraft"); public: - vector > players; + std::vector > players; private: MinecraftServer *server; unsigned int maxPlayers; // 4J Added - vector m_bannedXuids; + std::vector m_bannedXuids; deque m_smallIdsToKick; CRITICAL_SECTION m_kickPlayersCS; deque m_smallIdsToClose; @@ -51,7 +51,7 @@ private: int sendAllPlayerInfoIn; // 4J Added to maintain which players in which dimensions can receive all packet types - vector > receiveAllPlayers[3]; + std::vector > receiveAllPlayers[3]; private: std::shared_ptr findAlivePlayerOnSystem(std::shared_ptr currentPlayer); diff --git a/Minecraft.Client/Network/ServerChunkCache.cpp b/Minecraft.Client/Network/ServerChunkCache.cpp index 178dd901e..c4543545c 100644 --- a/Minecraft.Client/Network/ServerChunkCache.cpp +++ b/Minecraft.Client/Network/ServerChunkCache.cpp @@ -74,7 +74,7 @@ bool ServerChunkCache::hasChunk(int x, int z) return true; } -vector *ServerChunkCache::getLoadedChunkList() +std::vector *ServerChunkCache::getLoadedChunkList() { return &m_loadedChunkList; } @@ -608,7 +608,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) // Created a roughly sorted list to match the order that the files were created in McRegionChunkStorage::McRegionChunkStorage. // This is to minimise the amount of data that needs to be moved round when creating a new level. - vector sortedChunkList; + std::vector sortedChunkList; for( int i = 0; i < m_loadedChunkList.size(); i++ ) { @@ -693,7 +693,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) // Created a roughly sorted list to match the order that the files were created in McRegionChunkStorage::McRegionChunkStorage. // This is to minimise the amount of data that needs to be moved round when creating a new level. - vector sortedChunkList; + std::vector sortedChunkList; for( int i = 0; i < m_loadedChunkList.size(); i++ ) { @@ -902,7 +902,7 @@ std::wstring ServerChunkCache::gatherStats() return L"ServerChunkCache: ";// + _toString(loadedChunks.size()) + L" Drop: " + _toString(toDrop.size()); } -vector *ServerChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z) +std::vector *ServerChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { return source->getMobsAt(mobCategory, x, y, z); } diff --git a/Minecraft.Client/Network/ServerChunkCache.h b/Minecraft.Client/Network/ServerChunkCache.h index 46ed35903..331805a1d 100644 --- a/Minecraft.Client/Network/ServerChunkCache.h +++ b/Minecraft.Client/Network/ServerChunkCache.h @@ -21,7 +21,7 @@ public: bool autoCreate; private: LevelChunk **cache; - vector m_loadedChunkList; + std::vector m_loadedChunkList; ServerLevel *level; #ifdef _LARGE_WORLDS @@ -39,7 +39,7 @@ public: ServerChunkCache(ServerLevel *level, ChunkStorage *storage, ChunkSource *source); virtual ~ServerChunkCache(); virtual bool hasChunk(int x, int z); - vector *getLoadedChunkList(); + std::vector *getLoadedChunkList(); void drop(int x, int z); void dropAll(); virtual LevelChunk *create(int x, int z); @@ -82,7 +82,7 @@ public: virtual bool shouldSave(); virtual std::wstring gatherStats(); - virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); + virtual std::vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); virtual TilePos *findNearestMapFeature(Level *level, const std::wstring &featureName, int x, int y, int z); private: diff --git a/Minecraft.Client/Network/ServerConnection.cpp b/Minecraft.Client/Network/ServerConnection.cpp index 5a8321865..6b7c2fa01 100644 --- a/Minecraft.Client/Network/ServerConnection.cpp +++ b/Minecraft.Client/Network/ServerConnection.cpp @@ -64,7 +64,7 @@ void ServerConnection::tick() { // MGH - changed this so that the the CS lock doesn't cover the tick (was causing a lockup when 2 players tried to join) EnterCriticalSection(&pending_cs); - vector< std::shared_ptr > tempPending = pending; + std::vector< std::shared_ptr > tempPending = pending; LeaveCriticalSection(&pending_cs); for (unsigned int i = 0; i < tempPending.size(); i++) diff --git a/Minecraft.Client/Network/ServerConnection.h b/Minecraft.Client/Network/ServerConnection.h index 7d95157e8..9243abf1e 100644 --- a/Minecraft.Client/Network/ServerConnection.h +++ b/Minecraft.Client/Network/ServerConnection.h @@ -20,11 +20,11 @@ private: int connectionCounter; private: CRITICAL_SECTION pending_cs; // 4J added - vector< std::shared_ptr > pending; - vector< std::shared_ptr > players; + std::vector< std::shared_ptr > pending; + std::vector< std::shared_ptr > players; // 4J - When the server requests a texture, it should add it to here while we are waiting for it - vector m_pendingTextureRequests; + std::vector m_pendingTextureRequests; public: MinecraftServer *server; diff --git a/Minecraft.Client/Platform/Durango/Durango_App.cpp b/Minecraft.Client/Platform/Durango/Durango_App.cpp index aa5f518aa..14e27c42c 100644 --- a/Minecraft.Client/Platform/Durango/Durango_App.cpp +++ b/Minecraft.Client/Platform/Durango/Durango_App.cpp @@ -559,7 +559,7 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad, app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList\n"); if(lpvData!=NULL) { - vector *pvTmsFileDetails=(vector *)lpvData; + std::vector *pvTmsFileDetails=(std::vector *)lpvData; if(pvTmsFileDetails->size()>0) { diff --git a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.cpp b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.cpp index 983efb9d4..8e6b48c41 100644 --- a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.cpp +++ b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.cpp @@ -490,7 +490,7 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperation 0) { - vector xuids = vector(); + std::vector xuids = std::vector(); for(int i = 0; i < lastResult->Rows->Size; i++) { xuids.push_back(PlayerUID(lastResult->Rows->GetAt(i)->XboxUserId->Data())); @@ -585,7 +585,7 @@ void DurangoLeaderboardManager::GetProfilesCallback(LPVOID param, std::vector 0) { - dlm->m_displayNames = vector(); + dlm->m_displayNames = std::vector(); for (int i = 0; i < profiles.size(); i++) { dlm->m_displayNames.push_back(profiles[i]->GameDisplayName->Data()); diff --git a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.cpp b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.cpp index dda2cf0db..5e0a8dfbd 100644 --- a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.cpp +++ b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.cpp @@ -20,7 +20,7 @@ StatParam::StatParam(const std::wstring &base) { m_base = base; //m_numArgs = numArgs; - m_args = vector(); + m_args = std::vector(); unsigned int count=0; std::wstring::size_type pos =base.find(L"*"); @@ -46,9 +46,9 @@ void StatParam::addArgs(int v1, ...) va_end(argptr); } -vector *StatParam::getStats() +std::vector *StatParam::getStats() { - vector *out = new vector(); + std::vector *out = new std::vector(); static const int MAXSIZE = 256; static const std::wstring SUBSTR = L"*"; @@ -91,13 +91,13 @@ DurangoStatsDebugger::DurangoStatsDebugger() InitializeCriticalSection(&m_retrievedStatsLock); } -vector *DurangoStatsDebugger::getStats() +std::vector *DurangoStatsDebugger::getStats() { - vector *out = new vector(); + std::vector *out = new std::vector(); for (auto it = m_stats.begin(); it!=m_stats.end(); it++) { - vector *sublist = (*it)->getStats(); + std::vector *sublist = (*it)->getStats(); out->insert(out->end(), sublist->begin(), sublist->end()); } @@ -322,7 +322,7 @@ void DurangoStatsDebugger::PrintStats(int iPad) { if (instance == NULL) instance = Initialize(); - vector *tmp = instance->getStats(); + std::vector *tmp = instance->getStats(); instance->m_printQueue.insert(instance->m_printQueue.end(), tmp->begin(), tmp->end()); // app.DebugPrintf("[DEBUG] START\n"); @@ -407,7 +407,7 @@ void DurangoStatsDebugger::retrieveStats(int iPad) // Create Stat retrieval threads until there is no long any stats to start retrieving. while ( !instance->m_printQueue.empty() ) { - vector *printing = new vector(); + std::vector *printing = new std::vector(); if (m_printQueue.size() > R_SIZE) { diff --git a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.h b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.h index 4c3f5d22b..189cf28bd 100644 --- a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.h +++ b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.h @@ -14,14 +14,14 @@ private: std::wstring m_base; int m_numArgs; - vector m_args; + std::vector m_args; public: StatParam(const std::wstring &base); void addArgs(int v1, ...); - vector *getStats(); + std::vector *getStats(); }; @@ -65,9 +65,9 @@ protected: DurangoStatsDebugger(); - vector m_stats; + std::vector m_stats; - vector *getStats(); + std::vector *getStats(); public: static DurangoStatsDebugger *Initialize(); @@ -75,7 +75,7 @@ public: static void PrintStats(int iPad); private: - vector m_printQueue; + std::vector m_printQueue; void retrieveStats(int iPad); @@ -88,7 +88,7 @@ private: CRITICAL_SECTION m_retrievedStatsLock; - vector m_retrievedStats; + std::vector m_retrievedStats; void addRetrievedStat(StatResult result); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.h b/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.h index 2a852245c..78ad92b9f 100644 --- a/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.h +++ b/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.h @@ -51,7 +51,7 @@ public: void RemoveLocalUser( __in Windows::Xbox::System::IUser^ user ); void EvaluateDevicesForUser(__in Windows::Xbox::System::IUser^ user ); - vector m_addedUsers; + std::vector m_addedUsers; CRITICAL_SECTION m_csAddedUsers; private: diff --git a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.cpp b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.cpp index f85448526..42411528a 100644 --- a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.cpp +++ b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.cpp @@ -1440,8 +1440,8 @@ MXSM::MultiplayerSessionReference^ DQRNetworkManager::ConvertToMicrosoftXboxServ // this method is able to work out who has been added or removed from the game session, and notify the game of these events. void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData) { - vector tempPlayers; - vector newPlayers; + std::vector tempPlayers; + std::vector newPlayers; EnterCriticalSection(&m_csRoomSyncData); @@ -1574,7 +1574,7 @@ bool DQRNetworkManager::AddRoomSyncPlayer(DQRNetworkPlayer *pPlayer, unsigned in void DQRNetworkManager::RemoveRoomSyncPlayersWithSessionAddress(unsigned int sessionAddress) { EnterCriticalSection(&m_csRoomSyncData); - vector removedPlayers; + std::vector removedPlayers; int iWriteIdx = 0; for( int i = 0; i < m_roomSyncData.playerCount; i++ ) { @@ -1605,7 +1605,7 @@ void DQRNetworkManager::RemoveRoomSyncPlayersWithSessionAddress(unsigned int ses // This is called from the host a remove player from the room sync data that is sent out to the clients. void DQRNetworkManager::RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer) { - vector removedPlayers; + std::vector removedPlayers; int iWriteIdx = 0; for( int i = 0; i < m_roomSyncData.playerCount; i++ ) { diff --git a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h index eee2d5a3b..abcb9518f 100644 --- a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h +++ b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h @@ -461,7 +461,7 @@ private: int RTSDoWorkThread(); CRITICAL_SECTION m_csVecChatPlayers; - vector m_vecChatPlayersJoined; + std::vector m_vecChatPlayersJoined; public: void HandleNewPartyFoundForPlayer(); void HandlePlayerRemovedFromParty(int playerMask); diff --git a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager_FriendSessions.cpp b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager_FriendSessions.cpp index 644bc6c3f..556e1c744 100644 --- a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager_FriendSessions.cpp +++ b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager_FriendSessions.cpp @@ -169,10 +169,10 @@ int DQRNetworkManager::GetFriendsThreadProc() // Get party views for each of the user party associations that we have. These seem to be able to (individually) raise errors, so // accumulate results into 2 matched vectors declared below so that we can ignore any broken UserPartyAssociations from now - vector partyViewVector; - vector partyResultsVector; + std::vector partyViewVector; + std::vector partyResultsVector; - vector> taskVector; + std::vector> taskVector; for each(WXM::UserPartyAssociation^ remoteParty in partyResults) { auto asyncOp = WXM::Party::GetPartyViewByPartyIdAsync( primaryUser, remoteParty->PartyId ); @@ -210,8 +210,8 @@ int DQRNetworkManager::GetFriendsThreadProc() } // Filter the party view, and party results vector (partyResultsVector) this is matched to, to remove any that don't have game sessions - or game sessions that aren't this game - vector partyViewVectorFiltered; - vector partyResultsFiltered; + std::vector partyViewVectorFiltered; + std::vector partyResultsFiltered; for( int i = 0; i < partyViewVector.size(); i++ ) { @@ -237,9 +237,9 @@ int DQRNetworkManager::GetFriendsThreadProc() // // and, from the party views, we can now attempt to get game sessions - vector sessionVector; - vector partyViewVectorValid; - vector partyResultsValid; + std::vector sessionVector; + std::vector partyViewVectorValid; + std::vector partyResultsValid; for( int i = 0; i < partyViewVectorFiltered.size(); i++ ) { @@ -284,10 +284,10 @@ int DQRNetworkManager::GetFriendsThreadProc() // a session won't have any XUIDs to resolve, which would make GetUserProfilesAsync unhappy, so we'll only be creating a task // when there are members. Creating new matching arrays for party results and sessions, to match the results (we don't care about the party view anymore) - vector^>> nameResolveTaskVector; - vector^> nameResolveVector; - vector newSessionVector; - vector newPartyVector; + std::vector^>> nameResolveTaskVector; + std::vector^> nameResolveVector; + std::vector newSessionVector; + std::vector newPartyVector; for( int j = 0; j < sessionVector.size(); j++ ) { @@ -383,7 +383,7 @@ int DQRNetworkManager::GetFriendsThreadProc() try { - auto joinTask = when_all(begin(nameResolveTaskVector), end(nameResolveTaskVector) ).then([this, &nameResolveVector](vector^> results) + auto joinTask = when_all(begin(nameResolveTaskVector), end(nameResolveTaskVector) ).then([this, &nameResolveVector](std::vector^> results) { nameResolveVector = results; }) diff --git a/Minecraft.Client/Platform/Durango/Network/PartyController.cpp b/Minecraft.Client/Platform/Durango/Network/PartyController.cpp index 84b54b99d..df7a849b8 100644 --- a/Minecraft.Client/Platform/Durango/Network/PartyController.cpp +++ b/Minecraft.Client/Platform/Durango/Network/PartyController.cpp @@ -781,7 +781,7 @@ void PartyController::OnGameSessionReady( GameSessionReadyEventArgs^ eventArgs ) Microsoft::Xbox::Services::Multiplayer::MultiplayerSessionReference^ sessionRef = m_pDQRNet->ConvertToMicrosoftXboxServicesMultiplayerSessionReference(eventArgs->GameSession); - vector localAdhocAdditions; + std::vector localAdhocAdditions; // Use context from any user at all for this, since this might happen before we are in a game and won't have anything set up in the network manager itself. We are only // using it to read the session so there shouldn't be any requirements to use a particular live context diff --git a/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.cpp b/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.cpp index c2c7a253b..f0f5f0cba 100644 --- a/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.cpp +++ b/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.cpp @@ -790,9 +790,9 @@ void CPlatformNetworkManagerDurango::TickSearch() } } -vector *CPlatformNetworkManagerDurango::GetSessionList(int iPad, int localPlayers, bool partyOnly) +std::vector *CPlatformNetworkManagerDurango::GetSessionList(int iPad, int localPlayers, bool partyOnly) { - vector *filteredList = new vector(); + std::vector *filteredList = new std::vector(); for( int i = 0; i < m_searchResultsCount; i++ ) { GameSessionData *gameSessionData = (GameSessionData *)m_pSearchResults[i].m_extData; diff --git a/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.h b/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.h index 11a988445..fa9216a68 100644 --- a/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.h +++ b/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.h @@ -71,7 +71,7 @@ private: HANDLE m_notificationListener; - vector m_machineDQRPrimaryPlayers; // collection of players that we deem to be the main one for that system + std::vector m_machineDQRPrimaryPlayers; // collection of players that we deem to be the main one for that system bool m_bLeavingGame; bool m_bLeaveGameOnTick; @@ -107,7 +107,7 @@ private: PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count); ~PlayerFlags(); }; - vector m_playerFlags; + std::vector m_playerFlags; void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagReset(); @@ -124,7 +124,7 @@ public: std::wstring GatherRTTStats(); private: - vector friendsSessions[XUSER_MAX_COUNT]; + std::vector friendsSessions[XUSER_MAX_COUNT]; int m_searchResultsCount; int m_lastSearchStartTime; @@ -139,7 +139,7 @@ private: void TickSearch(); - vectorcurrentNetworkPlayers; + std::vectorcurrentNetworkPlayers; INetworkPlayer *addNetworkPlayer(DQRNetworkPlayer *pDQRPlayer); void removeNetworkPlayer(DQRNetworkPlayer *pDQRPlayer); static INetworkPlayer *getNetworkPlayer(DQRNetworkPlayer *pDQRPlayer); @@ -149,7 +149,7 @@ private: virtual void Notify(int ID, ULONG_PTR Param); public: - virtual vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); + virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ); virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); diff --git a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp index 3b4043e55..c38f9a2ed 100644 --- a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp @@ -989,7 +989,7 @@ Vec3::resetPool(); // g_pd3dDevice->Release(); -vector vRichPresenceStrings; +std::vector vRichPresenceStrings; // convert std::wstring to UTF-8 string std::string wstring_to_utf8 (const std::wstring& str) diff --git a/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp b/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp index d88c1c4f1..e03585349 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp +++ b/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp @@ -1460,7 +1460,7 @@ int main(int argc, const char *argv[] ) } -vector vRichPresenceStrings; +std::vector vRichPresenceStrings; // convert std::wstring to UTF-8 string std::string std::wstring_to_utf8 (const std::wstring& str) diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Stubs.cpp b/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Stubs.cpp index d72d3591a..4d543e156 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Stubs.cpp +++ b/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Stubs.cpp @@ -26,7 +26,7 @@ static char usrdirPathBDPatch[CELL_GAME_PATH_MAX]; //static char sc_loadPath[] = {"/app_home/"}; //static char sc_loadPath[CELL_GAME_PATH_MAX]; static int iFilesOpen=0; -vector vOpenFileHandles; +std::vector vOpenFileHandles; namespace boost { diff --git a/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp b/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp index e1cc711e8..95482c7a4 100644 --- a/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp +++ b/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp @@ -1362,7 +1362,7 @@ int main() ShutdownManager::MainThreadHandleShutdown(); } -vector vRichPresenceStrings; +std::vector vRichPresenceStrings; uint8_t * AddRichPresenceString(int iID) { uint8_t *strUtf8 = mallocAndCreateUTF8ArrayFromString(iID); diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.h index 22c3db1bb..a47788d33 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.h @@ -64,7 +64,7 @@ public: int id; int padding[1]; //public: - // vector > renderableTileEntities; // 4J - removed + // std::vector > renderableTileEntities; // 4J - removed private: void *globalRenderableTileEntities; diff --git a/Minecraft.Client/Platform/PSVita/PSVita_App.cpp b/Minecraft.Client/Platform/PSVita/PSVita_App.cpp index 7b903ccae..8d2fecb37 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_App.cpp +++ b/Minecraft.Client/Platform/PSVita/PSVita_App.cpp @@ -1566,7 +1566,7 @@ void CConsoleMinecraftApp::getSaveDataDeleteDialogParam(SceSaveDataDialogParam * ZeroMemory(&listParam, sizeof(SceSaveDataDialogListParam)); { - vector slots; + std::vector slots; for (unsigned int i = 2; i < SCE_APPUTIL_SAVEDATA_SLOT_MAX; i++) { SceAppUtilSaveDataSlotParam slotParam; @@ -1589,7 +1589,7 @@ void CConsoleMinecraftApp::getSaveDataDeleteDialogParam(SceSaveDataDialogParam * int slotIndex = 0; - vector::iterator itr; + std::vector::iterator itr; for (itr = slots.begin(); itr != slots.end(); itr++) { pSavesList[slotIndex] = *itr; diff --git a/Minecraft.Client/Platform/PSVita/PSVita_Minecraft.cpp b/Minecraft.Client/Platform/PSVita/PSVita_Minecraft.cpp index 4d25c6aa7..7939d875f 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_Minecraft.cpp +++ b/Minecraft.Client/Platform/PSVita/PSVita_Minecraft.cpp @@ -1061,7 +1061,7 @@ int main() ShutdownManager::MainThreadHandleShutdown(); } -vector vRichPresenceStrings; +std::vector vRichPresenceStrings; uint8_t * AddRichPresenceString(int iID) { uint8_t *strUtf8 = mallocAndCreateUTF8ArrayFromString(iID); diff --git a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp index c156fd141..cbb527ceb 100644 --- a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp @@ -25,7 +25,7 @@ IXACT3SoundBank *SoundEngine::m_pSoundBank2 = NULL; CRITICAL_SECTION SoundEngine::m_CS; X3DAUDIO_HANDLE SoundEngine::m_xact3dInstance; -vector SoundEngine::currentSounds; +std::vector SoundEngine::currentSounds; X3DAUDIO_DSP_SETTINGS SoundEngine::m_DSPSettings; X3DAUDIO_EMITTER SoundEngine::m_emitter; X3DAUDIO_LISTENER SoundEngine::m_listeners[4]; diff --git a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h index fd3a2fdbc..e0f5d6c7a 100644 --- a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h +++ b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h @@ -54,7 +54,7 @@ class SoundEngine : public ConsoleSoundEngine }; void update3DPosition( soundInfo *pInfo, bool bPlaceEmitterAtListener = false, bool bIsCDMusic = false); - static vectorcurrentSounds; + static std::vectorcurrentSounds; int noMusicDelay; Random *random; diff --git a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp index 4d9668cc3..e9813f1e4 100644 --- a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp +++ b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp @@ -1474,9 +1474,9 @@ void CPlatformNetworkManagerXbox::SetSearchResultsReady(int resultCount ) m_searchResultsCount[m_lastSearchPad] = resultCount; } -vector *CPlatformNetworkManagerXbox::GetSessionList(int iPad, int localPlayers, bool partyOnly) +std::vector *CPlatformNetworkManagerXbox::GetSessionList(int iPad, int localPlayers, bool partyOnly) { - vector *filteredList = new vector();; + std::vector *filteredList = new std::vector();; const XSESSION_SEARCHRESULT *pSearchResult; const XNQOSINFO * pxnqi; diff --git a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.h b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.h index 492299228..969ca1459 100644 --- a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.h +++ b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.h @@ -73,7 +73,7 @@ private: HANDLE m_notificationListener; - vector m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system + std::vector m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system bool m_bLeavingGame; bool m_bLeaveGameOnTick; @@ -108,7 +108,7 @@ private: PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count); ~PlayerFlags(); }; - vector m_playerFlags; + std::vector m_playerFlags; void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagReset(); @@ -125,7 +125,7 @@ public: std::wstring GatherRTTStats(); private: - vector friendsSessions[XUSER_MAX_COUNT]; + std::vector friendsSessions[XUSER_MAX_COUNT]; int m_searchResultsCount[XUSER_MAX_COUNT]; int m_lastSearchStartTime[XUSER_MAX_COUNT]; @@ -152,7 +152,7 @@ private: void SetSearchResultsReady(int resultCount = 0); - vectorcurrentNetworkPlayers; + std::vectorcurrentNetworkPlayers; INetworkPlayer *addNetworkPlayer(IQNetPlayer *pQNetPlayer); void removeNetworkPlayer(IQNetPlayer *pQNetPlayer); static INetworkPlayer *getNetworkPlayer(IQNetPlayer *pQNetPlayer); @@ -162,7 +162,7 @@ private: virtual void Notify(int ID, ULONG_PTR Param); public: - virtual vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); + virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ); virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); diff --git a/Minecraft.Client/Player/EntityTracker.cpp b/Minecraft.Client/Player/EntityTracker.cpp index d73ec6f1f..74985052b 100644 --- a/Minecraft.Client/Player/EntityTracker.cpp +++ b/Minecraft.Client/Player/EntityTracker.cpp @@ -115,7 +115,7 @@ void EntityTracker::removePlayer(std::shared_ptr e) void EntityTracker::tick() { - vector > movedPlayers; + std::vector > movedPlayers; for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) { std::shared_ptr te = *it; diff --git a/Minecraft.Client/Player/LocalPlayer.cpp b/Minecraft.Client/Player/LocalPlayer.cpp index aaa84ed61..2a32923d9 100644 --- a/Minecraft.Client/Player/LocalPlayer.cpp +++ b/Minecraft.Client/Player/LocalPlayer.cpp @@ -1609,7 +1609,7 @@ void LocalPlayer::handleCollectItem(std::shared_ptr item) } } -void LocalPlayer::SetPlayerAdditionalModelParts(vectorpAdditionalModelParts) +void LocalPlayer::SetPlayerAdditionalModelParts(std::vectorpAdditionalModelParts) { m_pAdditionalModelParts=pAdditionalModelParts; } diff --git a/Minecraft.Client/Player/LocalPlayer.h b/Minecraft.Client/Player/LocalPlayer.h index a4054c974..e9948b7d9 100644 --- a/Minecraft.Client/Player/LocalPlayer.h +++ b/Minecraft.Client/Player/LocalPlayer.h @@ -190,10 +190,10 @@ public: float getAndResetChangeDimensionTimer(); virtual void handleCollectItem(std::shared_ptr item); - void SetPlayerAdditionalModelParts(vectorpAdditionalModelParts); + void SetPlayerAdditionalModelParts(std::vectorpAdditionalModelParts); private: - vector m_pAdditionalModelParts; + std::vector m_pAdditionalModelParts; }; diff --git a/Minecraft.Client/Player/ServerPlayer.cpp b/Minecraft.Client/Player/ServerPlayer.cpp index a27e9ba6d..35e3e94a4 100644 --- a/Minecraft.Client/Player/ServerPlayer.cpp +++ b/Minecraft.Client/Player/ServerPlayer.cpp @@ -441,7 +441,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) // Don't send TileEntity data until we have sent the block data if( connection->isLocal() || chunkDataSent) { - vector > *tes = level->getTileEntitiesInRegion(nearest.x * 16, 0, nearest.z * 16, nearest.x * 16 + 16, Level::maxBuildHeight, nearest.z * 16 + 16); + std::vector > *tes = level->getTileEntitiesInRegion(nearest.x * 16, 0, nearest.z * 16, nearest.x * 16 + 16, Level::maxBuildHeight, nearest.z * 16 + 16); for (unsigned int i = 0; i < tes->size(); i++) { // 4J Stu - Added delay param to ensure that these arrive after the BRUPs from above @@ -1010,12 +1010,12 @@ void ServerPlayer::slotChanged(AbstractContainerMenu *container, int slotIndex, void ServerPlayer::refreshContainer(AbstractContainerMenu *menu) { - vector > *items = menu->getItems(); + std::vector > *items = menu->getItems(); refreshContainer(menu, items); delete items; } -void ServerPlayer::refreshContainer(AbstractContainerMenu *container, vector > *items) +void ServerPlayer::refreshContainer(AbstractContainerMenu *container, std::vector > *items) { connection->send( std::shared_ptr( new ContainerSetContentPacket(container->containerId, items) ) ); connection->send( std::shared_ptr( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) ); diff --git a/Minecraft.Client/Player/ServerPlayer.h b/Minecraft.Client/Player/ServerPlayer.h index 82eb27abc..8abb871f2 100644 --- a/Minecraft.Client/Player/ServerPlayer.h +++ b/Minecraft.Client/Player/ServerPlayer.h @@ -22,7 +22,7 @@ public: ServerPlayerGameMode *gameMode; double lastMoveX, lastMoveZ; list chunksToSend; - vector entitiesToRemove; + std::vector entitiesToRemove; unordered_set seenChunks; int spewTimer; @@ -104,7 +104,7 @@ public: virtual bool openTrading(std::shared_ptr traderTarget); // 4J added bool return virtual void slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr item); void refreshContainer(AbstractContainerMenu *menu); - virtual void refreshContainer(AbstractContainerMenu *container, vector > *items); + virtual void refreshContainer(AbstractContainerMenu *container, std::vector > *items); virtual void setContainerData(AbstractContainerMenu *container, int id, int value); virtual void closeContainer(); void broadcastCarriedItem(); diff --git a/Minecraft.Client/Player/TrackedEntity.cpp b/Minecraft.Client/Player/TrackedEntity.cpp index 7e31186fc..91a63c017 100644 --- a/Minecraft.Client/Player/TrackedEntity.cpp +++ b/Minecraft.Client/Player/TrackedEntity.cpp @@ -48,7 +48,7 @@ TrackedEntity::TrackedEntity(std::shared_ptr e, int range, int updateInt int c0a = 0, c0b = 0, c1a = 0, c1b = 0, c1c = 0, c2a = 0, c2b = 0; -void TrackedEntity::tick(EntityTracker *tracker, vector > *players) +void TrackedEntity::tick(EntityTracker *tracker, std::vector > *players) { moved = false; if (!updatedPlayerVisibility || e->distanceToSqr(xpu, ypu, zpu) > 4 * 4) @@ -308,7 +308,7 @@ void TrackedEntity::broadcast(std::shared_ptr packet) if( Packet::canSendToAnyClient( packet ) ) { // 4J-PB - due to the knockback on a player being hit, we need to send to all players, but limit the network traffic here to players that have not already had it sent to their system - vector< std::shared_ptr > sentTo; + std::vector< std::shared_ptr > sentTo; // 4J - don't send to a player we've already sent this data to that shares the same machine. // EntityMotionPacket used to limit themselves to sending once to each machine @@ -370,7 +370,7 @@ void TrackedEntity::broadcast(std::shared_ptr packet) void TrackedEntity::broadcastAndSend(std::shared_ptr packet) { - vector< std::shared_ptr > sentTo; + std::vector< std::shared_ptr > sentTo; broadcast(packet); std::shared_ptr sp = dynamic_pointer_cast(e); if (sp != NULL && sp->connection) @@ -526,7 +526,7 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, std::shared_ptr(e) != NULL) { std::shared_ptr mob = dynamic_pointer_cast(e); - vector *activeEffects = mob->getActiveEffects(); + std::vector *activeEffects = mob->getActiveEffects(); for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it) { MobEffectInstance *effect = *it; @@ -558,7 +558,7 @@ bool TrackedEntity::canBySeenBy(std::shared_ptr player) // return player->getLevel()->getChunkMap()->isPlayerIn(player, e->xChunk, e->zChunk); } -void TrackedEntity::updatePlayers(EntityTracker *tracker, vector > *players) +void TrackedEntity::updatePlayers(EntityTracker *tracker, std::vector > *players) { for (unsigned int i = 0; i < players->size(); i++) { diff --git a/Minecraft.Client/Player/TrackedEntity.h b/Minecraft.Client/Player/TrackedEntity.h index 46294ce2b..81e69cc5f 100644 --- a/Minecraft.Client/Player/TrackedEntity.h +++ b/Minecraft.Client/Player/TrackedEntity.h @@ -36,7 +36,7 @@ public: TrackedEntity(std::shared_ptr e, int range, int updateInterval, bool trackDelta); - void tick(EntityTracker *tracker, vector > *players); + void tick(EntityTracker *tracker, std::vector > *players); void broadcast(std::shared_ptr packet); void broadcastAndSend(std::shared_ptr packet); void broadcastRemoved(); @@ -56,7 +56,7 @@ private: public: void updatePlayer(EntityTracker *tracker, std::shared_ptr sp); - void updatePlayers(EntityTracker *tracker, vector > *players); + void updatePlayers(EntityTracker *tracker, std::vector > *players); private: void sendEntityData(std::shared_ptr conn); std::shared_ptr getAddEntityPacket(); diff --git a/Minecraft.Client/Player/User.cpp b/Minecraft.Client/Player/User.cpp index 533985dcc..5cdc0162d 100644 --- a/Minecraft.Client/Player/User.cpp +++ b/Minecraft.Client/Player/User.cpp @@ -2,7 +2,7 @@ #include "User.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.h" -vector User::allowedTiles; +std::vector User::allowedTiles; void User::staticCtor() { diff --git a/Minecraft.Client/Player/User.h b/Minecraft.Client/Player/User.h index 5d87832cb..7ee722eed 100644 --- a/Minecraft.Client/Player/User.h +++ b/Minecraft.Client/Player/User.h @@ -4,7 +4,7 @@ using namespace std; class User { public: - static vector allowedTiles; + static std::vector allowedTiles; static void staticCtor(); std::wstring name; std::wstring sessionId; diff --git a/Minecraft.Client/Rendering/Chunk.cpp b/Minecraft.Client/Rendering/Chunk.cpp index 97ec6eeaf..f94b0b880 100644 --- a/Minecraft.Client/Rendering/Chunk.cpp +++ b/Minecraft.Client/Rendering/Chunk.cpp @@ -207,7 +207,7 @@ void Chunk::rebuild() // unordered_set > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line // renderableTileEntities.clear(); - vector > renderableTileEntities; // 4J - added + std::vector > renderableTileEntities; // 4J - added int r = 1; @@ -574,12 +574,12 @@ void Chunk::rebuild() // 4J - All these new things added to globalRenderableTileEntities AUTO_VAR(endItRTE, renderableTileEntities.end()); - for( vector >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) + for( std::vector >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) { oldTileEntities.erase(*it); } // 4J - oldTileEntities is now the removed items - vector >::iterator it = globalRenderableTileEntities->begin(); + std::vector >::iterator it = globalRenderableTileEntities->begin(); while( it != globalRenderableTileEntities->end() ) { if( oldTileEntities.find(*it) != oldTileEntities.end() ) @@ -659,7 +659,7 @@ void Chunk::rebuild_SPU() // unordered_set > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line // renderableTileEntities.clear(); - vector > renderableTileEntities; // 4J - added + std::vector > renderableTileEntities; // 4J - added // List newTileEntities = new ArrayList(); // newTileEntities.clear(); @@ -903,12 +903,12 @@ void Chunk::rebuild_SPU() // 4J - All these new things added to globalRenderableTileEntities AUTO_VAR(endItRTE, renderableTileEntities.end()); - for( vector >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) + for( std::vector >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) { oldTileEntities.erase(*it); } // 4J - oldTileEntities is now the removed items - vector >::iterator it = globalRenderableTileEntities->begin(); + std::vector >::iterator it = globalRenderableTileEntities->begin(); while( it != globalRenderableTileEntities->end() ) { if( oldTileEntities.find(*it) != oldTileEntities.end() ) diff --git a/Minecraft.Client/Rendering/Chunk.h b/Minecraft.Client/Rendering/Chunk.h index a80f53484..c3231bb94 100644 --- a/Minecraft.Client/Rendering/Chunk.h +++ b/Minecraft.Client/Rendering/Chunk.h @@ -52,7 +52,7 @@ public: int id; //public: -// vector > renderableTileEntities; // 4J - removed +// std::vector > renderableTileEntities; // 4J - removed private: LevelRenderer::rteMap *globalRenderableTileEntities; diff --git a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp index 2cff2584f..eaec4c2d2 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp @@ -198,7 +198,7 @@ void PlayerRenderer::render(std::shared_ptr _mob, double x, double y, do } // 4J-PB - any additional parts to turn on for this player (skin dependent) - vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); + std::vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); //turn them on if(pAdditionalModelParts!=NULL) { diff --git a/Minecraft.Client/Rendering/GameRenderer.cpp b/Minecraft.Client/Rendering/GameRenderer.cpp index d7663f48f..f620c8331 100644 --- a/Minecraft.Client/Rendering/GameRenderer.cpp +++ b/Minecraft.Client/Rendering/GameRenderer.cpp @@ -57,10 +57,10 @@ C4JThread* GameRenderer::m_updateThread; C4JThread::EventArray* GameRenderer::m_updateEvents; bool GameRenderer::nearThingsToDo = false; bool GameRenderer::updateRunning = false; -vector GameRenderer::m_deleteStackByte; -vector GameRenderer::m_deleteStackSparseLightStorage; -vector GameRenderer::m_deleteStackCompressedTileStorage; -vector GameRenderer::m_deleteStackSparseDataStorage; +std::vector GameRenderer::m_deleteStackByte; +std::vector GameRenderer::m_deleteStackSparseLightStorage; +std::vector GameRenderer::m_deleteStackCompressedTileStorage; +std::vector GameRenderer::m_deleteStackSparseDataStorage; #endif CRITICAL_SECTION GameRenderer::m_csDeleteStack; @@ -352,7 +352,7 @@ void GameRenderer::pick(float a) Vec3 *to = from->add(b->x * range, b->y * range, b->z * range); hovered = nullptr; float overlap = 1; - vector > *objects = mc->level->getEntities(mc->cameraTargetPlayer, mc->cameraTargetPlayer->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap)); + std::vector > *objects = mc->level->getEntities(mc->cameraTargetPlayer, mc->cameraTargetPlayer->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap)); double nearest = dist; AUTO_VAR(itEnd, objects->end()); diff --git a/Minecraft.Client/Rendering/GameRenderer.h b/Minecraft.Client/Rendering/GameRenderer.h index d575952b6..5026704bb 100644 --- a/Minecraft.Client/Rendering/GameRenderer.h +++ b/Minecraft.Client/Rendering/GameRenderer.h @@ -156,10 +156,10 @@ public: static bool nearThingsToDo; static bool updateRunning; #endif - static vector m_deleteStackByte; - static vector m_deleteStackSparseLightStorage; - static vector m_deleteStackCompressedTileStorage; - static vector m_deleteStackSparseDataStorage; + static std::vector m_deleteStackByte; + static std::vector m_deleteStackSparseLightStorage; + static std::vector m_deleteStackCompressedTileStorage; + static std::vector m_deleteStackSparseDataStorage; static CRITICAL_SECTION m_csDeleteStack; static void AddForDelete(uint8_t *deleteThis); static void AddForDelete(SparseLightStorage *deleteThis); diff --git a/Minecraft.Client/Rendering/LevelRenderer.cpp b/Minecraft.Client/Rendering/LevelRenderer.cpp index 04854e5e2..49d9d93c0 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.cpp +++ b/Minecraft.Client/Rendering/LevelRenderer.cpp @@ -442,7 +442,7 @@ void LevelRenderer::allChanged(int playerIndex) } chunks[playerIndex] = ClipChunkArray(xChunks * yChunks * zChunks); - // sortedChunks[playerIndex] = new vector(xChunks * yChunks * zChunks); // 4J - removed - not sorting our chunks anymore + // sortedChunks[playerIndex] = new std::vector(xChunks * yChunks * zChunks); // 4J - removed - not sorting our chunks anymore int id = 0; int count = 0; @@ -520,7 +520,7 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a) mc->gameRenderer->turnOnLightLayer(a); // 4J - brought forward from 1.8.2 - vector > entities = level[playerIndex]->getAllEntities(); + std::vector > entities = level[playerIndex]->getAllEntities(); totalEntities = (int)entities.size(); AUTO_VAR(itEndGE, level[playerIndex]->globalEntities.end()); diff --git a/Minecraft.Client/Rendering/LevelRenderer.h b/Minecraft.Client/Rendering/LevelRenderer.h index bdf371752..ab8a1fe40 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.h +++ b/Minecraft.Client/Rendering/LevelRenderer.h @@ -120,18 +120,18 @@ public: void destroyTileProgress(int id, int x, int y, int z, int progress); void registerTextures(IconRegister *iconRegister); - typedef std::unordered_map >, IntKeyHash, IntKeyEq> rteMap; + typedef std::unordered_map >, IntKeyHash, IntKeyEq> rteMap; private: // debug int m_freezeticks; // used to freeze the clouds // 4J - this block of declarations was scattered round the code but have gathered everything into one place - rteMap renderableTileEntities; // 4J - changed - was vector, now hashed by chunk so we can find them + rteMap renderableTileEntities; // 4J - changed - was std::vector, now hashed by chunk so we can find them CRITICAL_SECTION m_csRenderableTileEntities; MultiPlayerLevel *level[4]; // 4J - now one per player Textures *textures; - // vector *sortedChunks[4]; // 4J - removed - not sorting our chunks anymore + // std::vector *sortedChunks[4]; // 4J - removed - not sorting our chunks anymore ClipChunkArray chunks[4]; // 4J - now one per player int lastPlayerCount[4]; // 4J - added int xChunks, yChunks, zChunks; @@ -149,7 +149,7 @@ private: int renderedEntities; int culledEntities; int chunkFixOffs; - vector _renderChunks; + std::vector _renderChunks; int frame; int repeatList; double xOld[4]; // 4J - now one per player @@ -189,7 +189,7 @@ public: ~RecentTile(); }; CRITICAL_SECTION m_csDestroyedTiles; - vector m_destroyedTiles; + std::vector m_destroyedTiles; public: void destroyingTileAt( Level *level, int x, int y, int z ); // For game to let this manager know that a tile is about to be destroyed (must be called before it actually is) void updatedChunkAt( Level * level, int x, int y, int z, int veryNearCount ); // For chunk rebuilding to inform the manager that a chunk (a 16x16x16 tile render chunk) has been updated diff --git a/Minecraft.Client/Rendering/Minimap.cpp b/Minecraft.Client/Rendering/Minimap.cpp index a4da8ca19..cb337cd83 100644 --- a/Minecraft.Client/Rendering/Minimap.cpp +++ b/Minecraft.Client/Rendering/Minimap.cpp @@ -147,12 +147,12 @@ void Minimap::render(std::shared_ptr player, Textures *textures, std::sh AUTO_VAR(itEnd, data->decorations.end()); #ifdef _LARGE_WORLDS - vector m_edgeIcons; + std::vector m_edgeIcons; #endif // 4J-PB - stack the map icons float fIconZ=-0.04f;// 4J - moved to -0.04 (was -0.02) to stop z fighting - for( vector::iterator it = data->decorations.begin(); it != itEnd; it++ ) + for( std::vector::iterator it = data->decorations.begin(); it != itEnd; it++ ) { MapItemSavedData::MapDecoration *dec = *it; diff --git a/Minecraft.Client/Rendering/Models/Model.h b/Minecraft.Client/Rendering/Models/Model.h index 335afb9ca..431ba5cde 100644 --- a/Minecraft.Client/Rendering/Models/Model.h +++ b/Minecraft.Client/Rendering/Models/Model.h @@ -12,7 +12,7 @@ class Model public: float attackTime; bool riding; - vector cubes; + std::vector cubes; bool young; std::unordered_map mappedTexOffs; int texWidth; diff --git a/Minecraft.Client/Rendering/Particles/GuiParticles.h b/Minecraft.Client/Rendering/Particles/GuiParticles.h index 3cbb9871e..73ef7eee4 100644 --- a/Minecraft.Client/Rendering/Particles/GuiParticles.h +++ b/Minecraft.Client/Rendering/Particles/GuiParticles.h @@ -8,7 +8,7 @@ using namespace std; class GuiParticles : public GuiComponent { private: - vector particles; + std::vector particles; Minecraft *mc; public: diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp index 3bae4d69a..0977b4ca2 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp @@ -18,7 +18,7 @@ TexturePackRepository::TexturePackRepository(File workingDirectory, Minecraft *m // 4J - added usingWeb = false; selected = NULL; - texturePacks = new vector; + texturePacks = new std::vector; this->minecraft = minecraft; @@ -157,7 +157,7 @@ void TexturePackRepository::updateList() { // 4J Stu - We don't ever want to completely refresh the lists, we keep them up-to-date as we go #if 0 - vector *currentPacks = new vector; + std::vector *currentPacks = new std::vector; currentPacks->push_back(DEFAULT_TEXTURE_PACK); cacheById[DEFAULT_TEXTURE_PACK->getId()] = DEFAULT_TEXTURE_PACK; #ifndef _CONTENT_PACKAGE @@ -195,9 +195,9 @@ void TexturePackRepository::updateList() // 4J - was texturePacks.removeAll(currentPacks); AUTO_VAR(itEnd, currentPacks->end()); - for( vector::iterator it1 = currentPacks->begin(); it1 != itEnd; it1++ ) + for( std::vector::iterator it1 = currentPacks->begin(); it1 != itEnd; it1++ ) { - for( vector::iterator it2 = texturePacks->begin(); it2 != texturePacks->end(); it2++ ) + for( std::vector::iterator it2 = texturePacks->begin(); it2 != texturePacks->end(); it2++ ) { if( *it1 == *it2 ) { @@ -207,7 +207,7 @@ void TexturePackRepository::updateList() } itEnd = texturePacks->end(); - for( vector::iterator it = texturePacks->begin(); it != itEnd; it++ ) + for( std::vector::iterator it = texturePacks->begin(); it != itEnd; it++ ) { TexturePack *pack = *it; pack->unload(minecraft->textures); @@ -234,7 +234,7 @@ std::wstring TexturePackRepository::getIdOrNull(File file) return L""; } -vector TexturePackRepository::getWorkDirContents() +std::vector TexturePackRepository::getWorkDirContents() { app.DebugPrintf("TexturePackRepository::getWorkDirContents is not implemented\n"); #if 0 @@ -244,10 +244,10 @@ vector TexturePackRepository::getWorkDirContents() return Collections.emptyList(); #endif - return vector(); + return std::vector(); } -vector *TexturePackRepository::getAll() +std::vector *TexturePackRepository::getAll() { // 4J - note that original constucted a copy of texturePacks here return texturePacks; @@ -291,9 +291,9 @@ bool TexturePackRepository::canUseWebSkin() return false; } -vector< pair > *TexturePackRepository::getTexturePackIdNames() +std::vector< pair > *TexturePackRepository::getTexturePackIdNames() { - vector< pair > *packList = new vector< pair >(); + std::vector< pair > *packList = new std::vector< pair >(); for(AUTO_VAR(it,texturePacks->begin()); it != texturePacks->end(); ++it) { diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.h b/Minecraft.Client/Textures/Packs/TexturePackRepository.h index 99e89852e..a397e39bc 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.h +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.h @@ -18,8 +18,8 @@ private: Minecraft *minecraft; File workDir; File multiplayerDir; - vector *texturePacks; - vector m_texturePacksToDelete; + std::vector *texturePacks; + std::vector m_texturePacksToDelete; std::unordered_map cacheById; @@ -49,10 +49,10 @@ public: private: std::wstring getIdOrNull(File file); - vector getWorkDirContents(); + std::vector getWorkDirContents(); public: - vector *getAll(); + std::vector *getAll(); TexturePack *getSelected(); bool shouldPromptForWebSkin(); @@ -60,7 +60,7 @@ public: bool isUsingDefaultSkin() { return selected == DEFAULT_TEXTURE_PACK; } // 4J Added TexturePack *getDefault() { return DEFAULT_TEXTURE_PACK; } // 4J Added - vector< pair > *getTexturePackIdNames(); + std::vector< pair > *getTexturePackIdNames(); bool selectTexturePackById(DWORD id); // 4J Added TexturePack *getTexturePackById(DWORD id); // 4J Added diff --git a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp index 8bf37af90..30fbaefd3 100644 --- a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp @@ -70,7 +70,7 @@ void PreStitchedTextureMap::stitch() } // Collection bucket for multiple frames per texture - std::unordered_map * > textures; // = new HashMap>(); + std::unordered_map * > textures; // = new HashMap>(); Stitcher *stitcher = TextureManager::getInstance()->createStitcher(name); @@ -143,7 +143,7 @@ void PreStitchedTextureMap::stitch() std::wstring filename = path + textureFileName + extension; // TODO: [EB] Put the frames into a proper object, not this inside out hack - vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); + std::vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); if (frames == NULL || frames->empty()) { continue; // Couldn't load a texture, skip it diff --git a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h index 763d2cab7..96e9c90ba 100644 --- a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h +++ b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h @@ -28,9 +28,9 @@ private: BufferedImage *missingTexture; // = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); StitchedTexture *missingPosition; Texture *stitchResult; - vector animatedTextures; // = new ArrayList(); + std::vector animatedTextures; // = new ArrayList(); - vector > texturesToAnimate; + std::vector > texturesToAnimate; void loadUVs(); public: diff --git a/Minecraft.Client/Textures/Stitching/StitchSlot.cpp b/Minecraft.Client/Textures/Stitching/StitchSlot.cpp index 15dcc2327..1a30bca3f 100644 --- a/Minecraft.Client/Textures/Stitching/StitchSlot.cpp +++ b/Minecraft.Client/Textures/Stitching/StitchSlot.cpp @@ -52,7 +52,7 @@ bool StitchSlot::add(TextureHolder *textureHolder) // See if we're already divided before, if not, setup subSlots if (subSlots == NULL) { - subSlots = new vector(); + subSlots = new std::vector(); // First slot is for the new texture subSlots->push_back(new StitchSlot(originX, originY, textureWidth, textureHeight)); @@ -132,7 +132,7 @@ bool StitchSlot::add(TextureHolder *textureHolder) return false; } -void StitchSlot::collectAssignments(vector *result) +void StitchSlot::collectAssignments(std::vector *result) { if (textureHolder != NULL) { diff --git a/Minecraft.Client/Textures/Stitching/StitchSlot.h b/Minecraft.Client/Textures/Stitching/StitchSlot.h index 3cedce6b4..0814d5f44 100644 --- a/Minecraft.Client/Textures/Stitching/StitchSlot.h +++ b/Minecraft.Client/Textures/Stitching/StitchSlot.h @@ -11,7 +11,7 @@ private: const int width; const int height; - vector *subSlots; + std::vector *subSlots; TextureHolder *textureHolder; public: @@ -21,7 +21,7 @@ public: int getX(); int getY(); bool add(TextureHolder *textureHolder); - void collectAssignments(vector *result); + void collectAssignments(std::vector *result); //@Override std::wstring toString(); diff --git a/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp b/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp index 3fce9033a..8b10493a2 100644 --- a/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp +++ b/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp @@ -75,7 +75,7 @@ void StitchedTexture::initUVs(float U0, float V0, float U1, float V1) v1 = V1; } -void StitchedTexture::init(Texture *source, vector *frames, int x, int y, int width, int height, bool rotated) +void StitchedTexture::init(Texture *source, std::vector *frames, int x, int y, int width, int height, bool rotated) { this->source = source; this->frames = frames; diff --git a/Minecraft.Client/Textures/Stitching/StitchedTexture.h b/Minecraft.Client/Textures/Stitching/StitchedTexture.h index e1c72e401..a1bdaa8fa 100644 --- a/Minecraft.Client/Textures/Stitching/StitchedTexture.h +++ b/Minecraft.Client/Textures/Stitching/StitchedTexture.h @@ -11,10 +11,10 @@ private: protected: Texture *source; - vector *frames; + std::vector *frames; private: - typedef vector > intPairVector; + typedef std::vector > intPairVector; intPairVector *frameOverride; int flags; @@ -49,7 +49,7 @@ protected: public: void initUVs(float U0, float V0, float U1, float V1); - void init(Texture *source, vector *frames, int x, int y, int width, int height, bool rotated); + void init(Texture *source, std::vector *frames, int x, int y, int width, int height, bool rotated); void replaceWith(StitchedTexture *texture); int getX() const; int getY() const; diff --git a/Minecraft.Client/Textures/Stitching/Stitcher.cpp b/Minecraft.Client/Textures/Stitching/Stitcher.cpp index ede0953e8..6b76bc216 100644 --- a/Minecraft.Client/Textures/Stitching/Stitcher.cpp +++ b/Minecraft.Client/Textures/Stitching/Stitcher.cpp @@ -60,7 +60,7 @@ Texture *Stitcher::constructTexture(bool mipmap) stitchedTexture = TextureManager::getInstance()->createTexture(name, Texture::TM_DYNAMIC, storageX, storageY, Texture::TFMT_RGBA, mipmap); stitchedTexture->fill(stitchedTexture->getRect(), 0xffff0000); - vector *slots = gatherAreas(); + std::vector *slots = gatherAreas(); for (int index = 0; index < slots->size(); index++) { StitchSlot *slot = slots->at(index); @@ -96,9 +96,9 @@ void Stitcher::stitch() } } -vector *Stitcher::gatherAreas() +std::vector *Stitcher::gatherAreas() { - vector *result = new vector(); + std::vector *result = new std::vector(); //for (StitchSlot slot : storage) for(AUTO_VAR(it, storage.begin()); it != storage.end(); ++it) diff --git a/Minecraft.Client/Textures/Stitching/Stitcher.h b/Minecraft.Client/Textures/Stitching/Stitcher.h index 62803955a..806e0d300 100644 --- a/Minecraft.Client/Textures/Stitching/Stitcher.h +++ b/Minecraft.Client/Textures/Stitching/Stitcher.h @@ -17,7 +17,7 @@ public: private: set texturesToBeStitched; // = new HashSet(256); - vector storage; // = new ArrayList(256); + std::vector storage; // = new ArrayList(256); int storageX; int storageY; @@ -41,7 +41,7 @@ public: void addTexture(TextureHolder *textureHolder); Texture *constructTexture(bool mipmap = true); // 4J Added mipmap param void stitch(); - vector *gatherAreas(); + std::vector *gatherAreas(); private: // Based on: http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 diff --git a/Minecraft.Client/Textures/Stitching/TextureMap.cpp b/Minecraft.Client/Textures/Stitching/TextureMap.cpp index a36517f94..3ee9794ff 100644 --- a/Minecraft.Client/Textures/Stitching/TextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/TextureMap.cpp @@ -58,7 +58,7 @@ void TextureMap::stitch() } // Collection bucket for multiple frames per texture - std::unordered_map * > textures; // = new HashMap>(); + std::unordered_map * > textures; // = new HashMap>(); Stitcher *stitcher = TextureManager::getInstance()->createStitcher(name); @@ -74,9 +74,9 @@ void TextureMap::stitch() TextureHolder *missingHolder = new TextureHolder(missingTex); stitcher->addTexture(missingHolder); - vector *missingVec = new vector(); + std::vector *missingVec = new std::vector(); missingVec->push_back(missingTex); - textures.insert( std::unordered_map * >::value_type( missingHolder, missingVec )); + textures.insert( std::unordered_map * >::value_type( missingHolder, missingVec )); // Extract frames from textures and add them to the stitchers //for (final String name : texturesToRegister.keySet()) @@ -87,7 +87,7 @@ void TextureMap::stitch() std::wstring filename = path + name + extension; // TODO: [EB] Put the frames into a proper object, not this inside out hack - vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); + std::vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); if (frames == NULL || frames->empty()) { @@ -98,7 +98,7 @@ void TextureMap::stitch() stitcher->addTexture(holder); // Store frames - textures.insert( std::unordered_map * >::value_type( holder, frames ) ); + textures.insert( std::unordered_map * >::value_type( holder, frames ) ); } // Stitch! @@ -123,7 +123,7 @@ void TextureMap::stitch() Texture *texture = textureHolder->getTexture(); std::wstring textureName = texture->getName(); - vector *frames = textures.find(textureHolder)->second; + std::vector *frames = textures.find(textureHolder)->second; StitchedTexture *stored = NULL; diff --git a/Minecraft.Client/Textures/Stitching/TextureMap.h b/Minecraft.Client/Textures/Stitching/TextureMap.h index 73c35d1ff..03d1fc306 100644 --- a/Minecraft.Client/Textures/Stitching/TextureMap.h +++ b/Minecraft.Client/Textures/Stitching/TextureMap.h @@ -26,7 +26,7 @@ private: BufferedImage *missingTexture; // = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); StitchedTexture *missingPosition; Texture *stitchResult; - vector animatedTextures; // = new ArrayList(); + std::vector animatedTextures; // = new ArrayList(); stringStitchedTextureMap texturesToRegister; // = new HashMap(); diff --git a/Minecraft.Client/Textures/TextureManager.cpp b/Minecraft.Client/Textures/TextureManager.cpp index c8f2f3230..b2808e470 100644 --- a/Minecraft.Client/Textures/TextureManager.cpp +++ b/Minecraft.Client/Textures/TextureManager.cpp @@ -80,9 +80,9 @@ Stitcher *TextureManager::createStitcher(const std::wstring &name) return new Stitcher(name, maxTextureSize, maxTextureSize, true); } -vector *TextureManager::createTextures(const std::wstring &filename, bool mipmap) +std::vector *TextureManager::createTextures(const std::wstring &filename, bool mipmap) { - vector *result = new vector(); + std::vector *result = new std::vector(); TexturePack *texturePack = Minecraft::GetInstance()->skins->getSelected(); //try { int mode = Texture::TM_CONTAINER; // Most important -- so it doesn't get uploaded to videoram diff --git a/Minecraft.Client/Textures/TextureManager.h b/Minecraft.Client/Textures/TextureManager.h index c67ea151b..4fb859546 100644 --- a/Minecraft.Client/Textures/TextureManager.h +++ b/Minecraft.Client/Textures/TextureManager.h @@ -29,7 +29,7 @@ public: void registerTexture(Texture *texture); void unregisterTexture(const std::wstring &name, Texture *texture); Stitcher *createStitcher(const std::wstring &name); - vector *createTextures(const std::wstring &filename, bool mipmap); // 4J added mipmap param + std::vector *createTextures(const std::wstring &filename, bool mipmap); // 4J added mipmap param private: std::wstring getTextureNameFromPath(const std::wstring &filename); diff --git a/Minecraft.Client/UI/Font.cpp b/Minecraft.Client/UI/Font.cpp index 3b5e99d21..65c2bf2b6 100644 --- a/Minecraft.Client/UI/Font.cpp +++ b/Minecraft.Client/UI/Font.cpp @@ -362,7 +362,7 @@ void Font::drawWordWrap(const std::wstring &string, int x, int y, int w, int col void Font::drawWordWrapInternal(const std::wstring& string, int x, int y, int w, int col, bool darken, int h) { - vectorlines = stringSplit(string,L'\n'); + std::vectorlines = stringSplit(string,L'\n'); if (lines.size() > 1) { AUTO_VAR(itEnd, lines.end()); @@ -375,7 +375,7 @@ void Font::drawWordWrapInternal(const std::wstring& string, int x, int y, int w, } return; } - vector words = stringSplit(string,L' '); + std::vector words = stringSplit(string,L' '); unsigned int pos = 0; while (pos < words.size()) { @@ -413,7 +413,7 @@ void Font::drawWordWrapInternal(const std::wstring& string, int x, int y, int w, int Font::wordWrapHeight(const std::wstring& string, int w) { - vector lines = stringSplit(string,L'\n'); + std::vector lines = stringSplit(string,L'\n'); if (lines.size() > 1) { int h = 0; @@ -424,7 +424,7 @@ int Font::wordWrapHeight(const std::wstring& string, int w) } return h; } - vector words = stringSplit(string,L' '); + std::vector words = stringSplit(string,L' '); unsigned int pos = 0; int y = 0; while (pos < words.size()) diff --git a/Minecraft.Client/UI/Gui.h b/Minecraft.Client/UI/Gui.h index 3db5c4191..590947f0e 100644 --- a/Minecraft.Client/UI/Gui.h +++ b/Minecraft.Client/UI/Gui.h @@ -12,7 +12,7 @@ private: //static const int MAX_MESSAGE_WIDTH = 320; static const int m_iMaxMessageWidth = 280; static ItemRenderer *itemRenderer; - vector guiMessages[XUSER_MAX_COUNT]; + std::vector guiMessages[XUSER_MAX_COUNT]; Random *random; Minecraft *minecraft; diff --git a/Minecraft.Client/UI/Screen.h b/Minecraft.Client/UI/Screen.h index 324f4ca5c..554671f49 100644 --- a/Minecraft.Client/UI/Screen.h +++ b/Minecraft.Client/UI/Screen.h @@ -13,7 +13,7 @@ public: int width; int height; protected: - vector