From 7074f35e4ba831e358117842b99ee35b87f85ae5 Mon Sep 17 00:00:00 2001 From: void_17 Date: Mon, 2 Mar 2026 15:58:20 +0700 Subject: shared_ptr -> std::shared_ptr This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today. --- Minecraft.World/AbstractContainerMenu.cpp | 70 ++--- Minecraft.World/AbstractContainerMenu.h | 34 +-- Minecraft.World/Achievement.cpp | 10 +- Minecraft.World/Achievement.h | 6 +- Minecraft.World/AddEntityPacket.cpp | 12 +- Minecraft.World/AddEntityPacket.h | 8 +- Minecraft.World/AddExperienceOrbPacket.cpp | 2 +- Minecraft.World/AddExperienceOrbPacket.h | 4 +- Minecraft.World/AddGlobalEntityPacket.cpp | 6 +- Minecraft.World/AddGlobalEntityPacket.h | 4 +- Minecraft.World/AddIslandLayer.cpp | 2 +- Minecraft.World/AddIslandLayer.h | 2 +- Minecraft.World/AddMobPacket.cpp | 6 +- Minecraft.World/AddMobPacket.h | 10 +- Minecraft.World/AddMushroomIslandLayer.cpp | 2 +- Minecraft.World/AddMushroomIslandLayer.h | 2 +- Minecraft.World/AddPaintingPacket.cpp | 2 +- Minecraft.World/AddPaintingPacket.h | 4 +- Minecraft.World/AddPlayerPacket.cpp | 10 +- Minecraft.World/AddPlayerPacket.h | 10 +- Minecraft.World/AddSnowLayer.cpp | 2 +- Minecraft.World/AddSnowLayer.h | 2 +- Minecraft.World/AdminLogCommand.h | 2 +- Minecraft.World/AgableMob.cpp | 6 +- Minecraft.World/AgableMob.h | 4 +- Minecraft.World/Animal.cpp | 56 ++-- Minecraft.World/Animal.h | 18 +- Minecraft.World/AnimatePacket.cpp | 10 +- Minecraft.World/AnimatePacket.h | 8 +- Minecraft.World/AnvilTile.cpp | 8 +- Minecraft.World/AnvilTile.h | 8 +- Minecraft.World/ArmorDyeRecipe.cpp | 20 +- Minecraft.World/ArmorDyeRecipe.h | 10 +- Minecraft.World/ArmorItem.cpp | 12 +- Minecraft.World/ArmorItem.h | 12 +- Minecraft.World/ArmorSlot.cpp | 14 +- Minecraft.World/ArmorSlot.h | 8 +- Minecraft.World/ArrayWithLength.h | 4 +- Minecraft.World/Arrow.cpp | 36 +-- Minecraft.World/Arrow.h | 8 +- Minecraft.World/ArrowAttackGoal.cpp | 10 +- Minecraft.World/AvoidPlayerGoal.cpp | 4 +- Minecraft.World/AwardStatPacket.h | 2 +- Minecraft.World/BedItem.cpp | 2 +- Minecraft.World/BedItem.h | 2 +- Minecraft.World/BedTile.cpp | 14 +- Minecraft.World/BedTile.h | 8 +- Minecraft.World/BegGoal.cpp | 4 +- Minecraft.World/BegGoal.h | 2 +- Minecraft.World/BiomeInitLayer.cpp | 2 +- Minecraft.World/BiomeInitLayer.h | 2 +- Minecraft.World/BiomeSource.h | 4 +- Minecraft.World/Blaze.cpp | 4 +- Minecraft.World/Blaze.h | 2 +- Minecraft.World/BlockRegionUpdatePacket.h | 2 +- Minecraft.World/Boat.cpp | 14 +- Minecraft.World/Boat.h | 4 +- Minecraft.World/BoatItem.cpp | 12 +- Minecraft.World/BoatItem.h | 4 +- Minecraft.World/BonusChestFeature.cpp | 2 +- Minecraft.World/BookItem.cpp | 2 +- Minecraft.World/BookItem.h | 2 +- Minecraft.World/BossMob.cpp | 4 +- Minecraft.World/BossMob.h | 2 +- Minecraft.World/BossMobPart.cpp | 2 +- Minecraft.World/BossMobPart.h | 2 +- Minecraft.World/BottleItem.cpp | 10 +- Minecraft.World/BottleItem.h | 4 +- Minecraft.World/BowItem.cpp | 12 +- Minecraft.World/BowItem.h | 10 +- Minecraft.World/BowlFoodItem.cpp | 4 +- Minecraft.World/BowlFoodItem.h | 2 +- Minecraft.World/BreedGoal.cpp | 12 +- Minecraft.World/BreedGoal.h | 2 +- Minecraft.World/BrewingStandMenu.cpp | 32 +- Minecraft.World/BrewingStandMenu.h | 26 +- Minecraft.World/BrewingStandTile.cpp | 18 +- Minecraft.World/BrewingStandTile.h | 6 +- Minecraft.World/BrewingStandTileEntity.cpp | 44 +-- Minecraft.World/BrewingStandTileEntity.h | 16 +- Minecraft.World/BucketItem.cpp | 54 ++-- Minecraft.World/BucketItem.h | 4 +- Minecraft.World/ButtonTile.cpp | 10 +- Minecraft.World/ButtonTile.h | 10 +- Minecraft.World/CactusTile.cpp | 4 +- Minecraft.World/CactusTile.h | 4 +- Minecraft.World/CakeTile.cpp | 8 +- Minecraft.World/CakeTile.h | 8 +- Minecraft.World/CarrotOnAStickItem.cpp | 6 +- Minecraft.World/CarrotOnAStickItem.h | 2 +- Minecraft.World/CauldronTile.cpp | 12 +- Minecraft.World/CauldronTile.h | 4 +- Minecraft.World/CaveSpider.cpp | 2 +- Minecraft.World/CaveSpider.h | 2 +- Minecraft.World/ChatPacket.h | 2 +- Minecraft.World/ChestTile.cpp | 40 +-- Minecraft.World/ChestTile.h | 8 +- Minecraft.World/ChestTileEntity.cpp | 36 +-- Minecraft.World/ChestTileEntity.h | 12 +- Minecraft.World/Chicken.cpp | 22 +- Minecraft.World/Chicken.h | 8 +- Minecraft.World/ChunkPos.cpp | 2 +- Minecraft.World/ChunkPos.h | 2 +- Minecraft.World/ChunkTilesUpdatePacket.h | 2 +- Minecraft.World/ChunkVisibilityAreaPacket.h | 2 +- Minecraft.World/ChunkVisibilityPacket.h | 2 +- Minecraft.World/ClientCommandPacket.h | 2 +- Minecraft.World/ClientSideMerchant.cpp | 12 +- Minecraft.World/ClientSideMerchant.h | 12 +- Minecraft.World/ClothTileItem.cpp | 14 +- Minecraft.World/ClothTileItem.h | 8 +- Minecraft.World/CoalItem.cpp | 4 +- Minecraft.World/CoalItem.h | 2 +- Minecraft.World/CocoaTile.cpp | 10 +- Minecraft.World/CocoaTile.h | 6 +- Minecraft.World/ColoredTileItem.cpp | 4 +- Minecraft.World/ColoredTileItem.h | 4 +- Minecraft.World/Command.cpp | 10 +- Minecraft.World/Command.h | 10 +- Minecraft.World/CommandDispatcher.cpp | 2 +- Minecraft.World/CommandDispatcher.h | 2 +- Minecraft.World/ComplexItem.cpp | 2 +- Minecraft.World/ComplexItem.h | 2 +- Minecraft.World/ComplexItemDataPacket.h | 2 +- Minecraft.World/CompoundContainer.cpp | 12 +- Minecraft.World/CompoundContainer.h | 14 +- Minecraft.World/Connection.cpp | 40 +-- Minecraft.World/Connection.h | 12 +- Minecraft.World/Container.h | 10 +- Minecraft.World/ContainerAckPacket.h | 2 +- Minecraft.World/ContainerButtonClickPacket.h | 2 +- Minecraft.World/ContainerClickPacket.cpp | 4 +- Minecraft.World/ContainerClickPacket.h | 6 +- Minecraft.World/ContainerClosePacket.h | 2 +- Minecraft.World/ContainerMenu.cpp | 20 +- Minecraft.World/ContainerMenu.h | 12 +- Minecraft.World/ContainerOpenPacket.h | 2 +- Minecraft.World/ContainerSetContentPacket.cpp | 14 +- Minecraft.World/ContainerSetContentPacket.h | 4 +- Minecraft.World/ContainerSetDataPacket.h | 2 +- Minecraft.World/ContainerSetSlotPacket.cpp | 6 +- Minecraft.World/ContainerSetSlotPacket.h | 6 +- Minecraft.World/ControlledByPlayerGoal.cpp | 8 +- Minecraft.World/Cow.cpp | 32 +- Minecraft.World/Cow.h | 4 +- Minecraft.World/CraftItemPacket.h | 2 +- Minecraft.World/CraftingContainer.cpp | 18 +- Minecraft.World/CraftingContainer.h | 12 +- Minecraft.World/CraftingMenu.cpp | 20 +- Minecraft.World/CraftingMenu.h | 14 +- Minecraft.World/Creeper.cpp | 8 +- Minecraft.World/Creeper.h | 2 +- Minecraft.World/CropTile.cpp | 2 +- Minecraft.World/CustomPayloadPacket.h | 2 +- Minecraft.World/DamageEnchantment.cpp | 4 +- Minecraft.World/DamageEnchantment.h | 4 +- Minecraft.World/DamageSource.cpp | 26 +- Minecraft.World/DamageSource.h | 22 +- Minecraft.World/DeadBushTile.cpp | 4 +- Minecraft.World/DeadBushTile.h | 2 +- Minecraft.World/DebugOptionsPacket.h | 2 +- Minecraft.World/DefaultGameModeCommand.cpp | 2 +- Minecraft.World/DefaultGameModeCommand.h | 2 +- Minecraft.World/DefendVillageTargetGoal.cpp | 2 +- Minecraft.World/DelayedRelease.cpp | 4 +- Minecraft.World/DelayedRelease.h | 4 +- Minecraft.World/DerivedLevelData.cpp | 2 +- Minecraft.World/DerivedLevelData.h | 2 +- Minecraft.World/DetectorRailTile.cpp | 4 +- Minecraft.World/DetectorRailTile.h | 2 +- Minecraft.World/DigDurabilityEnchantment.cpp | 4 +- Minecraft.World/DigDurabilityEnchantment.h | 4 +- Minecraft.World/DiggerItem.cpp | 10 +- Minecraft.World/DiggerItem.h | 10 +- Minecraft.World/DiggingEnchantment.cpp | 2 +- Minecraft.World/DiggingEnchantment.h | 2 +- Minecraft.World/DiodeTile.cpp | 6 +- Minecraft.World/DiodeTile.h | 4 +- Minecraft.World/DirectoryLevelStorage.cpp | 8 +- Minecraft.World/DirectoryLevelStorage.h | 8 +- Minecraft.World/DirectoryLevelStorageSource.cpp | 22 +- Minecraft.World/DirectoryLevelStorageSource.h | 4 +- Minecraft.World/DisconnectPacket.cpp | 4 +- Minecraft.World/DisconnectPacket.h | 4 +- Minecraft.World/DispenserTile.cpp | 92 +++--- Minecraft.World/DispenserTile.h | 10 +- Minecraft.World/DispenserTileEntity.cpp | 44 +-- Minecraft.World/DispenserTileEntity.h | 16 +- Minecraft.World/DoorItem.cpp | 2 +- Minecraft.World/DoorItem.h | 4 +- Minecraft.World/DoorTile.cpp | 6 +- Minecraft.World/DoorTile.h | 6 +- Minecraft.World/DownfallLayer.cpp | 2 +- Minecraft.World/DownfallLayer.h | 2 +- Minecraft.World/DownfallMixerLayer.cpp | 2 +- Minecraft.World/DownfallMixerLayer.h | 4 +- Minecraft.World/DragonFireball.cpp | 8 +- Minecraft.World/DragonFireball.h | 2 +- Minecraft.World/DurangoStats.cpp | 106 +++---- Minecraft.World/DurangoStats.h | 40 +-- Minecraft.World/DyePowderItem.cpp | 68 ++--- Minecraft.World/DyePowderItem.h | 8 +- Minecraft.World/EggItem.cpp | 4 +- Minecraft.World/EggItem.h | 2 +- Minecraft.World/EggTile.cpp | 8 +- Minecraft.World/EggTile.h | 4 +- Minecraft.World/EmptyLevelChunk.cpp | 18 +- Minecraft.World/EmptyLevelChunk.h | 16 +- Minecraft.World/EnchantItemCommand.cpp | 10 +- Minecraft.World/EnchantItemCommand.h | 4 +- Minecraft.World/EnchantedBookItem.cpp | 24 +- Minecraft.World/EnchantedBookItem.h | 18 +- Minecraft.World/Enchantment.cpp | 6 +- Minecraft.World/Enchantment.h | 4 +- Minecraft.World/EnchantmentHelper.cpp | 54 ++-- Minecraft.World/EnchantmentHelper.h | 52 ++-- Minecraft.World/EnchantmentMenu.cpp | 30 +- Minecraft.World/EnchantmentMenu.h | 14 +- Minecraft.World/EnchantmentSlot.h | 6 +- Minecraft.World/EnchantmentTableEntity.cpp | 6 +- Minecraft.World/EnchantmentTableEntity.h | 2 +- Minecraft.World/EnchantmentTableTile.cpp | 6 +- Minecraft.World/EnchantmentTableTile.h | 6 +- Minecraft.World/EnderChestTile.cpp | 12 +- Minecraft.World/EnderChestTile.h | 6 +- Minecraft.World/EnderChestTileEntity.cpp | 10 +- Minecraft.World/EnderChestTileEntity.h | 4 +- Minecraft.World/EnderCrystal.cpp | 10 +- Minecraft.World/EnderDragon.cpp | 88 +++--- Minecraft.World/EnderDragon.h | 36 +-- Minecraft.World/EnderEyeItem.cpp | 16 +- Minecraft.World/EnderEyeItem.h | 6 +- Minecraft.World/EnderMan.cpp | 12 +- Minecraft.World/EnderMan.h | 6 +- Minecraft.World/EnderpearlItem.cpp | 8 +- Minecraft.World/EnderpearlItem.h | 4 +- Minecraft.World/Entity.cpp | 72 ++--- Minecraft.World/Entity.h | 46 +-- Minecraft.World/EntityActionAtPositionPacket.cpp | 4 +- Minecraft.World/EntityActionAtPositionPacket.h | 4 +- Minecraft.World/EntityDamageSource.cpp | 14 +- Minecraft.World/EntityDamageSource.h | 12 +- Minecraft.World/EntityEventPacket.h | 2 +- Minecraft.World/EntityIO.cpp | 32 +- Minecraft.World/EntityIO.h | 12 +- Minecraft.World/EntityPos.cpp | 2 +- Minecraft.World/EntityPos.h | 2 +- Minecraft.World/EntityTile.cpp | 2 +- Minecraft.World/EntityTile.h | 2 +- Minecraft.World/ExperienceCommand.cpp | 6 +- Minecraft.World/ExperienceCommand.h | 4 +- Minecraft.World/ExperienceItem.cpp | 8 +- Minecraft.World/ExperienceItem.h | 6 +- Minecraft.World/ExperienceOrb.cpp | 4 +- Minecraft.World/ExperienceOrb.h | 4 +- Minecraft.World/ExplodePacket.h | 4 +- Minecraft.World/Explosion.cpp | 14 +- Minecraft.World/Explosion.h | 10 +- Minecraft.World/EyeOfEnderSignal.cpp | 2 +- Minecraft.World/FallingTile.cpp | 6 +- Minecraft.World/FarmTile.cpp | 4 +- Minecraft.World/FarmTile.h | 2 +- Minecraft.World/FenceGateTile.cpp | 6 +- Minecraft.World/FenceGateTile.h | 6 +- Minecraft.World/FenceTile.cpp | 2 +- Minecraft.World/FenceTile.h | 2 +- Minecraft.World/FireChargeItem.cpp | 10 +- Minecraft.World/FireChargeItem.h | 2 +- Minecraft.World/Fireball.cpp | 24 +- Minecraft.World/Fireball.h | 4 +- Minecraft.World/FishingHook.cpp | 28 +- Minecraft.World/FishingHook.h | 8 +- Minecraft.World/FishingRodItem.cpp | 18 +- Minecraft.World/FishingRodItem.h | 2 +- Minecraft.World/FlintAndSteelItem.cpp | 8 +- Minecraft.World/FlintAndSteelItem.h | 2 +- Minecraft.World/FlowerPotTile.cpp | 36 +-- Minecraft.World/FlowerPotTile.h | 6 +- Minecraft.World/FollowOwnerGoal.cpp | 2 +- Minecraft.World/FollowParentGoal.cpp | 6 +- Minecraft.World/FoodData.cpp | 2 +- Minecraft.World/FoodData.h | 2 +- Minecraft.World/FoodItem.cpp | 14 +- Minecraft.World/FoodItem.h | 12 +- Minecraft.World/FurnaceMenu.cpp | 20 +- Minecraft.World/FurnaceMenu.h | 10 +- Minecraft.World/FurnaceResultSlot.cpp | 16 +- Minecraft.World/FurnaceResultSlot.h | 16 +- Minecraft.World/FurnaceTile.cpp | 24 +- Minecraft.World/FurnaceTile.h | 6 +- Minecraft.World/FurnaceTileEntity.cpp | 28 +- Minecraft.World/FurnaceTileEntity.h | 16 +- Minecraft.World/FuzzyZoomLayer.cpp | 8 +- Minecraft.World/FuzzyZoomLayer.h | 4 +- Minecraft.World/GameCommandPacket.h | 2 +- Minecraft.World/GameEventPacket.h | 2 +- Minecraft.World/GameModeCommand.cpp | 6 +- Minecraft.World/GameModeCommand.h | 6 +- Minecraft.World/GenericStats.cpp | 158 +++++----- Minecraft.World/GenericStats.h | 16 +- Minecraft.World/GetInfoPacket.h | 2 +- Minecraft.World/Ghast.cpp | 24 +- Minecraft.World/Ghast.h | 4 +- Minecraft.World/GiveItemCommand.cpp | 12 +- Minecraft.World/GiveItemCommand.h | 4 +- Minecraft.World/GoldenAppleItem.cpp | 8 +- Minecraft.World/GoldenAppleItem.h | 8 +- Minecraft.World/GrowMushroomIslandLayer.cpp | 2 +- Minecraft.World/GrowMushroomIslandLayer.h | 2 +- Minecraft.World/HalfSlabTile.cpp | 52 ++-- Minecraft.World/HalfSlabTile.h | 6 +- Minecraft.World/HangingEntity.cpp | 78 ++--- Minecraft.World/HangingEntity.h | 4 +- Minecraft.World/HangingEntityItem.cpp | 26 +- Minecraft.World/HangingEntityItem.h | 8 +- Minecraft.World/HashExtension.h | 4 +- Minecraft.World/HatchetItem.cpp | 2 +- Minecraft.World/HatchetItem.h | 2 +- Minecraft.World/HeavyTile.cpp | 4 +- Minecraft.World/HeavyTile.h | 2 +- Minecraft.World/HellSandTile.cpp | 2 +- Minecraft.World/HellSandTile.h | 2 +- Minecraft.World/HitResult.cpp | 4 +- Minecraft.World/HitResult.h | 6 +- Minecraft.World/HoeItem.cpp | 6 +- Minecraft.World/HoeItem.h | 2 +- Minecraft.World/HouseFeature.cpp | 2 +- Minecraft.World/HurtByTargetGoal.cpp | 4 +- Minecraft.World/HurtByTargetGoal.h | 2 +- Minecraft.World/IceTile.cpp | 4 +- Minecraft.World/IceTile.h | 2 +- Minecraft.World/IndirectEntityDamageSource.cpp | 16 +- Minecraft.World/IndirectEntityDamageSource.h | 14 +- Minecraft.World/InteractPacket.h | 2 +- Minecraft.World/Inventory.cpp | 78 ++--- Minecraft.World/Inventory.h | 52 ++-- Minecraft.World/InventoryMenu.cpp | 46 +-- Minecraft.World/InventoryMenu.h | 20 +- Minecraft.World/Item.cpp | 74 ++--- Minecraft.World/Item.h | 82 +++--- Minecraft.World/ItemEntity.cpp | 36 +-- Minecraft.World/ItemEntity.h | 12 +- Minecraft.World/ItemFrame.cpp | 50 ++-- Minecraft.World/ItemFrame.h | 6 +- Minecraft.World/ItemInstance.cpp | 104 +++---- Minecraft.World/ItemInstance.h | 54 ++-- Minecraft.World/KeepAlivePacket.cpp | 6 +- Minecraft.World/KeepAlivePacket.h | 4 +- Minecraft.World/KickPlayerPacket.h | 2 +- Minecraft.World/KillCommand.cpp | 4 +- Minecraft.World/KillCommand.h | 2 +- Minecraft.World/LadderTile.cpp | 2 +- Minecraft.World/LadderTile.h | 2 +- Minecraft.World/LavaSlime.cpp | 4 +- Minecraft.World/LavaSlime.h | 2 +- Minecraft.World/Layer.cpp | 58 ++-- Minecraft.World/Layer.h | 2 +- Minecraft.World/LeafTile.cpp | 14 +- Minecraft.World/LeafTile.h | 8 +- Minecraft.World/LeafTileItem.cpp | 6 +- Minecraft.World/LeafTileItem.h | 6 +- Minecraft.World/Level.cpp | 198 ++++++------- Minecraft.World/Level.h | 120 ++++---- Minecraft.World/LevelChunk.cpp | 56 ++-- Minecraft.World/LevelChunk.h | 20 +- Minecraft.World/LevelData.cpp | 2 +- Minecraft.World/LevelData.h | 2 +- Minecraft.World/LevelEventPacket.h | 2 +- Minecraft.World/LevelListener.h | 10 +- Minecraft.World/LevelSoundPacket.h | 2 +- Minecraft.World/LevelSource.h | 2 +- Minecraft.World/LevelStorage.h | 4 +- Minecraft.World/LevelStorageProfilerDecorator.cpp | 2 +- Minecraft.World/LevelStorageProfilerDecorator.h | 2 +- Minecraft.World/LevelStorageSource.h | 6 +- Minecraft.World/LeverTile.cpp | 8 +- Minecraft.World/LeverTile.h | 6 +- Minecraft.World/LightningBolt.cpp | 6 +- Minecraft.World/LiquidTile.cpp | 4 +- Minecraft.World/LiquidTile.h | 2 +- Minecraft.World/LoginPacket.h | 2 +- Minecraft.World/LookControl.cpp | 6 +- Minecraft.World/LookControl.h | 2 +- Minecraft.World/MakeLoveGoal.cpp | 6 +- Minecraft.World/MapItem.cpp | 66 ++--- Minecraft.World/MapItem.h | 14 +- Minecraft.World/MapItemSavedData.cpp | 42 +-- Minecraft.World/MapItemSavedData.h | 18 +- Minecraft.World/McRegionLevelStorage.cpp | 16 +- Minecraft.World/McRegionLevelStorage.h | 2 +- Minecraft.World/McRegionLevelStorageSource.cpp | 32 +- Minecraft.World/McRegionLevelStorageSource.h | 6 +- Minecraft.World/MeleeAttackGoal.cpp | 4 +- Minecraft.World/MemoryLevelStorage.cpp | 12 +- Minecraft.World/MemoryLevelStorage.h | 8 +- Minecraft.World/MemoryLevelStorageSource.cpp | 10 +- Minecraft.World/MemoryLevelStorageSource.h | 4 +- Minecraft.World/MenuBackup.cpp | 2 +- Minecraft.World/MenuBackup.h | 4 +- Minecraft.World/Merchant.h | 8 +- Minecraft.World/MerchantContainer.cpp | 24 +- Minecraft.World/MerchantContainer.h | 16 +- Minecraft.World/MerchantMenu.cpp | 24 +- Minecraft.World/MerchantMenu.h | 18 +- Minecraft.World/MerchantRecipe.cpp | 20 +- Minecraft.World/MerchantRecipe.h | 22 +- Minecraft.World/MerchantRecipeList.cpp | 12 +- Minecraft.World/MerchantRecipeList.h | 4 +- Minecraft.World/MerchantResultSlot.cpp | 24 +- Minecraft.World/MerchantResultSlot.h | 20 +- Minecraft.World/MilkBucketItem.cpp | 10 +- Minecraft.World/MilkBucketItem.h | 8 +- Minecraft.World/MineShaftPieces.cpp | 14 +- Minecraft.World/Minecart.cpp | 64 ++-- Minecraft.World/Minecart.h | 16 +- Minecraft.World/MinecartItem.cpp | 8 +- Minecraft.World/MinecartItem.h | 4 +- Minecraft.World/Mob.cpp | 326 ++++++++++----------- Minecraft.World/Mob.h | 44 +-- Minecraft.World/MobEffect.cpp | 8 +- Minecraft.World/MobEffect.h | 6 +- Minecraft.World/MobEffectInstance.cpp | 6 +- Minecraft.World/MobEffectInstance.h | 4 +- Minecraft.World/MobSpawner.cpp | 38 +-- Minecraft.World/MobSpawner.h | 4 +- Minecraft.World/MobSpawnerTile.cpp | 4 +- Minecraft.World/MobSpawnerTile.h | 2 +- Minecraft.World/MobSpawnerTileEntity.cpp | 32 +- Minecraft.World/MobSpawnerTileEntity.h | 12 +- Minecraft.World/MockedLevelStorage.cpp | 6 +- Minecraft.World/MockedLevelStorage.h | 4 +- Minecraft.World/Monster.cpp | 24 +- Minecraft.World/Monster.h | 6 +- Minecraft.World/MonsterPlacerItem.cpp | 26 +- Minecraft.World/MonsterPlacerItem.h | 10 +- Minecraft.World/MonsterRoomFeature.cpp | 32 +- Minecraft.World/MonsterRoomFeature.h | 2 +- Minecraft.World/MoveEntityPacket.cpp | 26 +- Minecraft.World/MoveEntityPacket.h | 10 +- Minecraft.World/MoveEntityPacketSmall.cpp | 28 +- Minecraft.World/MoveEntityPacketSmall.h | 10 +- Minecraft.World/MoveIndoorsGoal.cpp | 8 +- Minecraft.World/MovePlayerPacket.cpp | 26 +- Minecraft.World/MovePlayerPacket.h | 10 +- Minecraft.World/MoveThroughVillageGoal.cpp | 20 +- Minecraft.World/MoveThroughVillageGoal.h | 4 +- Minecraft.World/MultiTextureTileItem.cpp | 10 +- Minecraft.World/MultiTextureTileItem.h | 4 +- Minecraft.World/MushroomCow.cpp | 20 +- Minecraft.World/MushroomCow.h | 4 +- Minecraft.World/MusicTile.cpp | 14 +- Minecraft.World/MusicTile.h | 6 +- Minecraft.World/MusicTileEntity.cpp | 10 +- Minecraft.World/MusicTileEntity.h | 2 +- Minecraft.World/NearestAttackableTargetGoal.cpp | 8 +- Minecraft.World/NearestAttackableTargetGoal.h | 2 +- Minecraft.World/NetherBridgePieces.cpp | 32 +- Minecraft.World/NetherStalkTile.cpp | 2 +- Minecraft.World/OcelotSitOnTileGoal.cpp | 2 +- Minecraft.World/OldChunkStorage.cpp | 16 +- Minecraft.World/OwnerHurtByTargetGoal.cpp | 2 +- Minecraft.World/OwnerHurtTargetGoal.cpp | 2 +- Minecraft.World/Ozelot.cpp | 16 +- Minecraft.World/Ozelot.h | 10 +- Minecraft.World/OzelotAttackGoal.cpp | 2 +- Minecraft.World/Packet.cpp | 22 +- Minecraft.World/Packet.h | 18 +- Minecraft.World/PacketListener.cpp | 302 +++++++++---------- Minecraft.World/PacketListener.h | 174 +++++------ Minecraft.World/Painting.cpp | 10 +- Minecraft.World/Painting.h | 4 +- Minecraft.World/Path.cpp | 16 +- Minecraft.World/Path.h | 6 +- Minecraft.World/PathNavigation.cpp | 4 +- Minecraft.World/PathNavigation.h | 4 +- Minecraft.World/PathfinderMob.cpp | 12 +- Minecraft.World/PathfinderMob.h | 10 +- Minecraft.World/PickaxeItem.cpp | 2 +- Minecraft.World/PickaxeItem.h | 4 +- Minecraft.World/Pig.cpp | 40 +-- Minecraft.World/Pig.h | 6 +- Minecraft.World/PigZombie.cpp | 30 +- Minecraft.World/PigZombie.h | 10 +- Minecraft.World/PistonBaseTile.cpp | 28 +- Minecraft.World/PistonBaseTile.h | 14 +- Minecraft.World/PistonExtensionTile.cpp | 4 +- Minecraft.World/PistonExtensionTile.h | 4 +- Minecraft.World/PistonMovingPiece.cpp | 22 +- Minecraft.World/PistonMovingPiece.h | 10 +- Minecraft.World/PistonPieceEntity.cpp | 8 +- Minecraft.World/PistonPieceEntity.h | 2 +- Minecraft.World/PlayGoal.cpp | 6 +- Minecraft.World/Player.cpp | 240 +++++++-------- Minecraft.World/Player.h | 96 +++--- Minecraft.World/PlayerAbilitiesPacket.cpp | 2 +- Minecraft.World/PlayerAbilitiesPacket.h | 4 +- Minecraft.World/PlayerActionPacket.h | 2 +- Minecraft.World/PlayerCommandPacket.cpp | 8 +- Minecraft.World/PlayerCommandPacket.h | 4 +- Minecraft.World/PlayerEnderChestContainer.cpp | 6 +- Minecraft.World/PlayerEnderChestContainer.h | 6 +- Minecraft.World/PlayerIO.h | 8 +- Minecraft.World/PlayerInfoPacket.cpp | 2 +- Minecraft.World/PlayerInfoPacket.h | 4 +- Minecraft.World/PlayerInputPacket.h | 2 +- Minecraft.World/PortalForcer.cpp | 12 +- Minecraft.World/PortalForcer.h | 6 +- Minecraft.World/PortalTile.cpp | 4 +- Minecraft.World/PortalTile.h | 4 +- Minecraft.World/PotatoTile.cpp | 2 +- Minecraft.World/PotionItem.cpp | 42 +-- Minecraft.World/PotionItem.h | 24 +- Minecraft.World/PreLoginPacket.h | 2 +- Minecraft.World/PressurePlateTile.cpp | 6 +- Minecraft.World/PressurePlateTile.h | 6 +- Minecraft.World/ProtectionEnchantment.cpp | 6 +- Minecraft.World/ProtectionEnchantment.h | 4 +- Minecraft.World/PumpkinTile.cpp | 6 +- Minecraft.World/PumpkinTile.h | 2 +- Minecraft.World/QuartzBlockTile.cpp | 4 +- Minecraft.World/QuartzBlockTile.h | 2 +- Minecraft.World/RailTile.cpp | 2 +- Minecraft.World/RailTile.h | 2 +- Minecraft.World/RandomPos.cpp | 8 +- Minecraft.World/RandomPos.h | 8 +- Minecraft.World/Recipes.cpp | 76 ++--- Minecraft.World/Recipes.h | 16 +- Minecraft.World/Recipy.h | 12 +- Minecraft.World/RecordPlayerTile.cpp | 14 +- Minecraft.World/RecordPlayerTile.h | 10 +- Minecraft.World/RecordingItem.cpp | 8 +- Minecraft.World/RecordingItem.h | 6 +- Minecraft.World/RedStoneItem.cpp | 4 +- Minecraft.World/RedStoneItem.h | 4 +- Minecraft.World/RedStoneOreTile.cpp | 10 +- Minecraft.World/RedStoneOreTile.h | 10 +- Minecraft.World/Region.cpp | 2 +- Minecraft.World/Region.h | 2 +- Minecraft.World/RegionHillsLayer.cpp | 2 +- Minecraft.World/RegionHillsLayer.h | 2 +- Minecraft.World/RemoveEntitiesPacket.h | 2 +- Minecraft.World/RemoveMobEffectPacket.h | 2 +- Minecraft.World/RepairMenu.cpp | 26 +- Minecraft.World/RepairMenu.h | 16 +- Minecraft.World/RepairResultSlot.cpp | 12 +- Minecraft.World/RepairResultSlot.h | 10 +- Minecraft.World/RespawnPacket.h | 2 +- Minecraft.World/RestrictOpenDoorGoal.cpp | 8 +- Minecraft.World/ResultContainer.cpp | 14 +- Minecraft.World/ResultContainer.h | 10 +- Minecraft.World/ResultSlot.cpp | 20 +- Minecraft.World/ResultSlot.h | 18 +- Minecraft.World/RiverInitLayer.cpp | 2 +- Minecraft.World/RiverInitLayer.h | 2 +- Minecraft.World/RiverLayer.cpp | 2 +- Minecraft.World/RiverLayer.h | 2 +- Minecraft.World/RiverMixerLayer.cpp | 2 +- Minecraft.World/RiverMixerLayer.h | 6 +- Minecraft.World/RotateHeadPacket.cpp | 4 +- Minecraft.World/RotateHeadPacket.h | 4 +- Minecraft.World/SaddleItem.cpp | 8 +- Minecraft.World/SaddleItem.h | 4 +- Minecraft.World/SaplingTileItem.cpp | 6 +- Minecraft.World/SaplingTileItem.h | 2 +- Minecraft.World/SavedDataStorage.cpp | 24 +- Minecraft.World/SavedDataStorage.h | 12 +- Minecraft.World/SeedFoodItem.cpp | 2 +- Minecraft.World/SeedFoodItem.h | 2 +- Minecraft.World/SeedItem.cpp | 4 +- Minecraft.World/SeedItem.h | 4 +- Minecraft.World/Sensing.cpp | 2 +- Minecraft.World/Sensing.h | 2 +- Minecraft.World/ServerSettingsChangedPacket.h | 2 +- Minecraft.World/SetCarriedItemPacket.cpp | 14 +- Minecraft.World/SetCarriedItemPacket.h | 4 +- Minecraft.World/SetCreativeModeSlotPacket.cpp | 4 +- Minecraft.World/SetCreativeModeSlotPacket.h | 6 +- Minecraft.World/SetEntityDataPacket.cpp | 10 +- Minecraft.World/SetEntityDataPacket.h | 8 +- Minecraft.World/SetEntityMotionPacket.cpp | 14 +- Minecraft.World/SetEntityMotionPacket.h | 6 +- Minecraft.World/SetEquippedItemPacket.cpp | 14 +- Minecraft.World/SetEquippedItemPacket.h | 12 +- Minecraft.World/SetExperiencePacket.cpp | 2 +- Minecraft.World/SetExperiencePacket.h | 4 +- Minecraft.World/SetHealthPacket.cpp | 8 +- Minecraft.World/SetHealthPacket.h | 4 +- Minecraft.World/SetRidingPacket.cpp | 8 +- Minecraft.World/SetRidingPacket.h | 6 +- Minecraft.World/SetSpawnPositionPacket.cpp | 10 +- Minecraft.World/SetSpawnPositionPacket.h | 4 +- Minecraft.World/SetTimePacket.cpp | 2 +- Minecraft.World/SetTimePacket.h | 4 +- Minecraft.World/ShapedRecipy.cpp | 60 ++-- Minecraft.World/ShapedRecipy.h | 8 +- Minecraft.World/ShapelessRecipy.cpp | 40 +-- Minecraft.World/ShapelessRecipy.h | 8 +- Minecraft.World/ShearsItem.cpp | 4 +- Minecraft.World/ShearsItem.h | 6 +- Minecraft.World/Sheep.cpp | 62 ++-- Minecraft.World/Sheep.h | 12 +- Minecraft.World/ShoreLayer.cpp | 2 +- Minecraft.World/ShoreLayer.h | 2 +- Minecraft.World/SignItem.cpp | 10 +- Minecraft.World/SignItem.h | 4 +- Minecraft.World/SignTile.cpp | 6 +- Minecraft.World/SignTile.h | 4 +- Minecraft.World/SignTileEntity.cpp | 24 +- Minecraft.World/SignTileEntity.h | 4 +- Minecraft.World/SignUpdatePacket.h | 2 +- Minecraft.World/Silverfish.cpp | 8 +- Minecraft.World/Silverfish.h | 4 +- Minecraft.World/SimpleContainer.cpp | 16 +- Minecraft.World/SimpleContainer.h | 10 +- Minecraft.World/SitGoal.cpp | 2 +- Minecraft.World/Skeleton.cpp | 22 +- Minecraft.World/Skeleton.h | 4 +- Minecraft.World/SkullItem.cpp | 12 +- Minecraft.World/SkullItem.h | 8 +- Minecraft.World/SkullTile.cpp | 24 +- Minecraft.World/SkullTile.h | 10 +- Minecraft.World/SkullTileEntity.cpp | 10 +- Minecraft.World/SkullTileEntity.h | 4 +- Minecraft.World/Slime.cpp | 22 +- Minecraft.World/Slime.h | 6 +- Minecraft.World/Slot.cpp | 38 +-- Minecraft.World/Slot.h | 28 +- Minecraft.World/SmallFireball.cpp | 2 +- Minecraft.World/SmallFireball.h | 2 +- Minecraft.World/SmoothLayer.cpp | 2 +- Minecraft.World/SmoothLayer.h | 2 +- Minecraft.World/SmoothStoneBrickTileItem.cpp | 2 +- Minecraft.World/SmoothStoneBrickTileItem.h | 2 +- Minecraft.World/SmoothZoomLayer.cpp | 8 +- Minecraft.World/SmoothZoomLayer.h | 4 +- Minecraft.World/Snowball.cpp | 2 +- Minecraft.World/Snowball.h | 2 +- Minecraft.World/SnowballItem.cpp | 6 +- Minecraft.World/SnowballItem.h | 2 +- Minecraft.World/Spider.cpp | 16 +- Minecraft.World/Spider.h | 6 +- Minecraft.World/SpikeFeature.cpp | 16 +- Minecraft.World/Squid.cpp | 42 +-- Minecraft.World/StairTile.cpp | 16 +- Minecraft.World/StairTile.h | 16 +- Minecraft.World/Stat.h | 2 +- Minecraft.World/StemTile.cpp | 4 +- Minecraft.World/StemTile.h | 2 +- Minecraft.World/StoneMonsterTile.cpp | 6 +- Minecraft.World/StoneMonsterTile.h | 2 +- Minecraft.World/StoneMonsterTileItem.cpp | 2 +- Minecraft.World/StoneMonsterTileItem.h | 2 +- Minecraft.World/StoneSlabTile.cpp | 12 +- Minecraft.World/StoneSlabTile.h | 2 +- Minecraft.World/StoneSlabTileItem.cpp | 38 +-- Minecraft.World/StoneSlabTileItem.h | 8 +- Minecraft.World/StrongholdPieces.cpp | 48 +-- Minecraft.World/StructurePiece.cpp | 10 +- Minecraft.World/SwampRiversLayer.cpp | 2 +- Minecraft.World/SwampRiversLayer.h | 2 +- Minecraft.World/SwellGoal.cpp | 2 +- Minecraft.World/SynchedEntityData.cpp | 94 +++--- Minecraft.World/SynchedEntityData.h | 28 +- Minecraft.World/TakeFlowerGoal.cpp | 4 +- Minecraft.World/TakeItemEntityPacket.h | 2 +- Minecraft.World/TallGrass.cpp | 6 +- Minecraft.World/TallGrass.h | 2 +- Minecraft.World/TamableAnimal.cpp | 2 +- Minecraft.World/TamableAnimal.h | 2 +- Minecraft.World/TargetGoal.cpp | 10 +- Minecraft.World/TargetGoal.h | 4 +- Minecraft.World/TeleportEntityPacket.cpp | 12 +- Minecraft.World/TeleportEntityPacket.h | 6 +- Minecraft.World/TemperatureLayer.cpp | 2 +- Minecraft.World/TemperatureLayer.h | 2 +- Minecraft.World/TemperatureMixerLayer.cpp | 2 +- Minecraft.World/TemperatureMixerLayer.h | 4 +- Minecraft.World/TemptGoal.cpp | 2 +- Minecraft.World/TextureAndGeometryChangePacket.cpp | 10 +- Minecraft.World/TextureAndGeometryChangePacket.h | 4 +- Minecraft.World/TextureAndGeometryPacket.h | 8 +- Minecraft.World/TextureChangePacket.cpp | 10 +- Minecraft.World/TextureChangePacket.h | 4 +- Minecraft.World/TexturePacket.h | 4 +- Minecraft.World/TheEndBiomeDecorator.cpp | 4 +- Minecraft.World/TheEndPortal.cpp | 10 +- Minecraft.World/TheEndPortal.h | 12 +- Minecraft.World/TheEndPortalFrameTile.cpp | 4 +- Minecraft.World/TheEndPortalFrameTile.h | 4 +- Minecraft.World/TheEndPortalTileEntity.cpp | 4 +- Minecraft.World/TheEndPortalTileEntity.h | 2 +- Minecraft.World/ThinFenceTile.cpp | 8 +- Minecraft.World/ThinFenceTile.h | 8 +- Minecraft.World/ThornsEnchantment.cpp | 6 +- Minecraft.World/ThornsEnchantment.h | 4 +- Minecraft.World/Throwable.cpp | 8 +- Minecraft.World/Throwable.h | 4 +- Minecraft.World/ThrownEgg.cpp | 4 +- Minecraft.World/ThrownEgg.h | 2 +- Minecraft.World/ThrownEnderpearl.cpp | 4 +- Minecraft.World/ThrownEnderpearl.h | 2 +- Minecraft.World/ThrownExpBottle.cpp | 4 +- Minecraft.World/ThrownExpBottle.h | 2 +- Minecraft.World/ThrownPotion.cpp | 10 +- Minecraft.World/ThrownPotion.h | 2 +- Minecraft.World/Tile.cpp | 42 +-- Minecraft.World/Tile.h | 32 +- Minecraft.World/TileDestructionPacket.cpp | 6 +- Minecraft.World/TileDestructionPacket.h | 4 +- Minecraft.World/TileEntity.cpp | 10 +- Minecraft.World/TileEntity.h | 8 +- Minecraft.World/TileEntityDataPacket.h | 2 +- Minecraft.World/TileEventPacket.h | 2 +- Minecraft.World/TileItem.cpp | 34 +-- Minecraft.World/TileItem.h | 14 +- Minecraft.World/TilePlanterItem.cpp | 12 +- Minecraft.World/TilePlanterItem.h | 2 +- Minecraft.World/TileUpdatePacket.h | 2 +- Minecraft.World/TimeCommand.cpp | 10 +- Minecraft.World/TimeCommand.h | 8 +- Minecraft.World/TntTile.cpp | 16 +- Minecraft.World/TntTile.h | 6 +- Minecraft.World/ToggleDownfallCommand.cpp | 6 +- Minecraft.World/ToggleDownfallCommand.h | 4 +- Minecraft.World/TopSnowTile.cpp | 6 +- Minecraft.World/TopSnowTile.h | 6 +- Minecraft.World/TorchTile.cpp | 4 +- Minecraft.World/TorchTile.h | 4 +- Minecraft.World/TradeItemPacket.h | 2 +- Minecraft.World/TradeWithPlayerGoal.cpp | 2 +- Minecraft.World/TrapDoorTile.cpp | 6 +- Minecraft.World/TrapDoorTile.h | 6 +- Minecraft.World/TrapMenu.cpp | 10 +- Minecraft.World/TrapMenu.h | 8 +- Minecraft.World/TreeTile.cpp | 8 +- Minecraft.World/TreeTile.h | 6 +- Minecraft.World/TreeTileItem.cpp | 4 +- Minecraft.World/TreeTileItem.h | 4 +- Minecraft.World/TripWireSourceTile.cpp | 8 +- Minecraft.World/TripWireSourceTile.h | 2 +- Minecraft.World/TripWireTile.cpp | 12 +- Minecraft.World/TripWireTile.h | 6 +- Minecraft.World/UntouchingEnchantment.cpp | 2 +- Minecraft.World/UntouchingEnchantment.h | 2 +- Minecraft.World/UpdateGameRuleProgressPacket.h | 2 +- Minecraft.World/UpdateMobEffectPacket.cpp | 4 +- Minecraft.World/UpdateMobEffectPacket.h | 4 +- Minecraft.World/UpdateProgressPacket.h | 2 +- Minecraft.World/UseItemPacket.cpp | 14 +- Minecraft.World/UseItemPacket.h | 8 +- Minecraft.World/Village.cpp | 46 +-- Minecraft.World/Village.h | 22 +- Minecraft.World/VillagePieces.cpp | 16 +- Minecraft.World/VillageSiege.cpp | 18 +- Minecraft.World/Villager.cpp | 62 ++-- Minecraft.World/Villager.h | 16 +- Minecraft.World/VillagerGolem.cpp | 6 +- Minecraft.World/VillagerGolem.h | 4 +- Minecraft.World/Villages.cpp | 38 +-- Minecraft.World/Villages.h | 10 +- Minecraft.World/VineTile.cpp | 6 +- Minecraft.World/VineTile.h | 4 +- Minecraft.World/VoronoiZoom.cpp | 2 +- Minecraft.World/VoronoiZoom.h | 2 +- Minecraft.World/WallTile.cpp | 4 +- Minecraft.World/WallTile.h | 2 +- Minecraft.World/WaterAnimal.cpp | 2 +- Minecraft.World/WaterAnimal.h | 2 +- Minecraft.World/WaterLevelChunk.cpp | 18 +- Minecraft.World/WaterLevelChunk.h | 16 +- Minecraft.World/WaterLilyTile.cpp | 2 +- Minecraft.World/WaterLilyTile.h | 2 +- Minecraft.World/WaterLilyTileItem.cpp | 4 +- Minecraft.World/WaterLilyTileItem.h | 4 +- Minecraft.World/WeaponItem.cpp | 18 +- Minecraft.World/WeaponItem.h | 16 +- Minecraft.World/WebTile.cpp | 2 +- Minecraft.World/WebTile.h | 2 +- Minecraft.World/WeighedTreasure.cpp | 16 +- Minecraft.World/WeighedTreasure.h | 8 +- Minecraft.World/Wolf.cpp | 148 +++++----- Minecraft.World/Wolf.h | 12 +- Minecraft.World/WoodSlabTile.cpp | 4 +- Minecraft.World/WoodSlabTile.h | 8 +- Minecraft.World/WoolCarpetTile.cpp | 2 +- Minecraft.World/WoolCarpetTile.h | 2 +- Minecraft.World/WorkbenchTile.cpp | 2 +- Minecraft.World/WorkbenchTile.h | 2 +- Minecraft.World/XZPacket.h | 2 +- Minecraft.World/Zombie.cpp | 14 +- Minecraft.World/Zombie.h | 6 +- Minecraft.World/ZonedChunkStorage.cpp | 12 +- Minecraft.World/ZoomLayer.cpp | 8 +- Minecraft.World/ZoomLayer.h | 4 +- .../net.minecraft.world.ContainerListener.h | 4 +- ...t.minecraft.world.inventory.ContainerListener.h | 6 +- 796 files changed, 5151 insertions(+), 5151 deletions(-) (limited to 'Minecraft.World') diff --git a/Minecraft.World/AbstractContainerMenu.cpp b/Minecraft.World/AbstractContainerMenu.cpp index 71d30feb..dcef1d46 100644 --- a/Minecraft.World/AbstractContainerMenu.cpp +++ b/Minecraft.World/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,14 +401,14 @@ 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); } void AbstractContainerMenu::setAll(ItemInstanceArray *items) { - for (unsigned int i = 0; i < items->length; i++) + for (unsigned int i = 0; i < items->length; i++) { getSlot(i)->set( (*items)[i] ); } @@ -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/AbstractContainerMenu.h b/Minecraft.World/AbstractContainerMenu.h index f34e1afc..0875d65c 100644 --- a/Minecraft.World/AbstractContainerMenu.h +++ b/Minecraft.World/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/Achievement.cpp b/Minecraft.World/Achievement.cpp index a0dfd533..23f54c12 100644 --- a/Minecraft.World/Achievement.cpp +++ b/Minecraft.World/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) { } @@ -36,7 +36,7 @@ Achievement *Achievement::setAwardLocallyOnly() return this; } -Achievement *Achievement::setGolden() +Achievement *Achievement::setGolden() { isGoldenVar = true; return this; @@ -51,14 +51,14 @@ Achievement *Achievement::postConstruct() return this; } -bool Achievement::isAchievement() +bool Achievement::isAchievement() { return true; } -wstring Achievement::getDescription() +wstring Achievement::getDescription() { - if (descFormatter != NULL) + if (descFormatter != NULL) { return descFormatter->format(desc); } diff --git a/Minecraft.World/Achievement.h b/Minecraft.World/Achievement.h index b39c44b3..71487392 100644 --- a/Minecraft.World/Achievement.h +++ b/Minecraft.World/Achievement.h @@ -11,12 +11,12 @@ public: const int x, y; Achievement *requires; -private: +private: const wstring desc; 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/AddEntityPacket.cpp b/Minecraft.World/AddEntityPacket.cpp index 6231537d..9263bfda 100644 --- a/Minecraft.World/AddEntityPacket.cpp +++ b/Minecraft.World/AddEntityPacket.cpp @@ -8,7 +8,7 @@ -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 @@ -38,16 +38,16 @@ void AddEntityPacket::_init(shared_ptr e, int type, int data, int xp, in } } -AddEntityPacket::AddEntityPacket() +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); } @@ -100,12 +100,12 @@ void AddEntityPacket::write(DataOutputStream *dos) // throws IOException TODO 4J } } -void AddEntityPacket::handle(PacketListener *listener) +void AddEntityPacket::handle(PacketListener *listener) { listener->handleAddEntity(shared_from_this()); } -int AddEntityPacket::getEstimatedSize() +int AddEntityPacket::getEstimatedSize() { return 11 + data > -1 ? 6 : 0; } diff --git a/Minecraft.World/AddEntityPacket.h b/Minecraft.World/AddEntityPacket.h index 5ac7286c..57b813e9 100644 --- a/Minecraft.World/AddEntityPacket.h +++ b/Minecraft.World/AddEntityPacket.h @@ -40,12 +40,12 @@ public: byte 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/AddExperienceOrbPacket.cpp b/Minecraft.World/AddExperienceOrbPacket.cpp index a1a22844..1d7a1f22 100644 --- a/Minecraft.World/AddExperienceOrbPacket.cpp +++ b/Minecraft.World/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/AddExperienceOrbPacket.h b/Minecraft.World/AddExperienceOrbPacket.h index 59accfb3..33ae0642 100644 --- a/Minecraft.World/AddExperienceOrbPacket.h +++ b/Minecraft.World/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/AddGlobalEntityPacket.cpp b/Minecraft.World/AddGlobalEntityPacket.cpp index bfb27331..db476433 100644 --- a/Minecraft.World/AddGlobalEntityPacket.cpp +++ b/Minecraft.World/AddGlobalEntityPacket.cpp @@ -20,13 +20,13 @@ AddGlobalEntityPacket::AddGlobalEntityPacket() type = 0; } -AddGlobalEntityPacket::AddGlobalEntityPacket(shared_ptr e) +AddGlobalEntityPacket::AddGlobalEntityPacket(std::shared_ptr e) { id = e->entityId; x = Mth::floor(e->x * 32); y = Mth::floor(e->y * 32); z = Mth::floor(e->z * 32); - if (dynamic_pointer_cast(e) != NULL) + if (dynamic_pointer_cast(e) != NULL) { this->type = LIGHTNING; } @@ -45,7 +45,7 @@ void AddGlobalEntityPacket::read(DataInputStream *dis) // throws IOException z = dis->readInt(); } -void AddGlobalEntityPacket::write(DataOutputStream *dos) // throws IOException +void AddGlobalEntityPacket::write(DataOutputStream *dos) // throws IOException { dos->writeInt(id); dos->writeByte(type); diff --git a/Minecraft.World/AddGlobalEntityPacket.h b/Minecraft.World/AddGlobalEntityPacket.h index 80c10db2..9f0f518c 100644 --- a/Minecraft.World/AddGlobalEntityPacket.h +++ b/Minecraft.World/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/AddIslandLayer.cpp b/Minecraft.World/AddIslandLayer.cpp index a8842936..96f762cb 100644 --- a/Minecraft.World/AddIslandLayer.cpp +++ b/Minecraft.World/AddIslandLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.newbiome.layer.h" #include "net.minecraft.world.level.biome.h" -AddIslandLayer::AddIslandLayer(int64_t seedMixup, shared_ptrparent) : Layer(seedMixup) +AddIslandLayer::AddIslandLayer(int64_t seedMixup, std::shared_ptrparent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/AddIslandLayer.h b/Minecraft.World/AddIslandLayer.h index 2446bbf8..c7de422e 100644 --- a/Minecraft.World/AddIslandLayer.h +++ b/Minecraft.World/AddIslandLayer.h @@ -5,7 +5,7 @@ class AddIslandLayer : public Layer { public: - AddIslandLayer(int64_t seedMixup, shared_ptrparent); + AddIslandLayer(int64_t 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/AddMobPacket.cpp b/Minecraft.World/AddMobPacket.cpp index 7e744c04..b6fd61ea 100644 --- a/Minecraft.World/AddMobPacket.cpp +++ b/Minecraft.World/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; @@ -115,7 +115,7 @@ void AddMobPacket::handle(PacketListener *listener) listener->handleAddMob(shared_from_this()); } -int AddMobPacket::getEstimatedSize() +int AddMobPacket::getEstimatedSize() { int size = 11; if( entityData != NULL ) @@ -130,7 +130,7 @@ int AddMobPacket::getEstimatedSize() return size; } -vector > *AddMobPacket::getUnpackedData() +vector > *AddMobPacket::getUnpackedData() { if (unpack == NULL) { diff --git a/Minecraft.World/AddMobPacket.h b/Minecraft.World/AddMobPacket.h index 37de84c3..bdb91e4b 100644 --- a/Minecraft.World/AddMobPacket.h +++ b/Minecraft.World/AddMobPacket.h @@ -16,22 +16,22 @@ public: byte 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/AddMushroomIslandLayer.cpp b/Minecraft.World/AddMushroomIslandLayer.cpp index 324c88ee..2166e465 100644 --- a/Minecraft.World/AddMushroomIslandLayer.cpp +++ b/Minecraft.World/AddMushroomIslandLayer.cpp @@ -3,7 +3,7 @@ #include "net.minecraft.world.level.biome.h" -AddMushroomIslandLayer::AddMushroomIslandLayer(int64_t seedMixup, shared_ptr parent) : Layer(seedMixup) +AddMushroomIslandLayer::AddMushroomIslandLayer(int64_t seedMixup, std::shared_ptr parent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/AddMushroomIslandLayer.h b/Minecraft.World/AddMushroomIslandLayer.h index f691ebda..39c6feea 100644 --- a/Minecraft.World/AddMushroomIslandLayer.h +++ b/Minecraft.World/AddMushroomIslandLayer.h @@ -4,6 +4,6 @@ class AddMushroomIslandLayer : public Layer { public: - AddMushroomIslandLayer(int64_t seedMixup, shared_ptr parent); + AddMushroomIslandLayer(int64_t 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/AddPaintingPacket.cpp b/Minecraft.World/AddPaintingPacket.cpp index f574cbf2..83fc9d67 100644 --- a/Minecraft.World/AddPaintingPacket.cpp +++ b/Minecraft.World/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/AddPaintingPacket.h b/Minecraft.World/AddPaintingPacket.h index a5694b74..0a002ddb 100644 --- a/Minecraft.World/AddPaintingPacket.h +++ b/Minecraft.World/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/AddPlayerPacket.cpp b/Minecraft.World/AddPlayerPacket.cpp index f3d8a32b..a9076fdb 100644 --- a/Minecraft.World/AddPlayerPacket.cpp +++ b/Minecraft.World/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; @@ -72,14 +72,14 @@ void AddPlayerPacket::read(DataInputStream *dis) //throws IOException y = dis->readInt(); z = dis->readInt(); yRot = dis->readByte(); - xRot = dis->readByte(); + xRot = dis->readByte(); yHeadRot = dis->readByte(); // 4J Added carriedItem = dis->readShort(); xuid = dis->readPlayerUID(); OnlineXuid = dis->readPlayerUID(); m_playerIndex = dis->readByte(); INT skinId = dis->readInt(); - m_skinId = *(DWORD *)&skinId; + m_skinId = *(DWORD *)&skinId; INT capeId = dis->readInt(); m_capeId = *(DWORD *)&capeId; INT privileges = dis->readInt(); @@ -132,7 +132,7 @@ int AddPlayerPacket::getEstimatedSize() return iSize; } -vector > *AddPlayerPacket::getUnpackedData() +vector > *AddPlayerPacket::getUnpackedData() { if (unpack == NULL) { diff --git a/Minecraft.World/AddPlayerPacket.h b/Minecraft.World/AddPlayerPacket.h index 30f6bcdd..5c55c863 100644 --- a/Minecraft.World/AddPlayerPacket.h +++ b/Minecraft.World/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/AddSnowLayer.cpp b/Minecraft.World/AddSnowLayer.cpp index aa459789..aaf41e43 100644 --- a/Minecraft.World/AddSnowLayer.cpp +++ b/Minecraft.World/AddSnowLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.newbiome.layer.h" #include "net.minecraft.world.level.biome.h" -AddSnowLayer::AddSnowLayer(int64_t seedMixup, shared_ptr parent) : Layer(seedMixup) +AddSnowLayer::AddSnowLayer(int64_t seedMixup, std::shared_ptr parent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/AddSnowLayer.h b/Minecraft.World/AddSnowLayer.h index 0b3702da..04009ad6 100644 --- a/Minecraft.World/AddSnowLayer.h +++ b/Minecraft.World/AddSnowLayer.h @@ -4,6 +4,6 @@ class AddSnowLayer : public Layer { public: - AddSnowLayer(int64_t seedMixup, shared_ptr parent); + AddSnowLayer(int64_t 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/AdminLogCommand.h b/Minecraft.World/AdminLogCommand.h index 26299c56..c9ab5800 100644 --- a/Minecraft.World/AdminLogCommand.h +++ b/Minecraft.World/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/AgableMob.cpp b/Minecraft.World/AgableMob.cpp index 39bcadbe..a433076e 100644 --- a/Minecraft.World/AgableMob.cpp +++ b/Minecraft.World/AgableMob.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/AgableMob.h b/Minecraft.World/AgableMob.h index 0020e876..f7f70ed6 100644 --- a/Minecraft.World/AgableMob.h +++ b/Minecraft.World/AgableMob.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/Animal.cpp b/Minecraft.World/Animal.cpp index 45fc304f..36cdbe37 100644 --- a/Minecraft.World/Animal.cpp +++ b/Minecraft.World/Animal.cpp @@ -18,7 +18,7 @@ Animal::Animal(Level *level) : AgableMob( level ) { // inLove = 0; // 4J removed - now synched data loveTime = 0; - loveCause = shared_ptr(); + loveCause = std::shared_ptr(); setDespawnProtected(); } @@ -62,7 +62,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) { @@ -75,7 +75,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())) { } @@ -87,7 +87,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) @@ -123,9 +123,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; @@ -154,7 +154,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(); @@ -170,7 +170,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() ) { @@ -179,7 +179,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; @@ -207,18 +207,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; @@ -231,13 +231,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; @@ -248,11 +248,11 @@ shared_ptr Animal::findAttackTarget() } else if (getAge() > 0) { - vector > *others = level->getEntitiesOfClass(typeid(*this), bb->grow(r, r, r)); - //for (int i = 0; i < others.size(); i++) + 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; @@ -283,19 +283,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) @@ -306,7 +306,7 @@ bool Animal::interact(shared_ptr player) player->inventory->setItem(player->inventory->selected, nullptr); } } - + // 4J-PB - If we can't produce another animal through breeding because of the spawn limits, display a message here if(!level->isClientSide) @@ -318,21 +318,21 @@ bool Animal::interact(shared_ptr player) { player->displayClientMessage(IDS_MAX_CHICKENS_BRED ); return false; - } + } break; case eTYPE_WOLF: if( !level->canCreateMore(eTYPE_WOLF, Level::eSpawnType_Breed) ) { player->displayClientMessage(IDS_MAX_WOLVES_BRED ); return false; - } + } break; case eTYPE_MUSHROOMCOW: if( !level->canCreateMore(eTYPE_MUSHROOMCOW, Level::eSpawnType_Breed) ) { player->displayClientMessage(IDS_MAX_MUSHROOMCOWS_BRED ); return false; - } + } break; default: if((GetType() & eTYPE_ANIMALS_SPAWN_LIMIT_CHECK) == eTYPE_ANIMALS_SPAWN_LIMIT_CHECK) @@ -380,13 +380,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(); } @@ -400,7 +400,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/Animal.h b/Minecraft.World/Animal.h index 8c0cda8e..987b360e 100644 --- a/Minecraft.World/Animal.h +++ b/Minecraft.World/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/AnimatePacket.cpp b/Minecraft.World/AnimatePacket.cpp index 2ca4ed49..4a2823fa 100644 --- a/Minecraft.World/AnimatePacket.cpp +++ b/Minecraft.World/AnimatePacket.cpp @@ -13,30 +13,30 @@ 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; } -void AnimatePacket::read(DataInputStream *dis) //throws IOException +void AnimatePacket::read(DataInputStream *dis) //throws IOException { id = dis->readInt(); action = dis->readByte(); } -void AnimatePacket::write(DataOutputStream *dos) //throws IOException +void AnimatePacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(id); dos->writeByte(action); } -void AnimatePacket::handle(PacketListener *listener) +void AnimatePacket::handle(PacketListener *listener) { listener->handleAnimate(shared_from_this()); } -int AnimatePacket::getEstimatedSize() +int AnimatePacket::getEstimatedSize() { return 5; } diff --git a/Minecraft.World/AnimatePacket.h b/Minecraft.World/AnimatePacket.h index 0287b9a6..78c8fae6 100644 --- a/Minecraft.World/AnimatePacket.h +++ b/Minecraft.World/AnimatePacket.h @@ -9,7 +9,7 @@ public: static const int SWING = 1; static const int HURT = 2; static const int WAKE_UP = 3; - static const int RESPAWN = 4; + static const int RESPAWN = 4; static const int EAT = 5; // 1.8.2 static const int CRITICAL_HIT = 6; static const int MAGIC_CRITICAL_HIT = 7; @@ -18,14 +18,14 @@ 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); virtual void handle(PacketListener *listener); 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/AnvilTile.cpp b/Minecraft.World/AnvilTile.cpp index e5fd736d..f0a6d2a7 100644 --- a/Minecraft.World/AnvilTile.cpp +++ b/Minecraft.World/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/AnvilTile.h b/Minecraft.World/AnvilTile.h index 1a4f0ed7..e625777d 100644 --- a/Minecraft.World/AnvilTile.h +++ b/Minecraft.World/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/ArmorDyeRecipe.cpp b/Minecraft.World/ArmorDyeRecipe.cpp index 3b74a8bb..8c5f52e0 100644 --- a/Minecraft.World/ArmorDyeRecipe.cpp +++ b/Minecraft.World/ArmorDyeRecipe.cpp @@ -5,14 +5,14 @@ #include "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); } @@ -181,8 +181,8 @@ void ArmorDyeRecipe::requires(INGREDIENTS_REQUIRED *pIngReq) { ItemInstance *expected = *ingredient; - if (expected!=NULL) - { + if (expected!=NULL) + { int iAuxVal = (*ingredient)->getAuxValue(); TempIngReq.uiGridA[iCount++]=expected->id | iAuxVal<<24; // 4J-PB - put the ingredients in boxes 1,2,4,5 so we can see them in a 2x2 crafting screen diff --git a/Minecraft.World/ArmorDyeRecipe.h b/Minecraft.World/ArmorDyeRecipe.h index b983ba7b..715b08e2 100644 --- a/Minecraft.World/ArmorDyeRecipe.h +++ b/Minecraft.World/ArmorDyeRecipe.h @@ -5,17 +5,17 @@ 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(); - - virtual const int getGroup(); + + virtual const int getGroup(); // 4J-PB virtual bool requires(int iRecipe); diff --git a/Minecraft.World/ArmorItem.cpp b/Minecraft.World/ArmorItem.cpp index 0b2c24e4..be7f6b9d 100644 --- a/Minecraft.World/ArmorItem.cpp +++ b/Minecraft.World/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/ArmorItem.h b/Minecraft.World/ArmorItem.h index c711e2f9..04b483e2 100644 --- a/Minecraft.World/ArmorItem.h +++ b/Minecraft.World/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/ArmorSlot.cpp b/Minecraft.World/ArmorSlot.cpp index 1efe0b71..c3006aaa 100644 --- a/Minecraft.World/ArmorSlot.cpp +++ b/Minecraft.World/ArmorSlot.cpp @@ -6,7 +6,7 @@ #include "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/ArmorSlot.h b/Minecraft.World/ArmorSlot.h index a9797be2..2bf02067 100644 --- a/Minecraft.World/ArmorSlot.h +++ b/Minecraft.World/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/ArrayWithLength.h b/Minecraft.World/ArrayWithLength.h index 4e9f9941..bee447f0 100644 --- a/Minecraft.World/ArrayWithLength.h +++ b/Minecraft.World/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 "ItemInstance.h" -typedef arrayWithLength > ItemInstanceArray; +typedef arrayWithLength > ItemInstanceArray; diff --git a/Minecraft.World/Arrow.cpp b/Minecraft.World/Arrow.cpp index 1b102c65..9edd2208 100644 --- a/Minecraft.World/Arrow.cpp +++ b/Minecraft.World/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(); @@ -88,8 +88,8 @@ Arrow::Arrow(Level *level, double x, double y, double z) : Entity( level ) this->setPos(x, y, z); 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(); @@ -171,12 +171,12 @@ void Arrow::lerpMotion(double xd, double yd, double zd) } } -void Arrow::tick() +void Arrow::tick() { Entity::tick(); - if (xRotO == 0 && yRotO == 0) + if (xRotO == 0 && yRotO == 0) { double sd = sqrt(xd * xd + zd * zd); yRotO = this->yRot = (float) (atan2(xd, zd) * 180 / PI); @@ -214,17 +214,17 @@ void Arrow::tick() life = 0; flightTime = 0; return; - } + } - else + else { life++; if (life == 20 * 60) remove(); return; } - } - - else + } + + else { flightTime++; } @@ -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++; @@ -333,7 +333,7 @@ void Arrow::tick() // 4J - sound change brought forward from 1.2.3 level->playSound(shared_from_this(), eSoundType_RANDOM_BOW_HIT, 1.0f, 1.2f / (random->nextFloat() * 0.2f + 0.9f)); remove(); - } + } else { xd *= -0.1f; @@ -343,7 +343,7 @@ void Arrow::tick() yRotO += 180; flightTime = 0; } - + delete damageSource; } else @@ -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/Arrow.h b/Minecraft.World/Arrow.h index b96aa210..9ac5a900 100644 --- a/Minecraft.World/Arrow.h +++ b/Minecraft.World/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/ArrowAttackGoal.cpp b/Minecraft.World/ArrowAttackGoal.cpp index 23a2d2ac..735b8389 100644 --- a/Minecraft.World/ArrowAttackGoal.cpp +++ b/Minecraft.World/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/AvoidPlayerGoal.cpp b/Minecraft.World/AvoidPlayerGoal.cpp index c94d5cb1..56202028 100644 --- a/Minecraft.World/AvoidPlayerGoal.cpp +++ b/Minecraft.World/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/AwardStatPacket.h b/Minecraft.World/AwardStatPacket.h index 6b79c023..aad8511d 100644 --- a/Minecraft.World/AwardStatPacket.h +++ b/Minecraft.World/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/BedItem.cpp b/Minecraft.World/BedItem.cpp index 1ff50c6c..d0417387 100644 --- a/Minecraft.World/BedItem.cpp +++ b/Minecraft.World/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/BedItem.h b/Minecraft.World/BedItem.h index ad0297bd..261423b3 100644 --- a/Minecraft.World/BedItem.h +++ b/Minecraft.World/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/BedTile.cpp b/Minecraft.World/BedTile.cpp index 7d32c6d3..47f2f86c 100644 --- a/Minecraft.World/BedTile.cpp +++ b/Minecraft.World/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; @@ -128,7 +128,7 @@ bool BedTile::use(Level *level, int x, int y, int z, shared_ptr player, else { player->displayClientMessage(IDS_TILE_BED_OCCUPIED ); - + return true; } } @@ -142,7 +142,7 @@ bool BedTile::use(Level *level, int x, int y, int z, shared_ptr player, if(level->AllPlayersAreSleeping()==false) { player->displayClientMessage(IDS_TILE_BED_PLAYERSLEEP); - } + } return true; } @@ -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/BedTile.h b/Minecraft.World/BedTile.h index 339080d3..a749f4b4 100644 --- a/Minecraft.World/BedTile.h +++ b/Minecraft.World/BedTile.h @@ -23,17 +23,17 @@ public: static int HEAD_DIRECTION_OFFSETS[4][2]; 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/BegGoal.cpp b/Minecraft.World/BegGoal.cpp index 97553928..39bb63da 100644 --- a/Minecraft.World/BegGoal.cpp +++ b/Minecraft.World/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/BegGoal.h b/Minecraft.World/BegGoal.h index 607937a7..b80a68a5 100644 --- a/Minecraft.World/BegGoal.h +++ b/Minecraft.World/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/BiomeInitLayer.cpp b/Minecraft.World/BiomeInitLayer.cpp index 6edd18de..99aafa7d 100644 --- a/Minecraft.World/BiomeInitLayer.cpp +++ b/Minecraft.World/BiomeInitLayer.cpp @@ -4,7 +4,7 @@ #include "net.minecraft.world.level.h" #include "BiomeInitLayer.h" -BiomeInitLayer::BiomeInitLayer(int64_t seed, shared_ptrparent, LevelType *levelType) : Layer(seed) +BiomeInitLayer::BiomeInitLayer(int64_t seed, std::shared_ptrparent, LevelType *levelType) : Layer(seed) { this->parent = parent; diff --git a/Minecraft.World/BiomeInitLayer.h b/Minecraft.World/BiomeInitLayer.h index 00bf3812..eaa1502f 100644 --- a/Minecraft.World/BiomeInitLayer.h +++ b/Minecraft.World/BiomeInitLayer.h @@ -10,7 +10,7 @@ private: BiomeArray startBiomes; public: - BiomeInitLayer(int64_t seed, shared_ptr parent, LevelType *levelType); + BiomeInitLayer(int64_t 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/BiomeSource.h b/Minecraft.World/BiomeSource.h index a1e8a50b..0d6cca5e 100644 --- a/Minecraft.World/BiomeSource.h +++ b/Minecraft.World/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/Blaze.cpp b/Minecraft.World/Blaze.cpp index 57726363..1218ec2c 100644 --- a/Minecraft.World/Blaze.cpp +++ b/Minecraft.World/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/Blaze.h b/Minecraft.World/Blaze.h index 4f60a4a4..640b9f39 100644 --- a/Minecraft.World/Blaze.h +++ b/Minecraft.World/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/BlockRegionUpdatePacket.h b/Minecraft.World/BlockRegionUpdatePacket.h index 54dfea4e..ac38a381 100644 --- a/Minecraft.World/BlockRegionUpdatePacket.h +++ b/Minecraft.World/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/Boat.cpp b/Minecraft.World/Boat.cpp index 39211e44..26f02203 100644 --- a/Minecraft.World/Boat.cpp +++ b/Minecraft.World/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,9 +98,9 @@ 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 && + if (dynamic_pointer_cast(attacker) != NULL && !dynamic_pointer_cast(attacker)->isAllowedToHurtEntity( shared_from_this() )) return false; } @@ -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/Boat.h b/Minecraft.World/Boat.h index 1039e8f9..dbfb3944 100644 --- a/Minecraft.World/Boat.h +++ b/Minecraft.World/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/BoatItem.cpp b/Minecraft.World/BoatItem.cpp index 3499bc02..af778350 100644 --- a/Minecraft.World/BoatItem.cpp +++ b/Minecraft.World/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(); @@ -105,12 +105,12 @@ shared_ptr BoatItem::use(shared_ptr itemInstance, Le int yt = hr->y; int zt = hr->z; - if (!level->isClientSide) + if (!level->isClientSide) { 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/BoatItem.h b/Minecraft.World/BoatItem.h index 81bc4e18..08a2ccf7 100644 --- a/Minecraft.World/BoatItem.h +++ b/Minecraft.World/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/BonusChestFeature.cpp b/Minecraft.World/BonusChestFeature.cpp index 2d7690ee..7fa6c489 100644 --- a/Minecraft.World/BonusChestFeature.cpp +++ b/Minecraft.World/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/BookItem.cpp b/Minecraft.World/BookItem.cpp index 8e4098bb..d1fea216 100644 --- a/Minecraft.World/BookItem.cpp +++ b/Minecraft.World/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/BookItem.h b/Minecraft.World/BookItem.h index f60fc417..8bb5d118 100644 --- a/Minecraft.World/BookItem.h +++ b/Minecraft.World/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/BossMob.cpp b/Minecraft.World/BossMob.cpp index 52b88230..a32a4325 100644 --- a/Minecraft.World/BossMob.cpp +++ b/Minecraft.World/BossMob.cpp @@ -6,7 +6,7 @@ BossMob::BossMob(Level *level) : Mob( level ) { - + maxHealth = 100; // 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 @@ -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/BossMob.h b/Minecraft.World/BossMob.h index 50a6d3ef..f4ef6a54 100644 --- a/Minecraft.World/BossMob.h +++ b/Minecraft.World/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/BossMobPart.cpp b/Minecraft.World/BossMobPart.cpp index 923972ad..2f10a891 100644 --- a/Minecraft.World/BossMobPart.cpp +++ b/Minecraft.World/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/BossMobPart.h b/Minecraft.World/BossMobPart.h index 55af809f..7b53126f 100644 --- a/Minecraft.World/BossMobPart.h +++ b/Minecraft.World/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/BottleItem.cpp b/Minecraft.World/BottleItem.cpp index 3aecafee..804384f7 100644 --- a/Minecraft.World/BottleItem.cpp +++ b/Minecraft.World/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/BottleItem.h b/Minecraft.World/BottleItem.h index a8f5bc09..400902e7 100644 --- a/Minecraft.World/BottleItem.h +++ b/Minecraft.World/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/BowItem.cpp b/Minecraft.World/BowItem.cpp index ed2376b0..f0e46c88 100644 --- a/Minecraft.World/BowItem.cpp +++ b/Minecraft.World/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/BowItem.h b/Minecraft.World/BowItem.h index b4eba111..76b795f9 100644 --- a/Minecraft.World/BowItem.h +++ b/Minecraft.World/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/BowlFoodItem.cpp b/Minecraft.World/BowlFoodItem.cpp index f8ab0605..48953b3c 100644 --- a/Minecraft.World/BowlFoodItem.cpp +++ b/Minecraft.World/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/BowlFoodItem.h b/Minecraft.World/BowlFoodItem.h index 77980bc2..1c488c7e 100644 --- a/Minecraft.World/BowlFoodItem.h +++ b/Minecraft.World/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/BreedGoal.cpp b/Minecraft.World/BreedGoal.cpp index 2145d371..f9427ccf 100644 --- a/Minecraft.World/BreedGoal.cpp +++ b/Minecraft.World/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/BreedGoal.h b/Minecraft.World/BreedGoal.h index d2b47e7d..0e07119d 100644 --- a/Minecraft.World/BreedGoal.h +++ b/Minecraft.World/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/BrewingStandMenu.cpp b/Minecraft.World/BrewingStandMenu.cpp index af1fac5c..196b9bf8 100644 --- a/Minecraft.World/BrewingStandMenu.cpp +++ b/Minecraft.World/BrewingStandMenu.cpp @@ -6,7 +6,7 @@ #include "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)) @@ -101,7 +101,7 @@ shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr pla else if (slotIndex >= INV_SLOT_START && slotIndex < INV_SLOT_END) { // 4J-PB - if the item is an ingredient, quickmove it into the ingredient slot - if( (Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherStalkSeeds_Id) ) && + if( (Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherStalkSeeds_Id) ) && (!IngredientSlot->hasItem() || (stack->id==IngredientSlot->getItem()->id) ) ) { if(!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT+1, false)) @@ -125,7 +125,7 @@ shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr pla else if (slotIndex >= USE_ROW_SLOT_START && slotIndex < USE_ROW_SLOT_END) { // 4J-PB - if the item is an ingredient, quickmove it into the ingredient slot - if((Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherStalkSeeds_Id)) && + if((Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherStalkSeeds_Id)) && (!IngredientSlot->hasItem() || (stack->id==IngredientSlot->getItem()->id) )) { if(!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT+1, false)) @@ -140,7 +140,7 @@ shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr pla { return nullptr; } - } + } else if (!moveItemStackTo(stack, INV_SLOT_START, INV_SLOT_END, false)) { return nullptr; @@ -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/BrewingStandMenu.h b/Minecraft.World/BrewingStandMenu.h index 1f8d705d..7a981acb 100644 --- a/Minecraft.World/BrewingStandMenu.h +++ b/Minecraft.World/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/BrewingStandTile.cpp b/Minecraft.World/BrewingStandTile.cpp index 5f09ba02..2a6fd2cd 100644 --- a/Minecraft.World/BrewingStandTile.cpp +++ b/Minecraft.World/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/BrewingStandTile.h b/Minecraft.World/BrewingStandTile.h index fc8ff462..1d842e98 100644 --- a/Minecraft.World/BrewingStandTile.h +++ b/Minecraft.World/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/BrewingStandTileEntity.cpp b/Minecraft.World/BrewingStandTileEntity.cpp index 20cb3737..98334f78 100644 --- a/Minecraft.World/BrewingStandTileEntity.cpp +++ b/Minecraft.World/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()) @@ -135,7 +135,7 @@ bool BrewingStandTileEntity::isBrewable() } else { - if (!Item::items[ingredient->id]->hasPotionBrewingFormula() && ingredient->id != Item::bucket_water_Id && ingredient->id != Item::netherStalkSeeds_Id) + if (!Item::items[ingredient->id]->hasPotionBrewingFormula() && ingredient->id != Item::bucket_water_Id && ingredient->id != Item::netherStalkSeeds_Id) { return false; } @@ -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) { @@ -278,7 +278,7 @@ int BrewingStandTileEntity::applyIngredient(int currentBrew, shared_ptrputByte(L"Slot", (byte) i); @@ -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 @@ -333,18 +333,18 @@ shared_ptr BrewingStandTileEntity::removeItem(unsigned int slot, i if (slot >= 0 && slot < items.length && items[slot] != NULL) { - if (items[slot]->count <= count) + 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 if(item->count <= 0) return nullptr; return item; - } - else + } + 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 @@ -354,19 +354,19 @@ 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/BrewingStandTileEntity.h b/Minecraft.World/BrewingStandTileEntity.h index 733e1073..91a2934c 100644 --- a/Minecraft.World/BrewingStandTileEntity.h +++ b/Minecraft.World/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/BucketItem.cpp b/Minecraft.World/BucketItem.cpp index d3570cd7..0aac9c83 100644 --- a/Minecraft.World/BucketItem.cpp +++ b/Minecraft.World/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; @@ -47,7 +47,7 @@ bool BucketItem::TestUse(Level *level, shared_ptr player) } if (content == 0) - { + { if (!player->mayBuild(xt, yt, zt)) return false; if (level->getMaterial(xt, yt, zt) == Material::water && level->getData(xt, yt, zt) == 0) { @@ -73,7 +73,7 @@ bool BucketItem::TestUse(Level *level, shared_ptr player) if (hr->f == 3) zt++; if (hr->f == 4) xt--; if (hr->f == 5) xt++; - + if (!player->mayBuild(xt, yt, zt)) return false; if (level->isEmptyTile(xt, yt, zt) || !level->getMaterial(xt, yt, zt)->isSolid()) @@ -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,19 +120,19 @@ 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; return itemInstance; } if (content == 0) - { + { if (!player->mayBuild(xt, yt, zt)) return itemInstance; if (level->getMaterial(xt, yt, zt) == Material::water && level->getData(xt, yt, zt) == 0) { @@ -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; } @@ -160,7 +160,7 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, { if( level->dimension->id == -1 ) player->awardStat( - GenericStats::netherLavaCollected(), + GenericStats::netherLavaCollected(), GenericStats::param_noArgs() ); @@ -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 { @@ -197,13 +197,13 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, if (hr->f == 3) zt++; if (hr->f == 4) xt--; if (hr->f == 5) xt++; - + if (!player->mayBuild(xt, yt, zt)) return 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; } @@ -234,22 +234,22 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, return itemInstance; } -bool BucketItem::emptyBucket(Level *level, double x, double y, double z, int xt, int yt, int zt) +bool BucketItem::emptyBucket(Level *level, double x, double y, double z, int xt, int yt, int zt) { if (content <= 0) return false; - if (level->isEmptyTile(xt, yt, zt) || !level->getMaterial(xt, yt, zt)->isSolid()) + if (level->isEmptyTile(xt, yt, zt) || !level->getMaterial(xt, yt, zt)->isSolid()) { - if (level->dimension->ultraWarm && content == Tile::water_Id) + if (level->dimension->ultraWarm && content == Tile::water_Id) { level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, eSoundType_RANDOM_FIZZ, 0.5f, 2.6f + (level->random->nextFloat() - level->random->nextFloat()) * 0.8f); - for (int i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { level->addParticle(eParticleType_largesmoke, xt + Math::random(), yt + Math::random(), zt + Math::random(), 0, 0, 0); } - } - else + } + else { level->setTileAndData(xt, yt, zt, content, 0); } diff --git a/Minecraft.World/BucketItem.h b/Minecraft.World/BucketItem.h index 500d19d8..f865ba21 100644 --- a/Minecraft.World/BucketItem.h +++ b/Minecraft.World/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/ButtonTile.cpp b/Minecraft.World/ButtonTile.cpp index 16055a7e..d6192650 100644 --- a/Minecraft.World/ButtonTile.cpp +++ b/Minecraft.World/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/ButtonTile.h b/Minecraft.World/ButtonTile.h index e06158e0..0721c05c 100644 --- a/Minecraft.World/ButtonTile.h +++ b/Minecraft.World/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); @@ -60,7 +60,7 @@ private: public: void registerIcons(IconRegister *iconRegister); - + // 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); }; \ No newline at end of file diff --git a/Minecraft.World/CactusTile.cpp b/Minecraft.World/CactusTile.cpp index b72570e1..69190b50 100644 --- a/Minecraft.World/CactusTile.cpp +++ b/Minecraft.World/CactusTile.cpp @@ -18,7 +18,7 @@ CactusTile::CactusTile(int id) : Tile(id, Material::cactus,isSolidRender()) void CactusTile::tick(Level *level, int x, int y, int z, Random *random) { if (level->isEmptyTile(x, y + 1, z)) - { + { int height = 1; while (level->getTile(x, y - height, z) == id) { @@ -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/CactusTile.h b/Minecraft.World/CactusTile.h index 3c5e9b49..4fe1e6e0 100644 --- a/Minecraft.World/CactusTile.h +++ b/Minecraft.World/CactusTile.h @@ -30,10 +30,10 @@ 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); - + // 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); }; \ No newline at end of file diff --git a/Minecraft.World/CakeTile.cpp b/Minecraft.World/CakeTile.cpp index 1254e10e..b857be3b 100644 --- a/Minecraft.World/CakeTile.cpp +++ b/Minecraft.World/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/CakeTile.h b/Minecraft.World/CakeTile.h index 7f03577d..d8f36b2b 100644 --- a/Minecraft.World/CakeTile.h +++ b/Minecraft.World/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/CarrotOnAStickItem.cpp b/Minecraft.World/CarrotOnAStickItem.cpp index 9845cc25..a0fbdcf6 100644 --- a/Minecraft.World/CarrotOnAStickItem.cpp +++ b/Minecraft.World/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/CarrotOnAStickItem.h b/Minecraft.World/CarrotOnAStickItem.h index 5e98f592..ef58c40f 100644 --- a/Minecraft.World/CarrotOnAStickItem.h +++ b/Minecraft.World/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/CauldronTile.cpp b/Minecraft.World/CauldronTile.cpp index 4d5640ca..1ff5d9b0 100644 --- a/Minecraft.World/CauldronTile.cpp +++ b/Minecraft.World/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/CauldronTile.h b/Minecraft.World/CauldronTile.h index 4ed3fc90..61c98de3 100644 --- a/Minecraft.World/CauldronTile.h +++ b/Minecraft.World/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/CaveSpider.cpp b/Minecraft.World/CaveSpider.cpp index 5f7c6028..4bf98956 100644 --- a/Minecraft.World/CaveSpider.cpp +++ b/Minecraft.World/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/CaveSpider.h b/Minecraft.World/CaveSpider.h index 26f07e5f..de9cf370 100644 --- a/Minecraft.World/CaveSpider.h +++ b/Minecraft.World/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/ChatPacket.h b/Minecraft.World/ChatPacket.h index c480dfd0..2481e903 100644 --- a/Minecraft.World/ChatPacket.h +++ b/Minecraft.World/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/ChestTile.cpp b/Minecraft.World/ChestTile.cpp index b7964e72..9c462713 100644 --- a/Minecraft.World/ChestTile.cpp +++ b/Minecraft.World/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,21 +263,21 @@ 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; - if (isCatSittingOnChest(level,x, y, z)) return true; + if (isCatSittingOnChest(level,x, y, z)) return true; if (level->getTile(x - 1, y, z) == id && (level->isSolidBlockingTile(x - 1, y + 1, z) || isCatSittingOnChest(level, x - 1, y, z))) return true; if (level->getTile(x + 1, y, z) == id && (level->isSolidBlockingTile(x + 1, y + 1, z) || isCatSittingOnChest(level, x + 1, y, z))) 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, 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); @@ -285,12 +285,12 @@ 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) +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,15 +300,15 @@ 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; } -void ChestTile::registerIcons(IconRegister *iconRegister) +void ChestTile::registerIcons(IconRegister *iconRegister) { // Register wood as the chest's icon, because it's used by the particles // when destroying the chest diff --git a/Minecraft.World/ChestTile.h b/Minecraft.World/ChestTile.h index ee2185cb..da55c503 100644 --- a/Minecraft.World/ChestTile.h +++ b/Minecraft.World/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/ChestTileEntity.cpp b/Minecraft.World/ChestTileEntity.cpp index 406b81b5..85a7d389 100644 --- a/Minecraft.World/ChestTileEntity.cpp +++ b/Minecraft.World/ChestTileEntity.cpp @@ -32,32 +32,32 @@ ChestTileEntity::~ChestTileEntity() delete items; } -unsigned int ChestTileEntity::getContainerSize() +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) + 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 if(item->count <= 0) return nullptr; return item; - } - else + } + 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(); @@ -118,7 +118,7 @@ void ChestTileEntity::save(CompoundTag *base) for (unsigned int i = 0; i < items->length; i++) { - if (items->data[i] != NULL) + if (items->data[i] != NULL) { CompoundTag *tag = new CompoundTag(); tag->putByte(L"Slot", (byte) i); @@ -135,14 +135,14 @@ 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; return true; } -void ChestTileEntity::setChanged() +void ChestTileEntity::setChanged() { TileEntity::setChanged(); } @@ -208,7 +208,7 @@ void ChestTileEntity::tick() if (s.lock() != NULL) zc += 0.5; if (e.lock() != NULL) xc += 0.5; - // 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit + // 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_OPEN, 0.2f, level->random->nextFloat() * 0.1f + 0.9f); } } @@ -233,7 +233,7 @@ void ChestTileEntity::tick() if (s.lock() != NULL) zc += 0.5; if (e.lock() != NULL) xc += 0.5; - // 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit + // 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_CLOSE, 0.2f, level->random->nextFloat() * 0.1f + 0.9f); } } @@ -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/ChestTileEntity.h b/Minecraft.World/ChestTileEntity.h index 5eeb3c44..37dde555 100644 --- a/Minecraft.World/ChestTileEntity.h +++ b/Minecraft.World/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/Chicken.cpp b/Minecraft.World/Chicken.cpp index 0104b2bf..a1193d4a 100644 --- a/Minecraft.World/Chicken.cpp +++ b/Minecraft.World/Chicken.cpp @@ -68,7 +68,7 @@ void Chicken::aiStep() if (!onGround && flapping < 1) flapping = 1; flapping *= 0.9; - if (!onGround && yd < 0) + if (!onGround && yd < 0) { yd *= 0.6; } @@ -77,7 +77,7 @@ void Chicken::aiStep() if (!isBaby()) { - if (!level->isClientSide && --eggTime <= 0) + if (!level->isClientSide && --eggTime <= 0) { level->playSound(shared_from_this(), eSoundType_MOB_CHICKENPLOP, 1.0f, (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f); spawnAtLocation(Item::egg->id, 1); @@ -87,27 +87,27 @@ void Chicken::aiStep() } -void Chicken::causeFallDamage(float distance) +void Chicken::causeFallDamage(float distance) { } -int Chicken::getAmbientSound() +int Chicken::getAmbientSound() { return eSoundType_MOB_CHICKEN_AMBIENT; } -int Chicken::getHurtSound() +int Chicken::getHurtSound() { return eSoundType_MOB_CHICKEN_HURT; } -int Chicken::getDeathSound() +int Chicken::getDeathSound() { return eSoundType_MOB_CHICKEN_HURT; } -int Chicken::getDeathLoot() +int Chicken::getDeathLoot() { return Item::feather->id; } @@ -121,7 +121,7 @@ void Chicken::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) spawnAtLocation(Item::feather_Id, 1); } // and some meat - if (this->isOnFire()) + if (this->isOnFire()) { spawnAtLocation(Item::chicken_cooked_Id, 1); } @@ -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/Chicken.h b/Minecraft.World/Chicken.h index a162a5eb..2814a29c 100644 --- a/Minecraft.World/Chicken.h +++ b/Minecraft.World/Chicken.h @@ -18,14 +18,14 @@ public: float flapping; int eggTime; -private: +private: void _init(); public: Chicken(Level *level); virtual bool useNewAi(); virtual int getMaxHealth(); - virtual void aiStep(); + virtual void aiStep(); protected: virtual void causeFallDamage(float distance); @@ -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/ChunkPos.cpp b/Minecraft.World/ChunkPos.cpp index 1bdf165d..025d1fc9 100644 --- a/Minecraft.World/ChunkPos.cpp +++ b/Minecraft.World/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/ChunkPos.h b/Minecraft.World/ChunkPos.h index 55bd1ebb..dc797b02 100644 --- a/Minecraft.World/ChunkPos.h +++ b/Minecraft.World/ChunkPos.h @@ -13,7 +13,7 @@ public: static int64_t 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/ChunkTilesUpdatePacket.h b/Minecraft.World/ChunkTilesUpdatePacket.h index a97f49a3..2e90d3c6 100644 --- a/Minecraft.World/ChunkTilesUpdatePacket.h +++ b/Minecraft.World/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/ChunkVisibilityAreaPacket.h b/Minecraft.World/ChunkVisibilityAreaPacket.h index 33087497..cc7f337d 100644 --- a/Minecraft.World/ChunkVisibilityAreaPacket.h +++ b/Minecraft.World/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/ChunkVisibilityPacket.h b/Minecraft.World/ChunkVisibilityPacket.h index 8c5856c7..d27b0200 100644 --- a/Minecraft.World/ChunkVisibilityPacket.h +++ b/Minecraft.World/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/ClientCommandPacket.h b/Minecraft.World/ClientCommandPacket.h index 2f614ddf..1dea6b22 100644 --- a/Minecraft.World/ClientCommandPacket.h +++ b/Minecraft.World/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/ClientSideMerchant.cpp b/Minecraft.World/ClientSideMerchant.cpp index 5d021c22..9719cd48 100644 --- a/Minecraft.World/ClientSideMerchant.cpp +++ b/Minecraft.World/ClientSideMerchant.cpp @@ -3,10 +3,10 @@ #include "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/ClientSideMerchant.h b/Minecraft.World/ClientSideMerchant.h index 33f0c0b1..fa02c486 100644 --- a/Minecraft.World/ClientSideMerchant.h +++ b/Minecraft.World/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/ClothTileItem.cpp b/Minecraft.World/ClothTileItem.cpp index 35f3bb96..2879deb8 100644 --- a/Minecraft.World/ClothTileItem.cpp +++ b/Minecraft.World/ClothTileItem.cpp @@ -4,8 +4,8 @@ #include "DyePowderItem.h" #include "ClothTileItem.h" -const unsigned int ClothTileItem::COLOR_DESCS[] = -{ +const unsigned int ClothTileItem::COLOR_DESCS[] = +{ IDS_TILE_CLOTH_BLACK, IDS_TILE_CLOTH_RED, IDS_TILE_CLOTH_GREEN, @@ -24,8 +24,8 @@ const unsigned int ClothTileItem::COLOR_DESCS[] = IDS_TILE_CLOTH_WHITE }; -const unsigned int ClothTileItem::CARPET_COLOR_DESCS[] = -{ +const unsigned int ClothTileItem::CARPET_COLOR_DESCS[] = +{ IDS_TILE_CARPET_BLACK, IDS_TILE_CARPET_RED, IDS_TILE_CARPET_GREEN, @@ -50,18 +50,18 @@ ClothTileItem::ClothTileItem(int id) : TileItem(id) setStackedByData(true); } -Icon *ClothTileItem::getIcon(int itemAuxValue) +Icon *ClothTileItem::getIcon(int itemAuxValue) { return Tile::cloth->getTexture(2, ClothTile::getTileDataForItemAuxValue(itemAuxValue)); } -int ClothTileItem::getLevelDataForAuxValue(int auxValue) +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/ClothTileItem.h b/Minecraft.World/ClothTileItem.h index e909df43..a2cf46a7 100644 --- a/Minecraft.World/ClothTileItem.h +++ b/Minecraft.World/ClothTileItem.h @@ -3,15 +3,15 @@ using namespace std; #include "TileItem.h" -class ClothTileItem : public TileItem +class ClothTileItem : public TileItem { -public: +public: static const unsigned int COLOR_DESCS[]; static const unsigned int CARPET_COLOR_DESCS[]; ClothTileItem(int id); - + 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/CoalItem.cpp b/Minecraft.World/CoalItem.cpp index 362689e0..2f6d9cb9 100644 --- a/Minecraft.World/CoalItem.cpp +++ b/Minecraft.World/CoalItem.cpp @@ -12,9 +12,9 @@ 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) + if (instance->getAuxValue() == CHAR_COAL) { return IDS_ITEM_CHARCOAL; } diff --git a/Minecraft.World/CoalItem.h b/Minecraft.World/CoalItem.h index 24814548..d45a6056 100644 --- a/Minecraft.World/CoalItem.h +++ b/Minecraft.World/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/CocoaTile.cpp b/Minecraft.World/CocoaTile.cpp index 1f575014..db9e7f53 100644 --- a/Minecraft.World/CocoaTile.cpp +++ b/Minecraft.World/CocoaTile.cpp @@ -46,7 +46,7 @@ void CocoaTile::tick(Level *level, int x, int y, int z, Random *random) } } -bool CocoaTile::canSurvive(Level *level, int x, int y, int z) +bool CocoaTile::canSurvive(Level *level, int x, int y, int z) { int dir = getDirection(level->getData(x, y, z)); @@ -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); @@ -127,7 +127,7 @@ int CocoaTile::getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int f return Direction::DIRECTION_OPPOSITE[Direction::FACING_DIRECTION[face]]; } -void CocoaTile::neighborChanged(Level *level, int x, int y, int z, int type) +void CocoaTile::neighborChanged(Level *level, int x, int y, int z, int type) { if (!canSurvive(level, x, y, z)) { @@ -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/CocoaTile.h b/Minecraft.World/CocoaTile.h index 267225ea..e1b6a92f 100644 --- a/Minecraft.World/CocoaTile.h +++ b/Minecraft.World/CocoaTile.h @@ -4,7 +4,7 @@ class CocoaTile : public DirectionalTile { -public: +public: static const int COCOA_TEXTURES_LENGTH = 3; static const wstring TEXTURE_AGES[]; @@ -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/ColoredTileItem.cpp b/Minecraft.World/ColoredTileItem.cpp index 37ea4c63..ab71641e 100644 --- a/Minecraft.World/ColoredTileItem.cpp +++ b/Minecraft.World/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/ColoredTileItem.h b/Minecraft.World/ColoredTileItem.h index cc3ef1e7..dfe5ebe6 100644 --- a/Minecraft.World/ColoredTileItem.h +++ b/Minecraft.World/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/Command.cpp b/Minecraft.World/Command.cpp index f6d0e592..7c8f56cf 100644 --- a/Minecraft.World/Command.cpp +++ b/Minecraft.World/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/Command.h b/Minecraft.World/Command.h index 815c24ba..8f923be2 100644 --- a/Minecraft.World/Command.h +++ b/Minecraft.World/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/CommandDispatcher.cpp b/Minecraft.World/CommandDispatcher.cpp index 68b74ca9..b9db3caf 100644 --- a/Minecraft.World/CommandDispatcher.cpp +++ b/Minecraft.World/CommandDispatcher.cpp @@ -2,7 +2,7 @@ #include "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/CommandDispatcher.h b/Minecraft.World/CommandDispatcher.h index 600f1db1..cfc4486a 100644 --- a/Minecraft.World/CommandDispatcher.h +++ b/Minecraft.World/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/ComplexItem.cpp b/Minecraft.World/ComplexItem.cpp index 9cf09b87..1b5f3cff 100644 --- a/Minecraft.World/ComplexItem.cpp +++ b/Minecraft.World/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/ComplexItem.h b/Minecraft.World/ComplexItem.h index 28aba791..036781a4 100644 --- a/Minecraft.World/ComplexItem.h +++ b/Minecraft.World/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/ComplexItemDataPacket.h b/Minecraft.World/ComplexItemDataPacket.h index 52de8f49..f299647d 100644 --- a/Minecraft.World/ComplexItemDataPacket.h +++ b/Minecraft.World/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/CompoundContainer.cpp b/Minecraft.World/CompoundContainer.cpp index 29bf60dd..17f2b6e5 100644 --- a/Minecraft.World/CompoundContainer.cpp +++ b/Minecraft.World/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/CompoundContainer.h b/Minecraft.World/CompoundContainer.h index b0b8b934..1103f000 100644 --- a/Minecraft.World/CompoundContainer.h +++ b/Minecraft.World/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/Connection.cpp b/Minecraft.World/Connection.cpp index 4392fe54..17b59dd3 100644 --- a/Minecraft.World/Connection.cpp +++ b/Minecraft.World/Connection.cpp @@ -96,7 +96,7 @@ Connection::Connection(Socket *socket, const wstring& id, PacketListener *packet }*/ dis = new DataInputStream(socket->getInputStream(packetListener->isServerPacketListener())); - + sos = socket->getOutputStream(packetListener->isServerPacketListener()); bufferedDos = new DataOutputStream(new BufferedOutputStream(sos, SEND_BUFFER_SIZE)); baos = new ByteArrayOutputStream( SEND_BUFFER_SIZE ); @@ -124,7 +124,7 @@ Connection::Connection(Socket *socket, const wstring& id, PacketListener *packet writeThread->Run(); - /* 4J JEV, java: + /* 4J JEV, java: new Thread(wstring(id).append(L" read thread")) { }; @@ -145,7 +145,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; @@ -154,7 +154,7 @@ void Connection::send(shared_ptr packet) EnterCriticalSection(&writeLock); estimatedRemaining += packet->getEstimatedSize() + 1; - if (packet->shouldDelay) + if (packet->shouldDelay) { // 4J We have delayed it enough by putting it in the slow queue, so don't delay when we actually send it packet->shouldDelay = false; @@ -171,7 +171,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; @@ -189,7 +189,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); @@ -200,11 +200,11 @@ bool Connection::writeTick() LeaveCriticalSection(&writeLock); Packet::writePacket(packet, bufferedDos); - + #ifndef _CONTENT_PACKAGE // 4J Added for debugging - if( !socket->isLocal() ) + if( !socket->isLocal() ) Packet::recordOutgoingPacket(packet); #endif @@ -220,7 +220,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) { @@ -252,9 +252,9 @@ bool Connection::writeTick() #ifndef _CONTENT_PACKAGE // 4J Added for debugging - if( !socket->isLocal() ) + if( !socket->isLocal() ) Packet::recordOutgoingPacket(packet); -#endif +#endif writeSizes[packet->getId()] += packet->getEstimatedSize() + 1; slowWriteDelay = 0; @@ -290,7 +290,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) { @@ -302,13 +302,13 @@ bool Connection::readTick() } LeaveCriticalSection(&incoming_cs); didSomething = true; - } + } else { // printf("Con:0x%x readTick close EOS\n",this); // 4J Stu - Remove this line - // Fix for #10410 - UI: If the player is removed from a splitscreened host’s game, the next game that player joins will produce a message stating that the host has left. + // Fix for #10410 - UI: If the player is removed from a splitscreened host�s game, the next game that player joins will produce a message stating that the host has left. //close(DisconnectPacket::eDisconnect_EndOfStream); } @@ -362,7 +362,7 @@ void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) // int count = 0, sum = 0, i = first; // va_list marker; - // + // // va_start( marker, first ); // while( i != -1 ) // { @@ -440,7 +440,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 @@ -455,10 +455,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(); } @@ -607,8 +607,8 @@ int Connection::runWrite(void* lpParam) while (con->writeTick()) ; - //Sleep(100L); - // TODO - 4J Stu - 1.8.2 changes these sleeps to 2L, but not sure whether we should do that as well + //Sleep(100L); + // TODO - 4J Stu - 1.8.2 changes these sleeps to 2L, but not sure whether we should do that as well waitResult = con->m_hWakeWriteThread->WaitForSignal(100L); if (con->bufferedDos != NULL) con->bufferedDos->flush(); diff --git a/Minecraft.World/Connection.h b/Minecraft.World/Connection.h index 9db00512..32068dfb 100644 --- a/Minecraft.World/Connection.h +++ b/Minecraft.World/Connection.h @@ -52,11 +52,11 @@ 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; bool quitting; @@ -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/Container.h b/Minecraft.World/Container.h index 7aa63728..8939cd01 100644 --- a/Minecraft.World/Container.h +++ b/Minecraft.World/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/ContainerAckPacket.h b/Minecraft.World/ContainerAckPacket.h index 00f3592e..0dce4e4f 100644 --- a/Minecraft.World/ContainerAckPacket.h +++ b/Minecraft.World/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/ContainerButtonClickPacket.h b/Minecraft.World/ContainerButtonClickPacket.h index 522c5f86..64ee6cb5 100644 --- a/Minecraft.World/ContainerButtonClickPacket.h +++ b/Minecraft.World/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/ContainerClickPacket.cpp b/Minecraft.World/ContainerClickPacket.cpp index 5b3ca24f..155f944b 100644 --- a/Minecraft.World/ContainerClickPacket.cpp +++ b/Minecraft.World/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; @@ -59,7 +59,7 @@ void ContainerClickPacket::write(DataOutputStream *dos) // throws IOException writeItem(item, dos); } -int ContainerClickPacket::getEstimatedSize() +int ContainerClickPacket::getEstimatedSize() { return 4 + 4 + 2 + 1; } diff --git a/Minecraft.World/ContainerClickPacket.h b/Minecraft.World/ContainerClickPacket.h index 8bea7da5..47c7e418 100644 --- a/Minecraft.World/ContainerClickPacket.h +++ b/Minecraft.World/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/ContainerClosePacket.h b/Minecraft.World/ContainerClosePacket.h index bf032a97..562646fa 100644 --- a/Minecraft.World/ContainerClosePacket.h +++ b/Minecraft.World/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/ContainerMenu.cpp b/Minecraft.World/ContainerMenu.cpp index 57190024..534da741 100644 --- a/Minecraft.World/ContainerMenu.cpp +++ b/Minecraft.World/ContainerMenu.cpp @@ -8,7 +8,7 @@ #include "..\Minecraft.Client\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/ContainerMenu.h b/Minecraft.World/ContainerMenu.h index e6da0782..a738cdc3 100644 --- a/Minecraft.World/ContainerMenu.h +++ b/Minecraft.World/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/ContainerOpenPacket.h b/Minecraft.World/ContainerOpenPacket.h index dbc65b9a..3d351a93 100644 --- a/Minecraft.World/ContainerOpenPacket.h +++ b/Minecraft.World/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/ContainerSetContentPacket.cpp b/Minecraft.World/ContainerSetContentPacket.cpp index 13cfebd7..62382888 100644 --- a/Minecraft.World/ContainerSetContentPacket.cpp +++ b/Minecraft.World/ContainerSetContentPacket.cpp @@ -12,28 +12,28 @@ ContainerSetContentPacket::~ContainerSetContentPacket() delete[] items.data; } -ContainerSetContentPacket::ContainerSetContentPacket() +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(); } } -void ContainerSetContentPacket::read(DataInputStream *dis) //throws IOException +void ContainerSetContentPacket::read(DataInputStream *dis) //throws IOException { containerId = dis->readByte(); int count = dis->readShort(); items = ItemInstanceArray(count); - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { items[i] = readItem(dis); } @@ -43,7 +43,7 @@ void ContainerSetContentPacket::write(DataOutputStream *dos) //throws IOExceptio { dos->writeByte(containerId); dos->writeShort(items.length); - for (unsigned int i = 0; i < items.length; i++) + for (unsigned int i = 0; i < items.length; i++) { writeItem(items[i], dos); } @@ -54,7 +54,7 @@ void ContainerSetContentPacket::handle(PacketListener *listener) listener->handleContainerContent(shared_from_this()); } -int ContainerSetContentPacket::getEstimatedSize() +int ContainerSetContentPacket::getEstimatedSize() { return 3 + items.length * 5; } diff --git a/Minecraft.World/ContainerSetContentPacket.h b/Minecraft.World/ContainerSetContentPacket.h index 10315f58..8e2a3c5a 100644 --- a/Minecraft.World/ContainerSetContentPacket.h +++ b/Minecraft.World/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/ContainerSetDataPacket.h b/Minecraft.World/ContainerSetDataPacket.h index ce075e00..6f694aeb 100644 --- a/Minecraft.World/ContainerSetDataPacket.h +++ b/Minecraft.World/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/ContainerSetSlotPacket.cpp b/Minecraft.World/ContainerSetSlotPacket.cpp index 42892f3c..0bb9857f 100644 --- a/Minecraft.World/ContainerSetSlotPacket.cpp +++ b/Minecraft.World/ContainerSetSlotPacket.cpp @@ -18,19 +18,19 @@ 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; this->item = item == NULL ? item : item->copy(); } -void ContainerSetSlotPacket::handle(PacketListener *listener) +void ContainerSetSlotPacket::handle(PacketListener *listener) { listener->handleContainerSetSlot(shared_from_this()); } -void ContainerSetSlotPacket::read(DataInputStream *dis) //throws IOException +void ContainerSetSlotPacket::read(DataInputStream *dis) //throws IOException { // 4J Stu - TU-1 hotfix // Fix for #13142 - Holding down the A button on the furnace ingredient slot causes the UI to display incorrect item counts diff --git a/Minecraft.World/ContainerSetSlotPacket.h b/Minecraft.World/ContainerSetSlotPacket.h index 61269df0..f996fc89 100644 --- a/Minecraft.World/ContainerSetSlotPacket.h +++ b/Minecraft.World/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/ControlledByPlayerGoal.cpp b/Minecraft.World/ControlledByPlayerGoal.cpp index 1e035494..ba46debe 100644 --- a/Minecraft.World/ControlledByPlayerGoal.cpp +++ b/Minecraft.World/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/Cow.cpp b/Minecraft.World/Cow.cpp index c259183e..f37cdd9a 100644 --- a/Minecraft.World/Cow.cpp +++ b/Minecraft.World/Cow.cpp @@ -47,27 +47,27 @@ int Cow::getMaxHealth() return 10; } -int Cow::getAmbientSound() +int Cow::getAmbientSound() { return eSoundType_MOB_COW_AMBIENT; } -int Cow::getHurtSound() +int Cow::getHurtSound() { return eSoundType_MOB_COW_HURT; } -int Cow::getDeathSound() +int Cow::getDeathSound() { return eSoundType_MOB_COW_HURT; } -float Cow::getSoundVolume() +float Cow::getSoundVolume() { return 0.4f; } -int Cow::getDeathLoot() +int Cow::getDeathLoot() { return Item::leather->id; } @@ -95,33 +95,33 @@ 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(); - if (item != NULL && item->id == Item::bucket_empty->id) + 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) + if (--item->count <= 0) { - player->inventory->setItem(player->inventory->selected, shared_ptr( new ItemInstance(Item::milk) ) ); - } - else if (!player->inventory->add(shared_ptr( new ItemInstance(Item::milk) ))) + player->inventory->setItem(player->inventory->selected, std::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; } 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/Cow.h b/Minecraft.World/Cow.h index a1a91aba..e721f830 100644 --- a/Minecraft.World/Cow.h +++ b/Minecraft.World/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/CraftItemPacket.h b/Minecraft.World/CraftItemPacket.h index 9793d593..b08d609e 100644 --- a/Minecraft.World/CraftItemPacket.h +++ b/Minecraft.World/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/CraftingContainer.cpp b/Minecraft.World/CraftingContainer.cpp index fbcc5678..db0d593d 100644 --- a/Minecraft.World/CraftingContainer.cpp +++ b/Minecraft.World/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/CraftingContainer.h b/Minecraft.World/CraftingContainer.h index 863249a2..d09d460a 100644 --- a/Minecraft.World/CraftingContainer.h +++ b/Minecraft.World/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/CraftingMenu.cpp b/Minecraft.World/CraftingMenu.cpp index eeb2a6e3..3a144a5d 100644 --- a/Minecraft.World/CraftingMenu.cpp +++ b/Minecraft.World/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/CraftingMenu.h b/Minecraft.World/CraftingMenu.h index 0452eccc..7ebba894 100644 --- a/Minecraft.World/CraftingMenu.h +++ b/Minecraft.World/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/Creeper.cpp b/Minecraft.World/Creeper.cpp index 3f6c66a7..2403d3a4 100644 --- a/Minecraft.World/Creeper.cpp +++ b/Minecraft.World/Creeper.cpp @@ -34,7 +34,7 @@ Creeper::Creeper(Level *level) : Monster( level ) health = getMaxHealth(); _init(); - + this->textureIdx = TN_MOB_CREEPER; // 4J was L"/mob/creeper.png"; goalSelector.addGoal(1, new FloatGoal(this)); @@ -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; } @@ -162,7 +162,7 @@ void Creeper::setSwellDir(int dir) entityData->set(DATA_SWELL_DIR, (byte) dir); } -void Creeper::thunderHit(const LightningBolt *lightningBolt) +void Creeper::thunderHit(const LightningBolt *lightningBolt) { Monster::thunderHit(lightningBolt); entityData->set(DATA_IS_POWERED, (byte) 1); diff --git a/Minecraft.World/Creeper.h b/Minecraft.World/Creeper.h index a5da0e10..ebd9fa78 100644 --- a/Minecraft.World/Creeper.h +++ b/Minecraft.World/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/CropTile.cpp b/Minecraft.World/CropTile.cpp index 0c19d889..80540b6a 100644 --- a/Minecraft.World/CropTile.cpp +++ b/Minecraft.World/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/CustomPayloadPacket.h b/Minecraft.World/CustomPayloadPacket.h index 95c5e708..b794631b 100644 --- a/Minecraft.World/CustomPayloadPacket.h +++ b/Minecraft.World/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/DamageEnchantment.cpp b/Minecraft.World/DamageEnchantment.cpp index 686abc62..804e6908 100644 --- a/Minecraft.World/DamageEnchantment.cpp +++ b/Minecraft.World/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/DamageEnchantment.h b/Minecraft.World/DamageEnchantment.h index 00f9b047..7d7a3fd9 100644 --- a/Minecraft.World/DamageEnchantment.h +++ b/Minecraft.World/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/DamageSource.cpp b/Minecraft.World/DamageSource.cpp index 29ea727e..2b075e0e 100644 --- a/Minecraft.World/DamageSource.cpp +++ b/Minecraft.World/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/DamageSource.h b/Minecraft.World/DamageSource.h index 2e1d249d..ecfc2423 100644 --- a/Minecraft.World/DamageSource.h +++ b/Minecraft.World/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/DeadBushTile.cpp b/Minecraft.World/DeadBushTile.cpp index 33fdfe6c..84b92817 100644 --- a/Minecraft.World/DeadBushTile.cpp +++ b/Minecraft.World/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/DeadBushTile.h b/Minecraft.World/DeadBushTile.h index 2d74816e..b1953e3f 100644 --- a/Minecraft.World/DeadBushTile.h +++ b/Minecraft.World/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/DebugOptionsPacket.h b/Minecraft.World/DebugOptionsPacket.h index 9ac5ef2f..d731ebdd 100644 --- a/Minecraft.World/DebugOptionsPacket.h +++ b/Minecraft.World/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/DefaultGameModeCommand.cpp b/Minecraft.World/DefaultGameModeCommand.cpp index 529733f7..3b64040d 100644 --- a/Minecraft.World/DefaultGameModeCommand.cpp +++ b/Minecraft.World/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/DefaultGameModeCommand.h b/Minecraft.World/DefaultGameModeCommand.h index 99d45a43..01a41331 100644 --- a/Minecraft.World/DefaultGameModeCommand.h +++ b/Minecraft.World/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/DefendVillageTargetGoal.cpp b/Minecraft.World/DefendVillageTargetGoal.cpp index ad6b3fd8..87cb5fe3 100644 --- a/Minecraft.World/DefendVillageTargetGoal.cpp +++ b/Minecraft.World/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/DelayedRelease.cpp b/Minecraft.World/DelayedRelease.cpp index ebd0398f..c1f9a3da 100644 --- a/Minecraft.World/DelayedRelease.cpp +++ b/Minecraft.World/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; @@ -37,7 +37,7 @@ void DelayedRelease::defineSynchedData() { } -void DelayedRelease::readAdditionalSaveData(CompoundTag *tag) +void DelayedRelease::readAdditionalSaveData(CompoundTag *tag) { } diff --git a/Minecraft.World/DelayedRelease.h b/Minecraft.World/DelayedRelease.h index aaccc843..8ec6fcd2 100644 --- a/Minecraft.World/DelayedRelease.h +++ b/Minecraft.World/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/DerivedLevelData.cpp b/Minecraft.World/DerivedLevelData.cpp index da3d048d..276d1c6e 100644 --- a/Minecraft.World/DerivedLevelData.cpp +++ b/Minecraft.World/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/DerivedLevelData.h b/Minecraft.World/DerivedLevelData.h index db5a72d2..f5b263db 100644 --- a/Minecraft.World/DerivedLevelData.h +++ b/Minecraft.World/DerivedLevelData.h @@ -15,7 +15,7 @@ protected: public: CompoundTag *createTag(); - CompoundTag *createTag(vector > *players); + CompoundTag *createTag(vector > *players); int64_t getSeed(); int getXSpawn(); int getYSpawn(); diff --git a/Minecraft.World/DetectorRailTile.cpp b/Minecraft.World/DetectorRailTile.cpp index e01ec259..bec7b16c 100644 --- a/Minecraft.World/DetectorRailTile.cpp +++ b/Minecraft.World/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/DetectorRailTile.h b/Minecraft.World/DetectorRailTile.h index dd0e6374..1dcca19b 100644 --- a/Minecraft.World/DetectorRailTile.h +++ b/Minecraft.World/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/DigDurabilityEnchantment.cpp b/Minecraft.World/DigDurabilityEnchantment.cpp index f2ef1656..6670371b 100644 --- a/Minecraft.World/DigDurabilityEnchantment.cpp +++ b/Minecraft.World/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/DigDurabilityEnchantment.h b/Minecraft.World/DigDurabilityEnchantment.h index 88f6447d..4751f3fe 100644 --- a/Minecraft.World/DigDurabilityEnchantment.h +++ b/Minecraft.World/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/DiggerItem.cpp b/Minecraft.World/DiggerItem.cpp index 144b1a11..00d06b22 100644 --- a/Minecraft.World/DiggerItem.cpp +++ b/Minecraft.World/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/DiggerItem.h b/Minecraft.World/DiggerItem.h index 4a4eeb07..747c755f 100644 --- a/Minecraft.World/DiggerItem.h +++ b/Minecraft.World/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/DiggingEnchantment.cpp b/Minecraft.World/DiggingEnchantment.cpp index b3775623..f6cbcad0 100644 --- a/Minecraft.World/DiggingEnchantment.cpp +++ b/Minecraft.World/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/DiggingEnchantment.h b/Minecraft.World/DiggingEnchantment.h index 324f5cdd..48b0fb0b 100644 --- a/Minecraft.World/DiggingEnchantment.h +++ b/Minecraft.World/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/DiodeTile.cpp b/Minecraft.World/DiodeTile.cpp index c28778d3..748e1a1d 100644 --- a/Minecraft.World/DiodeTile.cpp +++ b/Minecraft.World/DiodeTile.cpp @@ -163,7 +163,7 @@ bool DiodeTile::getSourceSignal(Level *level, int x, int y, int z, int data) case Direction::EAST: return level->getSignal(x + 1, y, z, Facing::EAST) || (level->getTile(x + 1, y, z) == Tile::redStoneDust_Id && level->getData(x + 1, y, z) > 0); case Direction::WEST: - return level->getSignal(x - 1, y, z, Facing::WEST) || (level->getTile(x - 1, y, z) == Tile::redStoneDust_Id && level->getData(x - 1, y, z) > 0); + return level->getSignal(x - 1, y, z, Facing::WEST) || (level->getTile(x - 1, y, z) == Tile::redStoneDust_Id && level->getData(x - 1, y, z) > 0); } return false; } @@ -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/DiodeTile.h b/Minecraft.World/DiodeTile.h index 003b011f..ff3b7e88 100644 --- a/Minecraft.World/DiodeTile.h +++ b/Minecraft.World/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/DirectoryLevelStorage.cpp b/Minecraft.World/DirectoryLevelStorage.cpp index 5a1dfc0a..210ddf87 100644 --- a/Minecraft.World/DirectoryLevelStorage.cpp +++ b/Minecraft.World/DirectoryLevelStorage.cpp @@ -347,7 +347,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 @@ -381,7 +381,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(); @@ -429,7 +429,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() ); @@ -738,7 +738,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/DirectoryLevelStorage.h b/Minecraft.World/DirectoryLevelStorage.h index e47769d9..335dc0a6 100644 --- a/Minecraft.World/DirectoryLevelStorage.h +++ b/Minecraft.World/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/DirectoryLevelStorageSource.cpp b/Minecraft.World/DirectoryLevelStorageSource.cpp index b4beb8b5..ecc49014 100644 --- a/Minecraft.World/DirectoryLevelStorageSource.cpp +++ b/Minecraft.World/DirectoryLevelStorageSource.cpp @@ -27,12 +27,12 @@ vector *DirectoryLevelStorageSource::getLevelList() // 4J Stu - We don't use directory list with the Xbox save locations vector *levels = new vector; #if 0 - for (int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) { wstring levelId = wstring(L"World").append( _toString( (i+1) ) ); LevelData *levelData = getDataTagFor(saveFile, levelId); - if (levelData != NULL) + if (levelData != NULL) { levels->push_back(new LevelSummary(levelId, L"", levelData->getLastPlayed(), levelData->getSizeOnDisk(), levelData.getGameType(), false, levelData->isHardcore())); } @@ -45,7 +45,7 @@ void DirectoryLevelStorageSource::clearAll() { } -LevelData *DirectoryLevelStorageSource::getDataTagFor(ConsoleSaveFile *saveFile, const wstring& levelId) +LevelData *DirectoryLevelStorageSource::getDataTagFor(ConsoleSaveFile *saveFile, const wstring& levelId) { //File dataFile(dir, L"level.dat"); ConsoleSavePath dataFile = ConsoleSavePath( wstring( L"level.dat" ) ); @@ -63,12 +63,12 @@ LevelData *DirectoryLevelStorageSource::getDataTagFor(ConsoleSaveFile *saveFile, } void DirectoryLevelStorageSource::renameLevel(const wstring& levelId, const wstring& newLevelName) -{ +{ ConsoleSaveFileOriginal tempSave(levelId); //File dataFile = File(dir, L"level.dat"); ConsoleSavePath dataFile = ConsoleSavePath( wstring( L"level.dat" ) ); - if ( tempSave.doesFileExist( dataFile ) ) + if ( tempSave.doesFileExist( dataFile ) ) { ConsoleSaveFileInputStream fis = ConsoleSaveFileInputStream(&tempSave, dataFile); CompoundTag *root = NbtIo::readCompressed(&fis); @@ -80,7 +80,7 @@ void DirectoryLevelStorageSource::renameLevel(const wstring& levelId, const wstr } } -bool DirectoryLevelStorageSource::isNewLevelIdAcceptable(const wstring& levelId) +bool DirectoryLevelStorageSource::isNewLevelIdAcceptable(const 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 wstring& levelId) { File dir = File(baseDir, levelId); if (!dir.exists()) return; @@ -110,7 +110,7 @@ void DirectoryLevelStorageSource::deleteRecursive(vector *files) for (AUTO_VAR(it, files->begin()); it != itEnd; it++) { File *file = *it; - if (file->isDirectory()) + if (file->isDirectory()) { deleteRecursive(file->listFiles()); } @@ -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) @@ -133,7 +133,7 @@ bool DirectoryLevelStorageSource::requiresConversion(ConsoleSaveFile *saveFile, return false; } -bool DirectoryLevelStorageSource::convertLevel(ConsoleSaveFile *saveFile, const wstring& levelId, ProgressListener *progress) +bool DirectoryLevelStorageSource::convertLevel(ConsoleSaveFile *saveFile, const wstring& levelId, ProgressListener *progress) { return false; } diff --git a/Minecraft.World/DirectoryLevelStorageSource.h b/Minecraft.World/DirectoryLevelStorageSource.h index 9f6069ab..e6aab76d 100644 --- a/Minecraft.World/DirectoryLevelStorageSource.h +++ b/Minecraft.World/DirectoryLevelStorageSource.h @@ -8,7 +8,7 @@ class ProgressListener; class LevelData; class ConsoleSaveFile; -class DirectoryLevelStorageSource : public LevelStorageSource +class DirectoryLevelStorageSource : public LevelStorageSource { protected: const File baseDir; @@ -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/DisconnectPacket.cpp b/Minecraft.World/DisconnectPacket.cpp index da20686a..cb018200 100644 --- a/Minecraft.World/DisconnectPacket.cpp +++ b/Minecraft.World/DisconnectPacket.cpp @@ -32,7 +32,7 @@ void DisconnectPacket::handle(PacketListener *listener) listener->handleDisconnect(shared_from_this()); } -int DisconnectPacket::getEstimatedSize() +int DisconnectPacket::getEstimatedSize() { return sizeof(eDisconnectReason); } @@ -42,7 +42,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/DisconnectPacket.h b/Minecraft.World/DisconnectPacket.h index 34983754..e2815c2c 100644 --- a/Minecraft.World/DisconnectPacket.h +++ b/Minecraft.World/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/DispenserTile.cpp b/Minecraft.World/DispenserTile.cpp index 286737c9..723aedc0 100644 --- a/Minecraft.World/DispenserTile.cpp +++ b/Minecraft.World/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); @@ -291,14 +291,14 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev // not sending a message here, since we will probably get flooded with them when people have automatic dispensers for spawn eggs return LEAVE_ITEM; } - } + } break; case Item::egg_Id: { 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; @@ -362,7 +362,7 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev level->addEntity(itemEntity); level->levelEvent(LevelEvent::SOUND_CLICK, x, y, z, 0); - } + } return REMOVE_ITEM; } else @@ -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); @@ -394,14 +394,14 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev // not sending a message here, since we will probably get flooded with them when people have automatic dispensers for spawn eggs return LEAVE_ITEM; } - } + } break; case Item::fireball_Id: // TU9 { 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; @@ -414,21 +414,21 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev // not sending a message here, since we will probably get flooded with them when people have automatic dispensers for spawn eggs return LEAVE_ITEM; } - } + } break; case Item::monsterPlacer_Id: { int iResult=0; //MonsterPlacerItem *spawnEgg = (MonsterPlacerItem *)item->getItem(); - shared_ptr newEntity = MonsterPlacerItem::canSpawn(item->getAuxValue(), level,&iResult); - - shared_ptr mob = dynamic_pointer_cast(newEntity); + std::shared_ptr newEntity = MonsterPlacerItem::canSpawn(item->getAuxValue(), level,&iResult); + + 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 mob->moveTo(xp + xd * 0.4, yp - 0.3, zp + zd * 0.4, level->random->nextFloat() * 360, 0); mob->finalizeMobSpawn(); - level->addEntity(mob); + level->addEntity(mob); level->levelEvent(LevelEvent::SOUND_LAUNCH, x, y, z, 0); return REMOVE_ITEM; } @@ -447,7 +447,7 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev { BucketItem *pBucket = (BucketItem *) item->getItem(); - if (pBucket->emptyBucket(level, x, y, z, x + xd, y, z + zd)) + if (pBucket->emptyBucket(level, x, y, z, x + xd, y, z + zd)) { item->id = Item::bucket_empty_Id; item->count = 1; @@ -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; @@ -507,22 +507,22 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev xp = x + (xd < 0 ? xd * 0.8 : xd * 1.8f) + Mth::abs(zd) * 0.5f; zp = z + (zd < 0 ? zd * 0.8 : zd * 1.8f) + Mth::abs(xd) * 0.5f; - if (RailTile::isRail(level, x + xd, y, z + zd)) + if (RailTile::isRail(level, x + xd, y, z + zd)) { yp = y + 0.5f; - } - else if (level->isEmptyTile(x + xd, y, z + zd) && RailTile::isRail(level, x + xd, y - 1, z + zd)) + } + else if (level->isEmptyTile(x + xd, y, z + zd) && RailTile::isRail(level, x + xd, y - 1, z + zd)) { yp = y - 0.5f; - } - else + } + else { return DISPENSE_ITEM; } 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); @@ -542,21 +542,21 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev xp = x + (xd < 0 ? xd * 0.8 : xd * 1.8f) + Mth::abs(zd) * 0.5f; zp = z + (zd < 0 ? zd * 0.8 : zd * 1.8f) + Mth::abs(xd) * 0.5f; - if (level->getMaterial(x + xd, y, z + zd) == Material::water) + if (level->getMaterial(x + xd, y, z + zd) == Material::water) { bLaunchBoat=true; yp = y + 1.0f; - } - else if (level->isEmptyTile(x + xd, y, z + zd) && level->getMaterial(x + xd, y - 1, z + zd) == Material::water) + } + else if (level->isEmptyTile(x + xd, y, z + zd) && level->getMaterial(x + xd, y - 1, z + zd) == Material::water) { bLaunchBoat=true; yp = y; - } + } // 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/DispenserTile.h b/Minecraft.World/DispenserTile.h index 5bc892aa..f693c5fa 100644 --- a/Minecraft.World/DispenserTile.h +++ b/Minecraft.World/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/DispenserTileEntity.cpp b/Minecraft.World/DispenserTileEntity.cpp index 2c4705ea..f06bc4c2 100644 --- a/Minecraft.World/DispenserTileEntity.cpp +++ b/Minecraft.World/DispenserTileEntity.cpp @@ -25,32 +25,32 @@ DispenserTileEntity::~DispenserTileEntity() delete random; } -unsigned int DispenserTileEntity::getContainerSize() +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 if(item->count <= 0) return nullptr; return item; - } - else + } + 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) { @@ -82,7 +82,7 @@ void DispenserTileEntity::AddItemBack(shared_ptritem, unsigned int { items->data[slot]->count++; this->setChanged(); - } + } } else { @@ -93,7 +93,7 @@ void DispenserTileEntity::AddItemBack(shared_ptritem, unsigned int } /** * Removes an item with the given id and returns true if one was found. -* +* * @param itemId * @return */ @@ -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; } } @@ -116,7 +116,7 @@ int DispenserTileEntity::getRandomSlot() int replaceOdds = 1; for (unsigned int i = 0; i < items->length; i++) { - if (items->data[i] != NULL && random->nextInt(replaceOdds++) == 0) + if (items->data[i] != NULL && random->nextInt(replaceOdds++) == 0) { replaceSlot = i; } @@ -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++) { @@ -146,7 +146,7 @@ int DispenserTileEntity::addItem(shared_ptr item) return -1; } -int DispenserTileEntity::getName() +int DispenserTileEntity::getName() { return IDS_TILE_DISPENSER; } @@ -169,7 +169,7 @@ void DispenserTileEntity::save(CompoundTag *base) TileEntity::save(base); ListTag *listTag = new ListTag; - for (unsigned int i = 0; i < items->length; i++) + for (unsigned int i = 0; i < items->length; i++) { if (items->data[i] != NULL) { @@ -182,12 +182,12 @@ void DispenserTileEntity::save(CompoundTag *base) base->put(L"Items", listTag); } -int DispenserTileEntity::getMaxStackSize() +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/DispenserTileEntity.h b/Minecraft.World/DispenserTileEntity.h index 8519ad54..d7c6385a 100644 --- a/Minecraft.World/DispenserTileEntity.h +++ b/Minecraft.World/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/DoorItem.cpp b/Minecraft.World/DoorItem.cpp index d59ac8d9..122b7be1 100644 --- a/Minecraft.World/DoorItem.cpp +++ b/Minecraft.World/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/DoorItem.h b/Minecraft.World/DoorItem.h index 843c768b..be471714 100644 --- a/Minecraft.World/DoorItem.h +++ b/Minecraft.World/DoorItem.h @@ -7,7 +7,7 @@ class Player; class Material; class Level; -class DoorItem : public Item +class DoorItem : public Item { private: Material *material; @@ -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/DoorTile.cpp b/Minecraft.World/DoorTile.cpp index be31be27..9b481269 100644 --- a/Minecraft.World/DoorTile.cpp +++ b/Minecraft.World/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/DoorTile.h b/Minecraft.World/DoorTile.h index 59a8b414..7dffe612 100644 --- a/Minecraft.World/DoorTile.h +++ b/Minecraft.World/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/DownfallLayer.cpp b/Minecraft.World/DownfallLayer.cpp index 30775218..6d345cb5 100644 --- a/Minecraft.World/DownfallLayer.cpp +++ b/Minecraft.World/DownfallLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.biome.h" #include "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/DownfallLayer.h b/Minecraft.World/DownfallLayer.h index e708253c..ed191b17 100644 --- a/Minecraft.World/DownfallLayer.h +++ b/Minecraft.World/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/DownfallMixerLayer.cpp b/Minecraft.World/DownfallMixerLayer.cpp index fcca5bdd..34e19b27 100644 --- a/Minecraft.World/DownfallMixerLayer.cpp +++ b/Minecraft.World/DownfallMixerLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.biome.h" #include "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/DownfallMixerLayer.h b/Minecraft.World/DownfallMixerLayer.h index 58e6151d..c0149dce 100644 --- a/Minecraft.World/DownfallMixerLayer.h +++ b/Minecraft.World/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/DragonFireball.cpp b/Minecraft.World/DragonFireball.cpp index e3b5d579..6146b8a1 100644 --- a/Minecraft.World/DragonFireball.cpp +++ b/Minecraft.World/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/DragonFireball.h b/Minecraft.World/DragonFireball.h index 9ce199ed..96ab6d9f 100644 --- a/Minecraft.World/DragonFireball.h +++ b/Minecraft.World/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/DurangoStats.cpp b/Minecraft.World/DurangoStats.cpp index c9b51c84..884adf39 100644 --- a/Minecraft.World/DurangoStats.cpp +++ b/Minecraft.World/DurangoStats.cpp @@ -54,9 +54,9 @@ bool DsItemEvent::onLeaderboard(ELeaderboardId leaderboard, eAcquisitionMethod m case eAcquisitionMethod_Mined: switch (param->itemId) { - case Tile::dirt_Id: + case Tile::dirt_Id: case Tile::stoneBrick_Id: - case Tile::sand_Id: + case Tile::sand_Id: case Tile::rock_Id: case Tile::gravel_Id: case Tile::clay_Id: @@ -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)) { @@ -170,7 +170,7 @@ void DsItemEvent::handleParamBlob(shared_ptr player, byteArray para else { EventWriteMcItemAcquired( - DurangoStats::getUserId(player), + DurangoStats::getUserId(player), 0, // TODO DurangoStats::getPlayerSession(), 0, @@ -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)) { @@ -222,7 +222,7 @@ void DsMobKilled::handleParamBlob(shared_ptr player, byteArray para DurangoStats::getPlayerSession(), // ROUND ID 0, param->weaponId, - param->mobType, + param->mobType, param->isRanged?1:0, 0, 0, 0, // (x,y,z), 0, @@ -231,7 +231,7 @@ void DsMobKilled::handleParamBlob(shared_ptr player, byteArray para == 0) { app.DebugPrintf("<%ls>\t%s(%i:%i:%i:%i)\n", DurangoStats::getUserId(player), - (param->isRanged?"mobShotWithEntity":"mobKilledInMelee"), + (param->isRanged?"mobShotWithEntity":"mobKilledInMelee"), param->mobType, param->weaponId, param->distance, param->damage); } @@ -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; @@ -286,25 +286,25 @@ byteArray DsMobKilled::createParamBlob(shared_ptr player, shared_ptrgetDirectEntity()->GetType()), - mob->distanceTo(player->x, player->y, player->z), + mob->distanceTo(player->x, player->y, player->z), 0/*not needed*/ }; output.data = (byte*) new Param(param); output.length = sizeof(Param); return output; } - + // Kill made in melee, use itemInHand as weapon. - shared_ptr item = player->getCarriedItem(); + std::shared_ptr item = player->getCarriedItem(); byteArray output; Param param = { - DsMobKilled::MELEE, - mob_networking_id, + DsMobKilled::MELEE, + mob_networking_id, (item != NULL ? item->getItem()->id : 0), - mob->distanceTo(player->x, player->y, player->z), + mob->distanceTo(player->x, player->y, player->z), 0/*not needed*/ }; output.data = (byte*) new Param(param); @@ -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)) { @@ -336,8 +336,8 @@ void DsMobInteract::handleParamBlob(shared_ptr player, byteArray pa EventWriteMobInteract( DurangoStats::getUserId(player), - DurangoStats::getPlayerSession(), - param->mobId, + DurangoStats::getPlayerSession(), + param->mobId, param->interactionType ); } } @@ -368,7 +368,7 @@ unsigned int DsTravel::CACHE_SIZES[eMethod_MAX] = 0, // FALL - Meters? - Fall event naturally only sends on land, no caching necessary. 10, // CLIMB - Meters? 70, // CART - Meters? - 70, // BOAT - Meters? + 70, // BOAT - Meters? 10, // PIG - Meters? 20*60*5, // TIME - GameTicks (20*60*5 ~ 5 mins) }; @@ -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,14 +520,14 @@ 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)) { SmallParam *paramS = (SmallParam*) paramBlob.data; assert( DurangoStats::binaryAchievement(paramS->award) ); app.DebugPrintf("<%ls>\tAchievement(%i)\n", DurangoStats::getUserId(player), paramS->award); - + bool canAward = true; if(paramS->award == eAward_stayinFrosty) { @@ -616,12 +616,12 @@ 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)) { Param *param = (Param*) paramBlob.data; - app.DebugPrintf("<%ls>\tchangedDimension(%i:%i)\n", DurangoStats::getUserId(player), + app.DebugPrintf("<%ls>\tchangedDimension(%i:%i)\n", DurangoStats::getUserId(player), param->fromDimId, param->toDimId); // No longer used. @@ -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)) { @@ -713,7 +713,7 @@ DurangoStats::~DurangoStats() Stat *DurangoStats::get_stat(int i) { - switch (i) + switch (i) { case itemsAcquired_Id: return (Stat*) itemsAcquired; case itemUsed_Id: return (Stat*) itemUsed; @@ -826,7 +826,7 @@ Stat* DurangoStats::get_itemsCrafted(int itemId) { switch (itemId) { - // 4J-JEV: These items can be crafted trivially to and from their block equivalents, + // 4J-JEV: These items can be crafted trivially to and from their block equivalents, // 'Acquire Hardware' also relies on 'Count_Crafted(IronIngot) == Count_Forged(IronIngot)" on the Stats server. case Item::ironIngot_Id: case Item::goldIngot_Id: @@ -839,7 +839,7 @@ Stat* DurangoStats::get_itemsCrafted(int itemId) default: return (Stat*) itemsAcquired; } - + } Stat* DurangoStats::get_itemsSmelted(int itemId) @@ -871,7 +871,7 @@ Stat* DurangoStats::get_enteredBiome(int biomeId) Stat* DurangoStats::get_achievement(eAward achievementId) { // Special case for 'binary' achievements. - if ( binaryAchievement(achievementId) + if ( binaryAchievement(achievementId) || enhancedAchievement(achievementId) ) { switch (achievementId) @@ -888,43 +888,43 @@ Stat* DurangoStats::get_achievement(eAward achievementId) { return get_curedEntity(eTYPE_ZOMBIE); } - + // Other achievements awarded through more detailed generic events. return NULL; } byteArray DurangoStats::getParam_walkOneM(int distance) -{ +{ return DsTravel::createParamBlob(DsTravel::eMethod_walk, distance); } byteArray DurangoStats::getParam_swimOneM(int distance) -{ +{ return DsTravel::createParamBlob(DsTravel::eMethod_swim,distance); } byteArray DurangoStats::getParam_fallOneM(int distance) -{ +{ return DsTravel::createParamBlob(DsTravel::eMethod_fall,distance); } byteArray DurangoStats::getParam_climbOneM(int distance) -{ +{ return DsTravel::createParamBlob(DsTravel::eMethod_climb,distance); } byteArray DurangoStats::getParam_minecartOneM(int distance) -{ +{ return DsTravel::createParamBlob(DsTravel::eMethod_minecart,distance); } byteArray DurangoStats::getParam_boatOneM(int distance) -{ +{ return DsTravel::createParamBlob(DsTravel::eMethod_boat,distance); } byteArray DurangoStats::getParam_pigOneM(int distance) -{ +{ return DsTravel::createParamBlob(DsTravel::eMethod_pig,distance); } @@ -953,10 +953,10 @@ 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(), + itm->getItem()->id, itm->getAuxValue(), itm->GetCount(), player->getHealth(), player->getFoodData()->getFoodLevel() ); } @@ -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); } @@ -993,7 +993,7 @@ byteArray DurangoStats::getParam_craftedEntity(eINSTANCEOF entityId) byteArray DurangoStats::getParam_shearedEntity(eINSTANCEOF entityId) { - return DsMobInteract::createParamBlob(DsMobInteract::eInteract_Sheared, entityId); + return DsMobInteract::createParamBlob(DsMobInteract::eInteract_Sheared, entityId); } byteArray DurangoStats::getParam_time(int timediff) @@ -1016,7 +1016,7 @@ byteArray DurangoStats::getParam_achievement(eAward id) if (binaryAchievement(id)) { return DsAchievement::createSmallParamBlob(id); - } + } else if (enhancedAchievement(id)) { assert(false); // Should be calling the appropriate getParam function. @@ -1071,7 +1071,7 @@ bool DurangoStats::binaryAchievement(eAward achievementId) } /** 4J-JEV, - Basically achievements with an inconsequential extra parameter + Basically achievements with an inconsequential extra parameter that I thought best not to / prefered not to / couldn't be bothered to make class handlers for. (Motivation: it would be nice for players to see how close they were/are to achieving these things). */ @@ -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,12 +1128,12 @@ 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) { //wprintf(uid.toString().c_str()); - + //EventWritePlayerSessionStart( app.DebugPrintf(">>>\tPlayerSessionStart(%ls,%s,%ls,%i,%i)\n", uid.toString(), @@ -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/DurangoStats.h b/Minecraft.World/DurangoStats.h index 1b2f7723..7956b1aa 100644 --- a/Minecraft.World/DurangoStats.h +++ b/Minecraft.World/DurangoStats.h @@ -20,7 +20,7 @@ public: enum eAcquisitionMethod { eAcquisitionMethod_None = 0, - + eAcquisitionMethod_Pickedup, eAcquisitionMethod_Crafted, eAcquisitionMethod_TakenFromChest, @@ -30,7 +30,7 @@ public: eAcquisitionMethod_Mined, eAcquisitionMethod_Placed, - + eAcquisitionMethod_MAX }; @@ -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); }; @@ -100,7 +100,7 @@ public: eMethod_boat, eMethod_pig, - eMethod_time, // Time is a dimension too right... + eMethod_time, // Time is a dimension too right... eMethod_MAX }; @@ -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); }; @@ -134,8 +134,8 @@ 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); }; @@ -240,7 +240,7 @@ protected: virtual Stat* get_changedDimension(int from, int to); virtual Stat* get_enteredBiome(int biomeId); - // Achievements + // Achievements virtual Stat* get_achievement(eAward achievementId); @@ -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/DyePowderItem.cpp b/Minecraft.World/DyePowderItem.cpp index a05b8354..b92e7789 100644 --- a/Minecraft.World/DyePowderItem.cpp +++ b/Minecraft.World/DyePowderItem.cpp @@ -21,8 +21,8 @@ DyePowderItem::DyePowderItem(int id) : Item( id ) icons = NULL; } -const unsigned int DyePowderItem::COLOR_DESCS[] = -{ +const unsigned int DyePowderItem::COLOR_DESCS[] = +{ IDS_ITEM_DYE_POWDER_BLACK, IDS_ITEM_DYE_POWDER_RED, IDS_ITEM_DYE_POWDER_GREEN, @@ -41,8 +41,8 @@ const unsigned int DyePowderItem::COLOR_DESCS[] = IDS_ITEM_DYE_POWDER_WHITE }; -const unsigned int DyePowderItem::COLOR_USE_DESCS[] = -{ +const unsigned int DyePowderItem::COLOR_USE_DESCS[] = +{ IDS_DESC_DYE_BLACK, IDS_DESC_DYE_RED, IDS_DESC_DYE_GREEN, @@ -102,38 +102,38 @@ const int DyePowderItem::MAGENTA = 13; const int DyePowderItem::ORANGE = 14; const int DyePowderItem::WHITE = 15; -Icon *DyePowderItem::getIcon(int itemAuxValue) +Icon *DyePowderItem::getIcon(int itemAuxValue) { int colorValue = Mth::clamp(itemAuxValue, 0, 15); 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; // 4J-PB - Adding a test only version to allow tooltips to be displayed - if (itemInstance->getAuxValue() == WHITE) + if (itemInstance->getAuxValue() == WHITE) { // bone meal is a fertilizer, so instantly grow trees and stuff int tile = level->getTile(x, y, z); - if (tile == Tile::sapling_Id) + if (tile == Tile::sapling_Id) { if(!bTestUseOnOnly) - { - if (!level->isClientSide) + { + if (!level->isClientSide) { ((Sapling *) Tile::sapling)->growTree(level, x, y, z, level->random); itemInstance->count--; @@ -167,13 +167,13 @@ bool DyePowderItem::useOn(shared_ptr itemInstance, shared_ptrgetData(x, y, z) == 7) return false; if(!bTestUseOnOnly) { - if (!level->isClientSide) + if (!level->isClientSide) { ((CropTile *) Tile::tiles[tile])->growCropsToMax(level, x, y, z); itemInstance->count--; @@ -181,12 +181,12 @@ bool DyePowderItem::useOn(shared_ptr itemInstance, shared_ptrgetData(x, y, z) == 7) return false; if(!bTestUseOnOnly) - { - if (!level->isClientSide) + { + if (!level->isClientSide) { ((CropTile *) Tile::crops)->growCropsToMax(level, x, y, z); itemInstance->count--; @@ -205,42 +205,42 @@ bool DyePowderItem::useOn(shared_ptr itemInstance, shared_ptrisClientSide) + { + if (!level->isClientSide) { itemInstance->count--; - for (int j = 0; j < 128; j++) + for (int j = 0; j < 128; j++) { int xx = x; int yy = y + 1; int zz = z; - for (int i = 0; i < j / 16; i++) + for (int i = 0; i < j / 16; i++) { xx += random->nextInt(3) - 1; yy += (random->nextInt(3) - 1) * random->nextInt(3) / 2; zz += random->nextInt(3) - 1; - if (level->getTile(xx, yy - 1, zz) != Tile::grass_Id || level->isSolidBlockingTile(xx, yy, zz)) + if (level->getTile(xx, yy - 1, zz) != Tile::grass_Id || level->isSolidBlockingTile(xx, yy, zz)) { goto mainloop; } } - if (level->getTile(xx, yy, zz) == 0) + if (level->getTile(xx, yy, zz) == 0) { - if (random->nextInt(10) != 0) + if (random->nextInt(10) != 0) { if (Tile::tallgrass->canSurvive(level, xx, yy, zz)) level->setTileAndData(xx, yy, zz, Tile::tallgrass_Id, TallGrass::TALL_GRASS); - } - else if (random->nextInt(3) != 0) + } + else if (random->nextInt(3) != 0) { if (Tile::flower->canSurvive(level, xx, yy, zz)) level->setTile(xx, yy, zz, Tile::flower_Id); - } - else + } + else { if (Tile::rose->canSurvive(level, xx, yy, zz)) level->setTile(xx, yy, zz, Tile::rose_Id); } @@ -289,14 +289,14 @@ 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) + 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) + if (!sheep->isSheared() && sheep->getColor() != newColor) { sheep->setColor(newColor); itemInstance->count--; diff --git a/Minecraft.World/DyePowderItem.h b/Minecraft.World/DyePowderItem.h index b96b4087..df6147b9 100644 --- a/Minecraft.World/DyePowderItem.h +++ b/Minecraft.World/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/EggItem.cpp b/Minecraft.World/EggItem.cpp index b85dbcd6..90c7d931 100644 --- a/Minecraft.World/EggItem.cpp +++ b/Minecraft.World/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/EggItem.h b/Minecraft.World/EggItem.h index 83f09db5..a5763a5e 100644 --- a/Minecraft.World/EggItem.h +++ b/Minecraft.World/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/EggTile.cpp b/Minecraft.World/EggTile.cpp index e6711a3f..64cc4377 100644 --- a/Minecraft.World/EggTile.cpp +++ b/Minecraft.World/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); } @@ -167,7 +167,7 @@ void EggTile::generateTeleportParticles(Level *level,int xt,int yt, int zt,int d } } -bool EggTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face) +bool EggTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face) { return true; } \ No newline at end of file diff --git a/Minecraft.World/EggTile.h b/Minecraft.World/EggTile.h index c8929cbe..7102bd8d 100644 --- a/Minecraft.World/EggTile.h +++ b/Minecraft.World/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/EmptyLevelChunk.cpp b/Minecraft.World/EmptyLevelChunk.cpp index 4934ac96..5bc7be0a 100644 --- a/Minecraft.World/EmptyLevelChunk.cpp +++ b/Minecraft.World/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/EmptyLevelChunk.h b/Minecraft.World/EmptyLevelChunk.h index a8ff27f9..07599723 100644 --- a/Minecraft.World/EmptyLevelChunk.h +++ b/Minecraft.World/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/EnchantItemCommand.cpp b/Minecraft.World/EnchantItemCommand.cpp index aa02b533..da5cd2bf 100644 --- a/Minecraft.World/EnchantItemCommand.cpp +++ b/Minecraft.World/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() )); } \ No newline at end of file diff --git a/Minecraft.World/EnchantItemCommand.h b/Minecraft.World/EnchantItemCommand.h index 5fc6c648..6792da53 100644 --- a/Minecraft.World/EnchantItemCommand.h +++ b/Minecraft.World/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/EnchantedBookItem.cpp b/Minecraft.World/EnchantedBookItem.cpp index 59e7156b..41245b1d 100644 --- a/Minecraft.World/EnchantedBookItem.cpp +++ b/Minecraft.World/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/EnchantedBookItem.h b/Minecraft.World/EnchantedBookItem.h index c67f208f..5b642b72 100644 --- a/Minecraft.World/EnchantedBookItem.h +++ b/Minecraft.World/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/Enchantment.cpp b/Minecraft.World/Enchantment.cpp index 2ce1441a..74d44b3b 100644 --- a/Minecraft.World/Enchantment.cpp +++ b/Minecraft.World/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; } @@ -154,12 +154,12 @@ wstring Enchantment::getFullname(int level,wstring &unformatted) { wchar_t formatted[256]; swprintf(formatted,256,L"%ls %ls",app.GetString( getDescriptionId() ), getLevelString(level).c_str()); - unformatted = formatted; + unformatted = formatted; swprintf(formatted,256,L"%ls",app.GetHTMLColour(eHTMLColor_f),unformatted.c_str()); 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/Enchantment.h b/Minecraft.World/Enchantment.h index 794edf85..08c1ab0a 100644 --- a/Minecraft.World/Enchantment.h +++ b/Minecraft.World/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/EnchantmentHelper.cpp b/Minecraft.World/EnchantmentHelper.cpp index f43ced01..0b744a25 100644 --- a/Minecraft.World/EnchantmentHelper.cpp +++ b/Minecraft.World/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) { @@ -142,12 +142,12 @@ EnchantmentHelper::GetDamageProtectionIteration EnchantmentHelper::getDamageProt /** * Fetches the protection value for enchanted items. -* +* * @param inventory * @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; @@ -172,12 +172,12 @@ void EnchantmentHelper::GetDamageBonusIteration::doEnchantment(Enchantment *ench EnchantmentHelper::GetDamageBonusIteration EnchantmentHelper::getDamageBonusIteration; /** -* +* * @param inventory * @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; @@ -258,7 +258,7 @@ shared_ptr EnchantmentHelper::getRandomItemWith(Enchantment *encha } /** -* +* * @param random * @param slot * The table slot, 0-2 @@ -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; @@ -325,13 +325,13 @@ shared_ptr EnchantmentHelper::enchantItem(Random *random, shared_p } /** -* +* * @param random * @param itemInstance * @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(); @@ -407,7 +407,7 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand } if (!availableEnchantments->empty()) - { + { for(AUTO_VAR(it, availableEnchantments->begin()); it != availableEnchantments->end(); ++it) { values.push_back(it->second); @@ -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/EnchantmentHelper.h b/Minecraft.World/EnchantmentHelper.h index 9f7de5c5..18cc7266 100644 --- a/Minecraft.World/EnchantmentHelper.h +++ b/Minecraft.World/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 @@ -43,20 +43,20 @@ private: /** * Fetches the protection value for enchanted items. - * + * * @param inventory * @param source * @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); }; @@ -64,27 +64,27 @@ private: static GetDamageBonusIteration getDamageBonusIteration; /** - * + * * @param inventory * @param target * @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); /** - * + * * @param random * @param slot * The table slot, 0-2 @@ -94,17 +94,17 @@ 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); /** - * + * * @param random * @param itemInstance * @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/EnchantmentMenu.cpp b/Minecraft.World/EnchantmentMenu.cpp index 23b366ce..d64abc47 100644 --- a/Minecraft.World/EnchantmentMenu.cpp +++ b/Minecraft.World/EnchantmentMenu.cpp @@ -7,9 +7,9 @@ #include "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) @@ -238,8 +238,8 @@ shared_ptr EnchantmentMenu::quickMoveStack(shared_ptr play else if (slotIndex >= INV_SLOT_START && slotIndex < INV_SLOT_END) { // if the item is an enchantable tool - - if(stack->isEnchantable() && (!IngredientSlot->hasItem() ) ) + + if(stack->isEnchantable() && (!IngredientSlot->hasItem() ) ) { if(!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT+1, false)) { @@ -258,7 +258,7 @@ shared_ptr EnchantmentMenu::quickMoveStack(shared_ptr play { // if the item is an enchantable tool - if(stack->isEnchantable() && (!IngredientSlot->hasItem() ) ) + if(stack->isEnchantable() && (!IngredientSlot->hasItem() ) ) { if(!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT+1, false)) { diff --git a/Minecraft.World/EnchantmentMenu.h b/Minecraft.World/EnchantmentMenu.h index 62408f1d..97279dee 100644 --- a/Minecraft.World/EnchantmentMenu.h +++ b/Minecraft.World/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/EnchantmentSlot.h b/Minecraft.World/EnchantmentSlot.h index 590d9e31..c8615288 100644 --- a/Minecraft.World/EnchantmentSlot.h +++ b/Minecraft.World/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/EnchantmentTableEntity.cpp b/Minecraft.World/EnchantmentTableEntity.cpp index 31da3c49..ff52541b 100644 --- a/Minecraft.World/EnchantmentTableEntity.cpp +++ b/Minecraft.World/EnchantmentTableEntity.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/EnchantmentTableEntity.h b/Minecraft.World/EnchantmentTableEntity.h index aa54c812..c7cef9f7 100644 --- a/Minecraft.World/EnchantmentTableEntity.h +++ b/Minecraft.World/EnchantmentTableEntity.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/EnchantmentTableTile.cpp b/Minecraft.World/EnchantmentTableTile.cpp index 70c127ba..911d19cd 100644 --- a/Minecraft.World/EnchantmentTableTile.cpp +++ b/Minecraft.World/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/EnchantmentTableTile.h b/Minecraft.World/EnchantmentTableTile.h index 43816cec..03916274 100644 --- a/Minecraft.World/EnchantmentTableTile.h +++ b/Minecraft.World/EnchantmentTableTile.h @@ -16,14 +16,14 @@ private: public: EnchantmentTableTile(int id); - + virtual void updateDefaultShape(); // 4J Added override bool isCubeShaped(); 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/EnderChestTile.cpp b/Minecraft.World/EnderChestTile.cpp index 7e50a933..2240a070 100644 --- a/Minecraft.World/EnderChestTile.cpp +++ b/Minecraft.World/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/EnderChestTile.h b/Minecraft.World/EnderChestTile.h index 96173f63..54cc1b75 100644 --- a/Minecraft.World/EnderChestTile.h +++ b/Minecraft.World/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/EnderChestTileEntity.cpp b/Minecraft.World/EnderChestTileEntity.cpp index dffa2bd5..25054c23 100644 --- a/Minecraft.World/EnderChestTileEntity.cpp +++ b/Minecraft.World/EnderChestTileEntity.cpp @@ -27,7 +27,7 @@ void EnderChestTileEntity::tick() double xc = x + 0.5; double zc = z + 0.5; - // 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit + // 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_OPEN, 0.2f, level->random->nextFloat() * 0.1f + 0.9f); } if ((openCount == 0 && openness > 0) || (openCount > 0 && openness < 1)) @@ -45,7 +45,7 @@ void EnderChestTileEntity::tick() double xc = x + 0.5; double zc = z + 0.5; - // 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit + // 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_CLOSE, 0.2f, level->random->nextFloat() * 0.1f + 0.9f); } if (openness < 0) @@ -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/EnderChestTileEntity.h b/Minecraft.World/EnderChestTileEntity.h index f6882980..e67b6bcc 100644 --- a/Minecraft.World/EnderChestTileEntity.h +++ b/Minecraft.World/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/EnderCrystal.cpp b/Minecraft.World/EnderCrystal.cpp index 719e9d96..7e43ef66 100644 --- a/Minecraft.World/EnderCrystal.cpp +++ b/Minecraft.World/EnderCrystal.cpp @@ -9,7 +9,7 @@ void EnderCrystal::_init(Level *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 this->defineSynchedData(); @@ -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/EnderDragon.cpp b/Minecraft.World/EnderDragon.cpp index 2ccd453c..d93dc3bd 100644 --- a/Minecraft.World/EnderDragon.cpp +++ b/Minecraft.World/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 @@ -185,7 +185,7 @@ void EnderDragon::aiStep() float flap = Mth::cos(flapTime * PI * 2); float oldFlap = Mth::cos(oFlapTime * PI * 2); - if (oldFlap <= -0.3f && flap >= -0.3f) + if (oldFlap <= -0.3f && flap >= -0.3f) { level->playLocalSound(x, y, z, eSoundType_MOB_ENDERDRAGON_MOVE, 1, 0.8f + random->nextFloat() * .3f, 100.0f); } @@ -352,7 +352,7 @@ void EnderDragon::aiStep() double zdd = zTarget - z; double dist = xdd * xdd + ydd * ydd + zdd * zdd; - + if( getSynchedAction() == e_EnderdragonAction_Sitting_Flaming ) { --m_actionTicks; @@ -379,7 +379,7 @@ void EnderDragon::aiStep() else if( getSynchedAction() == e_EnderdragonAction_Sitting_Scanning ) { attackTarget = level->getNearestPlayer( shared_from_this(), SITTING_ATTACK_VIEW_RANGE, SITTING_ATTACK_Y_VIEW_RANGE ); - + ++m_actionTicks; if( attackTarget != NULL ) { @@ -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; @@ -710,7 +710,7 @@ void EnderDragon::aiStep() if (!level->isClientSide) { double maxDist = 64.0f; - if (getSynchedAction() == e_EnderdragonAction_StrafePlayer && attackTarget != NULL && attackTarget->distanceToSqr(shared_from_this()) < maxDist * maxDist) + if (getSynchedAction() == e_EnderdragonAction_StrafePlayer && attackTarget != NULL && attackTarget->distanceToSqr(shared_from_this()) < maxDist * maxDist) { if (this->canSee(attackTarget)) { @@ -734,14 +734,14 @@ 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; level->addEntity(ie); m_fireballCharge = 0; - app.DebugPrintf("Finding new target due to having fired a fireball\n"); + app.DebugPrintf("Finding new target due to having fired a fireball\n"); if( m_currentPath != NULL ) { while(!m_currentPath->isDone()) @@ -752,8 +752,8 @@ void EnderDragon::aiStep() newTarget = true; findNewTarget(); } - } - else + } + else { if (m_fireballCharge > 0) m_fireballCharge--; } @@ -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) { @@ -809,7 +809,7 @@ void EnderDragon::checkCrystals() } } delete crystals; - + nearestCrystal = crystal; } @@ -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()) @@ -923,7 +923,7 @@ void EnderDragon::findNewTarget() // app.DebugPrintf("Dragon action is now: SittingFlaming\n"); //#endif // m_actionTicks = FLAME_TICKS; - + m_flameAttacks = 0; setSynchedAction(e_EnderdragonAction_Sitting_Scanning); attackTarget = level->getNearestPlayer( shared_from_this(), SITTING_ATTACK_VIEW_RANGE, SITTING_ATTACK_Y_VIEW_RANGE ); @@ -948,7 +948,7 @@ void EnderDragon::findNewTarget() if( m_currentPath == NULL || m_currentPath->isDone() ) { int currentNodeIndex = findClosestNode(); - + // To get the angle to the player correct when landing, head to a node diametrically opposite the player, then swoop in to 4,4 int eggHeight = max( level->seaLevel + 5, level->getTopSolidBlock(PODIUM_X_POS,PODIUM_Z_POS) ); //level->getHeightmap(4,4); playerNearestToEgg = level->getNearestPlayer(PODIUM_X_POS, eggHeight, PODIUM_Z_POS, 128.0); @@ -978,7 +978,7 @@ void EnderDragon::findNewTarget() navigateToNextPathNode(); if(m_currentPath != NULL && m_currentPath->isDone()) - { + { setSynchedAction(e_EnderdragonAction_Landing); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES app.DebugPrintf("Dragon action is now: Landing\n"); @@ -1033,7 +1033,7 @@ void EnderDragon::findNewTarget() } if(m_currentPath != NULL) delete m_currentPath; - m_currentPath = findPath(currentNodeIndex,targetNodeIndex); + m_currentPath = findPath(currentNodeIndex,targetNodeIndex); // Always skip the first node (as that's where we are already) if(m_currentPath != NULL) m_currentPath->next(); @@ -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,10 +1193,10 @@ 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) + if (dragonDeathTime == 1) { //level->globalLevelEvent(LevelEvent::SOUND_DRAGON_DEATH, (int) x, (int) y, (int) z, 0); level->levelEvent(LevelEvent::SOUND_DRAGON_DEATH, (int) x, (int) y, (int) z, 0); @@ -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; } @@ -1323,7 +1323,7 @@ bool EnderDragon::isPickable() } // Fix for TU9 Enderdragon sound hits being the player sound hits - moved this forward from later version -int EnderDragon::getHurtSound() +int EnderDragon::getHurtSound() { return eSoundType_MOB_ENDERDRAGON_HIT; } @@ -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; @@ -1751,7 +1751,7 @@ Path *EnderDragon::reconstruct_path(Node *from, Node *to) NodeArray nodes = NodeArray(count); n = to; nodes.data[--count] = n; - while (n->cameFrom != NULL) + while (n->cameFrom != NULL) { n = n->cameFrom; nodes.data[--count] = n; @@ -1761,7 +1761,7 @@ Path *EnderDragon::reconstruct_path(Node *from, Node *to) return ret; } -void EnderDragon::addAdditonalSaveData(CompoundTag *entityTag) +void EnderDragon::addAdditonalSaveData(CompoundTag *entityTag) { app.DebugPrintf("Adding EnderDragon additional save data\n"); entityTag->putShort(L"RemainingCrystals", m_remainingCrystalsCount); @@ -1770,7 +1770,7 @@ void EnderDragon::addAdditonalSaveData(CompoundTag *entityTag) BossMob::addAdditonalSaveData(entityTag); } -void EnderDragon::readAdditionalSaveData(CompoundTag *tag) +void EnderDragon::readAdditionalSaveData(CompoundTag *tag) { app.DebugPrintf("Reading EnderDragon additional save data\n"); m_remainingCrystalsCount = tag->getShort(L"RemainingCrystals"); @@ -1895,7 +1895,7 @@ double EnderDragon::getHeadPartYRotDiff(int partIndex, doubleArray bodyPos, doub Vec3 *EnderDragon::getHeadLookVector(float a) { Vec3 *result = NULL; - + if( getSynchedAction() == e_EnderdragonAction_Landing || getSynchedAction() == e_EnderdragonAction_Takeoff ) { int eggHeight = level->getTopSolidBlock(PODIUM_X_POS,PODIUM_Z_POS); //level->getHeightmap(4,4); @@ -1903,7 +1903,7 @@ Vec3 *EnderDragon::getHeadLookVector(float a) if( dist < 1.0f ) dist = 1.0f; // The 6.0f is dragon->getHeadPartYOffset(6, start, p) float yOffset = 6.0f / dist; - + double xRotTemp = xRot; double rotScale = 1.5f; xRot = -yOffset * rotScale * 5.0f; diff --git a/Minecraft.World/EnderDragon.h b/Minecraft.World/EnderDragon.h index 8a12c08c..93a352c5 100644 --- a/Minecraft.World/EnderDragon.h +++ b/Minecraft.World/EnderDragon.h @@ -16,7 +16,7 @@ public: private: static const int DATA_ID_SYNCHED_HEALTH = 16; - + // 4J Added for new behaviours static const int DATA_ID_SYNCHED_ACTION = 17; @@ -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(); @@ -161,10 +161,10 @@ private: void strafeAttackTarget(); void navigateToNextPathNode(); -public: +public: virtual void addAdditonalSaveData(CompoundTag *entityTag); virtual void readAdditionalSaveData(CompoundTag *tag); - + public: void handleCrystalDestroyed(DamageSource *source); diff --git a/Minecraft.World/EnderEyeItem.cpp b/Minecraft.World/EnderEyeItem.cpp index a08c1f62..4e82597e 100644 --- a/Minecraft.World/EnderEyeItem.cpp +++ b/Minecraft.World/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) @@ -157,15 +157,15 @@ bool EnderEyeItem::TestUse(Level *level, shared_ptr player) } else { -// int x,z; +// int x,z; // if(app.GetTerrainFeaturePosition(eTerrainFeature_Stronghold,&x,&z)) // { // level->getLevelData()->setXStronghold(x); // level->getLevelData()->setZStronghold(z); // level->getLevelData()->setHasStronghold(); -// +// // app.DebugPrintf("=== FOUND stronghold in terrain features list\n"); -// +// // app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_StrongholdPosition); // } // else @@ -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/EnderEyeItem.h b/Minecraft.World/EnderEyeItem.h index 72036aa5..cbe56cfb 100644 --- a/Minecraft.World/EnderEyeItem.h +++ b/Minecraft.World/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/EnderMan.cpp b/Minecraft.World/EnderMan.cpp index abfc5cb5..e5995587 100644 --- a/Minecraft.World/EnderMan.cpp +++ b/Minecraft.World/EnderMan.cpp @@ -83,16 +83,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)) @@ -112,9 +112,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(); @@ -250,7 +250,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/EnderMan.h b/Minecraft.World/EnderMan.h index f5084532..3b2bda86 100644 --- a/Minecraft.World/EnderMan.h +++ b/Minecraft.World/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/EnderpearlItem.cpp b/Minecraft.World/EnderpearlItem.cpp index 7a9b6e52..e103b73b 100644 --- a/Minecraft.World/EnderpearlItem.cpp +++ b/Minecraft.World/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; @@ -26,9 +26,9 @@ 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) + 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/EnderpearlItem.h b/Minecraft.World/EnderpearlItem.h index 84913b9e..5dbcb619 100644 --- a/Minecraft.World/EnderpearlItem.h +++ b/Minecraft.World/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/Entity.cpp b/Minecraft.World/Entity.cpp index 4c9d5cf6..6b602f6e 100644 --- a/Minecraft.World/Entity.cpp +++ b/Minecraft.World/Entity.cpp @@ -309,7 +309,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; @@ -350,7 +350,7 @@ Entity::~Entity() delete bb; } -shared_ptr Entity::getEntityData() +std::shared_ptr Entity::getEntityData() { return entityData; } @@ -372,7 +372,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); @@ -392,7 +392,7 @@ void Entity::remove() void Entity::setSize(float w, float h) { - if (w != bbWidth || h != bbHeight) + if (w != bbWidth || h != bbHeight) { float oldW = bbWidth; @@ -403,7 +403,7 @@ void Entity::setSize(float w, float h) bb->z1 = bb->z0 + bbWidth; bb->y1 = bb->y0 + bbHeight; - if (bbWidth > oldW && !firstTick && !level->isClientSide) + if (bbWidth > oldW && !firstTick && !level->isClientSide) { move(oldW - bbWidth, 0, oldW - bbWidth); } @@ -421,7 +421,7 @@ void Entity::setPos(EntityPos *pos) void Entity::setRot(float yRot, float xRot) { - /* JAVA: + /* JAVA: this->yRot = yRot % 360.0f; this->xRot = xRot % 360.0f; @@ -531,7 +531,7 @@ void Entity::baseTick() fallDistance = 0; wasInWater = true; onFire = 0; - } + } else { wasInWater = false; @@ -541,7 +541,7 @@ void Entity::baseTick() { onFire = 0; } - else + else { if (onFire > 0) { @@ -958,7 +958,7 @@ void Entity::playStepSound(int xt, int yt, int zt, int t) } } else - { + { if (level->getTile(xt, yt + 1, zt) == Tile::topSnow_Id) { soundType = Tile::topSnow->soundType; @@ -1020,7 +1020,7 @@ void Entity::checkFallDamage(double ya, bool onGround) causeFallDamage(fallDistance); fallDistance = 0; } - } + } else { if (ya < 0) fallDistance -= (float) ya; @@ -1169,7 +1169,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); @@ -1193,7 +1193,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; @@ -1201,11 +1201,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; @@ -1277,7 +1277,7 @@ bool Entity::isShootable() return false; } -void Entity::awardKillScore(shared_ptr victim, int score) +void Entity::awardKillScore(std::shared_ptr victim, int score) { } @@ -1437,19 +1437,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; @@ -1478,12 +1478,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; } @@ -1531,10 +1531,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; @@ -1555,7 +1555,7 @@ double Entity::getRideHeight() return bbHeight * .75; } -void Entity::ride(shared_ptr e) +void Entity::ride(std::shared_ptr e) { xRideRotA = 0; yRideRotA = 0; @@ -1580,7 +1580,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; @@ -1690,7 +1690,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) { } @@ -1739,7 +1739,7 @@ bool Entity::isInvisible() return getSharedFlag(FLAG_INVISIBLE); } -bool Entity::isInvisibleTo(shared_ptr plr) +bool Entity::isInvisibleTo(std::shared_ptr plr) { return isInvisible(); } @@ -1777,7 +1777,7 @@ bool Entity::getSharedFlag(int flag) void Entity::setSharedFlag(int flag, bool value) { byte currentValue = entityData->getByte(DATA_SHARED_FLAGS_ID); - if (value) + if (value) { entityData->set(DATA_SHARED_FLAGS_ID, (byte) (currentValue | (1 << flag))); } @@ -1806,7 +1806,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) { } @@ -1892,12 +1892,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; } @@ -1921,18 +1921,18 @@ 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); } -void Entity::setAnimOverrideBitmask(unsigned int uiBitmask) +void Entity::setAnimOverrideBitmask(unsigned int uiBitmask) { m_uiAnimOverrideBitmask=uiBitmask; app.DebugPrintf("!!! Setting anim override bitmask to %d\n",uiBitmask); } -unsigned int Entity::getAnimOverrideBitmask() -{ +unsigned int Entity::getAnimOverrideBitmask() +{ if(app.GetGameSettings(eGameSetting_CustomSkinAnim)==0 ) { // We have a force animation for some skins (claptrap) diff --git a/Minecraft.World/Entity.h b/Minecraft.World/Entity.h index bde83e30..2b8b167b 100644 --- a/Minecraft.World/Entity.h +++ b/Minecraft.World/Entity.h @@ -52,7 +52,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; @@ -118,7 +118,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) @@ -159,7 +159,7 @@ protected: virtual void defineSynchedData() = 0; public: - shared_ptr getEntityData(); + std::shared_ptr getEntityData(); /* public bool equals(Object obj) { @@ -243,12 +243,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: @@ -261,7 +261,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 @@ -283,20 +283,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(); @@ -306,7 +306,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(); @@ -316,7 +316,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); @@ -336,7 +336,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); @@ -347,7 +347,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: @@ -374,14 +374,14 @@ public: void considerForExtraWandering(bool enable); 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/EntityActionAtPositionPacket.cpp b/Minecraft.World/EntityActionAtPositionPacket.cpp index 7353f932..af7ee82d 100644 --- a/Minecraft.World/EntityActionAtPositionPacket.cpp +++ b/Minecraft.World/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; @@ -27,7 +27,7 @@ EntityActionAtPositionPacket::EntityActionAtPositionPacket(shared_ptr e, this->id = e->entityId; } -void EntityActionAtPositionPacket::read(DataInputStream *dis) //throws IOException +void EntityActionAtPositionPacket::read(DataInputStream *dis) //throws IOException { id = dis->readInt(); action = dis->readByte(); diff --git a/Minecraft.World/EntityActionAtPositionPacket.h b/Minecraft.World/EntityActionAtPositionPacket.h index 35202017..57a730d9 100644 --- a/Minecraft.World/EntityActionAtPositionPacket.h +++ b/Minecraft.World/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/EntityDamageSource.cpp b/Minecraft.World/EntityDamageSource.cpp index 8c7a5ee1..266c867f 100644 --- a/Minecraft.World/EntityDamageSource.cpp +++ b/Minecraft.World/EntityDamageSource.cpp @@ -4,32 +4,32 @@ #include "net.minecraft.world.damagesource.h" #include "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/EntityDamageSource.h b/Minecraft.World/EntityDamageSource.h index bdbe36e7..a8a8ffbb 100644 --- a/Minecraft.World/EntityDamageSource.h +++ b/Minecraft.World/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/EntityEventPacket.h b/Minecraft.World/EntityEventPacket.h index a151dbdb..264e504c 100644 --- a/Minecraft.World/EntityEventPacket.h +++ b/Minecraft.World/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/EntityIO.cpp b/Minecraft.World/EntityIO.cpp index d0677d38..123d4ba5 100644 --- a/Minecraft.World/EntityIO.cpp +++ b/Minecraft.World/EntityIO.cpp @@ -43,7 +43,7 @@ void EntityIO::staticCtor() { setId(ItemEntity::create, eTYPE_ITEMENTITY, L"Item", 1); setId(ExperienceOrb::create, eTYPE_EXPERIENCEORB, L"XPOrb", 2); - + setId(Painting::create, eTYPE_PAINTING, L"Painting", 9); setId(Arrow::create, eTYPE_ARROW, L"Arrow", 10); setId(Snowball::create, eTYPE_SNOWBALL, L"Snowball", 11); @@ -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() ) @@ -208,7 +208,7 @@ wstring EntityIO::getEncodeId(int entityIoValue) //{ //return classIdMap.get(class1); //} - + AUTO_VAR(it, numClassMap->find(entityIoValue)); if(it != numClassMap->end() ) { diff --git a/Minecraft.World/EntityIO.h b/Minecraft.World/EntityIO.h index c9aa9f65..be233d1d 100644 --- a/Minecraft.World/EntityIO.h +++ b/Minecraft.World/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/EntityPos.cpp b/Minecraft.World/EntityPos.cpp index 38b50573..8968ef80 100644 --- a/Minecraft.World/EntityPos.cpp +++ b/Minecraft.World/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/EntityPos.h b/Minecraft.World/EntityPos.h index 5b064901..6b82af01 100644 --- a/Minecraft.World/EntityPos.h +++ b/Minecraft.World/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/EntityTile.cpp b/Minecraft.World/EntityTile.cpp index 8dd68ff2..107742f3 100644 --- a/Minecraft.World/EntityTile.cpp +++ b/Minecraft.World/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/EntityTile.h b/Minecraft.World/EntityTile.h index 7f781c19..584fd1d4 100644 --- a/Minecraft.World/EntityTile.h +++ b/Minecraft.World/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/ExperienceCommand.cpp b/Minecraft.World/ExperienceCommand.cpp index b8ac2efc..7959212c 100644 --- a/Minecraft.World/ExperienceCommand.cpp +++ b/Minecraft.World/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/ExperienceCommand.h b/Minecraft.World/ExperienceCommand.h index b1dd2cbe..5165428f 100644 --- a/Minecraft.World/ExperienceCommand.h +++ b/Minecraft.World/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/ExperienceItem.cpp b/Minecraft.World/ExperienceItem.cpp index 497c2385..d2d5b896 100644 --- a/Minecraft.World/ExperienceItem.cpp +++ b/Minecraft.World/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/ExperienceItem.h b/Minecraft.World/ExperienceItem.h index c8e95925..c0d18dcf 100644 --- a/Minecraft.World/ExperienceItem.h +++ b/Minecraft.World/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/ExperienceOrb.cpp b/Minecraft.World/ExperienceOrb.cpp index 76f2a9ae..a8ae4da4 100644 --- a/Minecraft.World/ExperienceOrb.cpp +++ b/Minecraft.World/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; @@ -258,7 +258,7 @@ int ExperienceOrb::getIcon() * Fetches the biggest possible experience orb value based on a maximum * value. The current algorithm is next prime which is at least twice more * than the previous one. -* +* * @param maxValue * @return */ diff --git a/Minecraft.World/ExperienceOrb.h b/Minecraft.World/ExperienceOrb.h index 524ae52a..d506de93 100644 --- a/Minecraft.World/ExperienceOrb.h +++ b/Minecraft.World/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/ExplodePacket.h b/Minecraft.World/ExplodePacket.h index d4d8b3f9..7f2f0e1b 100644 --- a/Minecraft.World/ExplodePacket.h +++ b/Minecraft.World/ExplodePacket.h @@ -11,7 +11,7 @@ public: float r; vector toBlow; // 4J - was an unorderedset but doesn't require any features of that apart from making it match the ctor toBlow type bool m_bKnockbackOnly; - + private: float knockbackX; float knockbackY; @@ -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/Explosion.cpp b/Minecraft.World/Explosion.cpp index 604813b7..c3facfe7 100644 --- a/Minecraft.World/Explosion.cpp +++ b/Minecraft.World/Explosion.cpp @@ -8,7 +8,7 @@ #include "Explosion.h" #include "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 @@ -147,9 +147,9 @@ void Explosion::explode() double push = pow; e->xd += xa * push; e->yd += ya * push; - e->zd += za * 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/Explosion.h b/Minecraft.World/Explosion.h index c06960d2..f98c9e53 100644 --- a/Minecraft.World/Explosion.h +++ b/Minecraft.World/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/EyeOfEnderSignal.cpp b/Minecraft.World/EyeOfEnderSignal.cpp index 39d9f82e..14e19307 100644 --- a/Minecraft.World/EyeOfEnderSignal.cpp +++ b/Minecraft.World/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/FallingTile.cpp b/Minecraft.World/FallingTile.cpp index 254631ff..e7cf8f0e 100644 --- a/Minecraft.World/FallingTile.cpp +++ b/Minecraft.World/FallingTile.cpp @@ -19,7 +19,7 @@ void FallingTile::_init() data = 0; time = 0; dropItem = true; - + cancelDrop = false; hurtEntities = false; fallDamageMax = 40; @@ -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/FarmTile.cpp b/Minecraft.World/FarmTile.cpp index ecfaf44b..72d428bb 100644 --- a/Minecraft.World/FarmTile.cpp +++ b/Minecraft.World/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/FarmTile.h b/Minecraft.World/FarmTile.h index f9b4b031..3c227c2c 100644 --- a/Minecraft.World/FarmTile.h +++ b/Minecraft.World/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/FenceGateTile.cpp b/Minecraft.World/FenceGateTile.cpp index 6b0243ed..561cdf41 100644 --- a/Minecraft.World/FenceGateTile.cpp +++ b/Minecraft.World/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/FenceGateTile.h b/Minecraft.World/FenceGateTile.h index 277fcd4d..83cc378b 100644 --- a/Minecraft.World/FenceGateTile.h +++ b/Minecraft.World/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/FenceTile.cpp b/Minecraft.World/FenceTile.cpp index 0d1f9bc4..a0c685c6 100644 --- a/Minecraft.World/FenceTile.cpp +++ b/Minecraft.World/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/FenceTile.h b/Minecraft.World/FenceTile.h index 5b61fca4..a08af338 100644 --- a/Minecraft.World/FenceTile.h +++ b/Minecraft.World/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/FireChargeItem.cpp b/Minecraft.World/FireChargeItem.cpp index c4e47b0c..435c4663 100644 --- a/Minecraft.World/FireChargeItem.cpp +++ b/Minecraft.World/FireChargeItem.cpp @@ -13,9 +13,9 @@ 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) + if (level->isClientSide) { return true; } @@ -27,7 +27,7 @@ bool FireChargeItem::useOn(shared_ptr itemInstance, shared_ptrmayBuild(x, y, z)) + if (!player->mayBuild(x, y, z)) { return false; } @@ -40,13 +40,13 @@ bool FireChargeItem::useOn(shared_ptr itemInstance, shared_ptrgetTile(x, y, z); - if (targetType == 0) + if (targetType == 0) { level->playSound( x + 0.5, y + 0.5, z + 0.5,eSoundType_FIRE_IGNITE, 1, random->nextFloat() * 0.4f + 0.8f); level->setTile(x, y, z, Tile::fire_Id); } - if (!player->abilities.instabuild) + if (!player->abilities.instabuild) { itemInstance->count--; } diff --git a/Minecraft.World/FireChargeItem.h b/Minecraft.World/FireChargeItem.h index c0890a46..440222b4 100644 --- a/Minecraft.World/FireChargeItem.h +++ b/Minecraft.World/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/Fireball.cpp b/Minecraft.World/Fireball.cpp index 46be68f7..4f2b53a0 100644 --- a/Minecraft.World/Fireball.cpp +++ b/Minecraft.World/Fireball.cpp @@ -28,7 +28,7 @@ void Fireball::_init() zPower = 0.0; } -Fireball::Fireball(Level *level) : Entity( level ) +Fireball::Fireball(Level *level) : 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 @@ -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 @@ -142,7 +142,7 @@ void Fireball::tick() int minXZ = - (level->dimension->getXZSize() * 16 ) / 2; int maxXZ = (level->dimension->getXZSize() * 16 ) / 2 - 1; - if ((x<=minXZ) || (x>=maxXZ) || (z<=minXZ) || (z>=maxXZ)) + if ((x<=minXZ) || (x>=maxXZ) || (z<=minXZ) || (z>=maxXZ)) { remove(); app.DebugPrintf("Fireball removed - end of world\n"); @@ -163,7 +163,7 @@ void Fireball::tick() if (tile == lastTile) { life++; - if (life == SharedConstants::TICKS_PER_SECOND * 30) + if (life == SharedConstants::TICKS_PER_SECOND * 30) { remove(); app.DebugPrintf("Fireball removed - life is 20*60\n"); @@ -181,7 +181,7 @@ void Fireball::tick() flightTime = 0; } } - else + else { flightTime++; } @@ -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; @@ -217,7 +217,7 @@ void Fireball::tick() hitEntity = e; nearest = dd; } - delete p; + delete p; } } @@ -259,7 +259,7 @@ void Fireball::tick() float inertia = 0.95f; if (isInWater()) { - for (int i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { float s = 1 / 4.0f; level->addParticle(eParticleType_bubble, x - xd * s, y - yd * s, z - zd * s, xd, yd, zd); @@ -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; @@ -384,7 +384,7 @@ bool Fireball::hurt(DamageSource *source, int damage) return false; } -float Fireball::getShadowHeightOffs() +float Fireball::getShadowHeightOffs() { return 0; } diff --git a/Minecraft.World/Fireball.h b/Minecraft.World/Fireball.h index c9471625..a54f6083 100644 --- a/Minecraft.World/Fireball.h +++ b/Minecraft.World/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/FishingHook.cpp b/Minecraft.World/FishingHook.cpp index efa2dbc6..d1fd5bb6 100644 --- a/Minecraft.World/FishingHook.cpp +++ b/Minecraft.World/FishingHook.cpp @@ -38,7 +38,7 @@ void FishingHook::_init() lyr = 0.0; lxr = 0.0; lxd = 0.0; - lyd = 0.0; + lyd = 0.0; lzd = 0.0; owner = nullptr; life = 0; @@ -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(); @@ -195,7 +195,7 @@ void FishingHook::tick() if (shakeTime > 0) shakeTime--; - if (inGround) + if (inGround) { int tile = level->getTile(xTile, yTile, zTile); if (tile != lastTile) @@ -226,17 +226,17 @@ void FishingHook::tick() from = Vec3::newTemp(x, y, z); to = Vec3::newTemp(x + xd, y + yd, z + zd); - if (res != NULL) + if (res != NULL) { 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; @@ -262,7 +262,7 @@ void FishingHook::tick() if (res != NULL) { - if (res->entity != NULL) + if (res->entity != NULL) { // 4J Stu Move fix for : fix for #48587 - CRASH: Code: Gameplay: Hitting another player with the fishing bobber crashes the game. [Fishing pole, line] // Incorrect dynamic_pointer_cast used around the shared_from_this() @@ -327,7 +327,7 @@ void FishingHook::tick() if (nibble > 0) { nibble--; - } + } else { int nibbleOdds = 500; @@ -356,7 +356,7 @@ void FishingHook::tick() } - if (nibble > 0) + if (nibble > 0) { yd -= random->nextFloat() * random->nextFloat() * random->nextFloat() * 0.2; } @@ -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/FishingHook.h b/Minecraft.World/FishingHook.h index ec91e630..809cec75 100644 --- a/Minecraft.World/FishingHook.h +++ b/Minecraft.World/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/FishingRodItem.cpp b/Minecraft.World/FishingRodItem.cpp index 858005e0..418bc625 100644 --- a/Minecraft.World/FishingRodItem.cpp +++ b/Minecraft.World/FishingRodItem.cpp @@ -22,33 +22,33 @@ FishingRodItem::FishingRodItem(int id) : Item(id) emptyIcon = NULL; } -bool FishingRodItem::isHandEquipped() +bool FishingRodItem::isHandEquipped() { return true; } -bool FishingRodItem::isMirroredArt() +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) + if (player->fishing != NULL) { int dmg = player->fishing->retrieve(); instance->hurt(dmg, player); player->swing(); - } - else + } + else { level->playSound(player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); - if (!level->isClientSide) + 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/FishingRodItem.h b/Minecraft.World/FishingRodItem.h index a6df606d..718469dc 100644 --- a/Minecraft.World/FishingRodItem.h +++ b/Minecraft.World/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/FlintAndSteelItem.cpp b/Minecraft.World/FlintAndSteelItem.cpp index 5ebdad2b..a13431a2 100644 --- a/Minecraft.World/FlintAndSteelItem.cpp +++ b/Minecraft.World/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--; @@ -24,14 +24,14 @@ bool FlintAndSteelItem::useOn(shared_ptr instance, shared_ptrmayBuild(x, y, z)) return false; int targetType = level->getTile(x, y, z); if(!bTestUseOnOnly) - { - if (targetType == 0) + { + if (targetType == 0) { if( level->getTile(x, y-1, z) == Tile::obsidian_Id ) { diff --git a/Minecraft.World/FlintAndSteelItem.h b/Minecraft.World/FlintAndSteelItem.h index 4456330a..d8ddce65 100644 --- a/Minecraft.World/FlintAndSteelItem.h +++ b/Minecraft.World/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/FlowerPotTile.cpp b/Minecraft.World/FlowerPotTile.cpp index b245e56d..28f5c8e0 100644 --- a/Minecraft.World/FlowerPotTile.cpp +++ b/Minecraft.World/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/FlowerPotTile.h b/Minecraft.World/FlowerPotTile.h index 50dc18c4..5a615c07 100644 --- a/Minecraft.World/FlowerPotTile.h +++ b/Minecraft.World/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/FollowOwnerGoal.cpp b/Minecraft.World/FollowOwnerGoal.cpp index faba2226..4014771a 100644 --- a/Minecraft.World/FollowOwnerGoal.cpp +++ b/Minecraft.World/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/FollowParentGoal.cpp b/Minecraft.World/FollowParentGoal.cpp index 3e347d62..99224d08 100644 --- a/Minecraft.World/FollowParentGoal.cpp +++ b/Minecraft.World/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/FoodData.cpp b/Minecraft.World/FoodData.cpp index 79ef0fc1..a3c2d34b 100644 --- a/Minecraft.World/FoodData.cpp +++ b/Minecraft.World/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/FoodData.h b/Minecraft.World/FoodData.h index 3416a44a..9d847454 100644 --- a/Minecraft.World/FoodData.h +++ b/Minecraft.World/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/FoodItem.cpp b/Minecraft.World/FoodItem.cpp index f5304cb9..e617490a 100644 --- a/Minecraft.World/FoodItem.cpp +++ b/Minecraft.World/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)) { @@ -73,7 +73,7 @@ shared_ptr FoodItem::use(shared_ptr instance, Level // 4J : WESTY : Other award ... eating cooked pork chop. // 4J-JEV: This is just for an avatar award on the xbox. -#ifdef _XBOX +#ifdef _XBOX if ( instance->getItem() == Item::porkChop_cooked ) { player->awardStat(GenericStats::eatPorkChop(),GenericStats::param_eatPorkChop()); @@ -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/FoodItem.h b/Minecraft.World/FoodItem.h index 16e6ce3f..2100a3b3 100644 --- a/Minecraft.World/FoodItem.h +++ b/Minecraft.World/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/FurnaceMenu.cpp b/Minecraft.World/FurnaceMenu.cpp index dca02231..58f3b77d 100644 --- a/Minecraft.World/FurnaceMenu.cpp +++ b/Minecraft.World/FurnaceMenu.cpp @@ -8,7 +8,7 @@ #include "FurnaceMenu.h" #include "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; @@ -44,12 +44,12 @@ void FurnaceMenu::addSlotListener(ContainerListener *listener) void FurnaceMenu::broadcastChanges() { AbstractContainerMenu::broadcastChanges(); - + AUTO_VAR(itEnd, containerListeners->end()); for (AUTO_VAR(it, containerListeners->begin()); it != itEnd; it++) { ContainerListener *listener = *it; //containerListeners->at(i); - if (tc != furnace->tickCount) + if (tc != furnace->tickCount) { listener->setContainerData(this, 0, furnace->tickCount); } @@ -57,7 +57,7 @@ void FurnaceMenu::broadcastChanges() { listener->setContainerData(this, 1, furnace->litTime); } - if (ld != furnace->litDuration) + if (ld != furnace->litDuration) { listener->setContainerData(this, 2, furnace->litDuration); } @@ -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/FurnaceMenu.h b/Minecraft.World/FurnaceMenu.h index 72b264d3..576a0fa2 100644 --- a/Minecraft.World/FurnaceMenu.h +++ b/Minecraft.World/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/FurnaceResultSlot.cpp b/Minecraft.World/FurnaceResultSlot.cpp index d845dada..c7347ebe 100644 --- a/Minecraft.World/FurnaceResultSlot.cpp +++ b/Minecraft.World/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/FurnaceResultSlot.h b/Minecraft.World/FurnaceResultSlot.h index bc770fab..00967f31 100644 --- a/Minecraft.World/FurnaceResultSlot.h +++ b/Minecraft.World/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/FurnaceTile.cpp b/Minecraft.World/FurnaceTile.cpp index ea0f84e8..23270eee 100644 --- a/Minecraft.World/FurnaceTile.cpp +++ b/Minecraft.World/FurnaceTile.cpp @@ -15,7 +15,7 @@ FurnaceTile::FurnaceTile(int id, bool lit) : EntityTile(id, Material::stone) { random = new Random(); this->lit = lit; - + iconTop = NULL; iconFront = NULL; } @@ -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; @@ -182,10 +182,10 @@ void FurnaceTile::onRemove(Level *level, int x, int y, int z, int id, int data) printf("Server furnace dropping %d of %d/%d\n", count, item->id, item->getAuxValue() ); } #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/FurnaceTile.h b/Minecraft.World/FurnaceTile.h index c192f94d..62106150 100644 --- a/Minecraft.World/FurnaceTile.h +++ b/Minecraft.World/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/FurnaceTileEntity.cpp b/Minecraft.World/FurnaceTileEntity.cpp index 0f18528c..a75b7344 100644 --- a/Minecraft.World/FurnaceTileEntity.cpp +++ b/Minecraft.World/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(); @@ -185,7 +185,7 @@ void FurnaceTileEntity::tick() if ((*items)[FUEL_SLOT] != NULL) { // 4J Added: Keep track of whether charcoal was used in production of current stack. - if ( (*items)[FUEL_SLOT]->getItem()->id == Item::coal_Id + if ( (*items)[FUEL_SLOT]->getItem()->id == Item::coal_Id && (*items)[FUEL_SLOT]->getAuxValue() == CoalItem::CHAR_COAL) { m_charcoalUsed = true; @@ -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/FurnaceTileEntity.h b/Minecraft.World/FurnaceTileEntity.h index db39452e..29267de9 100644 --- a/Minecraft.World/FurnaceTileEntity.h +++ b/Minecraft.World/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/FuzzyZoomLayer.cpp b/Minecraft.World/FuzzyZoomLayer.cpp index 54155ff5..1e4c872a 100644 --- a/Minecraft.World/FuzzyZoomLayer.cpp +++ b/Minecraft.World/FuzzyZoomLayer.cpp @@ -2,7 +2,7 @@ #include "System.h" #include "net.minecraft.world.level.newbiome.layer.h" -FuzzyZoomLayer::FuzzyZoomLayer(int64_t seedMixup, shared_ptrparent) : Layer(seedMixup) +FuzzyZoomLayer::FuzzyZoomLayer(int64_t 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_t seed, shared_ptrsup, int count) +std::shared_ptrFuzzyZoomLayer::zoom(int64_t 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/FuzzyZoomLayer.h b/Minecraft.World/FuzzyZoomLayer.h index 19526931..3c82e6be 100644 --- a/Minecraft.World/FuzzyZoomLayer.h +++ b/Minecraft.World/FuzzyZoomLayer.h @@ -5,7 +5,7 @@ class FuzzyZoomLayer : public Layer { public: - FuzzyZoomLayer(int64_t seedMixup, shared_ptrparent); + FuzzyZoomLayer(int64_t 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_t seed, shared_ptrsup, int count); + static std::shared_ptrzoom(int64_t seed, std::shared_ptrsup, int count); }; \ No newline at end of file diff --git a/Minecraft.World/GameCommandPacket.h b/Minecraft.World/GameCommandPacket.h index 1f63e950..deb2659c 100644 --- a/Minecraft.World/GameCommandPacket.h +++ b/Minecraft.World/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/GameEventPacket.h b/Minecraft.World/GameEventPacket.h index 93ea911c..8f54a91e 100644 --- a/Minecraft.World/GameEventPacket.h +++ b/Minecraft.World/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/GameModeCommand.cpp b/Minecraft.World/GameModeCommand.cpp index 86d4c5a5..94252881 100644 --- a/Minecraft.World/GameModeCommand.cpp +++ b/Minecraft.World/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/GameModeCommand.h b/Minecraft.World/GameModeCommand.h index 66401587..7c08caab 100644 --- a/Minecraft.World/GameModeCommand.h +++ b/Minecraft.World/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/GenericStats.cpp b/Minecraft.World/GenericStats.cpp index 1fa90151..e765fc0c 100644 --- a/Minecraft.World/GenericStats.cpp +++ b/Minecraft.World/GenericStats.cpp @@ -58,51 +58,51 @@ Stat* GenericStats::get_netherLavaCollected() Stat* GenericStats::get_killMob() { - return NULL; + return NULL; } Stat* GenericStats::get_killsZombie() -{ - return NULL; +{ + return NULL; } -Stat* GenericStats::get_killsSkeleton() -{ - return NULL; +Stat* GenericStats::get_killsSkeleton() +{ + return NULL; } -Stat* GenericStats::get_killsCreeper() -{ +Stat* GenericStats::get_killsCreeper() +{ return NULL; } -Stat* GenericStats::get_killsSpider() -{ - return NULL; +Stat* GenericStats::get_killsSpider() +{ + return NULL; } -Stat* GenericStats::get_killsSpiderJockey() -{ +Stat* GenericStats::get_killsSpiderJockey() +{ return NULL; } -Stat* GenericStats::get_killsZombiePigman() -{ - return NULL; +Stat* GenericStats::get_killsZombiePigman() +{ + return NULL; } -Stat* GenericStats::get_killsSlime() -{ +Stat* GenericStats::get_killsSlime() +{ return NULL; } -Stat* GenericStats::get_killsGhast() -{ +Stat* GenericStats::get_killsGhast() +{ return NULL; } -Stat* GenericStats::get_killsNetherZombiePigman() -{ +Stat* GenericStats::get_killsNetherZombiePigman() +{ return NULL; } @@ -173,7 +173,7 @@ Stat* GenericStats::get_itemsUsed(int itemId) Stat *GenericStats::get_itemsBought(int itemId) { - return NULL; + return NULL; } Stat* GenericStats::get_killsEnderdragon() @@ -201,87 +201,87 @@ Stat* GenericStats::get_achievement(eAward achievementId) return NULL; } -Stat* GenericStats::openInventory() +Stat* GenericStats::openInventory() { - return instance->get_achievement( eAward_TakingInventory ); + return instance->get_achievement( eAward_TakingInventory ); } -Stat* GenericStats::mineWood() +Stat* GenericStats::mineWood() { - return instance->get_achievement( eAward_GettingWood ); + return instance->get_achievement( eAward_GettingWood ); } -Stat* GenericStats::buildWorkbench() +Stat* GenericStats::buildWorkbench() { - return instance->get_achievement( eAward_Benchmarking ); + return instance->get_achievement( eAward_Benchmarking ); } -Stat* GenericStats::buildPickaxe() +Stat* GenericStats::buildPickaxe() { - return instance->get_achievement( eAward_TimeToMine); + return instance->get_achievement( eAward_TimeToMine); } -Stat* GenericStats::buildFurnace() +Stat* GenericStats::buildFurnace() { - return instance->get_achievement( eAward_HotTopic ); + return instance->get_achievement( eAward_HotTopic ); } -Stat* GenericStats::acquireIron() +Stat* GenericStats::acquireIron() { - return instance->get_achievement( eAward_AquireHardware ); + return instance->get_achievement( eAward_AquireHardware ); } -Stat* GenericStats::buildHoe() +Stat* GenericStats::buildHoe() { - return instance->get_achievement( eAward_TimeToFarm ); + return instance->get_achievement( eAward_TimeToFarm ); } -Stat* GenericStats::makeBread() +Stat* GenericStats::makeBread() { - return instance->get_achievement( eAward_BakeBread ); + return instance->get_achievement( eAward_BakeBread ); } -Stat* GenericStats::bakeCake() +Stat* GenericStats::bakeCake() { - return instance->get_achievement( eAward_TheLie ); + return instance->get_achievement( eAward_TheLie ); } -Stat* GenericStats::buildBetterPickaxe() +Stat* GenericStats::buildBetterPickaxe() { - return instance->get_achievement( eAward_GettingAnUpgrade ); + return instance->get_achievement( eAward_GettingAnUpgrade ); } -Stat* GenericStats::cookFish() +Stat* GenericStats::cookFish() { return instance->get_achievement( eAward_DeliciousFish ); } -Stat* GenericStats::onARail() +Stat* GenericStats::onARail() { return instance->get_achievement( eAward_OnARail ); } -Stat* GenericStats::buildSword() +Stat* GenericStats::buildSword() { return instance->get_achievement( eAward_TimeToStrike ); } -Stat* GenericStats::killEnemy() +Stat* GenericStats::killEnemy() { return instance->get_achievement( eAward_MonsterHunter ); } -Stat* GenericStats::killCow() +Stat* GenericStats::killCow() { return instance->get_achievement( eAward_CowTipper ); } -Stat* GenericStats::flyPig() +Stat* GenericStats::flyPig() { return instance->get_achievement( eAward_WhenPigsFly ); } -Stat* GenericStats::snipeSkeleton() +Stat* GenericStats::snipeSkeleton() { #ifndef _XBOX return instance->get_achievement( eAward_snipeSkeleton ); @@ -290,7 +290,7 @@ Stat* GenericStats::snipeSkeleton() #endif } -Stat* GenericStats::diamonds() +Stat* GenericStats::diamonds() { #ifndef _XBOX return instance->get_achievement( eAward_diamonds ); @@ -299,7 +299,7 @@ Stat* GenericStats::diamonds() #endif } -Stat* GenericStats::ghast() +Stat* GenericStats::ghast() { #ifndef _XBOX return instance->get_achievement( eAward_ghast ); @@ -308,7 +308,7 @@ Stat* GenericStats::ghast() #endif } -Stat* GenericStats::blazeRod() +Stat* GenericStats::blazeRod() { #ifndef _XBOX return instance->get_achievement( eAward_blazeRod ); @@ -317,7 +317,7 @@ Stat* GenericStats::blazeRod() #endif } -Stat* GenericStats::potion() +Stat* GenericStats::potion() { #ifndef _XBOX return instance->get_achievement( eAward_potion ); @@ -326,7 +326,7 @@ Stat* GenericStats::potion() #endif } -Stat* GenericStats::theEnd() +Stat* GenericStats::theEnd() { #ifndef _XBOX return instance->get_achievement( eAward_theEnd ); @@ -335,7 +335,7 @@ Stat* GenericStats::theEnd() #endif } -Stat* GenericStats::winGame() +Stat* GenericStats::winGame() { #ifndef _XBOX return instance->get_achievement( eAward_winGame ); @@ -344,7 +344,7 @@ Stat* GenericStats::winGame() #endif } -Stat* GenericStats::enchantments() +Stat* GenericStats::enchantments() { #ifndef _XBOX return instance->get_achievement( eAward_enchantments ); @@ -353,7 +353,7 @@ Stat* GenericStats::enchantments() #endif } -Stat* GenericStats::overkill() +Stat* GenericStats::overkill() { #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement( eAward_overkill ); @@ -371,52 +371,52 @@ Stat* GenericStats::bookcase() #endif } -Stat* GenericStats::leaderOfThePack() +Stat* GenericStats::leaderOfThePack() { return instance->get_achievement( eAward_LeaderOfThePack ); } -Stat* GenericStats::MOARTools() +Stat* GenericStats::MOARTools() { return instance->get_achievement( eAward_MOARTools ); } -Stat* GenericStats::dispenseWithThis() +Stat* GenericStats::dispenseWithThis() { return instance->get_achievement( eAward_DispenseWithThis ); } -Stat* GenericStats::InToTheNether() +Stat* GenericStats::InToTheNether() { return instance->get_achievement( eAward_InToTheNether ); } -Stat* GenericStats::socialPost() +Stat* GenericStats::socialPost() { return instance->get_achievement( eAward_socialPost ); } -Stat* GenericStats::eatPorkChop() +Stat* GenericStats::eatPorkChop() { return instance->get_achievement( eAward_eatPorkChop ); } -Stat* GenericStats::play100Days() +Stat* GenericStats::play100Days() { return instance->get_achievement( eAward_play100Days ); } -Stat* GenericStats::arrowKillCreeper() +Stat* GenericStats::arrowKillCreeper() { return instance->get_achievement( eAward_arrowKillCreeper ); } -Stat* GenericStats::mine100Blocks() +Stat* GenericStats::mine100Blocks() { return instance->get_achievement( eAward_mine100Blocks ); } -Stat* GenericStats::kill10Creepers() +Stat* GenericStats::kill10Creepers() { return instance->get_achievement( eAward_kill10Creepers ); } @@ -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. } @@ -819,13 +819,13 @@ byteArray GenericStats::param_blocksMined(int id, int data, int count) } byteArray GenericStats::param_itemsCollected(int id, int aux, int count) -{ - return instance->getParam_itemsCollected(id,aux,count); +{ + return instance->getParam_itemsCollected(id,aux,count); } byteArray GenericStats::param_itemsCrafted(int id, int aux, int count) -{ - return instance->getParam_itemsCrafted(id,aux,count); +{ + return instance->getParam_itemsCrafted(id,aux,count); } byteArray GenericStats::param_itemsSmelted(int id, int aux, int count) @@ -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,9 +844,9 @@ 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); + if ( (plr != NULL) && (mob != NULL) ) return instance->getParam_mobKill(plr, mob, dmgSrc); else return instance->getParam_noArgs(); } @@ -891,8 +891,8 @@ byteArray GenericStats::param_enteredBiome(int biomeId) } byteArray GenericStats::param_noArgs() -{ - return instance->getParam_noArgs(); +{ + return instance->getParam_noArgs(); } byteArray GenericStats::param_openInventory() diff --git a/Minecraft.World/GenericStats.h b/Minecraft.World/GenericStats.h index 541424db..82c201cf 100644 --- a/Minecraft.World/GenericStats.h +++ b/Minecraft.World/GenericStats.h @@ -122,15 +122,15 @@ public: static Stat* kill10Creepers(); static Stat* adventuringTime(); // Requires new Stat - static Stat* repopulation(); + static Stat* repopulation(); static Stat* diamondsToYou(); // +Durango static Stat* porkChop(); // Req Stat? static Stat* passingTheTime(); // Req Stat - static Stat* archer(); + static Stat* archer(); static Stat* theHaggler(); // Req Stat static Stat* potPlanter(); // Req Stat static Stat* itsASign(); // Req Stat - static Stat* ironBelly(); + static Stat* ironBelly(); static Stat* haveAShearfulDay(); static Stat* rainbowCollection(); // Requires new Stat static Stat* stayinFrosty(); // +Durango @@ -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); @@ -249,7 +249,7 @@ public: protected: // ACHIEVEMENTS - VIRTUAL // - + virtual Stat* get_achievement(eAward achievementId); @@ -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/GetInfoPacket.h b/Minecraft.World/GetInfoPacket.h index 90688f3e..cdeb5170 100644 --- a/Minecraft.World/GetInfoPacket.h +++ b/Minecraft.World/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/Ghast.cpp b/Minecraft.World/Ghast.cpp index fcf0b705..9e66830d 100644 --- a/Minecraft.World/Ghast.cpp +++ b/Minecraft.World/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 @@ -62,7 +62,7 @@ bool Ghast::hurt(DamageSource *source, int dmg) return FlyingMob::hurt(source, dmg); } -void Ghast::defineSynchedData() +void Ghast::defineSynchedData() { FlyingMob::defineSynchedData(); @@ -82,7 +82,7 @@ void Ghast::tick() this->textureIdx = current == 1 ? TN_MOB_GHAST_FIRE : TN_MOB_GHAST; } -void Ghast::serverAiStep() +void Ghast::serverAiStep() { if (!level->isClientSide && level->difficulty == Difficulty::PEACEFUL) remove(); checkDespawn(); @@ -107,7 +107,7 @@ void Ghast::serverAiStep() dd = sqrt(dd); - if (canReach(xTarget, yTarget, zTarget, dd)) + if (canReach(xTarget, yTarget, zTarget, dd)) { this->xd += xd / dd * 0.1; this->yd += yd / dd * 0.1; @@ -125,14 +125,14 @@ void Ghast::serverAiStep() if (target == NULL || retargetTime-- <= 0) { target = level->getNearestAttackablePlayer(shared_from_this(), 100); - if (target != NULL) + if (target != NULL) { retargetTime = 20; } } double maxDist = 64.0f; - if (target != NULL && target->distanceToSqr(shared_from_this()) < maxDist * maxDist) + if (target != NULL && target->distanceToSqr(shared_from_this()) < maxDist * maxDist) { double xdd = target->x - x; double ydd = (target->bb->y0 + target->bbHeight / 2) - (y + bbHeight / 2); @@ -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; @@ -160,8 +160,8 @@ void Ghast::serverAiStep() level->addEntity(ie); charge = -40; } - } - else + } + else { if (charge > 0) charge--; } @@ -172,7 +172,7 @@ void Ghast::serverAiStep() if (charge > 0) charge--; } - if (!level->isClientSide) + if (!level->isClientSide) { byte old = entityData->getByte(DATA_IS_CHARGING); byte current = (byte) (charge > 10 ? 1 : 0); @@ -183,7 +183,7 @@ void Ghast::serverAiStep() } } -bool Ghast::canReach(double xt, double yt, double zt, double dist) +bool Ghast::canReach(double xt, double yt, double zt, double dist) { double xd = (xTarget - x) / dist; double yd = (yTarget - y) / dist; @@ -214,7 +214,7 @@ int Ghast::getDeathSound() return eSoundType_MOB_GHAST_DEATH; } -int Ghast::getDeathLoot() +int Ghast::getDeathLoot() { return Item::sulphur->id; } diff --git a/Minecraft.World/Ghast.h b/Minecraft.World/Ghast.h index cdb44b61..f9738625 100644 --- a/Minecraft.World/Ghast.h +++ b/Minecraft.World/Ghast.h @@ -20,8 +20,8 @@ public: int floatDuration; double xTarget, yTarget, zTarget; -private: - shared_ptr target; +private: + std::shared_ptr target; int retargetTime; public: diff --git a/Minecraft.World/GiveItemCommand.cpp b/Minecraft.World/GiveItemCommand.cpp index 1d13592f..076c3ade 100644 --- a/Minecraft.World/GiveItemCommand.cpp +++ b/Minecraft.World/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); @@ -20,20 +20,20 @@ void GiveItemCommand::execute(shared_ptr source, byteArray comman int amount = dis.readInt(); int aux = dis.readInt(); wstring tag = dis.readUTF(); - + 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() )); } \ No newline at end of file diff --git a/Minecraft.World/GiveItemCommand.h b/Minecraft.World/GiveItemCommand.h index 532070a6..0881d9f6 100644 --- a/Minecraft.World/GiveItemCommand.h +++ b/Minecraft.World/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/GoldenAppleItem.cpp b/Minecraft.World/GoldenAppleItem.cpp index 6c99d201..8ed422a7 100644 --- a/Minecraft.World/GoldenAppleItem.cpp +++ b/Minecraft.World/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/GoldenAppleItem.h b/Minecraft.World/GoldenAppleItem.h index 722bb2a9..052fcb49 100644 --- a/Minecraft.World/GoldenAppleItem.h +++ b/Minecraft.World/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/GrowMushroomIslandLayer.cpp b/Minecraft.World/GrowMushroomIslandLayer.cpp index d204502d..a5e9f6aa 100644 --- a/Minecraft.World/GrowMushroomIslandLayer.cpp +++ b/Minecraft.World/GrowMushroomIslandLayer.cpp @@ -3,7 +3,7 @@ #include "net.minecraft.world.level.biome.h" -GrowMushroomIslandLayer::GrowMushroomIslandLayer(int64_t seedMixup, shared_ptr parent) : Layer(seedMixup) +GrowMushroomIslandLayer::GrowMushroomIslandLayer(int64_t seedMixup, std::shared_ptr parent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/GrowMushroomIslandLayer.h b/Minecraft.World/GrowMushroomIslandLayer.h index 6b0860f7..7c340ede 100644 --- a/Minecraft.World/GrowMushroomIslandLayer.h +++ b/Minecraft.World/GrowMushroomIslandLayer.h @@ -4,6 +4,6 @@ class GrowMushroomIslandLayer : public Layer { public: - GrowMushroomIslandLayer(int64_t seedMixup, shared_ptr parent); + GrowMushroomIslandLayer(int64_t 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/HalfSlabTile.cpp b/Minecraft.World/HalfSlabTile.cpp index ed3969c1..9bbcbedb 100644 --- a/Minecraft.World/HalfSlabTile.cpp +++ b/Minecraft.World/HalfSlabTile.cpp @@ -22,56 +22,56 @@ HalfSlabTile::HalfSlabTile(int id, bool fullSize, Material *material) : Tile(id, { this->fullSize = fullSize; - if (fullSize) + if (fullSize) { solid[id] = true; - } - else + } + else { setShape(0, 0, 0, 1, 0.5f, 1); } 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) + if (fullSize) { setShape(0, 0, 0, 1, 1, 1); - } - else + } + else { bool upper = (level->getData(x, y, z) & TOP_SLOT_BIT) != 0; - if (upper) + if (upper) { setShape(0, 0.5f, 0, 1, 1, 1); - } - else + } + else { setShape(0, 0, 0, 1, 0.5f, 1); } } } -void HalfSlabTile::updateDefaultShape() +void HalfSlabTile::updateDefaultShape() { - if (fullSize) + if (fullSize) { setShape(0, 0, 0, 1, 1, 1); - } - else + } + else { setShape(0, 0, 0, 1, 0.5f, 1); } } -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); } -bool HalfSlabTile::isSolidRender(bool isServerLevel) +bool HalfSlabTile::isSolidRender(bool isServerLevel) { return fullSize; } @@ -87,30 +87,30 @@ int HalfSlabTile::getPlacedOnFaceDataValue(Level *level, int x, int y, int z, in return itemValue; } -int HalfSlabTile::getResourceCount(Random *random) +int HalfSlabTile::getResourceCount(Random *random) { - if (fullSize) + if (fullSize) { return 2; } return 1; } -int HalfSlabTile::getSpawnResourcesAuxValue(int data) +int HalfSlabTile::getSpawnResourcesAuxValue(int data) { return data & TYPE_MASK; } -bool HalfSlabTile::isCubeShaped() +bool HalfSlabTile::isCubeShaped() { return fullSize; } -bool HalfSlabTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face) +bool HalfSlabTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face) { if (fullSize) return Tile::shouldRenderFace(level, x, y, z, face); - if (face != Facing::UP && face != Facing::DOWN && !Tile::shouldRenderFace(level, x, y, z, face)) + if (face != Facing::UP && face != Facing::DOWN && !Tile::shouldRenderFace(level, x, y, z, face)) { return false; } @@ -121,13 +121,13 @@ bool HalfSlabTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int oz += Facing::STEP_Z[Facing::OPPOSITE_FACING[face]]; boolean isUpper = (level->getData(ox, oy, oz) & TOP_SLOT_BIT) != 0; - if (isUpper) + if (isUpper) { if (face == Facing::DOWN) return true; if (face == Facing::UP && Tile::shouldRenderFace(level, x, y, z, face)) return true; return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) != 0); - } - else + } + else { if (face == Facing::UP) return true; if (face == Facing::DOWN && Tile::shouldRenderFace(level, x, y, z, face)) return true; @@ -135,7 +135,7 @@ bool HalfSlabTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int } } -bool HalfSlabTile::isHalfSlab(int tileId) +bool HalfSlabTile::isHalfSlab(int tileId) { return tileId == Tile::stoneSlabHalf_Id || tileId == Tile::woodSlabHalf_Id; } diff --git a/Minecraft.World/HalfSlabTile.h b/Minecraft.World/HalfSlabTile.h index 183a4add..4d1e8ecd 100644 --- a/Minecraft.World/HalfSlabTile.h +++ b/Minecraft.World/HalfSlabTile.h @@ -3,7 +3,7 @@ #include "Tile.h" -class HalfSlabTile : public Tile +class HalfSlabTile : public Tile { @@ -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/HangingEntity.cpp b/Minecraft.World/HangingEntity.cpp index 6256a381..fcf80e07 100644 --- a/Minecraft.World/HangingEntity.cpp +++ b/Minecraft.World/HangingEntity.cpp @@ -10,7 +10,7 @@ void HangingEntity::_init(Level *level) -{ +{ checkInterval = 0; dir = 0; xTile = yTile = zTile = 0; @@ -35,7 +35,7 @@ HangingEntity::HangingEntity(Level *level, int xTile, int yTile, int zTile, int this->zTile = zTile; } -void HangingEntity::setDir(int dir) +void HangingEntity::setDir(int dir) { this->dir = dir; this->yRotO = this->yRot = (float)(dir * 90); @@ -44,12 +44,12 @@ void HangingEntity::setDir(int dir) float h = (float)getHeight(); float d = (float)getWidth(); - if (dir == Direction::NORTH || dir == Direction::SOUTH) + if (dir == Direction::NORTH || dir == Direction::SOUTH) { d = 0.5f; yRot = yRotO = (float)(Direction::DIRECTION_OPPOSITE[dir] * 90); - } - else + } + else { w = 0.5f; } @@ -89,19 +89,19 @@ void HangingEntity::setDir(int dir) bb->set(min(x0,x1), min(y0,y1), min(z0,z1), max(x0,x1), max(y0,y1), max(z0,z1)); } -float HangingEntity::offs(int w) +float HangingEntity::offs(int w) { if (w == 32) return 0.5f; if (w == 64) return 0.5f; return 0.0f; } -void HangingEntity::tick() +void HangingEntity::tick() { - if (checkInterval++ == 20 * 5 && !level->isClientSide)//isClientSide) + if (checkInterval++ == 20 * 5 && !level->isClientSide)//isClientSide) { checkInterval = 0; - if (!removed && !survives()) + if (!removed && !survives()) { remove(); dropItem(); @@ -109,13 +109,13 @@ void HangingEntity::tick() } } -bool HangingEntity::survives() +bool HangingEntity::survives() { - if (level->getCubes(shared_from_this(), bb)->size()!=0)//isEmpty()) + if (level->getCubes(shared_from_this(), bb)->size()!=0)//isEmpty()) { return false; - } - else + } + else { int ws = max(1, getWidth() / 16); int hs = max(1, getHeight() / 16); @@ -131,31 +131,31 @@ bool HangingEntity::survives() for (int ss = 0; ss < ws; ss++) { - for (int yy = 0; yy < hs; yy++) + for (int yy = 0; yy < hs; yy++) { Material *m; - if (dir == Direction::NORTH || dir == Direction::SOUTH) + if (dir == Direction::NORTH || dir == Direction::SOUTH) { m = level->getMaterial(xt + ss, yt + yy, zTile); - } - else + } + else { m = level->getMaterial(xTile, yt + yy, zt + ss); } - if (!m->isSolid()) + if (!m->isSolid()) { return false; } } - 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; @@ -167,12 +167,12 @@ bool HangingEntity::survives() return true; } -bool HangingEntity::isPickable() +bool HangingEntity::isPickable() { return true; } -bool HangingEntity::skipAttackInteraction(shared_ptr source) +bool HangingEntity::skipAttackInteraction(std::shared_ptr source) { if(source->GetType()==eTYPE_PLAYER) { @@ -181,13 +181,13 @@ bool HangingEntity::skipAttackInteraction(shared_ptr source) return false; } -bool HangingEntity::hurt(DamageSource *source, int damage) +bool HangingEntity::hurt(DamageSource *source, int damage) { - if (!removed && !level->isClientSide) + if (!removed && !level->isClientSide) { 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,14 +198,14 @@ 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 ); } - if (player != NULL && player->abilities.instabuild) + if (player != NULL && player->abilities.instabuild) { return true; } @@ -216,25 +216,25 @@ bool HangingEntity::hurt(DamageSource *source, int damage) } // 4J - added noEntityCubes parameter -void HangingEntity::move(double xa, double ya, double za, bool noEntityCubes) +void HangingEntity::move(double xa, double ya, double za, bool noEntityCubes) { - if (!level->isClientSide && !removed && (xa * xa + ya * ya + za * za) > 0) + if (!level->isClientSide && !removed && (xa * xa + ya * ya + za * za) > 0) { remove(); dropItem(); } } -void HangingEntity::push(double xa, double ya, double za) +void HangingEntity::push(double xa, double ya, double za) { - if (!level->isClientSide && !removed && (xa * xa + ya * ya + za * za) > 0) + if (!level->isClientSide && !removed && (xa * xa + ya * ya + za * za) > 0) { remove(); dropItem(); } } -void HangingEntity::addAdditonalSaveData(CompoundTag *tag) +void HangingEntity::addAdditonalSaveData(CompoundTag *tag) { tag->putByte(L"Direction", (byte) dir); tag->putInt(L"TileX", xTile); @@ -242,7 +242,7 @@ void HangingEntity::addAdditonalSaveData(CompoundTag *tag) tag->putInt(L"TileZ", zTile); // Back compat - switch (dir) + switch (dir) { case Direction::NORTH: tag->putByte(L"Dir", (byte) 0); @@ -259,15 +259,15 @@ void HangingEntity::addAdditonalSaveData(CompoundTag *tag) } } -void HangingEntity::readAdditionalSaveData(CompoundTag *tag) +void HangingEntity::readAdditionalSaveData(CompoundTag *tag) { - if (tag->contains(L"Direction")) + if (tag->contains(L"Direction")) { dir = tag->getByte(L"Direction"); - } - else + } + else { - switch (tag->getByte(L"Dir")) + switch (tag->getByte(L"Dir")) { case 0: dir = Direction::NORTH; diff --git a/Minecraft.World/HangingEntity.h b/Minecraft.World/HangingEntity.h index b87915e4..0736728b 100644 --- a/Minecraft.World/HangingEntity.h +++ b/Minecraft.World/HangingEntity.h @@ -15,7 +15,7 @@ private: int checkInterval; //eINSTANCEOF eType; -protected: +protected: virtual void defineSynchedData() {}; public: @@ -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/HangingEntityItem.cpp b/Minecraft.World/HangingEntityItem.cpp index 505dce4d..2e299b73 100644 --- a/Minecraft.World/HangingEntityItem.cpp +++ b/Minecraft.World/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,14 +33,14 @@ 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; - if (entity != NULL && entity->survives()) + if (entity != NULL && entity->survives()) { - if (!level->isClientSide) + if (!level->isClientSide) { if(level->addEntity(entity)==TRUE) { @@ -65,22 +65,22 @@ 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) + 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) + } + 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); - } - else + } + else { return nullptr; } diff --git a/Minecraft.World/HangingEntityItem.h b/Minecraft.World/HangingEntityItem.h index 51bd8b23..52983a95 100644 --- a/Minecraft.World/HangingEntityItem.h +++ b/Minecraft.World/HangingEntityItem.h @@ -4,7 +4,7 @@ class HangingEntity; -class HangingEntityItem : public Item +class HangingEntityItem : public Item { private: //final Class clazz; @@ -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/HashExtension.h b/Minecraft.World/HashExtension.h index 7ec9a909..85eec19a 100644 --- a/Minecraft.World/HashExtension.h +++ b/Minecraft.World/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/HatchetItem.cpp b/Minecraft.World/HatchetItem.cpp index 16bf89bf..e0123bf9 100644 --- a/Minecraft.World/HatchetItem.cpp +++ b/Minecraft.World/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/HatchetItem.h b/Minecraft.World/HatchetItem.h index afb6dfc0..2959e38b 100644 --- a/Minecraft.World/HatchetItem.h +++ b/Minecraft.World/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/HeavyTile.cpp b/Minecraft.World/HeavyTile.cpp index 18460f2f..23614a42 100644 --- a/Minecraft.World/HeavyTile.cpp +++ b/Minecraft.World/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/HeavyTile.h b/Minecraft.World/HeavyTile.h index a9186eae..739d3ea0 100644 --- a/Minecraft.World/HeavyTile.h +++ b/Minecraft.World/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/HellSandTile.cpp b/Minecraft.World/HellSandTile.cpp index dbaa6012..71faa279 100644 --- a/Minecraft.World/HellSandTile.cpp +++ b/Minecraft.World/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/HellSandTile.h b/Minecraft.World/HellSandTile.h index 9d8d004e..ef8df044 100644 --- a/Minecraft.World/HellSandTile.h +++ b/Minecraft.World/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/HitResult.cpp b/Minecraft.World/HitResult.cpp index ffa93541..1406d08c 100644 --- a/Minecraft.World/HitResult.cpp +++ b/Minecraft.World/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/HitResult.h b/Minecraft.World/HitResult.h index efcfa75a..7721a0ff 100644 --- a/Minecraft.World/HitResult.h +++ b/Minecraft.World/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/HoeItem.cpp b/Minecraft.World/HoeItem.cpp index 50dde305..11d09b9e 100644 --- a/Minecraft.World/HoeItem.cpp +++ b/Minecraft.World/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; @@ -23,7 +23,7 @@ bool HoeItem::useOn(shared_ptr instance, shared_ptr player int above = level->getTile(x, y + 1, z); // 4J-PB - missing parentheses - if (face != 0 && above == 0 && (targetType == Tile::grass_Id || targetType == Tile::dirt_Id)) + if (face != 0 && above == 0 && (targetType == Tile::grass_Id || targetType == Tile::dirt_Id)) { if(!bTestUseOnOnly) { @@ -40,7 +40,7 @@ bool HoeItem::useOn(shared_ptr instance, shared_ptr player return false; } -bool HoeItem::isHandEquipped() +bool HoeItem::isHandEquipped() { return true; } diff --git a/Minecraft.World/HoeItem.h b/Minecraft.World/HoeItem.h index a4d015ac..e353d6cb 100644 --- a/Minecraft.World/HoeItem.h +++ b/Minecraft.World/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/HouseFeature.cpp b/Minecraft.World/HouseFeature.cpp index f8c5d173..25c4841d 100644 --- a/Minecraft.World/HouseFeature.cpp +++ b/Minecraft.World/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/HurtByTargetGoal.cpp b/Minecraft.World/HurtByTargetGoal.cpp index a146c47d..5570e37a 100644 --- a/Minecraft.World/HurtByTargetGoal.cpp +++ b/Minecraft.World/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/HurtByTargetGoal.h b/Minecraft.World/HurtByTargetGoal.h index 4c6ee5fe..b731fc39 100644 --- a/Minecraft.World/HurtByTargetGoal.h +++ b/Minecraft.World/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/IceTile.cpp b/Minecraft.World/IceTile.cpp index 6ca9cc80..c0338fd5 100644 --- a/Minecraft.World/IceTile.cpp +++ b/Minecraft.World/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/IceTile.h b/Minecraft.World/IceTile.h index b3f1a5e6..3fa9d6d6 100644 --- a/Minecraft.World/IceTile.h +++ b/Minecraft.World/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/IndirectEntityDamageSource.cpp b/Minecraft.World/IndirectEntityDamageSource.cpp index 01c54ed6..009af37e 100644 --- a/Minecraft.World/IndirectEntityDamageSource.cpp +++ b/Minecraft.World/IndirectEntityDamageSource.cpp @@ -4,30 +4,30 @@ #include "net.minecraft.world.damagesource.h" #include "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/IndirectEntityDamageSource.h b/Minecraft.World/IndirectEntityDamageSource.h index b7aec18c..52848de1 100644 --- a/Minecraft.World/IndirectEntityDamageSource.h +++ b/Minecraft.World/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/InteractPacket.h b/Minecraft.World/InteractPacket.h index 0141038d..97b40fa0 100644 --- a/Minecraft.World/InteractPacket.h +++ b/Minecraft.World/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/Inventory.cpp b/Minecraft.World/Inventory.cpp index 8ef3f085..7218e14c 100644 --- a/Minecraft.World/Inventory.cpp +++ b/Minecraft.World/Inventory.cpp @@ -14,7 +14,7 @@ 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 +// 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,11 +83,11 @@ 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++) { - if (items[i] != NULL && items[i]->id == item->id && items[i]->isStackable() + if (items[i] != NULL && items[i]->id == item->id && items[i]->isStackable() && items[i]->count < items[i]->getMaxStackSize() && items[i]->count < getMaxStackSize() && (!items[i]->isStackedByData() || items[i]->getAuxValue() == item->getAuxValue()) && ItemInstance::tagMatches(items[i], item)) @@ -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; @@ -200,7 +200,7 @@ int Inventory::addResource(shared_ptr itemInstance) if (slot < 0) return count; if (items[slot] == NULL) { - items[slot] = ItemInstance::clone(itemInstance); + items[slot] = ItemInstance::clone(itemInstance); player->handleCollectItem(itemInstance); } return 0; @@ -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,16 +269,16 @@ 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; + if(item == NULL) return; int countToRemove = item->count; for (unsigned int i = 0; i < items.length; i++) { if (items[i] != NULL && items[i]->sameItemWithTags(item)) { - int slotCount = items[i]->count; + int slotCount = items[i]->count; items[i]->count -= countToRemove; if(slotCount < countToRemove) { @@ -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; @@ -359,7 +359,7 @@ bool Inventory::add(shared_ptr item) { player->handleCollectItem(item); - player->awardStat( + player->awardStat( GenericStats::itemsCollected(item->id, item->getAuxValue()), GenericStats::param_itemsCollected(item->id, item->getAuxValue(), item->GetCount())); @@ -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) @@ -447,7 +447,7 @@ void Inventory::setItem(unsigned int slot, shared_ptr item) else { items[slot] = item; - } + } player->handleCollectItem(item); /* ItemInstanceArray& pile = items; @@ -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/Inventory.h b/Minecraft.World/Inventory.h index 9d1aa7e0..ca4f6e79 100644 --- a/Minecraft.World/Inventory.h +++ b/Minecraft.World/Inventory.h @@ -25,8 +25,8 @@ public: Player *player; // This is owned by 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,8 +44,8 @@ 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/InventoryMenu.cpp b/Minecraft.World/InventoryMenu.cpp index 979243c1..32370af9 100644 --- a/Minecraft.World/InventoryMenu.cpp +++ b/Minecraft.World/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,16 +86,16 @@ 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); Slot *ChestplateSlot = slots->at(ARMOR_SLOT_START+1); Slot *LeggingsSlot = slots->at(ARMOR_SLOT_START+2); @@ -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) @@ -119,28 +119,28 @@ shared_ptr InventoryMenu::quickMoveStack(shared_ptr player else if (slotIndex >= INV_SLOT_START && slotIndex < INV_SLOT_END) { // 4J-PB - added for quick equip - if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Helmet && (!HelmetSlot->hasItem() ) ) + if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Helmet && (!HelmetSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START, ARMOR_SLOT_START+1, false)) { return nullptr; } } - else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Chestplate && (!ChestplateSlot->hasItem() ) ) + else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Chestplate && (!ChestplateSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START+1, ARMOR_SLOT_START+2, false)) { return nullptr; } } - else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Leggings && (!LeggingsSlot->hasItem() ) ) + else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Leggings && (!LeggingsSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START+2, ARMOR_SLOT_START+3, false)) { return nullptr; } } - else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Boots && (!BootsSlot->hasItem() ) ) + else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Boots && (!BootsSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START+3, ARMOR_SLOT_START+4, false)) { @@ -157,28 +157,28 @@ shared_ptr InventoryMenu::quickMoveStack(shared_ptr player { //ArmorRecipes::_eArmorType eArmourType=ArmorRecipes::GetArmorType(stack->id); - if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Helmet && (!HelmetSlot->hasItem() ) ) + if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Helmet && (!HelmetSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START, ARMOR_SLOT_START+1, false)) { return nullptr; } } - else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Chestplate && (!ChestplateSlot->hasItem() ) ) + else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Chestplate && (!ChestplateSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START+1, ARMOR_SLOT_START+2, false)) { return nullptr; } } - else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Leggings && (!LeggingsSlot->hasItem() ) ) + else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Leggings && (!LeggingsSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START+2, ARMOR_SLOT_START+3, false)) { return nullptr; } } - else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Boots && (!BootsSlot->hasItem() ) ) + else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Boots && (!BootsSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START+3, ARMOR_SLOT_START+4, false)) { @@ -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/InventoryMenu.h b/Minecraft.World/InventoryMenu.h index b37a4be9..cd18f95f 100644 --- a/Minecraft.World/InventoryMenu.h +++ b/Minecraft.World/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/Item.cpp b/Minecraft.World/Item.cpp index 5d723ec5..85a5f1bd 100644 --- a/Minecraft.World/Item.cpp +++ b/Minecraft.World/Item.cpp @@ -275,12 +275,12 @@ void Item::staticCtor() Item::helmet_iron = (ArmorItem *) ( ( new ArmorItem(50, ArmorItem::ArmorMaterial::IRON, 2, ArmorItem::SLOT_HEAD) ) ->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_iron) ->setTextureName(L"helmetIron")->setDescriptionId(IDS_ITEM_HELMET_IRON)->setUseDescriptionId(IDS_DESC_HELMET_IRON) ); Item::helmet_diamond = (ArmorItem *) ( ( new ArmorItem(54, ArmorItem::ArmorMaterial::DIAMOND, 3, ArmorItem::SLOT_HEAD) ) ->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_diamond) ->setTextureName(L"helmetDiamond")->setDescriptionId(IDS_ITEM_HELMET_DIAMOND)->setUseDescriptionId(IDS_DESC_HELMET_DIAMOND) ); Item::helmet_gold = (ArmorItem *) ( ( new ArmorItem(58, ArmorItem::ArmorMaterial::GOLD, 4, ArmorItem::SLOT_HEAD) ) ->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_gold) ->setTextureName(L"helmetGold")->setDescriptionId(IDS_ITEM_HELMET_GOLD)->setUseDescriptionId(IDS_DESC_HELMET_GOLD) ); - + Item::chestplate_cloth = (ArmorItem *) ( ( new ArmorItem(43, ArmorItem::ArmorMaterial::CLOTH, 0, ArmorItem::SLOT_TORSO) ) ->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_cloth) ->setTextureName(L"chestplateCloth")->setDescriptionId(IDS_ITEM_CHESTPLATE_CLOTH)->setUseDescriptionId(IDS_DESC_CHESTPLATE_LEATHER) ); Item::chestplate_iron = (ArmorItem *) ( ( new ArmorItem(51, ArmorItem::ArmorMaterial::IRON, 2, ArmorItem::SLOT_TORSO) ) ->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_iron) ->setTextureName(L"chestplateIron")->setDescriptionId(IDS_ITEM_CHESTPLATE_IRON)->setUseDescriptionId(IDS_DESC_CHESTPLATE_IRON) ); Item::chestplate_diamond = (ArmorItem *) ( ( new ArmorItem(55, ArmorItem::ArmorMaterial::DIAMOND, 3, ArmorItem::SLOT_TORSO) ) ->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_diamond) ->setTextureName(L"chestplateDiamond")->setDescriptionId(IDS_ITEM_CHESTPLATE_DIAMOND)->setUseDescriptionId(IDS_DESC_CHESTPLATE_DIAMOND) ); Item::chestplate_gold = (ArmorItem *) ( ( new ArmorItem(59, ArmorItem::ArmorMaterial::GOLD, 4, ArmorItem::SLOT_TORSO) ) ->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_gold) ->setTextureName(L"chestplateGold")->setDescriptionId(IDS_ITEM_CHESTPLATE_GOLD)->setUseDescriptionId(IDS_DESC_CHESTPLATE_GOLD) ); - + Item::leggings_cloth = (ArmorItem *) ( ( new ArmorItem(44, ArmorItem::ArmorMaterial::CLOTH, 0, ArmorItem::SLOT_LEGS) ) ->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_cloth) ->setTextureName(L"leggingsCloth")->setDescriptionId(IDS_ITEM_LEGGINGS_CLOTH)->setUseDescriptionId(IDS_DESC_LEGGINGS_LEATHER) ); Item::leggings_iron = (ArmorItem *) ( ( new ArmorItem(52, ArmorItem::ArmorMaterial::IRON, 2, ArmorItem::SLOT_LEGS) ) ->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_iron) ->setTextureName(L"leggingsIron")->setDescriptionId(IDS_ITEM_LEGGINGS_IRON)->setUseDescriptionId(IDS_DESC_LEGGINGS_IRON) ); Item::leggings_diamond = (ArmorItem *) ( ( new ArmorItem(56, ArmorItem::ArmorMaterial::DIAMOND, 3, ArmorItem::SLOT_LEGS) ) ->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_diamond) ->setTextureName(L"leggingsDiamond")->setDescriptionId(IDS_ITEM_LEGGINGS_DIAMOND)->setUseDescriptionId(IDS_DESC_LEGGINGS_DIAMOND) ); @@ -303,14 +303,14 @@ void Item::staticCtor() // 4J-PB - todo - add materials and base types to the ones below Item::bucket_empty = ( new BucketItem(69, 0) ) ->setBaseItemTypeAndMaterial(eBaseItemType_utensil, eMaterial_water)->setTextureName(L"bucket")->setDescriptionId(IDS_ITEM_BUCKET)->setUseDescriptionId(IDS_DESC_BUCKET)->setMaxStackSize(16); Item::bowl = ( new Item(25) ) ->setBaseItemTypeAndMaterial(eBaseItemType_utensil, eMaterial_wood)->setTextureName(L"bowl")->setDescriptionId(IDS_ITEM_BOWL)->setUseDescriptionId(IDS_DESC_BOWL)->setMaxStackSize(64); - + Item::bucket_water = ( new BucketItem(70, Tile::water_Id) ) ->setTextureName(L"bucketWater")->setDescriptionId(IDS_ITEM_BUCKET_WATER)->setCraftingRemainingItem(Item::bucket_empty)->setUseDescriptionId(IDS_DESC_BUCKET_WATER); Item::bucket_lava = ( new BucketItem(71, Tile::lava_Id) ) ->setTextureName(L"bucketLava")->setDescriptionId(IDS_ITEM_BUCKET_LAVA)->setCraftingRemainingItem(Item::bucket_empty)->setUseDescriptionId(IDS_DESC_BUCKET_LAVA); Item::milk = ( new MilkBucketItem(79) )->setTextureName(L"milk")->setDescriptionId(IDS_ITEM_BUCKET_MILK)->setCraftingRemainingItem(Item::bucket_empty)->setUseDescriptionId(IDS_DESC_BUCKET_MILK); Item::bow = (BowItem *)( new BowItem(5) ) ->setTextureName(L"bow")->setBaseItemTypeAndMaterial(eBaseItemType_bow, eMaterial_bow) ->setDescriptionId(IDS_ITEM_BOW)->setUseDescriptionId(IDS_DESC_BOW); Item::arrow = ( new Item(6) ) ->setTextureName(L"arrow")->setBaseItemTypeAndMaterial(eBaseItemType_bow, eMaterial_arrow) ->setDescriptionId(IDS_ITEM_ARROW)->setUseDescriptionId(IDS_DESC_ARROW); - + Item::compass = ( new CompassItem(89) ) ->setTextureName(L"compass")->setBaseItemTypeAndMaterial(eBaseItemType_pockettool, eMaterial_compass) ->setDescriptionId(IDS_ITEM_COMPASS)->setUseDescriptionId(IDS_DESC_COMPASS); Item::clock = ( new ClockItem(91) ) ->setTextureName(L"clock")->setBaseItemTypeAndMaterial(eBaseItemType_pockettool, eMaterial_clock) ->setDescriptionId(IDS_ITEM_CLOCK)->setUseDescriptionId(IDS_DESC_CLOCK); Item::map = (MapItem *) ( new MapItem(102) ) ->setTextureName(L"map")->setBaseItemTypeAndMaterial(eBaseItemType_pockettool, eMaterial_map) ->setDescriptionId(IDS_ITEM_MAP)->setUseDescriptionId(IDS_DESC_MAP); @@ -341,7 +341,7 @@ void Item::staticCtor() ->setBaseItemTypeAndMaterial(eBaseItemType_giltFruit,eMaterial_apple)->setTextureName(L"appleGold")->setDescriptionId(IDS_ITEM_APPLE_GOLD);//->setUseDescriptionId(IDS_DESC_GOLDENAPPLE); Item::sign = ( new SignItem(67) ) ->setBaseItemTypeAndMaterial(eBaseItemType_HangingItem, eMaterial_wood)->setTextureName(L"sign")->setDescriptionId(IDS_ITEM_SIGN)->setUseDescriptionId(IDS_DESC_SIGN); - + Item::minecart = ( new MinecartItem(72, Minecart::RIDEABLE) ) ->setTextureName(L"minecart")->setDescriptionId(IDS_ITEM_MINECART)->setUseDescriptionId(IDS_DESC_MINECART); @@ -380,7 +380,7 @@ void Item::staticCtor() Item::cookie = ( new FoodItem(101, 2, FoodConstants::FOOD_SATURATION_POOR, false) ) ->setTextureName(L"cookie")->setDescriptionId(IDS_ITEM_COOKIE)->setUseDescriptionId(IDS_DESC_COOKIE); - Item::shears = (ShearsItem *)( new ShearsItem(103) ) ->setTextureName(L"shears")->setBaseItemTypeAndMaterial(eBaseItemType_devicetool, eMaterial_shears)->setDescriptionId(IDS_ITEM_SHEARS)->setUseDescriptionId(IDS_DESC_SHEARS); + Item::shears = (ShearsItem *)( new ShearsItem(103) ) ->setTextureName(L"shears")->setBaseItemTypeAndMaterial(eBaseItemType_devicetool, eMaterial_shears)->setDescriptionId(IDS_ITEM_SHEARS)->setUseDescriptionId(IDS_DESC_SHEARS); Item::melon = (new FoodItem(104, 2, FoodConstants::FOOD_SATURATION_LOW, false)) ->setTextureName(L"melon")->setDescriptionId(IDS_ITEM_MELON_SLICE)->setUseDescriptionId(IDS_DESC_MELON_SLICE); @@ -473,7 +473,7 @@ void Item::staticCtor() void Item::staticInit() { Stats::buildItemStats(); -} +} _Tier::Tier(int level, int uses, float speed, int damage, int enchantmentValue) : @@ -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; } @@ -683,20 +683,20 @@ bool Item::canBeDepleted() /** * Returns true when the item was used to deal more than default damage -* +* * @param itemInstance * @param mob * @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; } /** * Returns true when the item was used to mine more efficiently -* +* * @param itemInstance * @param tile * @param x @@ -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/Item.h b/Minecraft.World/Item.h index 727fc661..3e3f7e27 100644 --- a/Minecraft.World/Item.h +++ b/Minecraft.World/Item.h @@ -68,8 +68,8 @@ public: eMaterial_stoneSmooth, eMaterial_netherbrick, eMaterial_ender, - eMaterial_glass, - eMaterial_blaze, + eMaterial_glass, + eMaterial_blaze, eMaterial_magic, eMaterial_melon, eMaterial_setfire, @@ -394,13 +394,13 @@ public: static const int bow_Id = 261; static const int arrow_Id = 262; static const int coal_Id = 263; - static const int diamond_Id = 264; + static const int diamond_Id = 264; static const int ironIngot_Id = 265; static const int goldIngot_Id = 266; static const int sword_iron_Id = 267; - static const int sword_wood_Id = 268; + static const int sword_wood_Id = 268; static const int shovel_wood_Id = 269; - static const int pickAxe_wood_Id = 270; + static const int pickAxe_wood_Id = 270; static const int hatchet_wood_Id = 271; static const int sword_stone_Id = 272; static const int shovel_stone_Id = 273; @@ -410,7 +410,7 @@ public: static const int shovel_diamond_Id = 277; static const int pickAxe_diamond_Id = 278; static const int hatchet_diamond_Id = 279; - static const int stick_Id = 280; + static const int stick_Id = 280; static const int bowl_Id = 281; static const int mushroomStew_Id = 282; static const int sword_gold_Id = 283; @@ -425,7 +425,7 @@ public: static const int hoe_iron_Id = 292; static const int hoe_diamond_Id = 293; static const int hoe_gold_Id = 294; - static const int seeds_wheat_Id = 295; + static const int seeds_wheat_Id = 295; static const int wheat_Id = 296; static const int bread_Id = 297; @@ -458,7 +458,7 @@ public: static const int porkChop_raw_Id = 319; static const int porkChop_cooked_Id = 320; static const int painting_Id = 321; - static const int apple_gold_Id = 322; + static const int apple_gold_Id = 322; static const int sign_Id = 323; static const int door_wood_Id = 324; static const int bucket_empty_Id = 325; @@ -474,7 +474,7 @@ public: static const int milk_Id = 335; static const int brick_Id = 336; static const int clay_Id = 337; - static const int reeds_Id = 338; + static const int reeds_Id = 338; static const int paper_Id = 339; static const int book_Id = 340; static const int slimeBall_Id = 341; @@ -487,7 +487,7 @@ public: static const int yellowDust_Id = 348; static const int fish_raw_Id = 349; static const int fish_cooked_Id = 350; - static const int dye_powder_Id = 351; + static const int dye_powder_Id = 351; static const int bone_Id = 352; static const int sugar_Id = 353; static const int cake_Id = 354; @@ -547,7 +547,7 @@ public: static const int record_12_Id = 2266; // 4J-PB - this one isn't playable in the PC game, but is fine in ours - static const int record_08_Id = 2267; + static const int record_08_Id = 2267; // TU9 static const int fireball_Id = 385; @@ -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(); @@ -645,17 +645,17 @@ public: /** * Returns true when the item was used to deal more than default damage - * + * * @param itemInstance * @param mob * @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 - * + * * @param itemInstance * @param tile * @param x @@ -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/ItemEntity.cpp b/Minecraft.World/ItemEntity.cpp index eb7684a6..5c3a4515 100644 --- a/Minecraft.World/ItemEntity.cpp +++ b/Minecraft.World/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); @@ -72,7 +72,7 @@ void ItemEntity::defineSynchedData() void ItemEntity::tick() { Entity::tick(); - + if (throwTime > 0) throwTime--; xo = x; yo = y; @@ -80,7 +80,7 @@ void ItemEntity::tick() yd -= 0.04f; noPhysics = checkInTile(x, (bb->y0 + bb->y1) / 2, z); - + // 4J - added parameter here so that these don't care about colliding with other entities move(xd, yd, zd, true); @@ -133,22 +133,22 @@ 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; @@ -189,7 +189,7 @@ bool ItemEntity::hurt(DamageSource *source, int damage) // 4J - added next line: found whilst debugging an issue with item entities getting into a bad state when being created by a cactus, since entities insides cactuses get hurt // and therefore depending on the timing of things they could get removed from the client when they weren't supposed to be. Are there really any cases were we would want // an itemEntity to be locally hurt? - if (level->isClientSide ) return false; + if (level->isClientSide ) return false; markHurt(); health -= damage; @@ -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()); @@ -251,7 +251,7 @@ void ItemEntity::playerTouch(shared_ptr player) } #endif } - if (item->id == Item::blazeRod_Id) + if (item->id == Item::blazeRod_Id) player->awardStat(GenericStats::blazeRod(), GenericStats::param_blazeRod()); level->playSound(shared_from_this(), eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f); @@ -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/ItemEntity.h b/Minecraft.World/ItemEntity.h index 1f42bc21..456a7441 100644 --- a/Minecraft.World/ItemEntity.h +++ b/Minecraft.World/ItemEntity.h @@ -30,9 +30,9 @@ private: 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/ItemFrame.cpp b/Minecraft.World/ItemFrame.cpp index 141f0630..ec412b33 100644 --- a/Minecraft.World/ItemFrame.cpp +++ b/Minecraft.World/ItemFrame.cpp @@ -33,33 +33,33 @@ ItemFrame::ItemFrame(Level *level, int xTile, int yTile, int zTile, int dir) : H setDir(dir); } -void ItemFrame::defineSynchedData() +void ItemFrame::defineSynchedData() { getEntityData()->defineNULL(DATA_ITEM, NULL); getEntityData()->define(DATA_ROTATION, (byte) 0); } -void ItemFrame::dropItem() +void ItemFrame::dropItem() { - spawnAtLocation(shared_ptr(new ItemInstance(Item::frame)), 0.0f); - shared_ptr item = getItem(); - if (item != NULL) + 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) { @@ -72,19 +72,19 @@ void ItemFrame::setItem(shared_ptr item) getEntityData()->markDirty(DATA_ITEM); } -int ItemFrame::getRotation() +int ItemFrame::getRotation() { return getEntityData()->getByte(DATA_ROTATION); } -void ItemFrame::setRotation(int rotation) +void ItemFrame::setRotation(int rotation) { getEntityData()->set(DATA_ROTATION, (byte) (rotation % 4)); } -void ItemFrame::addAdditonalSaveData(CompoundTag *tag) +void ItemFrame::addAdditonalSaveData(CompoundTag *tag) { - if (getItem() != NULL) + if (getItem() != NULL) { tag->putCompound(L"Item", getItem()->save(new CompoundTag())); tag->putByte(L"ItemRotation", (byte) getRotation()); @@ -93,10 +93,10 @@ void ItemFrame::addAdditonalSaveData(CompoundTag *tag) HangingEntity::addAdditonalSaveData(tag); } -void ItemFrame::readAdditionalSaveData(CompoundTag *tag) +void ItemFrame::readAdditionalSaveData(CompoundTag *tag) { CompoundTag *itemTag = tag->getCompound(L"Item"); - if (itemTag != NULL && !itemTag->isEmpty()) + if (itemTag != NULL && !itemTag->isEmpty()) { setItem(ItemInstance::fromTag(itemTag)); setRotation(tag->getByte(L"ItemRotation")); @@ -106,36 +106,36 @@ 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())) { return false; } - if (getItem() == NULL) + if (getItem() == NULL) { - shared_ptr item = player->getCarriedItem(); + std::shared_ptr item = player->getCarriedItem(); - if (item != NULL) + if (item != NULL) { - if (!level->isClientSide)//isClientSide) + if (!level->isClientSide)//isClientSide) { setItem(item); - if (!player->abilities.instabuild) + if (!player->abilities.instabuild) { - if (--item->count <= 0) + if (--item->count <= 0) { player->inventory->setItem(player->inventory->selected, nullptr); } } } } - } - else + } + else { - if (!level->isClientSide)//isClientSide) + if (!level->isClientSide)//isClientSide) { setRotation(getRotation() + 1); } diff --git a/Minecraft.World/ItemFrame.h b/Minecraft.World/ItemFrame.h index 1af5c2e9..d39c6cc8 100644 --- a/Minecraft.World/ItemFrame.h +++ b/Minecraft.World/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/ItemInstance.cpp b/Minecraft.World/ItemInstance.cpp index ab042af0..99b9fb74 100644 --- a/Minecraft.World/ItemInstance.cpp +++ b/Minecraft.World/ItemInstance.cpp @@ -28,17 +28,17 @@ void ItemInstance::_init(int id, int count, int auxValue) this->m_bForceNumberDisplay=false; } -ItemInstance::ItemInstance(Tile *tile) +ItemInstance::ItemInstance(Tile *tile) { _init(tile->id, 1, 0); } -ItemInstance::ItemInstance(Tile *tile, int count) +ItemInstance::ItemInstance(Tile *tile, int count) { _init(tile->id, count, 0); } // 4J-PB - added -ItemInstance::ItemInstance(MapItem *item, int count) +ItemInstance::ItemInstance(MapItem *item, int count) { _init(item->id, count, 0); } @@ -48,19 +48,19 @@ ItemInstance::ItemInstance(Tile *tile, int count, int auxValue) _init(tile->id, count, auxValue); } -ItemInstance::ItemInstance(Item *item) +ItemInstance::ItemInstance(Item *item) { _init(item->id, 1, 0); } -ItemInstance::ItemInstance(Item *item, int count) +ItemInstance::ItemInstance(Item *item, int count) { _init(item->id, count, 0); } -ItemInstance::ItemInstance(Item *item, int count, int auxValue) +ItemInstance::ItemInstance(Item *item, int count, int auxValue) { _init(item->id, count, auxValue); } @@ -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,32 +111,32 @@ 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); } -float ItemInstance::getDestroySpeed(Tile *tile) +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); } -CompoundTag *ItemInstance::save(CompoundTag *compoundTag) +CompoundTag *ItemInstance::save(CompoundTag *compoundTag) { compoundTag->putShort(L"id", (short) id); compoundTag->putByte(L"Count", (byte) count); @@ -167,7 +167,7 @@ bool ItemInstance::isStackable() return getMaxStackSize() > 1 && (!isDamageableItem() || !isDamaged()); } -bool ItemInstance::isDamageableItem() +bool ItemInstance::isDamageableItem() { return Item::items[id]->getMaxDamage() > 0; } @@ -175,7 +175,7 @@ bool ItemInstance::isDamageableItem() /** * Returns true if this item type only can be stacked with items that have * the same auxValue data. - * + * * @return */ @@ -184,7 +184,7 @@ bool ItemInstance::isStackedByData() return Item::items[id]->isStackedByData(); } -bool ItemInstance::isDamaged() +bool ItemInstance::isDamaged() { return isDamageableItem() && auxValue > 0; } @@ -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); @@ -232,7 +232,7 @@ void ItemInstance::hurt(int i, shared_ptr owner) // 4J Stu - Changed in TU6 to not damage items in creative mode if (!(owner != NULL && player->abilities.instabuild)) auxValue += i; - + if (auxValue > getMaxDamage()) { owner->breakItem(shared_from_this()); @@ -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 = + //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 = + //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; @@ -337,16 +337,16 @@ bool ItemInstance::matches(shared_ptr b) /** * Checks if this item is the same item as the other one, disregarding the * 'count' value. - * + * * @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; @@ -367,12 +367,12 @@ bool ItemInstance::sameItem_not_shared(ItemInstance *b) return id == b->id && auxValue == b->auxValue; } -unsigned int ItemInstance::getUseDescriptionId() +unsigned int ItemInstance::getUseDescriptionId() { return Item::items[id]->getUseDescriptionId(shared_from_this()); } -unsigned int ItemInstance::getDescriptionId(int iData /*= -1*/) +unsigned int ItemInstance::getDescriptionId(int iData /*= -1*/) { return Item::items[id]->getDescriptionId(shared_from_this()); } @@ -384,15 +384,15 @@ 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(); } -wstring ItemInstance::toString() +wstring ItemInstance::toString() { //return count + "x" + Item::items[id]->getDescriptionId() + "@" + auxValue; - + std::wostringstream oss; // 4J-PB - TODO - temp fix until ore recipe issue is fixed if(Item::items[id]==NULL) @@ -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]; @@ -667,7 +667,7 @@ int ItemInstance::get4JData() } } // 4J Added - to show strength on potions -bool ItemInstance::hasPotionStrengthBar() +bool ItemInstance::hasPotionStrengthBar() { // exclude a bottle of water from this if((id==Item::potion_Id) && (auxValue !=0))// && (!MACRO_POTION_IS_AKWARD(auxValue))) 4J-PB leaving the bar on an awkward potion so we can differentiate it from a water bottle @@ -678,7 +678,7 @@ bool ItemInstance::hasPotionStrengthBar() return false; } -int ItemInstance::GetPotionStrength() +int ItemInstance::GetPotionStrength() { if(MACRO_POTION_IS_INSTANTDAMAGE(auxValue) || MACRO_POTION_IS_INSTANTHEALTH(auxValue) ) { @@ -693,17 +693,17 @@ int ItemInstance::GetPotionStrength() // TU9 -bool ItemInstance::isFramed() +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/ItemInstance.h b/Minecraft.World/ItemInstance.h index c1e52177..dd3509ec 100644 --- a/Minecraft.World/ItemInstance.h +++ b/Minecraft.World/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, float clickY, float clickZ, bool bTestUseOnOnly=false); + bool useOn(std::shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, 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/KeepAlivePacket.cpp b/Minecraft.World/KeepAlivePacket.cpp index fee97910..88fd4fdb 100644 --- a/Minecraft.World/KeepAlivePacket.cpp +++ b/Minecraft.World/KeepAlivePacket.cpp @@ -21,7 +21,7 @@ void KeepAlivePacket::handle(PacketListener *listener) listener->handleKeepAlive(shared_from_this()); } -void KeepAlivePacket::read(DataInputStream *dis) //throws IOException +void KeepAlivePacket::read(DataInputStream *dis) //throws IOException { id = dis->readInt(); } @@ -31,7 +31,7 @@ void KeepAlivePacket::write(DataOutputStream *dos) //throws IOException dos->writeInt(id); } -int KeepAlivePacket::getEstimatedSize() +int KeepAlivePacket::getEstimatedSize() { return 4; } @@ -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/KeepAlivePacket.h b/Minecraft.World/KeepAlivePacket.h index a44d8745..d05e76d4 100644 --- a/Minecraft.World/KeepAlivePacket.h +++ b/Minecraft.World/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/KickPlayerPacket.h b/Minecraft.World/KickPlayerPacket.h index b9a6ce3e..62dd0dd1 100644 --- a/Minecraft.World/KickPlayerPacket.h +++ b/Minecraft.World/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/KillCommand.cpp b/Minecraft.World/KillCommand.cpp index 30a7880e..3a82378b 100644 --- a/Minecraft.World/KillCommand.cpp +++ b/Minecraft.World/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/KillCommand.h b/Minecraft.World/KillCommand.h index a88b2069..21155b6f 100644 --- a/Minecraft.World/KillCommand.h +++ b/Minecraft.World/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/LadderTile.cpp b/Minecraft.World/LadderTile.cpp index 32f35ed8..4f0dfb14 100644 --- a/Minecraft.World/LadderTile.cpp +++ b/Minecraft.World/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/LadderTile.h b/Minecraft.World/LadderTile.h index 823f35a7..97e4efc8 100644 --- a/Minecraft.World/LadderTile.h +++ b/Minecraft.World/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/LavaSlime.cpp b/Minecraft.World/LavaSlime.cpp index 3ab32d90..2131c24a 100644 --- a/Minecraft.World/LavaSlime.cpp +++ b/Minecraft.World/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/LavaSlime.h b/Minecraft.World/LavaSlime.h index 08857ca9..8a2e5db9 100644 --- a/Minecraft.World/LavaSlime.h +++ b/Minecraft.World/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/Layer.cpp b/Minecraft.World/Layer.cpp index ca805912..8ac5972b 100644 --- a/Minecraft.World/Layer.cpp +++ b/Minecraft.World/Layer.cpp @@ -21,17 +21,17 @@ LayerArray Layer::getDefaultLayers(int64_t 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_t 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_t 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/Layer.h b/Minecraft.World/Layer.h index 6f31e94a..c949cfa6 100644 --- a/Minecraft.World/Layer.h +++ b/Minecraft.World/Layer.h @@ -14,7 +14,7 @@ private: int64_t seed; protected: - shared_ptrparent; + std::shared_ptrparent; private: int64_t rval; diff --git a/Minecraft.World/LeafTile.cpp b/Minecraft.World/LeafTile.cpp index 8b7d381c..bed4a7ca 100644 --- a/Minecraft.World/LeafTile.cpp +++ b/Minecraft.World/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/LeafTile.h b/Minecraft.World/LeafTile.h index e6c39a7f..2ca8daef 100644 --- a/Minecraft.World/LeafTile.h +++ b/Minecraft.World/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,11 +63,11 @@ 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/LeafTileItem.cpp b/Minecraft.World/LeafTileItem.cpp index 40036ca0..96300b1e 100644 --- a/Minecraft.World/LeafTileItem.cpp +++ b/Minecraft.World/LeafTileItem.cpp @@ -18,11 +18,11 @@ int LeafTileItem::getLevelDataForAuxValue(int auxValue) Icon *LeafTileItem::getIcon(int itemAuxValue) { - return Tile::leaves->getTexture(0, itemAuxValue); + return Tile::leaves->getTexture(0, 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/LeafTileItem.h b/Minecraft.World/LeafTileItem.h index cd311590..cd266035 100644 --- a/Minecraft.World/LeafTileItem.h +++ b/Minecraft.World/LeafTileItem.h @@ -3,7 +3,7 @@ using namespace std; #include "TileItem.h" -class LeafTileItem : public TileItem +class LeafTileItem : public TileItem { using TileItem::getColor; public: @@ -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/Level.cpp b/Minecraft.World/Level.cpp index c159ecb8..3ad39b66 100644 --- a/Minecraft.World/Level.cpp +++ b/Minecraft.World/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_t 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, byte event) +void Level::broadcastEntityEvent(std::shared_ptr e, byte 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.h b/Minecraft.World/Level.h index ecafc02b..abf2489d 100644 --- a/Minecraft.World/Level.h +++ b/Minecraft.World/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); - - shared_ptr getPlayerByName(const wstring& name); - shared_ptr getPlayerByUUID(const wstring& name); // 4J Added + 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); + + 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, byte 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, byte 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/LevelChunk.cpp b/Minecraft.World/LevelChunk.cpp index 332f12f5..b27fb611 100644 --- a/Minecraft.World/LevelChunk.cpp +++ b/Minecraft.World/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/LevelChunk.h b/Minecraft.World/LevelChunk.h index 820835c3..16b6a8a7 100644 --- a/Minecraft.World/LevelChunk.h +++ b/Minecraft.World/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/LevelData.cpp b/Minecraft.World/LevelData.cpp index 486fbe98..6d8d76b5 100644 --- a/Minecraft.World/LevelData.cpp +++ b/Minecraft.World/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/LevelData.h b/Minecraft.World/LevelData.h index 405ba1b8..40ccb849 100644 --- a/Minecraft.World/LevelData.h +++ b/Minecraft.World/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/LevelEventPacket.h b/Minecraft.World/LevelEventPacket.h index 6c2fdbaf..78da348a 100644 --- a/Minecraft.World/LevelEventPacket.h +++ b/Minecraft.World/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/LevelListener.h b/Minecraft.World/LevelListener.h index ec9b11de..98222e84 100644 --- a/Minecraft.World/LevelListener.h +++ b/Minecraft.World/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/LevelSoundPacket.h b/Minecraft.World/LevelSoundPacket.h index 403ac092..4e6ede72 100644 --- a/Minecraft.World/LevelSoundPacket.h +++ b/Minecraft.World/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/LevelSource.h b/Minecraft.World/LevelSource.h index 7ff99146..7bfef06b 100644 --- a/Minecraft.World/LevelSource.h +++ b/Minecraft.World/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/LevelStorage.h b/Minecraft.World/LevelStorage.h index 25d2aba2..61d6cee2 100644 --- a/Minecraft.World/LevelStorage.h +++ b/Minecraft.World/LevelStorage.h @@ -12,7 +12,7 @@ class File; class ConsoleSaveFile; -class LevelStorage +class LevelStorage { public: static const wstring NETHER_FOLDER; @@ -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/LevelStorageProfilerDecorator.cpp b/Minecraft.World/LevelStorageProfilerDecorator.cpp index b6a4276e..532bdcfc 100644 --- a/Minecraft.World/LevelStorageProfilerDecorator.cpp +++ b/Minecraft.World/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/LevelStorageProfilerDecorator.h b/Minecraft.World/LevelStorageProfilerDecorator.h index 98ed7620..bd1751cc 100644 --- a/Minecraft.World/LevelStorageProfilerDecorator.h +++ b/Minecraft.World/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/LevelStorageSource.h b/Minecraft.World/LevelStorageSource.h index 16b8df88..ff6a41f7 100644 --- a/Minecraft.World/LevelStorageSource.h +++ b/Minecraft.World/LevelStorageSource.h @@ -9,11 +9,11 @@ class LevelData; class LevelStorage; class ConsoleSaveFile; -class LevelStorageSource +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; @@ -24,7 +24,7 @@ public: * handle. *

* Also, a new levelId may not overwrite an existing one. - * + * * @param levelId * @return */ diff --git a/Minecraft.World/LeverTile.cpp b/Minecraft.World/LeverTile.cpp index a8231251..054bc461 100644 --- a/Minecraft.World/LeverTile.cpp +++ b/Minecraft.World/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 ) { @@ -290,7 +290,7 @@ bool LeverTile::getDirectSignal(Level *level, int x, int y, int z, int dir) int data = level->getData(x, y, z); if ((data & 8) == 0) return false; int myDir = data & 7; - + if (myDir == 0 && dir == 0) return true; if (myDir == 7 && dir == 0) return true; if (myDir == 6 && dir == 1) return true; diff --git a/Minecraft.World/LeverTile.h b/Minecraft.World/LeverTile.h index 4d00db78..3c0140b5 100644 --- a/Minecraft.World/LeverTile.h +++ b/Minecraft.World/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/LightningBolt.cpp b/Minecraft.World/LightningBolt.cpp index 901bedf1..fe189cf4 100644 --- a/Minecraft.World/LightningBolt.cpp +++ b/Minecraft.World/LightningBolt.cpp @@ -9,7 +9,7 @@ #include "net.minecraft.world.level.dimension.h" -LightningBolt::LightningBolt(Level *level, double x, double y, double z) : +LightningBolt::LightningBolt(Level *level, double x, double y, double z) : life( 0 ), seed( 0 ), flashes( 0 ), @@ -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/LiquidTile.cpp b/Minecraft.World/LiquidTile.cpp index 466589a4..a17ff525 100644 --- a/Minecraft.World/LiquidTile.cpp +++ b/Minecraft.World/LiquidTile.cpp @@ -115,7 +115,7 @@ bool LiquidTile::isSolidFace(LevelSource *level, int x, int y, int z, int face) if (m == this->material) return false; if (face == Facing::UP) return true; if (m == Material::ice) return false; - + return Tile::isSolidFace(level, x, y, z, face); } @@ -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/LiquidTile.h b/Minecraft.World/LiquidTile.h index 67eb5b65..37ee3dd4 100644 --- a/Minecraft.World/LiquidTile.h +++ b/Minecraft.World/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/LoginPacket.h b/Minecraft.World/LoginPacket.h index bf7164fa..26c32ca6 100644 --- a/Minecraft.World/LoginPacket.h +++ b/Minecraft.World/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/LookControl.cpp b/Minecraft.World/LookControl.cpp index 829c3e4a..13783c81 100644 --- a/Minecraft.World/LookControl.cpp +++ b/Minecraft.World/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; @@ -54,7 +54,7 @@ void LookControl::tick() mob->yHeadRot = rotlerp(mob->yHeadRot, yRotD, yMax); } else - { + { mob->yHeadRot = rotlerp(mob->yHeadRot, mob->yBodyRot, 10); } diff --git a/Minecraft.World/LookControl.h b/Minecraft.World/LookControl.h index add64e4a..fe182e7c 100644 --- a/Minecraft.World/LookControl.h +++ b/Minecraft.World/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/MakeLoveGoal.cpp b/Minecraft.World/MakeLoveGoal.cpp index 89f09f1d..cff6d01e 100644 --- a/Minecraft.World/MakeLoveGoal.cpp +++ b/Minecraft.World/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/MapItem.cpp b/Minecraft.World/MapItem.cpp index abf4fb9a..3f5682ab 100644 --- a/Minecraft.World/MapItem.cpp +++ b/Minecraft.World/MapItem.cpp @@ -19,12 +19,12 @@ 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) + if (mapItemSavedData == NULL) { // 4J Stu - This call comes from ClientConnection, but i don't see why we should be trying to work out // the id again when it's passed as a param. In any case that won't work with the new map setup @@ -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; } @@ -75,18 +75,18 @@ shared_ptr MapItem::getSavedData(shared_ptr item mapItemSavedData->z = Math::round(level->getLevelData()->getZSpawn() / scale) * scale; #endif mapItemSavedData->dimension = (byte) level->dimension->id; - + 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) + if (level->dimension->id != data->dimension) { // Wrong dimension, abort return; @@ -152,8 +152,8 @@ void MapItem::update(Level *level, shared_ptr player, shared_ptr> 20) & 1) == 0) count[Tile::dirt_Id] += 10; else count[Tile::rock_Id] += 10; hh = 100; - } - else + } + else { for (int xs = 0; xs < scale; xs++) { @@ -161,7 +161,7 @@ void MapItem::update(Level *level, shared_ptr player, shared_ptrgetHeightmap(xs + xso, zs + zso) + 1; int t = 0; - if (yy > 1) + if (yy > 1) { bool ok = false; do @@ -222,7 +222,7 @@ void MapItem::update(Level *level, shared_ptr player, shared_ptr 0) + if (tBest > 0) { MaterialColor *mc = Tile::tiles[tBest]->material->color; if (mc == MaterialColor::water) @@ -252,27 +252,27 @@ void MapItem::update(Level *level, shared_ptr player, shared_ptrcolors[x + z * w] = newColor; } } - if (yd0 <= yd1) + if (yd0 <= yd1) { data->setDirty(x, yd0, yd1); } } } -void MapItem::inventoryTick(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); - if (dynamic_pointer_cast(owner) != NULL) + 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; @@ -283,7 +283,7 @@ void MapItem::inventoryTick(shared_ptr itemInstance, Level *level, ownersData->tickCarriedBy(player, itemInstance ); ownersData->mergeInMapData(data); player->inventoryMenu->broadcastChanges(); - + data = ownersData; } else @@ -292,13 +292,13 @@ void MapItem::inventoryTick(shared_ptr itemInstance, Level *level, } } - if (selected) + if (selected) { update(level, owner, data); } } -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]; @@ -314,19 +314,19 @@ void MapItem::onCraftedBy(shared_ptr itemInstance, Level *level, s #endif itemInstance->setAuxValue(level->getAuxValueForMap(player->getXuid(), player->dimension, centreXC, centreZC, mapScale)); - + 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 data->x = centreXC; @@ -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/MapItem.h b/Minecraft.World/MapItem.h index dc16339d..2d4f0518 100644 --- a/Minecraft.World/MapItem.h +++ b/Minecraft.World/MapItem.h @@ -5,7 +5,7 @@ using namespace std; class MapItemSavedData; -class MapItem : public ComplexItem +class MapItem : public ComplexItem { public: static const int IMAGE_WIDTH = 128; @@ -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/MapItemSavedData.cpp b/Minecraft.World/MapItemSavedData.cpp index d69a7f53..ab6d7819 100644 --- a/Minecraft.World/MapItemSavedData.cpp +++ b/Minecraft.World/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,12 +48,12 @@ MapItemSavedData::HoldingPlayer::~HoldingPlayer() delete lastSentDecorations.data; } -charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptr itemInstance) +charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(std::shared_ptr itemInstance) { if (--sendPosTick < 0) { sendPosTick = 4; - + unsigned int playerDecorationsSize = (int)parent->decorations.size(); unsigned int nonPlayerDecorationsSize = (int)parent->nonPlayerDecorations.size(); charArray data = charArray( (playerDecorationsSize + nonPlayerDecorationsSize ) * DEC_PACKET_BYTES + 1); @@ -68,7 +68,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptrimg << 4) | (md->rot & 0xF)); #endif data[i * DEC_PACKET_BYTES + 2] = md->x; - data[i * DEC_PACKET_BYTES + 3] = md->y; + data[i * DEC_PACKET_BYTES + 3] = md->y; data[i * DEC_PACKET_BYTES + 4] = md->entityId & 0xFF; data[i * DEC_PACKET_BYTES + 5] = (md->entityId>>8) & 0xFF; data[i * DEC_PACKET_BYTES + 6] = (md->entityId>>16) & 0xFF; @@ -86,7 +86,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptrimg << 4) | (md->rot & 0xF)); #endif data[dataIndex * DEC_PACKET_BYTES + 2] = md->x; - data[dataIndex * DEC_PACKET_BYTES + 3] = md->y; + data[dataIndex * DEC_PACKET_BYTES + 3] = md->y; data[dataIndex * DEC_PACKET_BYTES + 4] = md->entityId & 0xFF; data[dataIndex * DEC_PACKET_BYTES + 5] = (md->entityId>>8) & 0xFF; data[dataIndex * DEC_PACKET_BYTES + 6] = (md->entityId>>16) & 0xFF; @@ -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); } @@ -237,7 +237,7 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, 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; @@ -321,7 +321,7 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptrisFramed()) { //addDecoration(1, player.level, "frame-" + item.getFrame().entityId, item.getFrame().xTile, item.getFrame().zTile, item.getFrame().dir * 90); - + if( nonPlayerDecorations.find( item->getFrame()->entityId ) == nonPlayerDecorations.end() ) { float xd = (float) ( item->getFrame()->xTile - x ) / (1 << scale); @@ -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; @@ -555,14 +555,14 @@ void MapItemSavedData::mergeInMapData(shared_ptr dataToAdd) colors[x + z * w] = newColor; } } - if (yd0 <= yd1) + if (yd0 <= yd1) { setDirty(x, yd0, yd1); } } } -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/MapItemSavedData.h b/Minecraft.World/MapItemSavedData.h index fcbe5e30..79e85132 100644 --- a/Minecraft.World/MapItemSavedData.h +++ b/Minecraft.World/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: byte 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/McRegionLevelStorage.cpp b/Minecraft.World/McRegionLevelStorage.cpp index 687ee048..1727670f 100644 --- a/Minecraft.World/McRegionLevelStorage.cpp +++ b/Minecraft.World/McRegionLevelStorage.cpp @@ -20,13 +20,13 @@ McRegionLevelStorage::~McRegionLevelStorage() RegionFileCache::clear(); } -ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) +ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) { //File folder = getFolder(); if (dynamic_cast(dimension) != NULL) { - + if(app.GetResetNether()) { #ifdef SPLIT_SAVES @@ -43,7 +43,7 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) #else vector *netherFiles = m_saveFile->getFilesWithPrefix(LevelStorage::NETHER_FOLDER); if(netherFiles!=NULL) - { + { for(AUTO_VAR(it, netherFiles->begin()); it != netherFiles->end(); ++it) { m_saveFile->deleteFile(*it); @@ -56,13 +56,13 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) return new McRegionChunkStorage(m_saveFile, LevelStorage::NETHER_FOLDER); } - + if (dynamic_cast(dimension)) { //File dir2 = new File(folder, LevelStorage.ENDER_FOLDER); //dir2.mkdirs(); //return new ThreadedMcRegionChunkStorage(dir2); - + // 4J-PB - save version 0 at this point means it's a create new world int iSaveVersion=m_saveFile->getSaveVersion(); @@ -75,7 +75,7 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) // 4J-PB - There will be no End in early saves if(endFiles!=NULL) - { + { for(AUTO_VAR(it, endFiles->begin()); it != endFiles->end(); ++it) { m_saveFile->deleteFile(*it); @@ -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); @@ -97,7 +97,7 @@ void McRegionLevelStorage::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/McRegionLevelStorageSource.cpp b/Minecraft.World/McRegionLevelStorageSource.cpp index 0652ad84..48531944 100644 --- a/Minecraft.World/McRegionLevelStorageSource.cpp +++ b/Minecraft.World/McRegionLevelStorageSource.cpp @@ -44,7 +44,7 @@ vector *McRegionLevelStorageSource::getLevelList() { file = *it; //subFolders->at(i); - if (file->isDirectory()) + if (file->isDirectory()) { continue; } @@ -74,13 +74,13 @@ 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) +bool McRegionLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId) { // check if there is old file format level data LevelData *levelData = getDataTagFor(saveFile, levelId); @@ -145,7 +145,7 @@ bool McRegionLevelStorageSource::convertLevel(ConsoleSaveFile *saveFile, const w } int totalCount = normalRegions->size() + netherRegions->size() + enderRegions.size() + normalBaseFolders->size() + netherBaseFolders->size() + enderBaseFolders.size(); - + // System.out.println("Total conversion count is " + totalCount); 4J Jev, TODO // convert normal world @@ -173,7 +173,7 @@ bool McRegionLevelStorageSource::convertLevel(ConsoleSaveFile *saveFile, const w #if 0 // 4J - not required anymore -void McRegionLevelStorageSource::addRegions(File &baseFolder, vector *dest, vector *firstLevelFolders) +void McRegionLevelStorageSource::addRegions(File &baseFolder, vector *dest, vector *firstLevelFolders) { FolderFilter folderFilter; ChunkFilter chunkFilter; @@ -210,7 +210,7 @@ void McRegionLevelStorageSource::addRegions(File &baseFolder, vector *chunkFiles, int currentCount, int totalCount, ProgressListener *progress) +void McRegionLevelStorageSource::convertRegions(File &baseFolder, vector *chunkFiles, int currentCount, int totalCount, ProgressListener *progress) { assert( false ); @@ -238,7 +238,7 @@ void McRegionLevelStorageSource::convertRegions(File &baseFolder, vectorgetZ(); RegionFile *region = RegionFileCache::getRegionFile(baseFolder, x, z); - if (!region->hasChunk(x & 31, z & 31)) + if (!region->hasChunk(x & 31, z & 31)) { FileInputStream fis = new BufferedInputStream(FileInputStream(*chunkFile->getFile())); DataInputStream istream = DataInputStream(&fis); // 4J - was new GZIPInputStream as well @@ -289,7 +289,7 @@ void McRegionLevelStorageSource::eraseFolders(vector *folders, int curre #if 0 // 4J - not required anymore -bool McRegionLevelStorageSource::FolderFilter::accept(File *file) +bool McRegionLevelStorageSource::FolderFilter::accept(File *file) { if (file->isDirectory()) { @@ -300,23 +300,23 @@ bool McRegionLevelStorageSource::FolderFilter::accept(File *file) } -bool McRegionLevelStorageSource::ChunkFilter::accept(File *dir, const wstring& name) +bool McRegionLevelStorageSource::ChunkFilter::accept(File *dir, const wstring& name) { Matcher matcher( chunkFilePattern, name ); return matcher.matches(); } -McRegionLevelStorageSource::ChunkFile::ChunkFile(File *file) +McRegionLevelStorageSource::ChunkFile::ChunkFile(File *file) { this->file = file; Matcher matcher( ChunkFilter::chunkFilePattern, file->getName() ); - if (matcher.matches()) + if (matcher.matches()) { x = Integer::parseInt(matcher.group(1), 36); z = Integer::parseInt(matcher.group(2), 36); - } + } else { x = 0; @@ -348,17 +348,17 @@ bool McRegionLevelStorageSource::ChunkFile::operator<( ChunkFile *b ) return compareTo( b ) < 0; } -File *McRegionLevelStorageSource::ChunkFile::getFile() +File *McRegionLevelStorageSource::ChunkFile::getFile() { return (File *) file; } -int McRegionLevelStorageSource::ChunkFile::getX() +int McRegionLevelStorageSource::ChunkFile::getX() { return x; } -int McRegionLevelStorageSource::ChunkFile::getZ() +int McRegionLevelStorageSource::ChunkFile::getZ() { return z; } diff --git a/Minecraft.World/McRegionLevelStorageSource.h b/Minecraft.World/McRegionLevelStorageSource.h index d1a4bf30..0f6b940d 100644 --- a/Minecraft.World/McRegionLevelStorageSource.h +++ b/Minecraft.World/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); @@ -33,14 +33,14 @@ private: public: #if 0 // 4J - not required anymore - static class FolderFilter : public FileFilter + static class FolderFilter : public FileFilter { public: static const std::tr1::wregex chunkFolderPattern; // was Pattern bool accept(File *file); }; - static class ChunkFilter : public FilenameFilter + static class ChunkFilter : public FilenameFilter { public: static const std::tr1::wregex chunkFilePattern; // was Pattern diff --git a/Minecraft.World/MeleeAttackGoal.cpp b/Minecraft.World/MeleeAttackGoal.cpp index f3aa6455..bf779234 100644 --- a/Minecraft.World/MeleeAttackGoal.cpp +++ b/Minecraft.World/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/MemoryLevelStorage.cpp b/Minecraft.World/MemoryLevelStorage.cpp index 5a1d43bb..bc069fc3 100644 --- a/Minecraft.World/MemoryLevelStorage.cpp +++ b/Minecraft.World/MemoryLevelStorage.cpp @@ -17,7 +17,7 @@ LevelData *MemoryLevelStorage::prepareLevel() return NULL; } -void MemoryLevelStorage::checkSession() +void MemoryLevelStorage::checkSession() { } @@ -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,21 +43,21 @@ 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; } -CompoundTag *MemoryLevelStorage::loadPlayerDataTag(const wstring& playerName) +CompoundTag *MemoryLevelStorage::loadPlayerDataTag(const wstring& playerName) { return NULL; } -ConsoleSavePath MemoryLevelStorage::getDataFile(const wstring& id) +ConsoleSavePath MemoryLevelStorage::getDataFile(const wstring& id) { return ConsoleSaveFile(wstring(L"")); } \ No newline at end of file diff --git a/Minecraft.World/MemoryLevelStorage.h b/Minecraft.World/MemoryLevelStorage.h index 21ea784c..43af38c7 100644 --- a/Minecraft.World/MemoryLevelStorage.h +++ b/Minecraft.World/MemoryLevelStorage.h @@ -13,19 +13,19 @@ using namespace std; #include "ConsoleSaveFile.h" -class MemoryLevelStorage : public LevelStorage, public PlayerIO +class MemoryLevelStorage : public LevelStorage, public PlayerIO { public: MemoryLevelStorage(); 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/MemoryLevelStorageSource.cpp b/Minecraft.World/MemoryLevelStorageSource.cpp index db0cfa58..92a1b2c3 100644 --- a/Minecraft.World/MemoryLevelStorageSource.cpp +++ b/Minecraft.World/MemoryLevelStorageSource.cpp @@ -13,12 +13,12 @@ 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() +vector *MemoryLevelStorageSource::getLevelList() { return new vector; } @@ -32,12 +32,12 @@ LevelData *MemoryLevelStorageSource::getDataTagFor(const wstring& levelId) return NULL; } -bool MemoryLevelStorageSource::isNewLevelIdAcceptable(const wstring& levelId) +bool MemoryLevelStorageSource::isNewLevelIdAcceptable(const wstring& levelId) { return true; } -void MemoryLevelStorageSource::deleteLevel(const wstring& levelId) +void MemoryLevelStorageSource::deleteLevel(const wstring& levelId) { } diff --git a/Minecraft.World/MemoryLevelStorageSource.h b/Minecraft.World/MemoryLevelStorageSource.h index c53c0463..0f7d6ef2 100644 --- a/Minecraft.World/MemoryLevelStorageSource.h +++ b/Minecraft.World/MemoryLevelStorageSource.h @@ -3,12 +3,12 @@ using namespace std; #include "LevelStorageSource.h" -class MemoryLevelStorageSource : public LevelStorageSource +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/MenuBackup.cpp b/Minecraft.World/MenuBackup.cpp index 6d09f3e3..71ea3d38 100644 --- a/Minecraft.World/MenuBackup.cpp +++ b/Minecraft.World/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/MenuBackup.h b/Minecraft.World/MenuBackup.h index 2de750b1..27df45da 100644 --- a/Minecraft.World/MenuBackup.h +++ b/Minecraft.World/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/Merchant.h b/Minecraft.World/Merchant.h index 8b4b7a69..ad7ab1fc 100644 --- a/Minecraft.World/Merchant.h +++ b/Minecraft.World/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/MerchantContainer.cpp b/Minecraft.World/MerchantContainer.cpp index cadbe4e3..9ca871e3 100644 --- a/Minecraft.World/MerchantContainer.cpp +++ b/Minecraft.World/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/MerchantContainer.h b/Minecraft.World/MerchantContainer.h index efba13d6..9f4efe33 100644 --- a/Minecraft.World/MerchantContainer.h +++ b/Minecraft.World/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/MerchantMenu.cpp b/Minecraft.World/MerchantMenu.cpp index a6dfca1f..50f9fbdf 100644 --- a/Minecraft.World/MerchantMenu.cpp +++ b/Minecraft.World/MerchantMenu.cpp @@ -5,12 +5,12 @@ #include "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/MerchantMenu.h b/Minecraft.World/MerchantMenu.h index 14a5fa1d..23b63998 100644 --- a/Minecraft.World/MerchantMenu.h +++ b/Minecraft.World/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/MerchantRecipe.cpp b/Minecraft.World/MerchantRecipe.cpp index b772b0c7..84fdc744 100644 --- a/Minecraft.World/MerchantRecipe.cpp +++ b/Minecraft.World/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/MerchantRecipe.h b/Minecraft.World/MerchantRecipe.h index 0ed84898..dd684b6a 100644 --- a/Minecraft.World/MerchantRecipe.h +++ b/Minecraft.World/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/MerchantRecipeList.cpp b/Minecraft.World/MerchantRecipeList.cpp index bd7a126c..26436b59 100644 --- a/Minecraft.World/MerchantRecipeList.cpp +++ b/Minecraft.World/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/MerchantRecipeList.h b/Minecraft.World/MerchantRecipeList.h index 4a761d39..b3c0cd2b 100644 --- a/Minecraft.World/MerchantRecipeList.h +++ b/Minecraft.World/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/MerchantResultSlot.cpp b/Minecraft.World/MerchantResultSlot.cpp index fedbcc4a..7617bdf1 100644 --- a/Minecraft.World/MerchantResultSlot.cpp +++ b/Minecraft.World/MerchantResultSlot.cpp @@ -3,7 +3,7 @@ #include "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/MerchantResultSlot.h b/Minecraft.World/MerchantResultSlot.h index 7b8d97b6..1b45082c 100644 --- a/Minecraft.World/MerchantResultSlot.h +++ b/Minecraft.World/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/MilkBucketItem.cpp b/Minecraft.World/MilkBucketItem.cpp index 4a371078..320c57b7 100644 --- a/Minecraft.World/MilkBucketItem.cpp +++ b/Minecraft.World/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/MilkBucketItem.h b/Minecraft.World/MilkBucketItem.h index 672e3143..32c9a215 100644 --- a/Minecraft.World/MilkBucketItem.h +++ b/Minecraft.World/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/MineShaftPieces.cpp b/Minecraft.World/MineShaftPieces.cpp index fe13b49f..d6a60ee7 100644 --- a/Minecraft.World/MineShaftPieces.cpp +++ b/Minecraft.World/MineShaftPieces.cpp @@ -440,19 +440,19 @@ 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"); } } } // prevent air floating - for (int x = x0; x <= x1; x++) + for (int x = x0; x <= x1; x++) { - for (int z = 0; z <= length; z++) + for (int z = 0; z <= length; z++) { int block = getBlock(level, x, -1, z, chunkBB); - if (block == 0) + if (block == 0) { placeBlock(level, Tile::wood_Id, 0, x, -1, z, chunkBB); } @@ -594,12 +594,12 @@ bool MineShaftPieces::MineShaftCrossing::postProcess(Level *level, Random *rando // prevent air floating // note: use world coordinates because the corridor hasn't defined // orientation - for (int x = boundingBox->x0; x <= boundingBox->x1; x++) + for (int x = boundingBox->x0; x <= boundingBox->x1; x++) { - for (int z = boundingBox->z0; z <= boundingBox->z1; z++) + for (int z = boundingBox->z0; z <= boundingBox->z1; z++) { int block = getBlock(level, x, boundingBox->y0 - 1, z, chunkBB); - if (block == 0) + if (block == 0) { placeBlock(level, Tile::wood_Id, 0, x, boundingBox->y0 - 1, z, chunkBB); } diff --git a/Minecraft.World/Minecart.cpp b/Minecraft.World/Minecart.cpp index 2b8fbb95..529629ff 100644 --- a/Minecraft.World/Minecart.cpp +++ b/Minecraft.World/Minecart.cpp @@ -137,7 +137,7 @@ void Minecart::defineSynchedData() } -AABB *Minecart::getCollideAgainstBox(shared_ptr entity) +AABB *Minecart::getCollideAgainstBox(std::shared_ptr entity) { return entity->bb; } @@ -180,14 +180,14 @@ double Minecart::getRideHeight() bool Minecart::hurt(DamageSource *source, int hurtDamage) { if (level->isClientSide || removed) return true; - + // 4J-JEV: Fix for #88212, // 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 && + if (dynamic_pointer_cast(attacker) != NULL && !dynamic_pointer_cast(attacker)->isAllowedToHurtEntity( shared_from_this() )) return false; } @@ -202,7 +202,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)); @@ -215,10 +215,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; @@ -231,7 +231,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; @@ -270,20 +270,20 @@ void Minecart::remove() { for (unsigned int i = 0; i < getContainerSize(); i++) { - shared_ptr item = getItem(i); - if (item != NULL) + std::shared_ptr item = getItem(i); + if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; float zo = random->nextFloat() * 0.8f + 0.1f; - while (item->count > 0) + while (item->count > 0) { int count = random->nextInt(21) + 10; 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; @@ -388,7 +388,7 @@ void Minecart::tick() if (data == 3) xd += slideSpeed; if (data == 4) zd += slideSpeed; if (data == 5) zd -= slideSpeed; - + // 4J TODO Is this a good way to copy the bit of the array that we need? int exits[2][3]; memcpy( &exits, (void *)EXITS[data], sizeof(int) * 2 * 3); @@ -409,8 +409,8 @@ 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); @@ -669,16 +669,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()); @@ -848,7 +848,7 @@ void Minecart::addAdditonalSaveData(CompoundTag *base) { base->putInt(L"Type", type); - if (type == Minecart::FURNACE) + if (type == Minecart::FURNACE) { base->putDouble(L"PushX", xPush); base->putDouble(L"PushZ", zPush); @@ -889,7 +889,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) ); } } } @@ -900,7 +900,7 @@ float Minecart::getShadowHeightOffs() return 0; } -void Minecart::push(shared_ptr e) +void Minecart::push(std::shared_ptr e) { if (level->isClientSide) return; @@ -954,7 +954,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; @@ -1017,24 +1017,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; } @@ -1042,18 +1042,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(); @@ -1073,7 +1073,7 @@ void Minecart::setChanged() { } -bool Minecart::interact(shared_ptr player) +bool Minecart::interact(std::shared_ptr player) { if (type == Minecart::RIDEABLE) { @@ -1098,7 +1098,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); @@ -1144,7 +1144,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/Minecart.h b/Minecraft.World/Minecart.h index ea119bce..77b58e5f 100644 --- a/Minecraft.World/Minecart.h +++ b/Minecraft.World/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/MinecartItem.cpp b/Minecraft.World/MinecartItem.cpp index 3b062ccf..ea64152c 100644 --- a/Minecraft.World/MinecartItem.cpp +++ b/Minecraft.World/MinecartItem.cpp @@ -12,18 +12,18 @@ 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); - if (RailTile::isRail(targetType)) + if (RailTile::isRail(targetType)) { if(!bTestUseOnOnly) { - if (!level->isClientSide) + 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/MinecartItem.h b/Minecraft.World/MinecartItem.h index c63082a1..4ffabc63 100644 --- a/Minecraft.World/MinecartItem.h +++ b/Minecraft.World/MinecartItem.h @@ -3,12 +3,12 @@ using namespace std; #include "Item.h" -class MinecartItem : public Item +class MinecartItem : public Item { public: int type; 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/Mob.cpp b/Minecraft.World/Mob.cpp index d2dcddfb..23f8639e 100644 --- a/Minecraft.World/Mob.cpp +++ b/Minecraft.World/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,18 +299,18 @@ 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; } -void Mob::defineSynchedData() +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); @@ -318,62 +318,62 @@ bool Mob::canSee(shared_ptr target) return retVal; } -int Mob::getTexture() +int Mob::getTexture() { return textureIdx; } -bool Mob::isPickable() +bool Mob::isPickable() { return !removed; } -bool Mob::isPushable() +bool Mob::isPushable() { return !removed; } -float Mob::getHeadHeight() +float Mob::getHeadHeight() { return bbHeight * 0.85f; } -int Mob::getAmbientSoundInterval() +int Mob::getAmbientSoundInterval() { return 20 * 4; } -void Mob::playAmbientSound() +void Mob::playAmbientSound() { MemSect(31); int ambient = getAmbientSound(); - if (ambient != -1) + if (ambient != -1) { level->playSound(shared_from_this(), ambient, getSoundVolume(), getVoicePitch()); } MemSect(0); } -void Mob::baseTick() +void Mob::baseTick() { oAttackAnim = attackAnim; Entity::baseTick(); - if (isAlive() && random->nextInt(1000) < ambientSoundTime++) + if (isAlive() && random->nextInt(1000) < ambientSoundTime++) { ambientSoundTime = -getAmbientSoundInterval(); - playAmbientSound(); + playAmbientSound(); } - if (isAlive() && isInWall()) + if (isAlive() && isInWall()) { hurt(DamageSource::inWall, 1); } if (isFireImmune() || level->isClientSide) clearFire(); - if (isAlive() && isUnderLiquid(Material::water) && !isWaterMob() && activeEffects.find(MobEffect::waterBreathing->id) == activeEffects.end()) + if (isAlive() && isUnderLiquid(Material::water) && !isWaterMob() && activeEffects.find(MobEffect::waterBreathing->id) == activeEffects.end()) { setAirSupply(decreaseAirSupply(getAirSupply())); if (getAirSupply() == -20) @@ -393,8 +393,8 @@ void Mob::baseTick() } clearFire(); - } - else + } + else { setAirSupply(TOTAL_AIR_SUPPLY); } @@ -404,7 +404,7 @@ void Mob::baseTick() if (attackTime > 0) attackTime--; if (hurtTime > 0) hurtTime--; if (invulnerableTime > 0) invulnerableTime--; - if (health <= 0) + if (health <= 0) { tickDeath(); } @@ -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 ) { @@ -440,9 +440,9 @@ void Mob::baseTick() } void Mob::tickDeath() -{ +{ deathTime++; - if (deathTime == 20) + if (deathTime == 20) { // 4J Stu - Added level->isClientSide check from 1.2 to fix XP orbs being created client side if(!level->isClientSide && (lastHurtByPlayerTime > 0 || isAlwaysExperienceDropper()) ) @@ -454,13 +454,13 @@ 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) ) ); } } } remove(); - for (int i = 0; i < 20; i++) + for (int i = 0; i < 20; i++) { double xa = random->nextGaussian() * 0.02; double ya = random->nextGaussian() * 0.02; @@ -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; } @@ -485,9 +485,9 @@ bool Mob::isAlwaysExperienceDropper() return false; } -void Mob::spawnAnim() +void Mob::spawnAnim() { - for (int i = 0; i < 20; i++) + for (int i = 0; i < 20; i++) { double xa = random->nextGaussian() * 0.02; double ya = random->nextGaussian() * 0.02; @@ -498,7 +498,7 @@ void Mob::spawnAnim() } } -void Mob::rideTick() +void Mob::rideTick() { Entity::rideTick(); oRun = run; @@ -506,7 +506,7 @@ void Mob::rideTick() fallDistance = 0; } -void Mob::lerpTo(double x, double y, double z, float yRot, float xRot, int steps) +void Mob::lerpTo(double x, double y, double z, float yRot, float xRot, int steps) { heightOffset = 0; lx = x; @@ -518,12 +518,12 @@ void Mob::lerpTo(double x, double y, double z, float yRot, float xRot, int steps lSteps = steps; } -void Mob::superTick() +void Mob::superTick() { Entity::tick(); } -void Mob::tick() +void Mob::tick() { Entity::tick(); @@ -552,21 +552,21 @@ void Mob::tick() float walkSpeed = 0; oRun = run; float tRun = 0; - if (sideDist <= 0.05f * 0.05f) + if (sideDist <= 0.05f * 0.05f) { // animStep = 0; - } - else + } + else { tRun = 1; walkSpeed = sqrt(sideDist) * 3; yBodyRotT = ((float) atan2(zd, xd) * 180 / (float) PI - 90); } - if (attackAnim > 0) + if (attackAnim > 0) { yBodyRotT = yRot; } - if (!onGround) + if (!onGround) { tRun = 0; } @@ -592,12 +592,12 @@ void Mob::tick() if (headDiff < -75) headDiff = -75; if (headDiff >= 75) headDiff = +75; yBodyRot = yRot - headDiff; - if (headDiff * headDiff > 50 * 50) + if (headDiff * headDiff > 50 * 50) { yBodyRot += headDiff * 0.2f; } - if (behind) + if (behind) { walkSpeed *= -1; } @@ -625,7 +625,7 @@ void Mob::tick() animStep += walkSpeed; } -void Mob::heal(int heal) +void Mob::heal(int heal) { if (health <= 0) return; health += heal; @@ -647,7 +647,7 @@ void Mob::setHealth(int health) } } -bool Mob::hurt(DamageSource *source, int dmg) +bool Mob::hurt(DamageSource *source, int dmg) { // 4J Stu - Reworked this function a bit to show hurt damage on the client before the server responds. // Fix for #8823 - Gameplay: Confirmation that a monster or animal has taken damage from an attack is highly delayed @@ -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()); @@ -672,14 +672,14 @@ bool Mob::hurt(DamageSource *source, int dmg) this->walkAnimSpeed = 1.5f; bool sound = true; - if (invulnerableTime > invulnerableDuration / 2.0f) + if (invulnerableTime > invulnerableDuration / 2.0f) { if (dmg <= lastHurt) return false; if(!level->isClientSide) actuallyHurt(source, dmg - lastHurt); lastHurt = dmg; sound = false; - } - else + } + else { lastHurt = dmg; lastHealth = health; @@ -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; @@ -722,31 +722,31 @@ bool Mob::hurt(DamageSource *source, int dmg) { level->broadcastEntityEvent(shared_from_this(), EntityEvent::HURT); if (source != DamageSource::drown && source != DamageSource::controlledExplosion) markHurt(); - if (sourceEntity != NULL) + if (sourceEntity != NULL) { double xd = sourceEntity->x - x; double zd = sourceEntity->z - z; - while (xd * xd + zd * zd < 0.0001) + while (xd * xd + zd * zd < 0.0001) { xd = (Math::random() - Math::random()) * 0.01; zd = (Math::random() - Math::random()) * 0.01; } hurtDir = (float) (atan2(zd, xd) * 180 / PI) - yRot; knockback(sourceEntity, dmg, xd, zd); - } - else + } + else { hurtDir = (float) (int) ((Math::random() * 2) * 180); // 4J This cast is the same as Java } } MemSect(31); - if (health <= 0) + if (health <= 0) { if (sound) level->playSound(shared_from_this(), getDeathSound(), getSoundVolume(), getVoicePitch()); die(source); - } - else + } + else { if (sound) level->playSound(shared_from_this(), getHurtSound(), getSoundVolume(), getVoicePitch()); } @@ -765,7 +765,7 @@ float Mob::getVoicePitch() return (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f; } -void Mob::animateHurt() +void Mob::animateHurt() { hurtTime = hurtDuration = 10; hurtDir = 0; @@ -806,7 +806,7 @@ int Mob::getDamageAfterMagicAbsorb(DamageSource *damageSource, int damage) return damage; } -void Mob::actuallyHurt(DamageSource *source, int dmg) +void Mob::actuallyHurt(DamageSource *source, int dmg) { dmg = getDamageAfterArmorAbsorb(source, dmg); dmg = getDamageAfterMagicAbsorb(source, dmg); @@ -814,27 +814,27 @@ void Mob::actuallyHurt(DamageSource *source, int dmg) } -float Mob::getSoundVolume() +float Mob::getSoundVolume() { return 1; } -int Mob::getAmbientSound() +int Mob::getAmbientSound() { return -1; } -int Mob::getHurtSound() +int Mob::getHurtSound() { return eSoundType_DAMAGE_HURT; } -int Mob::getDeathSound() +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); @@ -851,19 +851,19 @@ void Mob::knockback(shared_ptr source, int dmg, double xd, double zd) if (this->yd > 0.4f) this->yd = 0.4f; } -void Mob::die(DamageSource *source) +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() ) ); dead = true; - if (!level->isClientSide) + 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); @@ -894,7 +894,7 @@ void Mob::die(DamageSource *source) /** * Drop extra rare loot. Only occurs roughly 5% of the time, rareRootLevel * is set to 1 (otherwise 0) 1% of the time. -* +* * @param rareLootLevel */ void Mob::dropRareDeathLoot(int rareLootLevel) @@ -902,10 +902,10 @@ void Mob::dropRareDeathLoot(int rareLootLevel) } -void Mob::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) +void Mob::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) { int loot = getDeathLoot(); - if (loot > 0) + if (loot > 0) { int count = random->nextInt(3); if (playerBonusLevel > 0) @@ -917,16 +917,16 @@ void Mob::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) } } -int Mob::getDeathLoot() +int Mob::getDeathLoot() { return 0; } -void Mob::causeFallDamage(float distance) +void Mob::causeFallDamage(float distance) { Entity::causeFallDamage(distance); int dmg = (int) ceil(distance - 3); - if (dmg > 0) + if (dmg > 0) { // 4J - new sounds here brought forward from 1.2.3 if (dmg > 4) @@ -940,7 +940,7 @@ void Mob::causeFallDamage(float distance) hurt(DamageSource::fall, dmg); int t = level->getTile( Mth::floor(x), Mth::floor(y - 0.2f - this->heightOffset), Mth::floor(z)); - if (t > 0) + if (t > 0) { const Tile::SoundType *soundType = Tile::tiles[t]->soundType; MemSect(31); @@ -950,7 +950,7 @@ void Mob::causeFallDamage(float distance) } } -void Mob::travel(float xa, float ya) +void Mob::travel(float xa, float ya) { #ifdef __PSVITA__ // AP - dynamic_pointer_cast is a non-trivial call @@ -960,9 +960,9 @@ 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) ) + if (isInWater() && !(thisPlayer && thisPlayer->abilities.flying) ) { double yo = y; moveRelative(xa, ya, useNewAi() ? 0.04f : 0.02f); @@ -973,12 +973,12 @@ void Mob::travel(float xa, float ya) zd *= 0.80f; yd -= 0.02; - if (horizontalCollision && isFree(xd, yd + 0.6f - y + yo, zd)) + if (horizontalCollision && isFree(xd, yd + 0.6f - y + yo, zd)) { yd = 0.3f; } - } - else if (isInLava() && !(thisPlayer && thisPlayer->abilities.flying) ) + } + else if (isInLava() && !(thisPlayer && thisPlayer->abilities.flying) ) { double yo = y; moveRelative(xa, ya, 0.02f); @@ -988,19 +988,19 @@ void Mob::travel(float xa, float ya) zd *= 0.50f; yd -= 0.02; - if (horizontalCollision && isFree(xd, yd + 0.6f - y + yo, zd)) + if (horizontalCollision && isFree(xd, yd + 0.6f - y + yo, zd)) { yd = 0.3f; } - } - else + } + else { float friction = 0.91f; - if (onGround) + if (onGround) { friction = 0.6f * 0.91f; int t = level->getTile(Mth::floor(x), Mth::floor(bb->y0) - 1, Mth::floor(z)); - if (t > 0) + if (t > 0) { friction = Tile::tiles[t]->friction * 0.91f; } @@ -1020,16 +1020,16 @@ void Mob::travel(float xa, float ya) moveRelative(xa, ya, speed); friction = 0.91f; - if (onGround) + if (onGround) { friction = 0.6f * 0.91f; int t = level->getTile( Mth::floor(x), Mth::floor(bb->y0) - 1, Mth::floor(z)); - if (t > 0) + if (t > 0) { friction = Tile::tiles[t]->friction * 0.91f; } } - if (onLadder()) + if (onLadder()) { float max = 0.15f; if (xd < -max) xd = -max; @@ -1044,7 +1044,7 @@ void Mob::travel(float xa, float ya) move(xd, yd, zd); - if (horizontalCollision && onLadder()) + if (horizontalCollision && onLadder()) { yd = 0.2; } @@ -1064,7 +1064,7 @@ void Mob::travel(float xa, float ya) walkAnimPos += walkAnimSpeed; } -bool Mob::onLadder() +bool Mob::onLadder() { int xt = Mth::floor(x); int yt = Mth::floor(bb->y0); @@ -1076,12 +1076,12 @@ bool Mob::onLadder() } -bool Mob::isShootable() +bool Mob::isShootable() { return true; } -void Mob::addAdditonalSaveData(CompoundTag *entityTag) +void Mob::addAdditonalSaveData(CompoundTag *entityTag) { entityTag->putShort(L"Health", (short) health); entityTag->putShort(L"HurtTime", (short) hurtTime); @@ -1106,7 +1106,7 @@ void Mob::addAdditonalSaveData(CompoundTag *entityTag) } } -void Mob::readAdditionalSaveData(CompoundTag *tag) +void Mob::readAdditionalSaveData(CompoundTag *tag) { if (health < Short::MIN_VALUE) health = Short::MIN_VALUE; health = tag->getShort(L"Health"); @@ -1130,12 +1130,12 @@ void Mob::readAdditionalSaveData(CompoundTag *tag) } } -bool Mob::isAlive() +bool Mob::isAlive() { return !removed && health > 0; } -bool Mob::isWaterMob() +bool Mob::isWaterMob() { return false; } @@ -1191,10 +1191,10 @@ void Mob::setJumping(bool jump) jumping = jump; } -void Mob::aiStep() +void Mob::aiStep() { if (noJumpDelay > 0) noJumpDelay--; - if (lSteps > 0) + if (lSteps > 0) { double xt = x + (lx - x) / lSteps; double yt = y + (ly - y) / lSteps; @@ -1236,14 +1236,14 @@ void Mob::aiStep() if (abs(zd) < MIN_MOVEMENT_DISTANCE) zd = 0; } - if (isImmobile()) + if (isImmobile()) { jumping = false; xxa = 0; yya = 0; yRotA = 0; - } - else + } + else { MemSect(25); if (isEffectiveAI()) @@ -1261,13 +1261,13 @@ void Mob::aiStep() MemSect(0); } - if (jumping) + if (jumping) { - if (isInWater() || isInLava() ) + if (isInWater() || isInLava() ) { yd += 0.04f; } - else if (onGround) + else if (onGround) { if (noJumpDelay == 0) { @@ -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)); - if (entities != NULL && !entities->empty()) + 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()); } } @@ -1316,7 +1316,7 @@ bool Mob::isEffectiveAI() return !level->isClientSide; } -bool Mob::isImmobile() +bool Mob::isImmobile() { return health <= 0; } @@ -1326,7 +1326,7 @@ bool Mob::isBlocking() return false; } -void Mob::jumpFromGround() +void Mob::jumpFromGround() { yd = 0.42f; if (hasEffect(MobEffect::jump)) @@ -1343,31 +1343,31 @@ void Mob::jumpFromGround() this->hasImpulse = true; } -bool Mob::removeWhenFarAway() +bool Mob::removeWhenFarAway() { return true; } -void Mob::checkDespawn() +void Mob::checkDespawn() { - shared_ptr player = level->getNearestPlayer(shared_from_this(), -1); - if (player != NULL) + std::shared_ptr player = level->getNearestPlayer(shared_from_this(), -1); + if (player != NULL) { double xd = player->x - x; double yd = player->y - y; double zd = player->z - z; double sd = xd * xd + yd * yd + zd * zd; - if (removeWhenFarAway() && sd > 128 * 128) + if (removeWhenFarAway() && sd > 128 * 128) { remove(); } - if (noActionTime > 20 * 30 && random->nextInt(800) == 0 && sd > 32 * 32 && removeWhenFarAway()) + if (noActionTime > 20 * 30 && random->nextInt(800) == 0 && sd > 32 * 32 && removeWhenFarAway()) { remove(); } - else if (sd < 32 * 32) + else if (sd < 32 * 32) { noActionTime = 0; } @@ -1397,7 +1397,7 @@ void Mob::serverAiMobStep() { } -void Mob::serverAiStep() +void Mob::serverAiStep() { noActionTime++; @@ -1407,15 +1407,15 @@ void Mob::serverAiStep() yya = 0; float lookDistance = 8; - if (random->nextFloat() < 0.02f) + if (random->nextFloat() < 0.02f) { - shared_ptr player = level->getNearestPlayer(shared_from_this(), lookDistance); - if (player != NULL) + std::shared_ptr player = level->getNearestPlayer(shared_from_this(), lookDistance); + if (player != NULL) { lookingAt = player; lookTime = 10 + random->nextInt(20); - } - else + } + else { yRotA = (random->nextFloat() - 0.5f) * 20; } @@ -1424,14 +1424,14 @@ void Mob::serverAiStep() if (lookingAt != NULL) { lookAt(lookingAt, 10.0f, (float) getMaxHeadXRot()); - if (lookTime-- <= 0 || lookingAt->removed || lookingAt->distanceToSqr(shared_from_this()) > lookDistance * lookDistance) + if (lookTime-- <= 0 || lookingAt->removed || lookingAt->distanceToSqr(shared_from_this()) > lookDistance * lookDistance) { lookingAt = nullptr; } - } - else + } + else { - if (random->nextFloat() < 0.05f) + if (random->nextFloat() < 0.05f) { yRotA = (random->nextFloat() - 0.5f) * 20; } @@ -1444,23 +1444,23 @@ void Mob::serverAiStep() if (inWater || inLava) jumping = random->nextFloat() < 0.8f; } -int Mob::getMaxHeadXRot() +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()); - } - else + } + else { yd = (e->bb->y0 + e->bb->y1) / 2 - (y + getHeadHeight()); } @@ -1473,42 +1473,42 @@ void Mob::lookAt(shared_ptr e, float yMax, float xMax) yRot = rotlerp(yRot, yRotD, yMax); } -bool Mob::isLookingAtAnEntity() +bool Mob::isLookingAtAnEntity() { return lookingAt != NULL; } -shared_ptr Mob::getLookingAt() +std::shared_ptr Mob::getLookingAt() { return lookingAt; } -float Mob::rotlerp(float a, float b, float max) +float Mob::rotlerp(float a, float b, float max) { float diff = Mth::wrapDegrees(b - a); - if (diff > max) + if (diff > max) { diff = max; } - if (diff < -max) + if (diff < -max) { diff = -max; } return a + diff; } -bool Mob::canSpawn() +bool Mob::canSpawn() { // 4J - altered to use special containsAnyLiquid variant return level->isUnobstructed(bb) && level->getCubes(shared_from_this(), bb)->empty() && !level->containsAnyLiquid_NoLoad(bb); } -void Mob::outOfWorld() +void Mob::outOfWorld() { hurt(DamageSource::outOfWorld, 4); } -float Mob::getAttackAnim(float a) +float Mob::getAttackAnim(float a) { float diff = attackAnim - oAttackAnim; if (diff < 0) diff += 1; @@ -1516,9 +1516,9 @@ float Mob::getAttackAnim(float a) } -Vec3 *Mob::getPos(float a) +Vec3 *Mob::getPos(float a) { - if (a == 1) + if (a == 1) { return Vec3::newTemp(x, y, z); } @@ -1529,14 +1529,14 @@ Vec3 *Mob::getPos(float a) return Vec3::newTemp(x, y, z); } -Vec3 *Mob::getLookAngle() +Vec3 *Mob::getLookAngle() { return getViewVector(1); } -Vec3 *Mob::getViewVector(float a) +Vec3 *Mob::getViewVector(float a) { - if (a == 1) + if (a == 1) { float yCos = Mth::cos(-yRot * Mth::RAD_TO_GRAD - PI); float ySin = Mth::sin(-yRot * Mth::RAD_TO_GRAD - PI); @@ -1566,7 +1566,7 @@ float Mob::getHeadSizeScale() return 1.0f; } -HitResult *Mob::pick(double range, float a) +HitResult *Mob::pick(double range, float a) { Vec3 *from = getPos(a); Vec3 *b = getViewVector(a); @@ -1574,26 +1574,26 @@ HitResult *Mob::pick(double range, float a) return level->clip(from, to); } -int Mob::getMaxSpawnClusterSize() +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; //return equipment[pos + 1]; } -void Mob::handleEntityEvent(byte id) +void Mob::handleEntityEvent(byte id) { - if (id == EntityEvent::HURT) + if (id == EntityEvent::HURT) { this->walkAnimSpeed = 1.5f; @@ -1605,37 +1605,37 @@ void Mob::handleEntityEvent(byte id) // 4J-PB -added because villagers have no sounds int iHurtSound=getHurtSound(); if(iHurtSound!=-1) - { + { level->playSound(shared_from_this(), iHurtSound, getSoundVolume(), (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f); } MemSect(0); hurt(DamageSource::genericSource, 0); - } - else if (id == EntityEvent::DEATH) + } + else if (id == EntityEvent::DEATH) { MemSect(31); // 4J-PB -added because villagers have no sounds int iDeathSound=getDeathSound(); if(iDeathSound!=-1) - { + { level->playSound(shared_from_this(), iDeathSound, getSoundVolume(), (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f); } MemSect(0); health = 0; die(DamageSource::genericSource); - } - else + } + else { Entity::handleEntityEvent(id); } } -bool Mob::isSleeping() +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(); } @@ -1885,7 +1885,7 @@ float Mob::getWalkingSpeedModifier() return speed; } -void Mob::teleportTo(double x, double y, double z) +void Mob::teleportTo(double x, double y, double z) { moveTo(x, y, z, yRot, xRot); } @@ -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/Mob.h b/Minecraft.World/Mob.h index 0e1af2be..1844922a 100644 --- a/Minecraft.World/Mob.h +++ b/Minecraft.World/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: @@ -222,7 +222,7 @@ public: /** * Fetches the mob's armor value, from 0 (no armor) to 20 (full armor) - * + * * @return */ virtual int getArmorValue(); @@ -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(byte 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/MobEffect.cpp b/Minecraft.World/MobEffect.cpp index f9687a15..f9fecc18 100644 --- a/Minecraft.World/MobEffect.cpp +++ b/Minecraft.World/MobEffect.cpp @@ -82,11 +82,11 @@ int MobEffect::getId() * This method should perform periodic updates on the player. Mainly used * for regeneration effects and the like. Other effects, such as blindness, * are in effect for the whole duration of the effect. -* +* * @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())) { @@ -152,7 +152,7 @@ bool MobEffect::isInstantenous() * This parameter says if the applyEffect method should be called depending * on the remaining duration ticker. For instance, the regeneration will be * activated every 8 ticks, healing one point of health. -* +* * @param remainingDuration * @param amplification * Effect amplification, starts at 0 (weakest) diff --git a/Minecraft.World/MobEffect.h b/Minecraft.World/MobEffect.h index b0460bf1..6d760e87 100644 --- a/Minecraft.World/MobEffect.h +++ b/Minecraft.World/MobEffect.h @@ -86,14 +86,14 @@ 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); MobEffect *setDescriptionId(unsigned int id); unsigned int getDescriptionId(int iData = -1); - + // 4J Added MobEffect *setPostfixDescriptionId(unsigned int id); unsigned int getPostfixDescriptionId(int iData = -1); diff --git a/Minecraft.World/MobEffectInstance.cpp b/Minecraft.World/MobEffectInstance.cpp index 1e15e58c..a05b7b10 100644 --- a/Minecraft.World/MobEffectInstance.cpp +++ b/Minecraft.World/MobEffectInstance.cpp @@ -64,11 +64,11 @@ int MobEffectInstance::getAmplifier() /** * Runs the effect on a Mob target. -* +* * @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/MobEffectInstance.h b/Minecraft.World/MobEffectInstance.h index d1c716e6..bfecc612 100644 --- a/Minecraft.World/MobEffectInstance.h +++ b/Minecraft.World/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/MobSpawner.cpp b/Minecraft.World/MobSpawner.cpp index d2b4f6fd..f89ac395 100644 --- a/Minecraft.World/MobSpawner.cpp +++ b/Minecraft.World/MobSpawner.cpp @@ -100,12 +100,12 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie } MemSect(20); chunksToPoll.clear(); - + #if 0 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__ @@ -164,20 +164,20 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie #ifdef __PSVITA__ ChunkPos cp = ChunkPos( ( xx[i] - r ) + l , ( zz[i] - r )); if( chunksToPoll.find( cp ) ) chunksToPoll.insert(cp, true); - cp = ChunkPos( ( xx[i] + r ), ( zz[i] - r ) + l ); + cp = ChunkPos( ( xx[i] + r ), ( zz[i] - r ) + l ); if( chunksToPoll.find( cp ) ) chunksToPoll.insert(cp, true); - cp = ChunkPos( ( xx[i] + r ) - l , ( zz[i] + r )); + cp = ChunkPos( ( xx[i] + r ) - l , ( zz[i] + r )); if( chunksToPoll.find( cp ) ) chunksToPoll.insert(cp, true); - cp = ChunkPos( ( xx[i] - r ), ( zz[i] + r ) - l); + cp = ChunkPos( ( xx[i] - r ), ( zz[i] + r ) - l); if( chunksToPoll.find( cp ) ) chunksToPoll.insert(cp, true); #else ChunkPos cp = ChunkPos( ( xx[i] - r ) + l , ( zz[i] - r )); if( chunksToPoll.find( cp ) == chunksToPoll.end() ) chunksToPoll.insert(std::pair(cp, true)); - cp = ChunkPos( ( xx[i] + r ), ( zz[i] - r ) + l ); + cp = ChunkPos( ( xx[i] + r ), ( zz[i] - r ) + l ); if( chunksToPoll.find( cp ) == chunksToPoll.end() ) chunksToPoll.insert(std::pair(cp, true)); - cp = ChunkPos( ( xx[i] + r ) - l , ( zz[i] + r )); + cp = ChunkPos( ( xx[i] + r ) - l , ( zz[i] + r )); if( chunksToPoll.find( cp ) == chunksToPoll.end() ) chunksToPoll.insert(std::pair(cp, true)); - cp = ChunkPos( ( xx[i] - r ), ( zz[i] + r ) - l); + cp = ChunkPos( ( xx[i] - r ), ( zz[i] + r ) - l); if( chunksToPoll.find( cp ) == chunksToPoll.end() ) chunksToPoll.insert(std::pair(cp, true)); #endif @@ -193,7 +193,7 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie MemSect(31); Pos *spawnPos = level->getSharedSpawnPos(); MemSect(0); - + for (unsigned int i = 0; i < MobCategory::values.length; i++) { MobCategory *mobCategory = MobCategory::values[i]; @@ -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 // { @@ -391,7 +391,7 @@ bool MobSpawner::isSpawnPositionOk(MobCategory *category, Level *level, int x, i // 4J - changed to spawn water things only in deep water int yo = 0; int liquidCount = 0; - + while( ( y - yo ) >= 0 && ( yo < 5 ) ) { if( level->getMaterial(x, y - yo, z)->isLiquid() ) liquidCount++; @@ -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/MobSpawner.h b/Minecraft.World/MobSpawner.h index b5022a77..a426f0e6 100644 --- a/Minecraft.World/MobSpawner.h +++ b/Minecraft.World/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/MobSpawnerTile.cpp b/Minecraft.World/MobSpawnerTile.cpp index d926fc24..b16d685f 100644 --- a/Minecraft.World/MobSpawnerTile.cpp +++ b/Minecraft.World/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/MobSpawnerTile.h b/Minecraft.World/MobSpawnerTile.h index edf3c5e7..82ef6ea4 100644 --- a/Minecraft.World/MobSpawnerTile.h +++ b/Minecraft.World/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/MobSpawnerTileEntity.cpp b/Minecraft.World/MobSpawnerTileEntity.cpp index ce7ae1dc..31240a40 100644 --- a/Minecraft.World/MobSpawnerTileEntity.cpp +++ b/Minecraft.World/MobSpawnerTileEntity.cpp @@ -35,7 +35,7 @@ MobSpawnerTileEntity::MobSpawnerTileEntity() : TileEntity() displayEntity = nullptr; } -wstring MobSpawnerTileEntity::getEntityId() +wstring MobSpawnerTileEntity::getEntityId() { return entityId; } @@ -81,18 +81,18 @@ void MobSpawnerTileEntity::tick() if (spawnDelay == -1) delay(); - if (spawnDelay > 0) + if (spawnDelay > 0) { spawnDelay--; return; } - for (int c = 0; c < spawnCount; c++) + 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; @@ -110,16 +110,16 @@ void MobSpawnerTileEntity::tick() return; } - if (entity != NULL) + if (entity != NULL) { 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); - if (mob == NULL || mob->canSpawn()) + if (mob == NULL || mob->canSpawn()) { fillExtraData(entity); @@ -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) { @@ -156,7 +156,7 @@ void MobSpawnerTileEntity::fillExtraData(shared_ptr entity) } } -void MobSpawnerTileEntity::delay() +void MobSpawnerTileEntity::delay() { spawnDelay = minSpawnDelay + level->random->nextInt(maxSpawnDelay - minSpawnDelay); } @@ -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/MobSpawnerTileEntity.h b/Minecraft.World/MobSpawnerTileEntity.h index 9cfb9f2f..f22f8e8f 100644 --- a/Minecraft.World/MobSpawnerTileEntity.h +++ b/Minecraft.World/MobSpawnerTileEntity.h @@ -33,8 +33,8 @@ 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/MockedLevelStorage.cpp b/Minecraft.World/MockedLevelStorage.cpp index 9a7a63c0..8ac5fd7c 100644 --- a/Minecraft.World/MockedLevelStorage.cpp +++ b/Minecraft.World/MockedLevelStorage.cpp @@ -7,7 +7,7 @@ #include "ConsoleSaveFileIO.h" -LevelData *MockedLevelStorage::prepareLevel() +LevelData *MockedLevelStorage::prepareLevel() { return NULL; } @@ -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) { } @@ -34,7 +34,7 @@ PlayerIO *MockedLevelStorage::getPlayerIO() return NULL; } -void MockedLevelStorage::closeAll() +void MockedLevelStorage::closeAll() { } diff --git a/Minecraft.World/MockedLevelStorage.h b/Minecraft.World/MockedLevelStorage.h index 6a9eed70..e481379e 100644 --- a/Minecraft.World/MockedLevelStorage.h +++ b/Minecraft.World/MockedLevelStorage.h @@ -5,13 +5,13 @@ using namespace std; #include "ConsoleSavePath.h" -class MockedLevelStorage : public LevelStorage +class MockedLevelStorage : public LevelStorage { 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/Monster.cpp b/Minecraft.World/Monster.cpp index 627ce8d1..1ec418ae 100644 --- a/Minecraft.World/Monster.cpp +++ b/Minecraft.World/Monster.cpp @@ -30,7 +30,7 @@ Monster::Monster(Level *level) : PathfinderMob( level ) xpReward = Enemy::XP_REWARD_MEDIUM; } -void Monster::aiStep() +void Monster::aiStep() { float br = getBrightness(1); if (br > 0.5f) @@ -47,28 +47,28 @@ 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()) + if (sourceEntity != shared_from_this()) { this->attackTarget = sourceEntity; } @@ -79,11 +79,11 @@ bool Monster::hurt(DamageSource *source, int dmg) /** * Performs hurt action, returns if successful -* +* * @param target * @return */ -bool Monster::doHurtTarget(shared_ptr target) +bool Monster::doHurtTarget(std::shared_ptr target) { int dmg = attackDamage; if (hasEffect(MobEffect::damageBoost)) @@ -107,7 +107,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); @@ -117,7 +117,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) { @@ -140,7 +140,7 @@ bool Monster::isDarkEnoughToSpawn() int br = level->getRawBrightness(xt, yt, zt); - if (level->isThundering()) + if (level->isThundering()) { int tmp = level->skyDarken; level->skyDarken = 10; diff --git a/Minecraft.World/Monster.h b/Minecraft.World/Monster.h index 2bad48da..804760ee 100644 --- a/Minecraft.World/Monster.h +++ b/Minecraft.World/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/MonsterPlacerItem.cpp b/Minecraft.World/MonsterPlacerItem.cpp index a2970033..3c7809fe 100644 --- a/Minecraft.World/MonsterPlacerItem.cpp +++ b/Minecraft.World/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(); @@ -29,14 +29,14 @@ wstring MonsterPlacerItem::getHoverName(shared_ptr itemInstance) //elementName += " " + I18n.get("entity." + encodeId + ".name"); } else - { + { elementName = replaceAll(elementName,L"{*CREATURE*}",L""); } 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()) ); @@ -193,7 +193,7 @@ bool MonsterPlacerItem::useOn(shared_ptr itemInstance, shared_ptr< x += Facing::STEP_X[face]; y += Facing::STEP_Y[face]; z += Facing::STEP_Z[face]; - + double yOff = 0; // 4J-PB - missing parentheses added if (face == Facing::UP && (tile == Tile::fence_Id || tile == Tile::netherFence_Id)) @@ -211,11 +211,11 @@ bool MonsterPlacerItem::useOn(shared_ptr itemInstance, shared_ptr< } if (spawned) - { + { if (!player->abilities.instabuild) { itemInstance->count--; - } + } } else { @@ -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/MonsterPlacerItem.h b/Minecraft.World/MonsterPlacerItem.h index f1cead6d..bccca915 100644 --- a/Minecraft.World/MonsterPlacerItem.h +++ b/Minecraft.World/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/MonsterRoomFeature.cpp b/Minecraft.World/MonsterRoomFeature.cpp index cd44376a..cd8e4d53 100644 --- a/Minecraft.World/MonsterRoomFeature.cpp +++ b/Minecraft.World/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/MonsterRoomFeature.h b/Minecraft.World/MonsterRoomFeature.h index 88304ad6..81eeafde 100644 --- a/Minecraft.World/MonsterRoomFeature.h +++ b/Minecraft.World/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/MoveEntityPacket.cpp b/Minecraft.World/MoveEntityPacket.cpp index b52482f5..ce33c019 100644 --- a/Minecraft.World/MoveEntityPacket.cpp +++ b/Minecraft.World/MoveEntityPacket.cpp @@ -4,7 +4,7 @@ #include "PacketListener.h" #include "MoveEntityPacket.h" -MoveEntityPacket::MoveEntityPacket() +MoveEntityPacket::MoveEntityPacket() { hasRot = false; @@ -28,7 +28,7 @@ MoveEntityPacket::MoveEntityPacket(int id) xRot = 0; } -void MoveEntityPacket::read(DataInputStream *dis) //throws IOException +void MoveEntityPacket::read(DataInputStream *dis) //throws IOException { id = dis->readShort(); } @@ -48,7 +48,7 @@ void MoveEntityPacket::handle(PacketListener *listener) listener->handleMoveEntity(shared_from_this()); } -int MoveEntityPacket::getEstimatedSize() +int MoveEntityPacket::getEstimatedSize() { return 2; } @@ -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; } @@ -79,7 +79,7 @@ MoveEntityPacket::PosRot::PosRot(int id, char xa, char ya, char za, char yRot, c hasRot = true; } -void MoveEntityPacket::PosRot::read(DataInputStream *dis) //throws IOException +void MoveEntityPacket::PosRot::read(DataInputStream *dis) //throws IOException { MoveEntityPacket::read(dis); xa = dis->readByte(); @@ -89,7 +89,7 @@ void MoveEntityPacket::PosRot::read(DataInputStream *dis) //throws IOException xRot = dis->readByte(); } -void MoveEntityPacket::PosRot::write(DataOutputStream *dos) //throws IOException +void MoveEntityPacket::PosRot::write(DataOutputStream *dos) //throws IOException { MoveEntityPacket::write(dos); dos->writeByte(xa); @@ -99,12 +99,12 @@ void MoveEntityPacket::PosRot::write(DataOutputStream *dos) //throws IOException dos->writeByte(xRot); } -int MoveEntityPacket::PosRot::getEstimatedSize() +int MoveEntityPacket::PosRot::getEstimatedSize() { return 2+5; } -MoveEntityPacket::Pos::Pos() +MoveEntityPacket::Pos::Pos() { } @@ -115,7 +115,7 @@ MoveEntityPacket::Pos::Pos(int id, char xa, char ya, char za) : MoveEntityPacket this->za = za; } -void MoveEntityPacket::Pos::read(DataInputStream *dis) //throws IOException +void MoveEntityPacket::Pos::read(DataInputStream *dis) //throws IOException { MoveEntityPacket::read(dis); xa = dis->readByte(); @@ -136,7 +136,7 @@ int MoveEntityPacket::Pos::getEstimatedSize() return 2+3; } -MoveEntityPacket::Rot::Rot() +MoveEntityPacket::Rot::Rot() { hasRot = true; } @@ -148,14 +148,14 @@ MoveEntityPacket::Rot::Rot(int id, char yRot, char xRot) : MoveEntityPacket(id) hasRot = true; } -void MoveEntityPacket::Rot::read(DataInputStream *dis) //throws IOException +void MoveEntityPacket::Rot::read(DataInputStream *dis) //throws IOException { MoveEntityPacket::read(dis); yRot = dis->readByte(); xRot = dis->readByte(); } -void MoveEntityPacket::Rot::write(DataOutputStream *dos) //throws IOException +void MoveEntityPacket::Rot::write(DataOutputStream *dos) //throws IOException { MoveEntityPacket::write(dos); dos->writeByte(yRot); diff --git a/Minecraft.World/MoveEntityPacket.h b/Minecraft.World/MoveEntityPacket.h index ab16ac3a..7dbe0c29 100644 --- a/Minecraft.World/MoveEntityPacket.h +++ b/Minecraft.World/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/MoveEntityPacketSmall.cpp b/Minecraft.World/MoveEntityPacketSmall.cpp index 8216478f..8a46537f 100644 --- a/Minecraft.World/MoveEntityPacketSmall.cpp +++ b/Minecraft.World/MoveEntityPacketSmall.cpp @@ -5,7 +5,7 @@ #include "MoveEntityPacketSmall.h" -MoveEntityPacketSmall::MoveEntityPacketSmall() +MoveEntityPacketSmall::MoveEntityPacketSmall() { hasRot = false; @@ -35,7 +35,7 @@ MoveEntityPacketSmall::MoveEntityPacketSmall(int id) xRot = 0; } -void MoveEntityPacketSmall::read(DataInputStream *dis) //throws IOException +void MoveEntityPacketSmall::read(DataInputStream *dis) //throws IOException { id = dis->readShort(); } @@ -55,7 +55,7 @@ void MoveEntityPacketSmall::handle(PacketListener *listener) listener->handleMoveEntitySmall(shared_from_this()); } -int MoveEntityPacketSmall::getEstimatedSize() +int MoveEntityPacketSmall::getEstimatedSize() { return 2; } @@ -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; } @@ -86,18 +86,18 @@ MoveEntityPacketSmall::PosRot::PosRot(int id, char xa, char ya, char za, char yR hasRot = true; } -void MoveEntityPacketSmall::PosRot::read(DataInputStream *dis) //throws IOException +void MoveEntityPacketSmall::PosRot::read(DataInputStream *dis) //throws IOException { int idAndRot = dis->readShort(); this->id = idAndRot & 0x07ff; this->yRot = idAndRot >> 11; int xAndYAndZ = (int)dis->readShort(); - this->xa = xAndYAndZ >> 11; + this->xa = xAndYAndZ >> 11; this->ya = (xAndYAndZ << 21 ) >> 26; this->za = (xAndYAndZ << 27 ) >> 27; } -void MoveEntityPacketSmall::PosRot::write(DataOutputStream *dos) //throws IOException +void MoveEntityPacketSmall::PosRot::write(DataOutputStream *dos) //throws IOException { if( (id < 0 ) || (id >= 2048 ) ) { @@ -110,12 +110,12 @@ void MoveEntityPacketSmall::PosRot::write(DataOutputStream *dos) //throws IOExce dos->writeShort(xAndYAndZ); } -int MoveEntityPacketSmall::PosRot::getEstimatedSize() +int MoveEntityPacketSmall::PosRot::getEstimatedSize() { return 4; } -MoveEntityPacketSmall::Pos::Pos() +MoveEntityPacketSmall::Pos::Pos() { } @@ -126,7 +126,7 @@ MoveEntityPacketSmall::Pos::Pos(int id, char xa, char ya, char za) : MoveEntityP this->za = za; } -void MoveEntityPacketSmall::Pos::read(DataInputStream *dis) //throws IOException +void MoveEntityPacketSmall::Pos::read(DataInputStream *dis) //throws IOException { int idAndY = dis->readShort(); this->id = idAndY & 0x07ff; @@ -154,7 +154,7 @@ int MoveEntityPacketSmall::Pos::getEstimatedSize() return 3; } -MoveEntityPacketSmall::Rot::Rot() +MoveEntityPacketSmall::Rot::Rot() { hasRot = true; } @@ -167,14 +167,14 @@ MoveEntityPacketSmall::Rot::Rot(int id, char yRot, char xRot) : MoveEntityPacket hasRot = true; } -void MoveEntityPacketSmall::Rot::read(DataInputStream *dis) //throws IOException +void MoveEntityPacketSmall::Rot::read(DataInputStream *dis) //throws IOException { int idAndRot = (int)dis->readShort(); this->id = idAndRot & 0x07ff; this->yRot = idAndRot >> 11; } -void MoveEntityPacketSmall::Rot::write(DataOutputStream *dos) //throws IOException +void MoveEntityPacketSmall::Rot::write(DataOutputStream *dos) //throws IOException { if( (id < 0 ) || (id >= 2048 ) ) { diff --git a/Minecraft.World/MoveEntityPacketSmall.h b/Minecraft.World/MoveEntityPacketSmall.h index 4218f11b..2fc54dd6 100644 --- a/Minecraft.World/MoveEntityPacketSmall.h +++ b/Minecraft.World/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/MoveIndoorsGoal.cpp b/Minecraft.World/MoveIndoorsGoal.cpp index 215f9a29..697b2840 100644 --- a/Minecraft.World/MoveIndoorsGoal.cpp +++ b/Minecraft.World/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/MovePlayerPacket.cpp b/Minecraft.World/MovePlayerPacket.cpp index 9f0a8867..e5153cb5 100644 --- a/Minecraft.World/MovePlayerPacket.cpp +++ b/Minecraft.World/MovePlayerPacket.cpp @@ -4,7 +4,7 @@ #include "PacketListener.h" #include "MovePlayerPacket.h" -MovePlayerPacket::MovePlayerPacket() +MovePlayerPacket::MovePlayerPacket() { x = 0; y = 0; @@ -33,12 +33,12 @@ MovePlayerPacket::MovePlayerPacket(bool onGround, bool isFlying) this->isFlying = isFlying; } -void MovePlayerPacket::handle(PacketListener *listener) +void MovePlayerPacket::handle(PacketListener *listener) { listener->handleMovePlayer(shared_from_this()); } -void MovePlayerPacket::read(DataInputStream *dis) //throws IOException +void MovePlayerPacket::read(DataInputStream *dis) //throws IOException { char value = dis->read(); onGround = (value & 0x1) != 0; @@ -46,7 +46,7 @@ void MovePlayerPacket::read(DataInputStream *dis) //throws IOException //onGround = dis->read() != 0; } -void MovePlayerPacket::write(DataOutputStream *dos) //throws IOException +void MovePlayerPacket::write(DataOutputStream *dos) //throws IOException { char value = (onGround ? 0x1 : 0) | (isFlying ? 0x2 : 0); dos->write(value); @@ -63,7 +63,7 @@ bool MovePlayerPacket::canBeInvalidated() return true; } -bool MovePlayerPacket::isInvalidatedBy(shared_ptr packet) +bool MovePlayerPacket::isInvalidatedBy(std::shared_ptr packet) { return true; } @@ -88,7 +88,7 @@ MovePlayerPacket::PosRot::PosRot(double x, double y, double yView, double z, flo this->isFlying = isFlying; } -void MovePlayerPacket::PosRot::read(DataInputStream *dis) //throws IOException +void MovePlayerPacket::PosRot::read(DataInputStream *dis) //throws IOException { x = dis->readDouble(); y = dis->readDouble(); @@ -99,7 +99,7 @@ void MovePlayerPacket::PosRot::read(DataInputStream *dis) //throws IOException MovePlayerPacket::read(dis); } -void MovePlayerPacket::PosRot::write(DataOutputStream *dos) //throws IOException +void MovePlayerPacket::PosRot::write(DataOutputStream *dos) //throws IOException { dos->writeDouble(x); dos->writeDouble(y); @@ -120,7 +120,7 @@ MovePlayerPacket::Pos::Pos() hasPos = true; } -MovePlayerPacket::Pos::Pos(double x, double y, double yView, double z, bool onGround, bool isFlying) +MovePlayerPacket::Pos::Pos(double x, double y, double yView, double z, bool onGround, bool isFlying) { this->x = x; this->y = y; @@ -149,17 +149,17 @@ void MovePlayerPacket::Pos::write(DataOutputStream *dos) //throws IOException MovePlayerPacket::write(dos); } -int MovePlayerPacket::Pos::getEstimatedSize() +int MovePlayerPacket::Pos::getEstimatedSize() { return 8 * 4 + 1; } -MovePlayerPacket::Rot::Rot() +MovePlayerPacket::Rot::Rot() { hasRot = true; } -MovePlayerPacket::Rot::Rot(float yRot, float xRot, bool onGround, bool isFlying) +MovePlayerPacket::Rot::Rot(float yRot, float xRot, bool onGround, bool isFlying) { this->yRot = yRot; this->xRot = xRot; @@ -168,7 +168,7 @@ MovePlayerPacket::Rot::Rot(float yRot, float xRot, bool onGround, bool isFlying) this->isFlying = isFlying; } -void MovePlayerPacket::Rot::read(DataInputStream *dis) //throws IOException +void MovePlayerPacket::Rot::read(DataInputStream *dis) //throws IOException { yRot = dis->readFloat(); xRot = dis->readFloat(); @@ -182,7 +182,7 @@ void MovePlayerPacket::Rot::write(DataOutputStream *dos) //throws IOException MovePlayerPacket::write(dos); } -int MovePlayerPacket::Rot::getEstimatedSize() +int MovePlayerPacket::Rot::getEstimatedSize() { return 8 + 1; } diff --git a/Minecraft.World/MovePlayerPacket.h b/Minecraft.World/MovePlayerPacket.h index 26ae8392..d91c0c37 100644 --- a/Minecraft.World/MovePlayerPacket.h +++ b/Minecraft.World/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/MoveThroughVillageGoal.cpp b/Minecraft.World/MoveThroughVillageGoal.cpp index 2405374f..40acca5d 100644 --- a/Minecraft.World/MoveThroughVillageGoal.cpp +++ b/Minecraft.World/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/MoveThroughVillageGoal.h b/Minecraft.World/MoveThroughVillageGoal.h index a087e522..1d14d587 100644 --- a/Minecraft.World/MoveThroughVillageGoal.h +++ b/Minecraft.World/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/MultiTextureTileItem.cpp b/Minecraft.World/MultiTextureTileItem.cpp index a41a896f..6af8acd2 100644 --- a/Minecraft.World/MultiTextureTileItem.cpp +++ b/Minecraft.World/MultiTextureTileItem.cpp @@ -13,19 +13,19 @@ MultiTextureTileItem::MultiTextureTileItem(int id, Tile *parentTile, int *nameEx setStackedByData(true); } -Icon *MultiTextureTileItem::getIcon(int itemAuxValue) +Icon *MultiTextureTileItem::getIcon(int itemAuxValue) { return parentTile->getTexture(2, itemAuxValue); } -int MultiTextureTileItem::getLevelDataForAuxValue(int auxValue) +int MultiTextureTileItem::getLevelDataForAuxValue(int auxValue) { return auxValue; } unsigned int MultiTextureTileItem::getDescriptionId(int iData) { - if (iData < 0 || iData >= m_iNameExtensionsLength) + if (iData < 0 || iData >= m_iNameExtensionsLength) { iData = 0; } @@ -33,10 +33,10 @@ 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) + if (auxValue < 0 || auxValue >= m_iNameExtensionsLength) { auxValue = 0; } diff --git a/Minecraft.World/MultiTextureTileItem.h b/Minecraft.World/MultiTextureTileItem.h index 078357ea..028169cd 100644 --- a/Minecraft.World/MultiTextureTileItem.h +++ b/Minecraft.World/MultiTextureTileItem.h @@ -4,7 +4,7 @@ class Tile; -class MultiTextureTileItem : public TileItem +class MultiTextureTileItem : public TileItem { private: Tile *parentTile; @@ -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/MushroomCow.cpp b/Minecraft.World/MushroomCow.cpp index a2aef158..179746f1 100644 --- a/Minecraft.World/MushroomCow.cpp +++ b/Minecraft.World/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) + 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,16 +45,16 @@ 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; + return true; } 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/MushroomCow.h b/Minecraft.World/MushroomCow.h index 4ec97476..27bc9e35 100644 --- a/Minecraft.World/MushroomCow.h +++ b/Minecraft.World/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/MusicTile.cpp b/Minecraft.World/MusicTile.cpp index ebdb9680..fe8503e2 100644 --- a/Minecraft.World/MusicTile.cpp +++ b/Minecraft.World/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/MusicTile.h b/Minecraft.World/MusicTile.h index 47333870..09c4618b 100644 --- a/Minecraft.World/MusicTile.h +++ b/Minecraft.World/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/MusicTileEntity.cpp b/Minecraft.World/MusicTileEntity.cpp index 4c2d2615..54e1568b 100644 --- a/Minecraft.World/MusicTileEntity.cpp +++ b/Minecraft.World/MusicTileEntity.cpp @@ -13,7 +13,7 @@ MusicTileEntity::MusicTileEntity() : TileEntity() { note = 0; - + on = false; } @@ -23,7 +23,7 @@ void MusicTileEntity::save(CompoundTag *tag) tag->putByte(L"note", note); } -void MusicTileEntity::load(CompoundTag *tag) +void MusicTileEntity::load(CompoundTag *tag) { TileEntity::load(tag); note = tag->getByte(L"note"); @@ -31,7 +31,7 @@ void MusicTileEntity::load(CompoundTag *tag) if (note > 24) note = 24; } -void MusicTileEntity::tune() +void MusicTileEntity::tune() { note = (byte) ((note + 1) % 25); setChanged(); @@ -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/MusicTileEntity.h b/Minecraft.World/MusicTileEntity.h index a4941ff1..6e631981 100644 --- a/Minecraft.World/MusicTileEntity.h +++ b/Minecraft.World/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/NearestAttackableTargetGoal.cpp b/Minecraft.World/NearestAttackableTargetGoal.cpp index 5ed9f4f1..23bf8d0b 100644 --- a/Minecraft.World/NearestAttackableTargetGoal.cpp +++ b/Minecraft.World/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/NearestAttackableTargetGoal.h b/Minecraft.World/NearestAttackableTargetGoal.h index a10e9264..af796840 100644 --- a/Minecraft.World/NearestAttackableTargetGoal.h +++ b/Minecraft.World/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/NetherBridgePieces.cpp b/Minecraft.World/NetherBridgePieces.cpp index 9a795e78..d643904b 100644 --- a/Minecraft.World/NetherBridgePieces.cpp +++ b/Minecraft.World/NetherBridgePieces.cpp @@ -43,7 +43,7 @@ NetherBridgePieces::PieceWeight *NetherBridgePieces::bridgePieceWeights[NetherBr new PieceWeight(EPieceClass_StairsRoom, 10, 3), }; -NetherBridgePieces::PieceWeight *NetherBridgePieces::castlePieceWeights[NetherBridgePieces::CASTLE_PIECEWEIGHTS_COUNT] = +NetherBridgePieces::PieceWeight *NetherBridgePieces::castlePieceWeights[NetherBridgePieces::CASTLE_PIECEWEIGHTS_COUNT] = { new PieceWeight(EPieceClass_CastleStalkRoom, 30, 2), // 4J Stu - Increased weight to ensure that we have these (was 5), required for Nether Wart, and therefore required for brewing new PieceWeight(EPieceClass_CastleSmallCorridorPiece, 25, 0, true), @@ -325,7 +325,7 @@ NetherBridgePieces::BridgeStraight *NetherBridgePieces::BridgeStraight::createPi { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -3, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -386,7 +386,7 @@ NetherBridgePieces::BridgeEndFiller *NetherBridgePieces::BridgeEndFiller::create { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -3, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -475,7 +475,7 @@ NetherBridgePieces::BridgeCrossing *NetherBridgePieces::BridgeCrossing::createPi { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -8, -3, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -576,7 +576,7 @@ NetherBridgePieces::RoomCrossing *NetherBridgePieces::RoomCrossing::createPiece( { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -2, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -641,7 +641,7 @@ NetherBridgePieces::StairsRoom *NetherBridgePieces::StairsRoom::createPiece(list { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -2, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -711,7 +711,7 @@ NetherBridgePieces::MonsterThrone *NetherBridgePieces::MonsterThrone::createPiec { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -2, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -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"); } } @@ -789,7 +789,7 @@ NetherBridgePieces::CastleEntrance *NetherBridgePieces::CastleEntrance::createPi { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -5, -3, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -915,7 +915,7 @@ NetherBridgePieces::CastleStalkRoom *NetherBridgePieces::CastleStalkRoom::create { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -5, -3, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -1077,7 +1077,7 @@ NetherBridgePieces::CastleSmallCorridorPiece *NetherBridgePieces::CastleSmallCor BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -1137,7 +1137,7 @@ NetherBridgePieces::CastleSmallCorridorCrossingPiece *NetherBridgePieces::Castle { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -1193,7 +1193,7 @@ NetherBridgePieces::CastleSmallCorridorRightTurnPiece *NetherBridgePieces::Castl { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -1254,7 +1254,7 @@ NetherBridgePieces::CastleSmallCorridorLeftTurnPiece *NetherBridgePieces::Castle { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -1315,7 +1315,7 @@ NetherBridgePieces::CastleCorridorStairsPiece *NetherBridgePieces::CastleCorrido { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -7, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -1393,7 +1393,7 @@ NetherBridgePieces::CastleCorridorTBalconyPiece *NetherBridgePieces::CastleCorri { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -3, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) diff --git a/Minecraft.World/NetherStalkTile.cpp b/Minecraft.World/NetherStalkTile.cpp index eadf9646..731552f8 100644 --- a/Minecraft.World/NetherStalkTile.cpp +++ b/Minecraft.World/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/OcelotSitOnTileGoal.cpp b/Minecraft.World/OcelotSitOnTileGoal.cpp index f5cf7066..0d0af7de 100644 --- a/Minecraft.World/OcelotSitOnTileGoal.cpp +++ b/Minecraft.World/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/OldChunkStorage.cpp b/Minecraft.World/OldChunkStorage.cpp index c1515c12..ca085cbe 100644 --- a/Minecraft.World/OldChunkStorage.cpp +++ b/Minecraft.World/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/OwnerHurtByTargetGoal.cpp b/Minecraft.World/OwnerHurtByTargetGoal.cpp index e576f575..521d859d 100644 --- a/Minecraft.World/OwnerHurtByTargetGoal.cpp +++ b/Minecraft.World/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/OwnerHurtTargetGoal.cpp b/Minecraft.World/OwnerHurtTargetGoal.cpp index c6c367d7..9782951b 100644 --- a/Minecraft.World/OwnerHurtTargetGoal.cpp +++ b/Minecraft.World/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/Ozelot.cpp b/Minecraft.World/Ozelot.cpp index 3c05f357..e43705ec 100644 --- a/Minecraft.World/Ozelot.cpp +++ b/Minecraft.World/Ozelot.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/Ozelot.h b/Minecraft.World/Ozelot.h index c763f3bc..fd628f4b 100644 --- a/Minecraft.World/Ozelot.h +++ b/Minecraft.World/Ozelot.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/OzelotAttackGoal.cpp b/Minecraft.World/OzelotAttackGoal.cpp index 27ca2b5c..099a3f8a 100644 --- a/Minecraft.World/OzelotAttackGoal.cpp +++ b/Minecraft.World/OzelotAttackGoal.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/Packet.cpp b/Minecraft.World/Packet.cpp index 8bac8629..48e203f7 100644 --- a/Minecraft.World/Packet.cpp +++ b/Minecraft.World/Packet.cpp @@ -207,7 +207,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 @@ -285,7 +285,7 @@ int64_t 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 @@ -326,7 +326,7 @@ byteArray Packet::readBytes(DataInputStream *datainputstream) } -bool Packet::canSendToAnyClient(shared_ptr packet) +bool Packet::canSendToAnyClient(std::shared_ptr packet) { int packetId = packet->getId(); @@ -345,10 +345,10 @@ 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? { int id = 0; - shared_ptr packet = nullptr; + std::shared_ptr packet = nullptr; // 4J - removed try/catch // try @@ -399,7 +399,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()); @@ -519,7 +519,7 @@ bool Packet::canBeInvalidated() return false; } -bool Packet::isInvalidatedBy(shared_ptr packet) +bool Packet::isInvalidatedBy(std::shared_ptr packet) { return false; } @@ -530,16 +530,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()) { @@ -550,7 +550,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/Packet.h b/Minecraft.World/Packet.h index 0bafe443..46499e0c 100644 --- a/Minecraft.World/Packet.h +++ b/Minecraft.World/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/PacketListener.cpp b/Minecraft.World/PacketListener.cpp index 2f051d7d..8c507cdc 100644 --- a/Minecraft.World/PacketListener.cpp +++ b/Minecraft.World/PacketListener.cpp @@ -2,383 +2,383 @@ #include "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) { } -void PacketListener::onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects) +void PacketListener::onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects) { } -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/PacketListener.h b/Minecraft.World/PacketListener.h index 93b14603..85d8d122 100644 --- a/Minecraft.World/PacketListener.h +++ b/Minecraft.World/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/Painting.cpp b/Minecraft.World/Painting.cpp index 0d8f35fe..bc4eef38 100644 --- a/Minecraft.World/Painting.cpp +++ b/Minecraft.World/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(); @@ -132,17 +132,17 @@ void Painting::readAdditionalSaveData(CompoundTag *tag) HangingEntity::readAdditionalSaveData(tag); } -int Painting::getWidth() +int Painting::getWidth() { return motive->w; } -int Painting::getHeight() +int Painting::getHeight() { return motive->h; } -void Painting::dropItem() +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/Painting.h b/Minecraft.World/Painting.h index 7866b662..c382420e 100644 --- a/Minecraft.World/Painting.h +++ b/Minecraft.World/Painting.h @@ -73,7 +73,7 @@ public: public: // int dir; -// +// // int xTile, yTile, zTile; Motive *motive; @@ -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/Path.cpp b/Minecraft.World/Path.cpp index 538917f6..61bd055e 100644 --- a/Minecraft.World/Path.cpp +++ b/Minecraft.World/Path.cpp @@ -13,7 +13,7 @@ Path::~Path() } } -Path::Path(NodeArray nodes) +Path::Path(NodeArray nodes) { index = 0; @@ -30,26 +30,26 @@ Path::Path(NodeArray nodes) } } -void Path::next() +void Path::next() { index++; } -bool Path::isDone() +bool Path::isDone() { return index >= length; } -Node *Path::last() +Node *Path::last() { - if (length > 0) + if (length > 0) { return nodes[length - 1]; } return NULL; } -Node *Path::get(int i) +Node *Path::get(int i) { return nodes[i]; } @@ -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/Path.h b/Minecraft.World/Path.h index 01f56e72..f0983e47 100644 --- a/Minecraft.World/Path.h +++ b/Minecraft.World/Path.h @@ -1,6 +1,6 @@ #pragma once -class Path +class Path { friend class PathFinder; @@ -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/PathNavigation.cpp b/Minecraft.World/PathNavigation.cpp index 2bf01672..30140712 100644 --- a/Minecraft.World/PathNavigation.cpp +++ b/Minecraft.World/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/PathNavigation.h b/Minecraft.World/PathNavigation.h index b8a8cfd6..9dd40c1d 100644 --- a/Minecraft.World/PathNavigation.h +++ b/Minecraft.World/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/PathfinderMob.cpp b/Minecraft.World/PathfinderMob.cpp index b72e064f..da6ccd55 100644 --- a/Minecraft.World/PathfinderMob.cpp +++ b/Minecraft.World/PathfinderMob.cpp @@ -71,7 +71,7 @@ void PathfinderMob::serverAiStep() } else if (!holdGround && ((path == NULL && (random->nextInt(180) == 0) || fleeTime > 0) || (random->nextInt(120) == 0 || fleeTime > 0))) { - if(noActionTime < SharedConstants::TICKS_PER_SECOND * 5) + if(noActionTime < SharedConstants::TICKS_PER_SECOND * 5) { findRandomStrollLocation(); } @@ -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/PathfinderMob.h b/Minecraft.World/PathfinderMob.h index fdbadf8c..df759f48 100644 --- a/Minecraft.World/PathfinderMob.h +++ b/Minecraft.World/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/PickaxeItem.cpp b/Minecraft.World/PickaxeItem.cpp index 5876b9bb..d545fba2 100644 --- a/Minecraft.World/PickaxeItem.cpp +++ b/Minecraft.World/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/PickaxeItem.h b/Minecraft.World/PickaxeItem.h index 52dac510..2ecf1263 100644 --- a/Minecraft.World/PickaxeItem.h +++ b/Minecraft.World/PickaxeItem.h @@ -9,12 +9,12 @@ class PickaxeItem : public DiggerItem private: static TileArray *diggables; -public: // +public: // static void staticCtor(); PickaxeItem(int id, const Tier *tier); 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/Pig.cpp b/Minecraft.World/Pig.cpp index b556a936..21086365 100644 --- a/Minecraft.World/Pig.cpp +++ b/Minecraft.World/Pig.cpp @@ -56,49 +56,49 @@ 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; } -void Pig::defineSynchedData() +void Pig::defineSynchedData() { Animal::defineSynchedData(); entityData->define(DATA_SADDLE_ID, (byte) 0); } -void Pig::addAdditonalSaveData(CompoundTag *tag) +void Pig::addAdditonalSaveData(CompoundTag *tag) { Animal::addAdditonalSaveData(tag); tag->putBoolean(L"Saddle", hasSaddle()); } -void Pig::readAdditionalSaveData(CompoundTag *tag) +void Pig::readAdditionalSaveData(CompoundTag *tag) { Animal::readAdditionalSaveData(tag); setSaddle(tag->getBoolean(L"Saddle")); } -int Pig::getAmbientSound() +int Pig::getAmbientSound() { return eSoundType_MOB_PIG_AMBIENT; } -int Pig::getHurtSound() +int Pig::getHurtSound() { return eSoundType_MOB_PIG_AMBIENT; } -int Pig::getDeathSound() +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)) { - if (hasSaddle() && !level->isClientSide && (rider.lock() == NULL || rider.lock() == player)) + if (hasSaddle() && !level->isClientSide && (rider.lock() == NULL || rider.lock() == player)) { // 4J HEG - Fixed issue with player not being able to dismount pig (issue #4479) player->ride( rider.lock() == player ? nullptr : shared_from_this() ); @@ -109,7 +109,7 @@ bool Pig::interact(shared_ptr player) return true; } -int Pig::getDeathLoot() +int Pig::getDeathLoot() { if (this->isOnFire() ) return Item::porkChop_cooked->id; return Item::porkChop_raw_Id; @@ -133,18 +133,18 @@ void Pig::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) if (hasSaddle()) spawnAtLocation(Item::saddle_Id, 1); } -bool Pig::hasSaddle() +bool Pig::hasSaddle() { return (entityData->getByte(DATA_SADDLE_ID) & 1) != 0; } -void Pig::setSaddle(bool value) +void Pig::setSaddle(bool value) { - if (value) + if (value) { entityData->set(DATA_SADDLE_ID, (byte) 1); - } - else + } + else { entityData->set(DATA_SADDLE_ID, (byte) 0); } @@ -153,13 +153,13 @@ 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(); } -void Pig::causeFallDamage(float distance) +void Pig::causeFallDamage(float distance) { Animal::causeFallDamage(distance); if (distance > 5 && dynamic_pointer_cast( rider.lock() ) != NULL) @@ -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/Pig.h b/Minecraft.World/Pig.h index adcfbf4e..34695b74 100644 --- a/Minecraft.World/Pig.h +++ b/Minecraft.World/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/PigZombie.cpp b/Minecraft.World/PigZombie.cpp index cc060484..35da6eb9 100644 --- a/Minecraft.World/PigZombie.cpp +++ b/Minecraft.World/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() @@ -51,7 +51,7 @@ bool PigZombie::useNewAi() return false; } -int PigZombie::getTexture() +int PigZombie::getTexture() { return textureIdx; } @@ -69,7 +69,7 @@ void PigZombie::tick() Zombie::tick(); } -bool PigZombie::canSpawn() +bool PigZombie::canSpawn() { return level->difficulty > Difficulty::PEACEFUL && level->isUnobstructed(bb) && level->getCubes(shared_from_this(), bb)->empty() && !level->containsAnyLiquid(bb); } @@ -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/PigZombie.h b/Minecraft.World/PigZombie.h index b47efacb..ff164edf 100644 --- a/Minecraft.World/PigZombie.h +++ b/Minecraft.World/PigZombie.h @@ -5,7 +5,7 @@ using namespace std; class DamageSource; -// SKIN BY XaPhobia Chris Beidler +// SKIN BY XaPhobia Chris Beidler class PigZombie : public Zombie { public: @@ -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/PistonBaseTile.cpp b/Minecraft.World/PistonBaseTile.cpp index cbad5cec..ab8199c3 100644 --- a/Minecraft.World/PistonBaseTile.cpp +++ b/Minecraft.World/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); @@ -180,7 +180,7 @@ void PistonBaseTile::checkIfExtend(Level *level, int x, int y, int z) * This method checks neighbor signals for this block and the block above, * and directly beneath. However, it avoids checking blocks that would be * pushed by this block. - * + * * @param level * @param x * @param y @@ -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,9 +404,9 @@ 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) + if (Mth::abs((float) player->x - x) < 2 && Mth::abs((float) player->z - z) < 2) { // If the player is above the block, the slot is on the top double py = player->y + 1.82 - player->heightOffset; @@ -456,7 +456,7 @@ bool PistonBaseTile::isPushable(int block, Level *level, int cx, int cy, int cz, { return false; } - + if (!allowDestroyable && Tile::tiles[block]->getPistonPushReaction() == Material::PUSH_DESTROY) { return false; @@ -486,7 +486,7 @@ bool PistonBaseTile::canPush(Level *level, int sx, int sy, int sz, int facing) // out of bounds return false; } - + // 4J - added to also check for out of bounds in x/z for our finite world int minXZ = - (level->dimension->getXZSize() * 16 ) / 2; int maxXZ = (level->dimension->getXZSize() * 16 ) / 2 - 1; @@ -529,7 +529,7 @@ bool PistonBaseTile::canPush(Level *level, int sx, int sy, int sz, int facing) void PistonBaseTile::stopSharingIfServer(Level *level, int x, int y, int z) { if( !level->isClientSide ) - { + { MultiPlayerLevel *clientLevel = Minecraft::GetInstance()->getLevel(level->dimension->id); if( clientLevel ) { @@ -552,7 +552,7 @@ bool PistonBaseTile::createPush(Level *level, int sx, int sy, int sz, int facing // out of bounds return false; } - + // 4J - added to also check for out of bounds in x/z for our finite world int minXZ = - (level->dimension->getXZSize() * 16 ) / 2; int maxXZ = (level->dimension->getXZSize() * 16 ) / 2 - 1; diff --git a/Minecraft.World/PistonBaseTile.h b/Minecraft.World/PistonBaseTile.h index 0fda1391..c61eec86 100644 --- a/Minecraft.World/PistonBaseTile.h +++ b/Minecraft.World/PistonBaseTile.h @@ -27,8 +27,8 @@ private: static DWORD tlsIdx; // 4J - was just a static but implemented with TLS for our version - static bool ignoreUpdate(); - static void ignoreUpdate(bool set); + static bool ignoreUpdate(); + static void ignoreUpdate(bool set); public: PistonBaseTile(int id, bool isSticky); @@ -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/PistonExtensionTile.cpp b/Minecraft.World/PistonExtensionTile.cpp index 1827ddde..882a6116 100644 --- a/Minecraft.World/PistonExtensionTile.cpp +++ b/Minecraft.World/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/PistonExtensionTile.h b/Minecraft.World/PistonExtensionTile.h index a0b08729..8ebb9bd1 100644 --- a/Minecraft.World/PistonExtensionTile.h +++ b/Minecraft.World/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/PistonMovingPiece.cpp b/Minecraft.World/PistonMovingPiece.cpp index e141cebe..a9d661ee 100644 --- a/Minecraft.World/PistonMovingPiece.cpp +++ b/Minecraft.World/PistonMovingPiece.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/PistonMovingPiece.h b/Minecraft.World/PistonMovingPiece.h index 1b1a61dc..e27a6381 100644 --- a/Minecraft.World/PistonMovingPiece.h +++ b/Minecraft.World/PistonMovingPiece.h @@ -8,7 +8,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); @@ -18,18 +18,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/PistonPieceEntity.cpp b/Minecraft.World/PistonPieceEntity.cpp index 3498cec0..99b9e5ca 100644 --- a/Minecraft.World/PistonPieceEntity.cpp +++ b/Minecraft.World/PistonPieceEntity.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/PistonPieceEntity.h b/Minecraft.World/PistonPieceEntity.h index 8d8543ef..2a451207 100644 --- a/Minecraft.World/PistonPieceEntity.h +++ b/Minecraft.World/PistonPieceEntity.h @@ -36,5 +36,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/PlayGoal.cpp b/Minecraft.World/PlayGoal.cpp index 304e7758..07b94ff9 100644 --- a/Minecraft.World/PlayGoal.cpp +++ b/Minecraft.World/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/Player.cpp b/Minecraft.World/Player.cpp index d4832e40..25aeceb8 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -2,7 +2,7 @@ // All the instanceof s from Java have been converted to dynamic_cast in this file // Once all the classes are finished it may be that we do not need to use dynamic_cast -// for every test and a simple virtual function should suffice. We probably only need +// for every test and a simple virtual function should suffice. We probably only need // dynamic_cast to find one of the classes that an object derives from, and not to find // the derived class itself (which should own the virtual GetType function) @@ -44,7 +44,7 @@ void Player::_init() { - inventory = shared_ptr( new Inventory( this ) ); + inventory = std::shared_ptr( new Inventory( this ) ); userType = 0; score = 0; @@ -116,7 +116,7 @@ void Player::_init() m_ePlayerNameValidState=ePlayerNameValid_NotSet; #endif - enderChestInventory = shared_ptr(new PlayerEnderChestContainer()); + enderChestInventory = std::shared_ptr(new PlayerEnderChestContainer()); m_bAwardedOnARail=false; } @@ -186,7 +186,7 @@ void Player::defineSynchedData() entityData->define(DATA_PLAYER_RUNNING_ID, (byte) 0); } -shared_ptr Player::getUseItem() +std::shared_ptr Player::getUseItem() { return useItem; } @@ -245,7 +245,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) @@ -344,7 +344,7 @@ void Player::tick() zCloak += zca * 0.25; yCloak += yca * 0.25; - if (riding == NULL) + if (riding == NULL) { if( minecartAchievementPos != NULL ) { @@ -367,73 +367,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); */ @@ -454,10 +454,10 @@ void Player::tick() // minecart. For some reason some of the torches come off so it will also need some fixing along the way. 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; @@ -523,7 +523,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) { @@ -558,7 +558,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; @@ -594,7 +594,7 @@ void Player::closeContainer() containerMenu = inventoryMenu; } -void Player::ride(shared_ptr e) +void Player::ride(std::shared_ptr e) { if (riding != NULL && e == NULL) { @@ -611,8 +611,8 @@ void Player::ride(shared_ptr e) Mob::ride(e); } -void Player::setPlayerDefaultSkin(EDefaultSkins skin) -{ +void Player::setPlayerDefaultSkin(EDefaultSkins skin) +{ #ifndef _CONTENT_PACKAGE wprintf(L"Setting default skin to %d for player %ls\n", skin, name.c_str() ); #endif @@ -631,8 +631,8 @@ void Player::setCustomSkin(DWORD skinId) setAnimOverrideBitmask(getSkinAnimOverrideBitmask(skinId)); if( !GET_IS_DLC_SKIN_FROM_BITMASK(skinId) ) - { - // GET_UGC_SKIN_ID_FROM_BITMASK will always be zero - this was for a possible custom skin editor skin + { + // GET_UGC_SKIN_ID_FROM_BITMASK will always be zero - this was for a possible custom skin editor skin DWORD ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(skinId); DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId); if( ugcSkinIndex == 0 && defaultSkinIndex > 0 ) @@ -702,7 +702,7 @@ unsigned int Player::getSkinAnimOverrideBitmask(DWORD skinId) { unsigned long bitmask = 0L; if( GET_IS_DLC_SKIN_FROM_BITMASK(skinId) ) - { + { // Temp check for anim override switch( GET_DLC_SKIN_ID_FROM_BITMASK(skinId) ) { @@ -765,7 +765,7 @@ void Player::setCustomCape(DWORD capeId) else { MOJANG_DATA *pMojangData=app.GetMojangDataForXuid(getOnlineXuid()); - if(pMojangData) + if(pMojangData) { // Cape if(pMojangData->wchCape) @@ -802,7 +802,7 @@ void Player::setCustomCape(DWORD capeId) DWORD Player::getCapeIdFromPath(const wstring &cape) { - bool dlcCape = false; + bool dlcCape = false; unsigned int capeId = 0; if(cape.size() >= 14) @@ -866,7 +866,7 @@ void Player::ChangePlayerSkin() this->customTextureUrl=L""; } else - { + { if(m_uiPlayerCurrentSkin>0) { // change this players custom texture url @@ -880,7 +880,7 @@ void Player::prepareCustomTextures() { MOJANG_DATA *pMojangData=app.GetMojangDataForXuid(getOnlineXuid()); - if(pMojangData) + if(pMojangData) { // Skin if(pMojangData->wchSkin) @@ -943,7 +943,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) @@ -1037,13 +1037,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); @@ -1054,7 +1054,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() ) ); } @@ -1062,7 +1062,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() @@ -1080,7 +1080,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(); @@ -1096,7 +1096,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; } @@ -1125,21 +1125,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()); @@ -1175,7 +1175,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); } @@ -1290,7 +1290,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; } @@ -1310,7 +1310,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) { } @@ -1349,7 +1349,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) @@ -1395,7 +1395,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 @@ -1406,7 +1406,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; @@ -1420,11 +1420,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()) @@ -1474,26 +1474,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; } @@ -1503,16 +1503,16 @@ 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 // Hack to prevent item stacks from decrementing if the player has // the ability to instabuild @@ -1533,7 +1533,7 @@ bool Player::interact(shared_ptr entity) return false; } -shared_ptr Player::getSelectedItem() +std::shared_ptr Player::getSelectedItem() { return inventory->getSelected(); } @@ -1557,7 +1557,7 @@ void Player::swing() } } -void Player::attack(shared_ptr entity) +void Player::attack(std::shared_ptr entity) { if (!entity->isAttackable()) { @@ -1577,7 +1577,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); @@ -1596,7 +1596,7 @@ void Player::attack(shared_ptr entity) dmg += random->nextInt(dmg / 2 + 2); } dmg += magicBoost; - + // Ensure we put the entity on fire if we're hitting with a // fire-enchanted weapon bool setOnFireTemporatily = false; @@ -1635,14 +1635,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() ) ); @@ -1672,11 +1672,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) { } @@ -1686,7 +1686,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++) @@ -1756,7 +1756,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; @@ -1765,11 +1765,11 @@ Player::BedSleepingResult Player::startSleepInBed(int x, int y, int z, bool bTes } // This causes a message to be displayed, so we do want to show the tooltip in test mode - if (!bTestUse && level->isDay()) + if (!bTestUse && level->isDay()) { // may not sleep during day return NOT_POSSIBLE_NOW; - } + } } if(bTestUse) @@ -1852,7 +1852,7 @@ void Player::setBedOffset(int bedDirection) /** -* +* * @param forcefulWakeUp * If the player has been forced to wake up. When this happens, * the client will skip the wake-up animation. For example, when @@ -2136,7 +2136,7 @@ void Player::checkMovementStatistiscs(double dx, double dy, double dz) void Player::checkRidingStatistiscs(double dx, double dy, double dz) -{ +{ if (riding != NULL) { int distance = (int) Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f); @@ -2158,7 +2158,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) minecartAchievementPos = new Pos(Mth::floor(x), Mth::floor(y), Mth::floor(z)); } // 4J-PB - changed this because our world isn't big enough to go 1000m - else + else { // 4-JEV, changed slightly to add extra parameters for event on durango. int dist = minecartAchievementPos->dist(Mth::floor(x), Mth::floor(y), Mth::floor(z)); @@ -2185,7 +2185,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) awardStat(GenericStats::onARail(), GenericStats::param_onARail(dist)); m_bAwardedOnARail=true; } -#endif +#endif } } @@ -2232,7 +2232,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) @@ -2247,13 +2247,13 @@ void Player::killed(shared_ptr mob) case eTYPE_SKELETON: if( mob->isRiding() && mob->riding->GetType() == eTYPE_SPIDER ) awardStat(GenericStats::killsSpiderJockey(), GenericStats::param_noArgs()); - else + else awardStat(GenericStats::killsSkeleton(), GenericStats::param_noArgs()); break; case eTYPE_SPIDER: if( mob->rider.lock() != NULL && mob->rider.lock()->GetType() == eTYPE_SKELETON ) awardStat(GenericStats::killsSpiderJockey(), GenericStats::param_noArgs()); - else + else awardStat(GenericStats::killsSpider(), GenericStats::param_noArgs()); break; case eTYPE_ZOMBIE: @@ -2282,7 +2282,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) @@ -2312,7 +2312,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); } @@ -2378,7 +2378,7 @@ void Player::levelUp() /** * This method adds on to the player's exhaustion, which may decrease the * player's food level. -* +* * @param amount * Amount of exhaustion to add, between 0 and 20 (setting it to * 20 will guarantee that at least 1, and at most 4, food points @@ -2413,7 +2413,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; @@ -2438,7 +2438,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) @@ -2463,7 +2463,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) { @@ -2514,17 +2514,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(); } @@ -2555,7 +2555,7 @@ int Player::getTexture() } } -int Player::hash_fnct(const shared_ptr k) +int Player::hash_fnct(const std::shared_ptr k) { // TODO 4J Stu - Should we just be using the pointers and hashing them? #ifdef __PS3__ @@ -2565,7 +2565,7 @@ int Player::hash_fnct(const 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? @@ -2617,7 +2617,7 @@ void Player::setPlayerGamePrivilege(unsigned int &uiGamePrivileges, EPlayerGameP } } else if (privilege < ePlayerGamePrivilege_MAX ) - { + { if(value!=0) { uiGamePrivileges|=(1< item) +bool Player::isAllowedToUse(std::shared_ptr item) { bool allowed = true; if(item != NULL && app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) @@ -2765,7 +2765,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) @@ -2774,7 +2774,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; } @@ -2830,7 +2830,7 @@ bool Player::isAllowedToAttackAnimals() return allowed; } -bool Player::isAllowedToHurtEntity(shared_ptr target) +bool Player::isAllowedToHurtEntity(std::shared_ptr target) { bool allowed = true; @@ -2921,7 +2921,7 @@ void Player::enableAllPlayerPrivileges(unsigned int &uigamePrivileges, bool enab } void Player::enableAllPlayerPrivileges(bool enable) -{ +{ Player::enableAllPlayerPrivileges(m_uiGamePrivileges,enable); } @@ -2930,8 +2930,8 @@ bool Player::canCreateParticles() return !hasInvisiblePrivilege(); } -vector *Player::GetAdditionalModelParts() -{ +vector *Player::GetAdditionalModelParts() +{ if(m_ppAdditionalModelParts==NULL && !m_bCheckedForModelParts) { bool hasCustomTexture = !customTextureUrl.empty(); @@ -2975,8 +2975,8 @@ vector *Player::GetAdditionalModelParts() return m_ppAdditionalModelParts; } -void Player::SetAdditionalModelParts(vector *ppAdditionalModelParts) -{ +void Player::SetAdditionalModelParts(vector *ppAdditionalModelParts) +{ m_ppAdditionalModelParts=ppAdditionalModelParts; } @@ -2987,7 +2987,7 @@ Player::ePlayerNameValidState Player::GetPlayerNameValidState(void) return m_ePlayerNameValidState; } -void Player::SetPlayerNameValidState(bool bState) +void Player::SetPlayerNameValidState(bool bState) { if(bState) { diff --git a/Minecraft.World/Player.h b/Minecraft.World/Player.h index 185a70a7..68088fc1 100644 --- a/Minecraft.World/Player.h +++ b/Minecraft.World/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); @@ -281,7 +281,7 @@ private: public: /** - * + * * @param forcefulWakeUp * If the player has been forced to wake up. When this happens, * the client will skip the wake-up animation. For example, when @@ -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 @@ -421,7 +421,7 @@ 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"") { } private: PlayerUID m_xuid; @@ -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,13 +541,13 @@ private: struct PlayerKeyHash { - inline int operator() (const shared_ptr k) const + inline int operator() (const std::shared_ptr k) const { return Player::hash_fnct (k); } }; struct PlayerKeyEq { - inline bool operator() (const shared_ptr x, const shared_ptr y) const + inline bool operator() (const std::shared_ptr x, const std::shared_ptr y) const { return Player::eq_test (x, y); } }; diff --git a/Minecraft.World/PlayerAbilitiesPacket.cpp b/Minecraft.World/PlayerAbilitiesPacket.cpp index b1b854a5..e0bfb21e 100644 --- a/Minecraft.World/PlayerAbilitiesPacket.cpp +++ b/Minecraft.World/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/PlayerAbilitiesPacket.h b/Minecraft.World/PlayerAbilitiesPacket.h index 21c1fdc2..8a6e43a3 100644 --- a/Minecraft.World/PlayerAbilitiesPacket.h +++ b/Minecraft.World/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/PlayerActionPacket.h b/Minecraft.World/PlayerActionPacket.h index 0228ebb4..35221628 100644 --- a/Minecraft.World/PlayerActionPacket.h +++ b/Minecraft.World/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/PlayerCommandPacket.cpp b/Minecraft.World/PlayerCommandPacket.cpp index 6aecc0e6..626a71fc 100644 --- a/Minecraft.World/PlayerCommandPacket.cpp +++ b/Minecraft.World/PlayerCommandPacket.cpp @@ -22,19 +22,19 @@ 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; } -void PlayerCommandPacket::read(DataInputStream *dis) //throws IOException +void PlayerCommandPacket::read(DataInputStream *dis) //throws IOException { id = dis->readInt(); action = dis->readByte(); } -void PlayerCommandPacket::write(DataOutputStream *dos) //throws IOException +void PlayerCommandPacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(id); dos->writeByte(action); @@ -45,7 +45,7 @@ void PlayerCommandPacket::handle(PacketListener *listener) listener->handlePlayerCommand(shared_from_this()); } -int PlayerCommandPacket::getEstimatedSize() +int PlayerCommandPacket::getEstimatedSize() { return 5; } diff --git a/Minecraft.World/PlayerCommandPacket.h b/Minecraft.World/PlayerCommandPacket.h index dd6c8cb1..5e558358 100644 --- a/Minecraft.World/PlayerCommandPacket.h +++ b/Minecraft.World/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/PlayerEnderChestContainer.cpp b/Minecraft.World/PlayerEnderChestContainer.cpp index 466d9710..9bcf07d2 100644 --- a/Minecraft.World/PlayerEnderChestContainer.cpp +++ b/Minecraft.World/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/PlayerEnderChestContainer.h b/Minecraft.World/PlayerEnderChestContainer.h index 523417aa..43bb3052 100644 --- a/Minecraft.World/PlayerEnderChestContainer.h +++ b/Minecraft.World/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/PlayerIO.h b/Minecraft.World/PlayerIO.h index 559ab2ee..dc843605 100644 --- a/Minecraft.World/PlayerIO.h +++ b/Minecraft.World/PlayerIO.h @@ -7,16 +7,16 @@ using namespace std; class Player; -class PlayerIO +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/PlayerInfoPacket.cpp b/Minecraft.World/PlayerInfoPacket.cpp index 9cbe5f7c..d0d94c62 100644 --- a/Minecraft.World/PlayerInfoPacket.cpp +++ b/Minecraft.World/PlayerInfoPacket.cpp @@ -25,7 +25,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/PlayerInfoPacket.h b/Minecraft.World/PlayerInfoPacket.h index 85e2ed64..f4ad972f 100644 --- a/Minecraft.World/PlayerInfoPacket.h +++ b/Minecraft.World/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/PlayerInputPacket.h b/Minecraft.World/PlayerInputPacket.h index 8bc11d3e..93bbf797 100644 --- a/Minecraft.World/PlayerInputPacket.h +++ b/Minecraft.World/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/PortalForcer.cpp b/Minecraft.World/PortalForcer.cpp index 7c9b7a86..e6c51a41 100644 --- a/Minecraft.World/PortalForcer.cpp +++ b/Minecraft.World/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; @@ -147,7 +147,7 @@ bool PortalForcer::createPortal(Level *level, shared_ptr e) int XZSIZE = level->dimension->getXZSize() * 16; // XZSize is chunks, convert to blocks int XZOFFSET = (XZSIZE / 2) - 4; // Subtract 4 to stay away from the edges // TODO Make the 4 a constant in HellRandomLevelSource - // Move the positions that we want to check away from the edge of the world + // Move the positions that we want to check away from the edge of the world if( (xc - r) < -XZOFFSET ) { app.DebugPrintf("Adjusting portal creation x due to being too close to the edge\n"); @@ -215,7 +215,7 @@ bool PortalForcer::createPortal(Level *level, shared_ptr e) int yt = y + h; int zt = z + (s - 1) * za - b * xa; - // 4J Stu - Changes to stop Portals being created at the border of the nether inside the bedrock + // 4J Stu - Changes to stop Portals being created at the border of the nether inside the bedrock if( ( xt < -XZOFFSET ) || ( xt >= XZOFFSET ) || ( zt < -XZOFFSET ) || ( zt >= XZOFFSET ) ) { app.DebugPrintf("Skipping possible portal location as at least one block is too close to the edge\n"); @@ -275,7 +275,7 @@ bool PortalForcer::createPortal(Level *level, shared_ptr e) int yt = y + h; int zt = z + (s - 1) * za; - // 4J Stu - Changes to stop Portals being created at the border of the nether inside the bedrock + // 4J Stu - Changes to stop Portals being created at the border of the nether inside the bedrock if( ( xt < -XZOFFSET ) || ( xt >= XZOFFSET ) || ( zt < -XZOFFSET ) || ( zt >= XZOFFSET ) ) { app.DebugPrintf("Skipping possible portal location as at least one block is too close to the edge\n"); diff --git a/Minecraft.World/PortalForcer.h b/Minecraft.World/PortalForcer.h index feb2f129..b3dcd4e6 100644 --- a/Minecraft.World/PortalForcer.h +++ b/Minecraft.World/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/PortalTile.cpp b/Minecraft.World/PortalTile.cpp index 1b500a36..f97670a8 100644 --- a/Minecraft.World/PortalTile.cpp +++ b/Minecraft.World/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/PortalTile.h b/Minecraft.World/PortalTile.h index 7be4320f..df6e4dee 100644 --- a/Minecraft.World/PortalTile.h +++ b/Minecraft.World/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/PotatoTile.cpp b/Minecraft.World/PotatoTile.cpp index 27ca1984..d348aaec 100644 --- a/Minecraft.World/PotatoTile.cpp +++ b/Minecraft.World/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/PotionItem.cpp b/Minecraft.World/PotionItem.cpp index 643e9661..d7154c49 100644 --- a/Minecraft.World/PotionItem.cpp +++ b/Minecraft.World/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) { @@ -197,7 +197,7 @@ wstring PotionItem::getHoverName(shared_ptr itemInstance) //String postfixString = effects.get(0).getDescriptionId(); //postfixString += ".postfix"; //return elementName + " " + I18n.get(postfixString).trim(); - + elementName = replaceAll(elementName,L"{*prefix*}",L""); elementName = replaceAll(elementName,L"{*postfix*}",app.GetString(effects->at(0)->getPostfixDescriptionId())); } @@ -205,14 +205,14 @@ wstring PotionItem::getHoverName(shared_ptr itemInstance) { //String appearanceName = PotionBrewing.getAppearanceName(itemInstance.getAuxValue()); //return I18n.get(appearanceName).trim() + " " + elementName; - + elementName = replaceAll(elementName,L"{*prefix*}",app.GetString( PotionBrewing::getAppearanceName(itemInstance->getAuxValue()))); elementName = replaceAll(elementName,L"{*postfix*}",L""); } 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) { @@ -260,12 +260,12 @@ void PotionItem::appendHoverText(shared_ptr itemInstance, shared_p if (MobEffect::effects[effect->getId()]->isHarmful()) { colour = eHTMLColor_c; - //lines->push_back(L"§c + effectString); //"§c" + //lines->push_back(L"�c + effectString); //"�c" } else { colour = eHTMLColor_7; - //lines->push_back(L"§7" + effectString); //"§7" + //lines->push_back(L"�7" + effectString); //"�7" } swprintf(formatted, 256, L"%ls",app.GetHTMLColour(colour),effectString.c_str()); lines->push_back(formatted); @@ -277,21 +277,21 @@ void PotionItem::appendHoverText(shared_ptr itemInstance, shared_p //eHTMLColor_7 wchar_t formatted[256]; swprintf(formatted,256,L"%ls",app.GetHTMLColour(eHTMLColor_7),effectString.c_str()); - lines->push_back(formatted); //"§7" + lines->push_back(formatted); //"�7" } } -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(); - + #define MACRO_POTION_IS_NIGHTVISION(aux) ((aux & 0x200F) == MASK_NIGHTVISION) #define MACRO_POTION_IS_INVISIBILITY(aux) ((aux & 0x200F) == MASK_INVISIBILITY) diff --git a/Minecraft.World/PotionItem.h b/Minecraft.World/PotionItem.h index d03d3308..0d5dd181 100644 --- a/Minecraft.World/PotionItem.h +++ b/Minecraft.World/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/PreLoginPacket.h b/Minecraft.World/PreLoginPacket.h index 243f2f36..2d73d630 100644 --- a/Minecraft.World/PreLoginPacket.h +++ b/Minecraft.World/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/PressurePlateTile.cpp b/Minecraft.World/PressurePlateTile.cpp index eacdeb07..43dd9aed 100644 --- a/Minecraft.World/PressurePlateTile.cpp +++ b/Minecraft.World/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/PressurePlateTile.h b/Minecraft.World/PressurePlateTile.h index 0b70fca9..e46f5a1a 100644 --- a/Minecraft.World/PressurePlateTile.h +++ b/Minecraft.World/PressurePlateTile.h @@ -31,19 +31,19 @@ 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(); virtual void updateDefaultShape(); virtual int getPistonPushReaction(); void registerIcons(IconRegister *iconRegister); - + // 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/ProtectionEnchantment.cpp b/Minecraft.World/ProtectionEnchantment.cpp index 39e3eca1..b8311c85 100644 --- a/Minecraft.World/ProtectionEnchantment.cpp +++ b/Minecraft.World/ProtectionEnchantment.cpp @@ -52,7 +52,7 @@ int ProtectionEnchantment::getDescriptionId() } bool ProtectionEnchantment::isCompatibleWith(Enchantment *other) const -{ +{ ProtectionEnchantment *pe = dynamic_cast( other ); if (pe != NULL) { @@ -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/ProtectionEnchantment.h b/Minecraft.World/ProtectionEnchantment.h index 910e32df..e9727254 100644 --- a/Minecraft.World/ProtectionEnchantment.h +++ b/Minecraft.World/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/PumpkinTile.cpp b/Minecraft.World/PumpkinTile.cpp index 577b9a17..22c31d3d 100644 --- a/Minecraft.World/PumpkinTile.cpp +++ b/Minecraft.World/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/PumpkinTile.h b/Minecraft.World/PumpkinTile.h index 1c808b54..03e55569 100644 --- a/Minecraft.World/PumpkinTile.h +++ b/Minecraft.World/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/QuartzBlockTile.cpp b/Minecraft.World/QuartzBlockTile.cpp index a7beeb21..f719ff7a 100644 --- a/Minecraft.World/QuartzBlockTile.cpp +++ b/Minecraft.World/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/QuartzBlockTile.h b/Minecraft.World/QuartzBlockTile.h index bdb5af8b..d812e8a1 100644 --- a/Minecraft.World/QuartzBlockTile.h +++ b/Minecraft.World/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/RailTile.cpp b/Minecraft.World/RailTile.cpp index 4ece48ca..c2d1befc 100644 --- a/Minecraft.World/RailTile.cpp +++ b/Minecraft.World/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/RailTile.h b/Minecraft.World/RailTile.h index 776d8454..9fb854ad 100644 --- a/Minecraft.World/RailTile.h +++ b/Minecraft.World/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/RandomPos.cpp b/Minecraft.World/RandomPos.cpp index c2cfd908..a12c93a9 100644 --- a/Minecraft.World/RandomPos.cpp +++ b/Minecraft.World/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/RandomPos.h b/Minecraft.World/RandomPos.h index eceed17e..a5ee447b 100644 --- a/Minecraft.World/RandomPos.h +++ b/Minecraft.World/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/Recipes.cpp b/Minecraft.World/Recipes.cpp index 93be1dfb..066bd4a1 100644 --- a/Minecraft.World/Recipes.cpp +++ b/Minecraft.World/Recipes.cpp @@ -45,7 +45,7 @@ void Recipes::_init() recipies = new RecipyList(); } -Recipes::Recipes() +Recipes::Recipes() { int iCount=0; _init(); @@ -55,7 +55,7 @@ Recipes::Recipes() pFoodRecipies = new FoodRecipies; pOreRecipies = new OreRecipies; pStructureRecipies = new StructureRecipies; - pToolRecipies = new ToolRecipies; + pToolRecipies = new ToolRecipies; pWeaponRecipies = new WeaponRecipies; // 4J Stu - These just don't work with our crafting menu @@ -74,8 +74,8 @@ Recipes::Recipes() L"#", // L'#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::BIRCH_TRUNK), - L'S'); - + L'S'); + addShapedRecipy(new ItemInstance(Tile::wood, 4, TreeTile::DARK_TRUNK), // L"sczg", L"#", // @@ -99,7 +99,7 @@ Recipes::Recipes() L'S'); pToolRecipies->addRecipes(this); - pFoodRecipies->addRecipes(this); + pFoodRecipies->addRecipes(this); pStructureRecipies->addRecipes(this); @@ -146,8 +146,8 @@ Recipes::Recipes() L"#W#", // L'#', Item::stick, L'W', Tile::wood, - L'S'); - + L'S'); + addShapedRecipy(new ItemInstance(Tile::fence, 2), // L"sscig", L"###", // @@ -155,7 +155,7 @@ Recipes::Recipes() L'#', Item::stick, L'S'); - + addShapedRecipy(new ItemInstance(Tile::netherFence, 6), // L"ssctg", L"###", // @@ -303,10 +303,10 @@ Recipes::Recipes() L'#', Tile::quartzBlock, L'S'); - pArmorRecipes->addRecipes(this); + pArmorRecipes->addRecipes(this); //iCount=getRecipies()->size(); - pClothDyeRecipes->addRecipes(this); + pClothDyeRecipes->addRecipes(this); addShapedRecipy(new ItemInstance(Tile::snow, 1), // @@ -363,14 +363,14 @@ Recipes::Recipes() L"###", // L'#', Tile::rock, - L'S'); + L'S'); addShapedRecipy(new ItemInstance(Tile::stoneSlabHalf, 6, StoneSlabTile::COBBLESTONE_SLAB), // L"sctg", L"###", // L'#', Tile::stoneBrick, L'S'); - + addShapedRecipy(new ItemInstance(Tile::stoneSlabHalf, 6, StoneSlabTile::BRICK_SLAB), // L"sctg", L"###", // @@ -556,7 +556,7 @@ Recipes::Recipes() L"# X", // L" #X", // - L'X', Item::string,// + L'X', Item::string,// L'#', Item::stick, L'T'); @@ -566,8 +566,8 @@ Recipes::Recipes() L"#", // L"Y", // - L'Y', Item::feather,// - L'X', Item::flint,// + L'Y', Item::feather,// + L'X', Item::flint,// L'#', Item::stick, L'T'); @@ -715,7 +715,7 @@ Recipes::Recipes() L'#', Item::paper, L'X', Item::compass, L'T'); - + addShapedRecipy(new ItemInstance(Tile::button, 1), // L"sctg", L"#", // @@ -844,7 +844,7 @@ Recipes::Recipes() L'#', Item::stick, L'X', Item::leather, L'D'); - pOreRecipies->addRecipes(this); + pOreRecipies->addRecipes(this); addShapedRecipy(new ItemInstance(Item::goldIngot), // L"ssscig", @@ -894,17 +894,17 @@ Recipes::Recipes() // Sort so the largest recipes get checked first! /* 4J-PB - TODO - Collections.sort(recipies, new Comparator() + Collections.sort(recipies, new Comparator() { - public: int compare(Recipy r0, Recipy r1) + public: int compare(Recipy r0, Recipy r1) { // shapeless recipes are put in the back of the list - if (r0 instanceof ShapelessRecipy && r1 instanceof ShapedRecipy) + if (r0 instanceof ShapelessRecipy && r1 instanceof ShapedRecipy) { return 1; } - if (r1 instanceof ShapelessRecipy && r0 instanceof ShapedRecipy) + if (r1 instanceof ShapelessRecipy && r0 instanceof ShapedRecipy) { return -1; } @@ -957,7 +957,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) wchTypes = va_arg(vl,wchar_t *); - for(int i = 0; wchTypes[i] != L'\0'; ++i ) + for(int i = 0; wchTypes[i] != L'\0'; ++i ) { if(wchTypes[i+1]==L'\0' && wchTypes[i]!=L'g') { @@ -1051,15 +1051,15 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) ids = new ItemInstance *[width * height]; - for (int j = 0; j < width * height; j++) + for (int j = 0; j < width * height; j++) { wchar_t ch = map[j]; myMap::iterator it=mappings->find(ch); - if (it != mappings->end()) + if (it != mappings->end()) { ids[j] =it->second; - } - else + } + else { ids[j] = NULL; } @@ -1073,7 +1073,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) return recipe; } -void Recipes::addShapelessRecipy(ItemInstance *result,... ) +void Recipes::addShapelessRecipy(ItemInstance *result,... ) { va_list vl; wchar_t *szTypes; @@ -1092,7 +1092,7 @@ void Recipes::addShapelessRecipy(ItemInstance *result,... ) // t - Tile * szTypes = va_arg(vl,wchar_t *); - for(int i = 0; szTypes[i] != L'\0'; ++i ) + for(int i = 0; szTypes[i] != L'\0'; ++i ) { switch(szTypes[i]) { @@ -1143,17 +1143,17 @@ void Recipes::addShapelessRecipy(ItemInstance *result,... ) break; } } - recipies->push_back(new ShapelessRecipy(result, ingredients, group)); + 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()); @@ -1182,13 +1182,13 @@ shared_ptr Recipes::getItemFor(shared_ptr craft return nullptr; } -vector *Recipes::getRecipies() +vector *Recipes::getRecipies() { return recipies; } // 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); } @@ -1204,9 +1204,9 @@ void Recipes::buildRecipeIngredientsArray(void) int iCount=0; AUTO_VAR(itEndRec, recipies->end()); - for (AUTO_VAR(it, recipies->begin()); it != itEndRec; it++) + for (AUTO_VAR(it, recipies->begin()); it != itEndRec; it++) { - Recipy *recipe = *it; + Recipy *recipe = *it; //wprintf(L"RECIPE - [%d] is %w\n",iCount,recipe->getResultItem()->getItem()->getName()); recipe->requires(&m_pRecipeIngredientsRequired[iCount++]); } diff --git a/Minecraft.World/Recipes.h b/Minecraft.World/Recipes.h index c5d091e1..5d75b0e6 100644 --- a/Minecraft.World/Recipes.h +++ b/Minecraft.World/Recipes.h @@ -62,12 +62,12 @@ private: eINSTANCEOF eType; }; -class Recipes +class Recipes { public: static const int ANY_AUX_VALUE = -1; -private: +private: static Recipes *instance; vector *recipies; @@ -75,25 +75,25 @@ private: public: static void staticCtor(); -public: - static Recipes *getInstance() +public: + static Recipes *getInstance() { return instance; } -private: +private: void _init(); // 4J add Recipes(); public: ShapedRecipy *addShapedRecipy(ItemInstance *, ... ); - void addShapelessRecipy(ItemInstance *result,... ); + 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/Recipy.h b/Minecraft.World/Recipy.h index 88d9640a..96d6be35 100644 --- a/Minecraft.World/Recipy.h +++ b/Minecraft.World/Recipy.h @@ -1,5 +1,5 @@ // package net.minecraft.world.item.crafting; -// +// // import net.minecraft.world.inventory.CraftingContainer; // import net.minecraft.world.item.ItemInstance; @@ -10,7 +10,7 @@ #define RECIPE_TYPE_2x2 0 #define RECIPE_TYPE_3x3 1 -class Recipy +class Recipy { public: enum _eGroupType @@ -28,7 +28,7 @@ public: eGroupType; // to class the item produced by the recipe // 4J-PB - we'll classing an ingredient ID with a different aux value as a different IngID AuxVal pair - typedef struct + typedef struct { int iIngC; int iType; // Can be a 2x2 or a 3x3. Inventory crafting can only make a 2x2. @@ -42,11 +42,11 @@ 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; + virtual const int getGroup() = 0; // 4J-PB virtual bool requires(int iRecipe) = 0; diff --git a/Minecraft.World/RecordPlayerTile.cpp b/Minecraft.World/RecordPlayerTile.cpp index de5f7386..12fd3590 100644 --- a/Minecraft.World/RecordPlayerTile.cpp +++ b/Minecraft.World/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/RecordPlayerTile.h b/Minecraft.World/RecordPlayerTile.h index b6a2d901..8d216af8 100644 --- a/Minecraft.World/RecordPlayerTile.h +++ b/Minecraft.World/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/RecordingItem.cpp b/Minecraft.World/RecordingItem.cpp index 24be1190..dffd38c6 100644 --- a/Minecraft.World/RecordingItem.cpp +++ b/Minecraft.World/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/RecordingItem.h b/Minecraft.World/RecordingItem.h index 9b184c6a..5aba0b51 100644 --- a/Minecraft.World/RecordingItem.h +++ b/Minecraft.World/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/RedStoneItem.cpp b/Minecraft.World/RedStoneItem.cpp index 64201caa..f2769e92 100644 --- a/Minecraft.World/RedStoneItem.cpp +++ b/Minecraft.World/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) @@ -27,7 +27,7 @@ bool RedStoneItem::useOn(shared_ptr itemInstance, shared_ptrmayPlace(level, x, y, z)) { if(!bTestUseOnOnly) - { + { // 4J-JEV: Hook for durango 'BlockPlaced' event. player->awardStat(GenericStats::blocksPlaced(Tile::redStoneDust_Id), GenericStats::param_blocksPlaced(Tile::redStoneDust_Id,itemInstance->getAuxValue(),1)); diff --git a/Minecraft.World/RedStoneItem.h b/Minecraft.World/RedStoneItem.h index 01be92ff..13ee7f13 100644 --- a/Minecraft.World/RedStoneItem.h +++ b/Minecraft.World/RedStoneItem.h @@ -3,11 +3,11 @@ using namespace std; #include "Item.h" - class RedStoneItem : public Item + class RedStoneItem : public Item { public: 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/RedStoneOreTile.cpp b/Minecraft.World/RedStoneOreTile.cpp index 9317ffdd..f08cf9fa 100644 --- a/Minecraft.World/RedStoneOreTile.cpp +++ b/Minecraft.World/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/RedStoneOreTile.h b/Minecraft.World/RedStoneOreTile.h index bc1d48d7..3e96a228 100644 --- a/Minecraft.World/RedStoneOreTile.h +++ b/Minecraft.World/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: @@ -24,11 +24,11 @@ public: virtual int getResourceCount(Random *random); virtual void spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel); virtual void animateTick(Level *level, int x, int y, int z, Random *random); - + // 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); 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/Region.cpp b/Minecraft.World/Region.cpp index 4c3a454d..fb7a62d5 100644 --- a/Minecraft.World/Region.cpp +++ b/Minecraft.World/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/Region.h b/Minecraft.World/Region.h index 0d200a35..fad828ee 100644 --- a/Minecraft.World/Region.h +++ b/Minecraft.World/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/RegionHillsLayer.cpp b/Minecraft.World/RegionHillsLayer.cpp index a1e17524..63d284e2 100644 --- a/Minecraft.World/RegionHillsLayer.cpp +++ b/Minecraft.World/RegionHillsLayer.cpp @@ -3,7 +3,7 @@ #include "IntCache.h" #include "RegionHillsLayer.h" -RegionHillsLayer::RegionHillsLayer(int64_t seed, shared_ptr parent) : Layer(seed) +RegionHillsLayer::RegionHillsLayer(int64_t seed, std::shared_ptr parent) : Layer(seed) { this->parent = parent; } diff --git a/Minecraft.World/RegionHillsLayer.h b/Minecraft.World/RegionHillsLayer.h index 5ad0bb75..23a63abc 100644 --- a/Minecraft.World/RegionHillsLayer.h +++ b/Minecraft.World/RegionHillsLayer.h @@ -5,7 +5,7 @@ class RegionHillsLayer : public Layer { public: - RegionHillsLayer(int64_t seed, shared_ptr parent); + RegionHillsLayer(int64_t 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/RemoveEntitiesPacket.h b/Minecraft.World/RemoveEntitiesPacket.h index 2e734e71..f6626d56 100644 --- a/Minecraft.World/RemoveEntitiesPacket.h +++ b/Minecraft.World/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/RemoveMobEffectPacket.h b/Minecraft.World/RemoveMobEffectPacket.h index d69a4ed4..ade1ed1b 100644 --- a/Minecraft.World/RemoveMobEffectPacket.h +++ b/Minecraft.World/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/RepairMenu.cpp b/Minecraft.World/RepairMenu.cpp index d246b73f..c254eb21 100644 --- a/Minecraft.World/RepairMenu.cpp +++ b/Minecraft.World/RepairMenu.cpp @@ -6,10 +6,10 @@ #include "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/RepairMenu.h b/Minecraft.World/RepairMenu.h index e0c90267..acd7dc37 100644 --- a/Minecraft.World/RepairMenu.h +++ b/Minecraft.World/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/RepairResultSlot.cpp b/Minecraft.World/RepairResultSlot.cpp index 041a64a7..651cd3a1 100644 --- a/Minecraft.World/RepairResultSlot.cpp +++ b/Minecraft.World/RepairResultSlot.cpp @@ -5,7 +5,7 @@ #include "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/RepairResultSlot.h b/Minecraft.World/RepairResultSlot.h index 1895ca30..92af20fe 100644 --- a/Minecraft.World/RepairResultSlot.h +++ b/Minecraft.World/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/RespawnPacket.h b/Minecraft.World/RespawnPacket.h index 3caf1ee3..e8af00b0 100644 --- a/Minecraft.World/RespawnPacket.h +++ b/Minecraft.World/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/RestrictOpenDoorGoal.cpp b/Minecraft.World/RestrictOpenDoorGoal.cpp index e8620a71..2849aabc 100644 --- a/Minecraft.World/RestrictOpenDoorGoal.cpp +++ b/Minecraft.World/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/ResultContainer.cpp b/Minecraft.World/ResultContainer.cpp index c28b3cf3..782c2aa8 100644 --- a/Minecraft.World/ResultContainer.cpp +++ b/Minecraft.World/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/ResultContainer.h b/Minecraft.World/ResultContainer.h index 62df65d8..1b030d81 100644 --- a/Minecraft.World/ResultContainer.h +++ b/Minecraft.World/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/ResultSlot.cpp b/Minecraft.World/ResultSlot.cpp index b79329af..d44083c7 100644 --- a/Minecraft.World/ResultSlot.cpp +++ b/Minecraft.World/ResultSlot.cpp @@ -6,19 +6,19 @@ #include "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; @@ -49,17 +49,17 @@ void ResultSlot::checkTakeAchievements(shared_ptr carried) //else if (carried->id == Tile::enchantTable_Id) player->awardStat(GenericStats::enchantments(), GenericStats::param_achievement(eAward_)); else if (carried->id == Tile::bookshelf_Id) player->awardStat(GenericStats::bookcase(), GenericStats::param_bookcase()); - // 4J : WESTY : Added new acheivements. + // 4J : WESTY : Added new acheivements. 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/ResultSlot.h b/Minecraft.World/ResultSlot.h index 28e464f0..b8308f66 100644 --- a/Minecraft.World/ResultSlot.h +++ b/Minecraft.World/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/RiverInitLayer.cpp b/Minecraft.World/RiverInitLayer.cpp index 86110e13..33afa47d 100644 --- a/Minecraft.World/RiverInitLayer.cpp +++ b/Minecraft.World/RiverInitLayer.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "net.minecraft.world.level.newbiome.layer.h" -RiverInitLayer::RiverInitLayer(int64_t seed, shared_ptrparent) : Layer(seed) +RiverInitLayer::RiverInitLayer(int64_t seed, std::shared_ptrparent) : Layer(seed) { this->parent = parent; } diff --git a/Minecraft.World/RiverInitLayer.h b/Minecraft.World/RiverInitLayer.h index bc8dca1b..7c9e8ef8 100644 --- a/Minecraft.World/RiverInitLayer.h +++ b/Minecraft.World/RiverInitLayer.h @@ -5,7 +5,7 @@ class RiverInitLayer : public Layer { public: - RiverInitLayer(int64_t seed, shared_ptrparent); + RiverInitLayer(int64_t 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/RiverLayer.cpp b/Minecraft.World/RiverLayer.cpp index 14cf3142..09880f00 100644 --- a/Minecraft.World/RiverLayer.cpp +++ b/Minecraft.World/RiverLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.biome.h" #include "net.minecraft.world.level.newbiome.layer.h" -RiverLayer::RiverLayer(int64_t seedMixup, shared_ptrparent) : Layer(seedMixup) +RiverLayer::RiverLayer(int64_t seedMixup, std::shared_ptrparent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/RiverLayer.h b/Minecraft.World/RiverLayer.h index a76d3fab..3e2db6af 100644 --- a/Minecraft.World/RiverLayer.h +++ b/Minecraft.World/RiverLayer.h @@ -5,6 +5,6 @@ class RiverLayer : public Layer { public: - RiverLayer(int64_t seedMixup, shared_ptrparent); + RiverLayer(int64_t 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/RiverMixerLayer.cpp b/Minecraft.World/RiverMixerLayer.cpp index 4de49245..935832a6 100644 --- a/Minecraft.World/RiverMixerLayer.cpp +++ b/Minecraft.World/RiverMixerLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.biome.h" #include "net.minecraft.world.level.newbiome.layer.h" -RiverMixerLayer::RiverMixerLayer(int64_t seed, shared_ptrbiomes, shared_ptrrivers) : Layer(seed) +RiverMixerLayer::RiverMixerLayer(int64_t seed, std::shared_ptrbiomes, std::shared_ptrrivers) : Layer(seed) { this->biomes = biomes; this->rivers = rivers; diff --git a/Minecraft.World/RiverMixerLayer.h b/Minecraft.World/RiverMixerLayer.h index 3a069c41..4cad36a3 100644 --- a/Minecraft.World/RiverMixerLayer.h +++ b/Minecraft.World/RiverMixerLayer.h @@ -5,11 +5,11 @@ class RiverMixerLayer : public Layer { private: - shared_ptrbiomes; - shared_ptrrivers; + std::shared_ptrbiomes; + std::shared_ptrrivers; public: - RiverMixerLayer(int64_t seed, shared_ptrbiomes, shared_ptrrivers); + RiverMixerLayer(int64_t seed, std::shared_ptrbiomes, std::shared_ptrrivers); virtual void init(int64_t seed); virtual intArray getArea(int xo, int yo, int w, int h); diff --git a/Minecraft.World/RotateHeadPacket.cpp b/Minecraft.World/RotateHeadPacket.cpp index a0cd02d7..46d48a99 100644 --- a/Minecraft.World/RotateHeadPacket.cpp +++ b/Minecraft.World/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/RotateHeadPacket.h b/Minecraft.World/RotateHeadPacket.h index 19ccf97f..78bd7a16 100644 --- a/Minecraft.World/RotateHeadPacket.h +++ b/Minecraft.World/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/SaddleItem.cpp b/Minecraft.World/SaddleItem.cpp index 0effeb53..1f9c580d 100644 --- a/Minecraft.World/SaddleItem.cpp +++ b/Minecraft.World/SaddleItem.cpp @@ -9,12 +9,12 @@ 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); - if (!pig->hasSaddle() && !pig->isBaby()) + std::shared_ptr pig = dynamic_pointer_cast(mob); + if (!pig->hasSaddle() && !pig->isBaby()) { pig->setSaddle(true); itemInstance->count--; @@ -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/SaddleItem.h b/Minecraft.World/SaddleItem.h index 129922db..de65ff50 100644 --- a/Minecraft.World/SaddleItem.h +++ b/Minecraft.World/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/SaplingTileItem.cpp b/Minecraft.World/SaplingTileItem.cpp index c88275f3..000955a1 100644 --- a/Minecraft.World/SaplingTileItem.cpp +++ b/Minecraft.World/SaplingTileItem.cpp @@ -9,18 +9,18 @@ SaplingTileItem::SaplingTileItem(int id) : TileItem(id) setStackedByData(true); } -int SaplingTileItem::getLevelDataForAuxValue(int auxValue) +int SaplingTileItem::getLevelDataForAuxValue(int auxValue) { return auxValue; } -Icon *SaplingTileItem::getIcon(int itemAuxValue) +Icon *SaplingTileItem::getIcon(int itemAuxValue) { return Tile::sapling->getTexture(0, 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/SaplingTileItem.h b/Minecraft.World/SaplingTileItem.h index f0b03cc4..feabb0de 100644 --- a/Minecraft.World/SaplingTileItem.h +++ b/Minecraft.World/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/SavedDataStorage.cpp b/Minecraft.World/SavedDataStorage.cpp index cacfa688..67b15c51 100644 --- a/Minecraft.World/SavedDataStorage.cpp +++ b/Minecraft.World/SavedDataStorage.cpp @@ -8,11 +8,11 @@ #include "ConsoleSaveFileIO.h" -SavedDataStorage::SavedDataStorage(LevelStorage *levelStorage) +SavedDataStorage::SavedDataStorage(LevelStorage *levelStorage) { /* - cache = new unordered_map >; - savedDatas = new vector >; + cache = new unordered_map >; + savedDatas = new vector >; usedAuxIds = new unordered_map; */ @@ -20,28 +20,28 @@ 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); ConsoleSavePath file = levelStorage->getDataFile(id); - if (!file.getName().empty() && levelStorage->getSaveFile()->doesFileExist( file ) ) + if (!file.getName().empty() && levelStorage->getSaveFile()->doesFileExist( file ) ) { // mob = dynamic_pointer_cast(Mob::_class->newInstance( level )); //data = clazz.getConstructor(String.class).newInstance(id); 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/SavedDataStorage.h b/Minecraft.World/SavedDataStorage.h index 9a342ab6..14d9776a 100644 --- a/Minecraft.World/SavedDataStorage.h +++ b/Minecraft.World/SavedDataStorage.h @@ -4,27 +4,27 @@ using namespace std; class ConsoleSaveFile; #include "SavedData.h" -class SavedDataStorage +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/SeedFoodItem.cpp b/Minecraft.World/SeedFoodItem.cpp index 4ba9a14a..d46b77c7 100644 --- a/Minecraft.World/SeedFoodItem.cpp +++ b/Minecraft.World/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/SeedFoodItem.h b/Minecraft.World/SeedFoodItem.h index fe24430f..0b9b79b5 100644 --- a/Minecraft.World/SeedFoodItem.h +++ b/Minecraft.World/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/SeedItem.cpp b/Minecraft.World/SeedItem.cpp index 7a5ac1b8..63fa9ac4 100644 --- a/Minecraft.World/SeedItem.cpp +++ b/Minecraft.World/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; @@ -23,7 +23,7 @@ bool SeedItem::useOn(shared_ptr instance, shared_ptr playe int targetType = level->getTile(x, y, z); - if (targetType == targetLand && level->isEmptyTile(x, y + 1, z)) + if (targetType == targetLand && level->isEmptyTile(x, y + 1, z)) { if(!bTestUseOnOnly) { diff --git a/Minecraft.World/SeedItem.h b/Minecraft.World/SeedItem.h index c16a76ce..820d9a8d 100644 --- a/Minecraft.World/SeedItem.h +++ b/Minecraft.World/SeedItem.h @@ -3,7 +3,7 @@ using namespace std; #include "Item.h" -class SeedItem : public Item +class SeedItem : public Item { private: int resultId; @@ -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/Sensing.cpp b/Minecraft.World/Sensing.cpp index d451f483..f5d1cddc 100644 --- a/Minecraft.World/Sensing.cpp +++ b/Minecraft.World/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/Sensing.h b/Minecraft.World/Sensing.h index d6428515..844a3e60 100644 --- a/Minecraft.World/Sensing.h +++ b/Minecraft.World/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/ServerSettingsChangedPacket.h b/Minecraft.World/ServerSettingsChangedPacket.h index e6ab7356..b929348f 100644 --- a/Minecraft.World/ServerSettingsChangedPacket.h +++ b/Minecraft.World/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/SetCarriedItemPacket.cpp b/Minecraft.World/SetCarriedItemPacket.cpp index 2c640609..f9fd8b08 100644 --- a/Minecraft.World/SetCarriedItemPacket.cpp +++ b/Minecraft.World/SetCarriedItemPacket.cpp @@ -6,12 +6,12 @@ -SetCarriedItemPacket::SetCarriedItemPacket() +SetCarriedItemPacket::SetCarriedItemPacket() { slot = 0; } -SetCarriedItemPacket::SetCarriedItemPacket(int slot) +SetCarriedItemPacket::SetCarriedItemPacket(int slot) { this->slot = slot; } @@ -21,27 +21,27 @@ void SetCarriedItemPacket::read(DataInputStream *dis) //throws IOException slot = dis->readShort(); } -void SetCarriedItemPacket::write(DataOutputStream *dos) //throws IOException +void SetCarriedItemPacket::write(DataOutputStream *dos) //throws IOException { dos->writeShort(slot); } -void SetCarriedItemPacket::handle(PacketListener *listener) +void SetCarriedItemPacket::handle(PacketListener *listener) { listener->handleSetCarriedItem(shared_from_this()); } -int SetCarriedItemPacket::getEstimatedSize() +int SetCarriedItemPacket::getEstimatedSize() { return 2; } -bool SetCarriedItemPacket::canBeInvalidated() +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/SetCarriedItemPacket.h b/Minecraft.World/SetCarriedItemPacket.h index 06fb3c30..d9b6c94a 100644 --- a/Minecraft.World/SetCarriedItemPacket.h +++ b/Minecraft.World/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/SetCreativeModeSlotPacket.cpp b/Minecraft.World/SetCreativeModeSlotPacket.cpp index 17e36b37..d650327b 100644 --- a/Minecraft.World/SetCreativeModeSlotPacket.cpp +++ b/Minecraft.World/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/SetCreativeModeSlotPacket.h b/Minecraft.World/SetCreativeModeSlotPacket.h index 94ae7807..ca46bf98 100644 --- a/Minecraft.World/SetCreativeModeSlotPacket.h +++ b/Minecraft.World/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/SetEntityDataPacket.cpp b/Minecraft.World/SetEntityDataPacket.cpp index 1538c152..6384200e 100644 --- a/Minecraft.World/SetEntityDataPacket.cpp +++ b/Minecraft.World/SetEntityDataPacket.cpp @@ -7,7 +7,7 @@ -SetEntityDataPacket::SetEntityDataPacket() +SetEntityDataPacket::SetEntityDataPacket() { id = -1; packedItems = NULL; @@ -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) @@ -37,7 +37,7 @@ void SetEntityDataPacket::read(DataInputStream *dis) //throws IOException packedItems = SynchedEntityData::unpack(dis); } -void SetEntityDataPacket::write(DataOutputStream *dos) //throws IOException +void SetEntityDataPacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(id); SynchedEntityData::pack(packedItems, dos); @@ -48,7 +48,7 @@ void SetEntityDataPacket::handle(PacketListener *listener) listener->handleSetEntityData(shared_from_this()); } -int SetEntityDataPacket::getEstimatedSize() +int SetEntityDataPacket::getEstimatedSize() { return 5; } @@ -58,7 +58,7 @@ bool SetEntityDataPacket::isAync() return true; } -vector > *SetEntityDataPacket::getUnpackedData() +vector > *SetEntityDataPacket::getUnpackedData() { return packedItems; } diff --git a/Minecraft.World/SetEntityDataPacket.h b/Minecraft.World/SetEntityDataPacket.h index 1b31aa4c..6978aac4 100644 --- a/Minecraft.World/SetEntityDataPacket.h +++ b/Minecraft.World/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/SetEntityMotionPacket.cpp b/Minecraft.World/SetEntityMotionPacket.cpp index a0749b74..49dd7d6b 100644 --- a/Minecraft.World/SetEntityMotionPacket.cpp +++ b/Minecraft.World/SetEntityMotionPacket.cpp @@ -32,22 +32,22 @@ void SetEntityMotionPacket::_init(int id, double xd, double yd, double zd) } } -SetEntityMotionPacket::SetEntityMotionPacket() +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); } SetEntityMotionPacket::SetEntityMotionPacket(int id, double xd, double yd, double zd) { - _init(id, xd, yd, zd); + _init(id, xd, yd, zd); } -void SetEntityMotionPacket::read(DataInputStream *dis) //throws IOException +void SetEntityMotionPacket::read(DataInputStream *dis) //throws IOException { short idAndFlag = dis->readShort(); id = idAndFlag & 0x07ff; @@ -73,7 +73,7 @@ void SetEntityMotionPacket::read(DataInputStream *dis) //throws IOException } } -void SetEntityMotionPacket::write(DataOutputStream *dos) //throws IOException +void SetEntityMotionPacket::write(DataOutputStream *dos) //throws IOException { if( useBytes ) { @@ -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/SetEntityMotionPacket.h b/Minecraft.World/SetEntityMotionPacket.h index 00c019da..ef9fefc5 100644 --- a/Minecraft.World/SetEntityMotionPacket.h +++ b/Minecraft.World/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/SetEquippedItemPacket.cpp b/Minecraft.World/SetEquippedItemPacket.cpp index 1da93b84..cbb71803 100644 --- a/Minecraft.World/SetEquippedItemPacket.cpp +++ b/Minecraft.World/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; @@ -23,7 +23,7 @@ SetEquippedItemPacket::SetEquippedItemPacket(int entity, int slot, shared_ptritem = item == NULL ? nullptr : item->copy(); } -void SetEquippedItemPacket::read(DataInputStream *dis) //throws IOException +void SetEquippedItemPacket::read(DataInputStream *dis) //throws IOException { entity = dis->readInt(); slot = dis->readShort(); @@ -32,7 +32,7 @@ void SetEquippedItemPacket::read(DataInputStream *dis) //throws IOException item = readItem(dis); } -void SetEquippedItemPacket::write(DataOutputStream *dos) //throws IOException +void SetEquippedItemPacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(entity); dos->writeShort(slot); @@ -41,7 +41,7 @@ void SetEquippedItemPacket::write(DataOutputStream *dos) //throws IOException writeItem(item, dos); } -void SetEquippedItemPacket::handle(PacketListener *listener) +void SetEquippedItemPacket::handle(PacketListener *listener) { listener->handleSetEquippedItem(shared_from_this()); } @@ -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/SetEquippedItemPacket.h b/Minecraft.World/SetEquippedItemPacket.h index def39120..9b907acc 100644 --- a/Minecraft.World/SetEquippedItemPacket.h +++ b/Minecraft.World/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/SetExperiencePacket.cpp b/Minecraft.World/SetExperiencePacket.cpp index ffe90a67..bd96a926 100644 --- a/Minecraft.World/SetExperiencePacket.cpp +++ b/Minecraft.World/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/SetExperiencePacket.h b/Minecraft.World/SetExperiencePacket.h index 499b7efd..c8aff620 100644 --- a/Minecraft.World/SetExperiencePacket.h +++ b/Minecraft.World/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/SetHealthPacket.cpp b/Minecraft.World/SetHealthPacket.cpp index 55d7ccc3..63e1a593 100644 --- a/Minecraft.World/SetHealthPacket.cpp +++ b/Minecraft.World/SetHealthPacket.cpp @@ -25,7 +25,7 @@ SetHealthPacket::SetHealthPacket(int health, int food, float saturation, ETeleme this->damageSource = damageSource; } -void SetHealthPacket::read(DataInputStream *dis) //throws IOException +void SetHealthPacket::read(DataInputStream *dis) //throws IOException { health = dis->readShort(); food = dis->readShort(); @@ -35,7 +35,7 @@ void SetHealthPacket::read(DataInputStream *dis) //throws IOException damageSource = (ETelemetryChallenges)dis->readByte(); } -void SetHealthPacket::write(DataOutputStream *dos) //throws IOException +void SetHealthPacket::write(DataOutputStream *dos) //throws IOException { dos->writeShort(health); dos->writeShort(food); @@ -45,7 +45,7 @@ void SetHealthPacket::write(DataOutputStream *dos) //throws IOException dos->writeByte(damageSource); } -void SetHealthPacket::handle(PacketListener *listener) +void SetHealthPacket::handle(PacketListener *listener) { listener->handleSetHealth(shared_from_this()); } @@ -60,7 +60,7 @@ bool SetHealthPacket::canBeInvalidated() return true; } -bool SetHealthPacket::isInvalidatedBy(shared_ptr packet) +bool SetHealthPacket::isInvalidatedBy(std::shared_ptr packet) { return true; } \ No newline at end of file diff --git a/Minecraft.World/SetHealthPacket.h b/Minecraft.World/SetHealthPacket.h index de8f4cb9..0f74075b 100644 --- a/Minecraft.World/SetHealthPacket.h +++ b/Minecraft.World/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/SetRidingPacket.cpp b/Minecraft.World/SetRidingPacket.cpp index 454da047..de7b0bf2 100644 --- a/Minecraft.World/SetRidingPacket.cpp +++ b/Minecraft.World/SetRidingPacket.cpp @@ -13,13 +13,13 @@ 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; } -int SetRidingPacket::getEstimatedSize() +int SetRidingPacket::getEstimatedSize() { return 8; } @@ -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/SetRidingPacket.h b/Minecraft.World/SetRidingPacket.h index 60c3ac43..049b9d13 100644 --- a/Minecraft.World/SetRidingPacket.h +++ b/Minecraft.World/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/SetSpawnPositionPacket.cpp b/Minecraft.World/SetSpawnPositionPacket.cpp index 035da347..07ad2622 100644 --- a/Minecraft.World/SetSpawnPositionPacket.cpp +++ b/Minecraft.World/SetSpawnPositionPacket.cpp @@ -6,7 +6,7 @@ -SetSpawnPositionPacket::SetSpawnPositionPacket() +SetSpawnPositionPacket::SetSpawnPositionPacket() { x = 0; y = 0; @@ -27,19 +27,19 @@ void SetSpawnPositionPacket::read(DataInputStream *dis) //throws IOException z = dis->readInt(); } -void SetSpawnPositionPacket::write(DataOutputStream *dos) //throws IOException +void SetSpawnPositionPacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(x); dos->writeInt(y); dos->writeInt(z); } -void SetSpawnPositionPacket::handle(PacketListener *listener) +void SetSpawnPositionPacket::handle(PacketListener *listener) { listener->handleSetSpawn(shared_from_this()); } -int SetSpawnPositionPacket::getEstimatedSize() +int SetSpawnPositionPacket::getEstimatedSize() { return 3*4; } @@ -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/SetSpawnPositionPacket.h b/Minecraft.World/SetSpawnPositionPacket.h index 3ba66af8..e9e5c7cd 100644 --- a/Minecraft.World/SetSpawnPositionPacket.h +++ b/Minecraft.World/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/SetTimePacket.cpp b/Minecraft.World/SetTimePacket.cpp index 1f0701eb..0a5fe621 100644 --- a/Minecraft.World/SetTimePacket.cpp +++ b/Minecraft.World/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/SetTimePacket.h b/Minecraft.World/SetTimePacket.h index b7d3e645..8074ce9e 100644 --- a/Minecraft.World/SetTimePacket.h +++ b/Minecraft.World/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/ShapedRecipy.cpp b/Minecraft.World/ShapedRecipy.cpp index 15ccca2d..4e22dcd2 100644 --- a/Minecraft.World/ShapedRecipy.cpp +++ b/Minecraft.World/ShapedRecipy.cpp @@ -1,5 +1,5 @@ // package net.minecraft.world.item.crafting; -// +// // import net.minecraft.world.inventory.CraftingContainer; // import net.minecraft.world.item.ItemInstance; @@ -12,7 +12,7 @@ #include "ShapedRecipy.h" // 4J-PB - for new crafting - Adding group to define type of item that the recipe produces -ShapedRecipy::ShapedRecipy(int width, int height, ItemInstance **recipeItems, ItemInstance *result, int iGroup) +ShapedRecipy::ShapedRecipy(int width, int height, ItemInstance **recipeItems, ItemInstance *result, int iGroup) : resultId(result->id) { this->width = width; @@ -23,21 +23,21 @@ ShapedRecipy::ShapedRecipy(int width, int height, ItemInstance **recipeItems, It _keepTag = false; } -const int ShapedRecipy::getGroup() +const int ShapedRecipy::getGroup() { return group; } -const ItemInstance *ShapedRecipy::getResultItem() +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++) + for (int xOffs = 0; xOffs <= (3 - width); xOffs++) { - for (int yOffs = 0; yOffs <= (3 - height); yOffs++) + for (int yOffs = 0; yOffs <= (3 - height); yOffs++) { if (matches(craftSlots, xOffs, yOffs, true)) return true; if (matches(craftSlots, xOffs, yOffs, false)) return true; @@ -46,32 +46,32 @@ 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++) { int xs = x - xOffs; int ys = y - yOffs; ItemInstance *expected = NULL; - if (xs >= 0 && ys >= 0 && xs < width && ys < height) + if (xs >= 0 && ys >= 0 && xs < width && ys < height) { if (xFlip) expected = recipeItems[(width - xs - 1) + ys * width]; else expected = recipeItems[xs + ys * width]; } - shared_ptr item = craftSlots->getItem(x, y); - if (item == NULL && expected == NULL) + std::shared_ptr item = craftSlots->getItem(x, y); + if (item == NULL && expected == NULL) { continue; } - if ((item == NULL && expected != NULL) || (item != NULL && expected == NULL)) + if ((item == NULL && expected != NULL) || (item != NULL && expected == NULL)) { return false; } - if (expected->id != item->id) + if (expected->id != item->id) { return false; } - if (expected->getAuxValue() != Recipes::ANY_AUX_VALUE && expected->getAuxValue() != item->getAuxValue()) + if (expected->getAuxValue() != Recipes::ANY_AUX_VALUE && expected->getAuxValue() != item->getAuxValue()) { return false; } @@ -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()) { @@ -100,25 +100,25 @@ shared_ptr ShapedRecipy::assemble(shared_ptr cr return result; } -int ShapedRecipy::size() +int ShapedRecipy::size() { return width * height; } // 4J-PB -bool ShapedRecipy::requires(int iRecipe) +bool ShapedRecipy::requires(int iRecipe) { app.DebugPrintf("ShapedRecipy %d\n",iRecipe); int iCount=0; - for (int x = 0; x < 3; x++) + for (int x = 0; x < 3; x++) { - for (int y = 0; y < 3; y++) + for (int y = 0; y < 3; y++) { - if (x < width && y < height) + if (x < width && y < height) { ItemInstance *expected = recipeItems[x+y*width]; - if (expected!=NULL) - { + if (expected!=NULL) + { //printf("\tIngredient %d is %d\n",iCount++,expected->id); } } @@ -130,7 +130,7 @@ bool ShapedRecipy::requires(int iRecipe) return false; } -void ShapedRecipy::requires(INGREDIENTS_REQUIRED *pIngReq) +void ShapedRecipy::requires(INGREDIENTS_REQUIRED *pIngReq) { //printf("ShapedRecipy %d\n",iRecipe); @@ -151,16 +151,16 @@ void ShapedRecipy::requires(INGREDIENTS_REQUIRED *pIngReq) memset(TempIngReq.iIngAuxValA,Recipes::ANY_AUX_VALUE,sizeof(int)*9); ZeroMemory(TempIngReq.uiGridA,sizeof(unsigned int)*9); - for (int x = 0; x < 3; x++) + for (int x = 0; x < 3; x++) { - for (int y = 0; y < 3; y++) + for (int y = 0; y < 3; y++) { - if (x < width && y < height) + if (x < width && y < height) { ItemInstance *expected = recipeItems[x+y*width]; - if (expected!=NULL) - { + if (expected!=NULL) + { int iAuxVal = expected->getAuxValue(); TempIngReq.uiGridA[x+y*3]=expected->id | iAuxVal<<24; diff --git a/Minecraft.World/ShapedRecipy.h b/Minecraft.World/ShapedRecipy.h index 56cae3fd..387cf17b 100644 --- a/Minecraft.World/ShapedRecipy.h +++ b/Minecraft.World/ShapedRecipy.h @@ -1,6 +1,6 @@ #pragma once -class ShapedRecipy : public Recipy +class ShapedRecipy : public Recipy { private: int width, height, group; @@ -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/ShapelessRecipy.cpp b/Minecraft.World/ShapelessRecipy.cpp index 67ed0381..46a58524 100644 --- a/Minecraft.World/ShapelessRecipy.cpp +++ b/Minecraft.World/ShapelessRecipy.cpp @@ -1,7 +1,7 @@ // package net.minecraft.world.item.crafting; -// +// // import java.util.*; -// +// // import net.minecraft.world.inventory.CraftingContainer; // import net.minecraft.world.item.ItemInstance; #include "stdafx.h" @@ -19,27 +19,27 @@ ShapelessRecipy::ShapelessRecipy(ItemInstance *result, vector *i { } -const int ShapelessRecipy::getGroup() -{ +const int ShapelessRecipy::getGroup() +{ return group; } -const ItemInstance *ShapelessRecipy::getResultItem() +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; - - for (int y = 0; y < 3; y++) + + for (int y = 0; y < 3; y++) { - for (int x = 0; x < 3; x++) + 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) + if (item != NULL) { bool found = false; @@ -47,7 +47,7 @@ bool ShapelessRecipy::matches(shared_ptr craftSlots, Level *l for (AUTO_VAR(cit, ingredients->begin()); cit != citEnd; ++cit) { ItemInstance *ingredient = *cit; - if (item->id == ingredient->id && (ingredient->getAuxValue() == Recipes::ANY_AUX_VALUE || item->getAuxValue() == ingredient->getAuxValue())) + if (item->id == ingredient->id && (ingredient->getAuxValue() == Recipes::ANY_AUX_VALUE || item->getAuxValue() == ingredient->getAuxValue())) { found = true; AUTO_VAR( it, find(tempList.begin(), tempList.end(), ingredient ) ); @@ -56,7 +56,7 @@ bool ShapelessRecipy::matches(shared_ptr craftSlots, Level *l } } - if (!found) + if (!found) { return false; } @@ -67,18 +67,18 @@ 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(); } -int ShapelessRecipy::size() +int ShapelessRecipy::size() { return (int)ingredients->size(); } // 4J-PB -bool ShapelessRecipy::requires(int iRecipe) +bool ShapelessRecipy::requires(int iRecipe) { vector *tempList = new vector; @@ -91,7 +91,7 @@ bool ShapelessRecipy::requires(int iRecipe) for (vector::iterator ingredient = ingredients->begin(); ingredient != citEnd; ingredient++) { //printf("\tIngredient %d is %d\n",iCount++,(*ingredient)->id); - //if (item->id == (*ingredient)->id && ((*ingredient)->getAuxValue() == Recipes::ANY_AUX_VALUE || item->getAuxValue() == (*ingredient)->getAuxValue())) + //if (item->id == (*ingredient)->id && ((*ingredient)->getAuxValue() == Recipes::ANY_AUX_VALUE || item->getAuxValue() == (*ingredient)->getAuxValue())) tempList->erase(ingredient); } @@ -99,7 +99,7 @@ bool ShapelessRecipy::requires(int iRecipe) return false; } -void ShapelessRecipy::requires(INGREDIENTS_REQUIRED *pIngReq) +void ShapelessRecipy::requires(INGREDIENTS_REQUIRED *pIngReq) { int iCount=0; bool bFound; @@ -125,8 +125,8 @@ void ShapelessRecipy::requires(INGREDIENTS_REQUIRED *pIngReq) { ItemInstance *expected = *ingredient; - if (expected!=NULL) - { + if (expected!=NULL) + { int iAuxVal = (*ingredient)->getAuxValue(); TempIngReq.uiGridA[iCount++]=expected->id | iAuxVal<<24; // 4J-PB - put the ingredients in boxes 1,2,4,5 so we can see them in a 2x2 crafting screen diff --git a/Minecraft.World/ShapelessRecipy.h b/Minecraft.World/ShapelessRecipy.h index 5f7f6076..88de0060 100644 --- a/Minecraft.World/ShapelessRecipy.h +++ b/Minecraft.World/ShapelessRecipy.h @@ -1,6 +1,6 @@ #pragma once -class ShapelessRecipy : public Recipy +class ShapelessRecipy : public Recipy { private: _eGroupType group; @@ -12,12 +12,12 @@ 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 virtual bool requires(int iRecipe); - virtual void requires(INGREDIENTS_REQUIRED *pIngReq); + virtual void requires(INGREDIENTS_REQUIRED *pIngReq); }; diff --git a/Minecraft.World/ShearsItem.cpp b/Minecraft.World/ShearsItem.cpp index 7f4d8d51..00372e29 100644 --- a/Minecraft.World/ShearsItem.cpp +++ b/Minecraft.World/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/ShearsItem.h b/Minecraft.World/ShearsItem.h index 06078645..fe713eaa 100644 --- a/Minecraft.World/ShearsItem.h +++ b/Minecraft.World/ShearsItem.h @@ -3,11 +3,11 @@ using namespace std; #include "Item.h" -class ShearsItem : public Item +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/Sheep.cpp b/Minecraft.World/Sheep.cpp index 30eeefcd..cc1d69ed 100644 --- a/Minecraft.World/Sheep.cpp +++ b/Minecraft.World/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() @@ -95,7 +95,7 @@ int Sheep::getMaxHealth() return 8; } -void Sheep::defineSynchedData() +void Sheep::defineSynchedData() { Animal::defineSynchedData(); @@ -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; @@ -191,80 +191,80 @@ bool Sheep::interact(shared_ptr player) return Animal::interact(player); } -void Sheep::addAdditonalSaveData(CompoundTag *tag) +void Sheep::addAdditonalSaveData(CompoundTag *tag) { Animal::addAdditonalSaveData(tag); tag->putBoolean(L"Sheared", isSheared()); tag->putByte(L"Color", (byte) getColor()); } -void Sheep::readAdditionalSaveData(CompoundTag *tag) +void Sheep::readAdditionalSaveData(CompoundTag *tag) { Animal::readAdditionalSaveData(tag); setSheared(tag->getBoolean(L"Sheared")); setColor((int) tag->getByte(L"Color")); } -int Sheep::getAmbientSound() +int Sheep::getAmbientSound() { return eSoundType_MOB_SHEEP_AMBIENT; } -int Sheep::getHurtSound() +int Sheep::getHurtSound() { return eSoundType_MOB_SHEEP_AMBIENT; } -int Sheep::getDeathSound() +int Sheep::getDeathSound() { return eSoundType_MOB_SHEEP_AMBIENT; } -int Sheep::getColor() +int Sheep::getColor() { return (entityData->getByte(DATA_WOOL_ID) & 0x0f); } -void Sheep::setColor(int color) +void Sheep::setColor(int color) { byte current = entityData->getByte(DATA_WOOL_ID); entityData->set(DATA_WOOL_ID, (byte) ((current & 0xf0) | (color & 0x0f))); } -bool Sheep::isSheared() +bool Sheep::isSheared() { return (entityData->getByte(DATA_WOOL_ID) & 0x10) != 0; } -void Sheep::setSheared(bool value) +void Sheep::setSheared(bool value) { byte current = entityData->getByte(DATA_WOOL_ID); - if (value) + if (value) { entityData->set(DATA_WOOL_ID, (byte) (current | 0x10)); - } - else + } + else { entityData->set(DATA_WOOL_ID, (byte) (current & ~0x10)); } } -int Sheep::getSheepColor(Random *random) +int Sheep::getSheepColor(Random *random) { int nextInt = random->nextInt(100); - if (nextInt < 5) + if (nextInt < 5) { return 15 - DyePowderItem::BLACK; } - if (nextInt < 10) + if (nextInt < 10) { return 15 - DyePowderItem::GRAY; } - if (nextInt < 15) + if (nextInt < 15) { return 15 - DyePowderItem::SILVER; } - if (nextInt < 18) + if (nextInt < 18) { return 15 - DyePowderItem::BROWN; } @@ -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/Sheep.h b/Minecraft.World/Sheep.h index 666e1d57..098183e8 100644 --- a/Minecraft.World/Sheep.h +++ b/Minecraft.World/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/ShoreLayer.cpp b/Minecraft.World/ShoreLayer.cpp index 7ae52557..9640c736 100644 --- a/Minecraft.World/ShoreLayer.cpp +++ b/Minecraft.World/ShoreLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.newbiome.layer.h" #include "net.minecraft.world.level.biome.h" -ShoreLayer::ShoreLayer(int64_t seed, shared_ptr parent) : Layer(seed) +ShoreLayer::ShoreLayer(int64_t seed, std::shared_ptr parent) : Layer(seed) { this->parent = parent; } diff --git a/Minecraft.World/ShoreLayer.h b/Minecraft.World/ShoreLayer.h index a7053004..a8aff680 100644 --- a/Minecraft.World/ShoreLayer.h +++ b/Minecraft.World/ShoreLayer.h @@ -4,6 +4,6 @@ class ShoreLayer : public Layer { public: - ShoreLayer(int64_t seed, shared_ptr parent); + ShoreLayer(int64_t 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/SignItem.cpp b/Minecraft.World/SignItem.cpp index 02ccf83d..fa9d6772 100644 --- a/Minecraft.World/SignItem.cpp +++ b/Minecraft.World/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; @@ -32,24 +32,24 @@ bool SignItem::useOn(shared_ptr instance, shared_ptr playe if(!bTestUseOnOnly) { - if (face == 1) + if (face == 1) { int rot = Mth::floor(((player->yRot + 180) * 16) / 360 + 0.5) & 15; level->setTileAndData(x, y, z, Tile::sign_Id, rot); - } + } else { level->setTileAndData(x, y, z, Tile::wallSign_Id, face); } 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. player->awardStat( GenericStats::blocksPlaced((face==1) ? Tile::sign_Id : Tile::wallSign_Id), - GenericStats::param_blocksPlaced( + GenericStats::param_blocksPlaced( (face==1) ? Tile::sign_Id : Tile::wallSign_Id, instance->getAuxValue(), 1) diff --git a/Minecraft.World/SignItem.h b/Minecraft.World/SignItem.h index 6265e759..98e39c0f 100644 --- a/Minecraft.World/SignItem.h +++ b/Minecraft.World/SignItem.h @@ -3,10 +3,10 @@ using namespace std; #include "Item.h" -class SignItem : public Item +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/SignTile.cpp b/Minecraft.World/SignTile.cpp index 52dc1260..363ef5be 100644 --- a/Minecraft.World/SignTile.cpp +++ b/Minecraft.World/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/SignTile.h b/Minecraft.World/SignTile.h index 92163973..75d723ad 100644 --- a/Minecraft.World/SignTile.h +++ b/Minecraft.World/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/SignTileEntity.cpp b/Minecraft.World/SignTileEntity.cpp index 09b8e022..b2219c94 100644 --- a/Minecraft.World/SignTileEntity.cpp +++ b/Minecraft.World/SignTileEntity.cpp @@ -40,7 +40,7 @@ SignTileEntity::~SignTileEntity() #endif } -void SignTileEntity::save(CompoundTag *tag) +void SignTileEntity::save(CompoundTag *tag) { TileEntity::save(tag); tag->putString(L"Text1", m_wsmessages[0] ); @@ -61,7 +61,7 @@ void SignTileEntity::load(CompoundTag *tag) { _isEditable = false; TileEntity::load(tag); - for (int i = 0; i < MAX_SIGN_LINES; i++) + for (int i = 0; i < MAX_SIGN_LINES; i++) { wchar_t *buf = new wchar_t[256]; swprintf(buf, 256, L"Text%d", (i+1) ); @@ -84,17 +84,17 @@ 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++) + 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() +bool SignTileEntity::isEditable() { return _isEditable; } @@ -115,10 +115,10 @@ void SignTileEntity::setChanged() //if (pMinecraft->level->isClientSide) { WCHAR *wcMessages[MAX_SIGN_LINES]; - for (int i = 0; i < MAX_SIGN_LINES; ++i) + for (int i = 0; i < MAX_SIGN_LINES; ++i) { wcMessages[i]=new WCHAR [MAX_LINE_LENGTH+1]; - ZeroMemory(wcMessages[i],sizeof(WCHAR)*(MAX_LINE_LENGTH+1)); + ZeroMemory(wcMessages[i],sizeof(WCHAR)*(MAX_LINE_LENGTH+1)); if(m_wsmessages[i].length()>0) { memcpy(wcMessages[i],m_wsmessages[i].c_str(),m_wsmessages[i].length()*sizeof(WCHAR)); @@ -149,8 +149,8 @@ void SignTileEntity::setChanged() } -void SignTileEntity::SetMessage(int iIndex,wstring &wsText) -{ +void SignTileEntity::SetMessage(int iIndex,wstring &wsText) +{ m_wsmessages[iIndex]=wsText; } @@ -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/SignTileEntity.h b/Minecraft.World/SignTileEntity.h index b963f12f..8713c627 100644 --- a/Minecraft.World/SignTileEntity.h +++ b/Minecraft.World/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/SignUpdatePacket.h b/Minecraft.World/SignUpdatePacket.h index 80cc2968..e3284ab1 100644 --- a/Minecraft.World/SignUpdatePacket.h +++ b/Minecraft.World/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/Silverfish.cpp b/Minecraft.World/Silverfish.cpp index 117dc41b..24745b6c 100644 --- a/Minecraft.World/Silverfish.cpp +++ b/Minecraft.World/Silverfish.cpp @@ -37,12 +37,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 @@ -79,7 +79,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); @@ -199,7 +199,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/Silverfish.h b/Minecraft.World/Silverfish.h index 0fd0cc06..34d10842 100644 --- a/Minecraft.World/Silverfish.h +++ b/Minecraft.World/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/SimpleContainer.cpp b/Minecraft.World/SimpleContainer.cpp index e29bc790..20c253dc 100644 --- a/Minecraft.World/SimpleContainer.cpp +++ b/Minecraft.World/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/SimpleContainer.h b/Minecraft.World/SimpleContainer.h index 98c193d3..1dfade29 100644 --- a/Minecraft.World/SimpleContainer.h +++ b/Minecraft.World/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/SitGoal.cpp b/Minecraft.World/SitGoal.cpp index 90180201..b01bb86a 100644 --- a/Minecraft.World/SitGoal.cpp +++ b/Minecraft.World/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/Skeleton.cpp b/Minecraft.World/Skeleton.cpp index b6dbab1f..4f28327c 100644 --- a/Minecraft.World/Skeleton.cpp +++ b/Minecraft.World/Skeleton.cpp @@ -53,7 +53,7 @@ int Skeleton::getMaxHealth() return 20; } -int Skeleton::getAmbientSound() +int Skeleton::getAmbientSound() { return eSoundType_MOB_SKELETON_AMBIENT; } @@ -63,19 +63,19 @@ int Skeleton::getHurtSound() return eSoundType_MOB_SKELETON_HURT; } -int Skeleton::getDeathSound() +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; } -MobType Skeleton::getMobType() +MobType Skeleton::getMobType() { return UNDEAD; } @@ -83,7 +83,7 @@ MobType Skeleton::getMobType() void Skeleton::aiStep() { // isClientSide check brought forward from 1.8 (I assume it's related to the lighting changes) - if (level->isDay() && !level->isClientSide) + if (level->isDay() && !level->isClientSide) { float br = getBrightness(1); if (br > 0.5f) @@ -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; @@ -113,7 +113,7 @@ void Skeleton::die(DamageSource *source) } } -int Skeleton::getDeathLoot() +int Skeleton::getDeathLoot() { return Item::arrow->id; } @@ -122,7 +122,7 @@ void Skeleton::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) { // drop some arrows int count = random->nextInt(3 + playerBonusLevel); - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { spawnAtLocation(Item::arrow->id, 1); } @@ -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/Skeleton.h b/Minecraft.World/Skeleton.h index b85d9afe..d5760e9a 100644 --- a/Minecraft.World/Skeleton.h +++ b/Minecraft.World/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/SkullItem.cpp b/Minecraft.World/SkullItem.cpp index 643021dc..36825d9f 100644 --- a/Minecraft.World/SkullItem.cpp +++ b/Minecraft.World/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/SkullItem.h b/Minecraft.World/SkullItem.h index fc23be2f..2cd828e9 100644 --- a/Minecraft.World/SkullItem.h +++ b/Minecraft.World/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/SkullTile.cpp b/Minecraft.World/SkullTile.cpp index 73aef0e1..38c47479 100644 --- a/Minecraft.World/SkullTile.cpp +++ b/Minecraft.World/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/SkullTile.h b/Minecraft.World/SkullTile.h index 1d514acd..0d33723f 100644 --- a/Minecraft.World/SkullTile.h +++ b/Minecraft.World/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/SkullTileEntity.cpp b/Minecraft.World/SkullTileEntity.cpp index ea19b446..e36f4e6a 100644 --- a/Minecraft.World/SkullTileEntity.cpp +++ b/Minecraft.World/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,11 +60,11 @@ 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; result->rotation = rotation; result->extraType = extraType; diff --git a/Minecraft.World/SkullTileEntity.h b/Minecraft.World/SkullTileEntity.h index 4b24457b..db1580fa 100644 --- a/Minecraft.World/SkullTileEntity.h +++ b/Minecraft.World/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/Slime.cpp b/Minecraft.World/Slime.cpp index 7941fbe0..47b64482 100644 --- a/Minecraft.World/Slime.cpp +++ b/Minecraft.World/Slime.cpp @@ -116,7 +116,7 @@ void Slime::tick() level->addParticle(getParticleName(), x + xd, bb->y0, z + zd, 0, 0, 0); } - if (doPlayLandSound()) + if (doPlayLandSound()) { level->playSound(shared_from_this(), getSquishSound(), getSoundVolume(), ((random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f) / 0.8f); } @@ -130,15 +130,15 @@ void Slime::tick() decreaseSquish(); } -void Slime::serverAiStep() +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); } - if (onGround && jumpDelay-- <= 0) + if (onGround && jumpDelay-- <= 0) { jumpDelay = getJumpDelay(); if (player != NULL) @@ -155,7 +155,7 @@ void Slime::serverAiStep() //targetSquish = 1; xxa = 1 - random->nextFloat() * 2; yya = (float) 1 * getSize(); - } + } else { jumping = false; @@ -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()) { @@ -233,7 +233,7 @@ int Slime::getAttackDamage() return getSize(); } -int Slime::getHurtSound() +int Slime::getHurtSound() { return eSoundType_MOB_SLIME; } @@ -266,7 +266,7 @@ bool Slime::canSpawn() return false; } -float Slime::getSoundVolume() +float Slime::getSoundVolume() { return 0.4f * getSize(); } diff --git a/Minecraft.World/Slime.h b/Minecraft.World/Slime.h index 6fa56056..b9ea741f 100644 --- a/Minecraft.World/Slime.h +++ b/Minecraft.World/Slime.h @@ -27,7 +27,7 @@ private: public: Slime(Level *level); -protected: +protected: virtual void defineSynchedData(); public: @@ -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/Slot.cpp b/Minecraft.World/Slot.cpp index 30fd9125..1f7415f2 100644 --- a/Minecraft.World/Slot.cpp +++ b/Minecraft.World/Slot.cpp @@ -5,7 +5,7 @@ #include "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/Slot.h b/Minecraft.World/Slot.h index 6289ec0e..13827b5a 100644 --- a/Minecraft.World/Slot.h +++ b/Minecraft.World/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/SmallFireball.cpp b/Minecraft.World/SmallFireball.cpp index a1fa5cb1..be84e82c 100644 --- a/Minecraft.World/SmallFireball.cpp +++ b/Minecraft.World/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/SmallFireball.h b/Minecraft.World/SmallFireball.h index 38ad8efd..3b63e2e0 100644 --- a/Minecraft.World/SmallFireball.h +++ b/Minecraft.World/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/SmoothLayer.cpp b/Minecraft.World/SmoothLayer.cpp index e94ae36d..698a9428 100644 --- a/Minecraft.World/SmoothLayer.cpp +++ b/Minecraft.World/SmoothLayer.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "net.minecraft.world.level.newbiome.layer.h" -SmoothLayer::SmoothLayer(int64_t seedMixup, shared_ptrparent) : Layer(seedMixup) +SmoothLayer::SmoothLayer(int64_t seedMixup, std::shared_ptrparent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/SmoothLayer.h b/Minecraft.World/SmoothLayer.h index 14e3d152..a6ac07d8 100644 --- a/Minecraft.World/SmoothLayer.h +++ b/Minecraft.World/SmoothLayer.h @@ -5,7 +5,7 @@ class SmoothLayer : public Layer { public: - SmoothLayer(int64_t seedMixup, shared_ptrparent); + SmoothLayer(int64_t 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/SmoothStoneBrickTileItem.cpp b/Minecraft.World/SmoothStoneBrickTileItem.cpp index e0326130..7d18bfc0 100644 --- a/Minecraft.World/SmoothStoneBrickTileItem.cpp +++ b/Minecraft.World/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/SmoothStoneBrickTileItem.h b/Minecraft.World/SmoothStoneBrickTileItem.h index 18b640a3..94f71ec0 100644 --- a/Minecraft.World/SmoothStoneBrickTileItem.h +++ b/Minecraft.World/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/SmoothZoomLayer.cpp b/Minecraft.World/SmoothZoomLayer.cpp index 2df34a3b..66429658 100644 --- a/Minecraft.World/SmoothZoomLayer.cpp +++ b/Minecraft.World/SmoothZoomLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.newbiome.layer.h" #include "System.h" -SmoothZoomLayer::SmoothZoomLayer(int64_t seedMixup, shared_ptrparent) : Layer(seedMixup) +SmoothZoomLayer::SmoothZoomLayer(int64_t 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_t seed, shared_ptrsup, int count) +std::shared_ptrSmoothZoomLayer::zoom(int64_t 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/SmoothZoomLayer.h b/Minecraft.World/SmoothZoomLayer.h index 90cc292e..59d81f40 100644 --- a/Minecraft.World/SmoothZoomLayer.h +++ b/Minecraft.World/SmoothZoomLayer.h @@ -5,8 +5,8 @@ class SmoothZoomLayer : public Layer { public: - SmoothZoomLayer(int64_t seedMixup, shared_ptrparent); + SmoothZoomLayer(int64_t seedMixup, std::shared_ptrparent); virtual intArray getArea(int xo, int yo, int w, int h); - static shared_ptrzoom(int64_t seed, shared_ptrsup, int count); + static std::shared_ptrzoom(int64_t seed, std::shared_ptrsup, int count); }; \ No newline at end of file diff --git a/Minecraft.World/Snowball.cpp b/Minecraft.World/Snowball.cpp index cdcefb1b..37983a68 100644 --- a/Minecraft.World/Snowball.cpp +++ b/Minecraft.World/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/Snowball.h b/Minecraft.World/Snowball.h index 82971726..d3ccfa1d 100644 --- a/Minecraft.World/Snowball.h +++ b/Minecraft.World/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/SnowballItem.cpp b/Minecraft.World/SnowballItem.cpp index 41dd2b7c..706cd75d 100644 --- a/Minecraft.World/SnowballItem.cpp +++ b/Minecraft.World/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/SnowballItem.h b/Minecraft.World/SnowballItem.h index bf2d20cb..97680968 100644 --- a/Minecraft.World/SnowballItem.h +++ b/Minecraft.World/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/Spider.cpp b/Minecraft.World/Spider.cpp index ba58ce54..a80543e4 100644 --- a/Minecraft.World/Spider.cpp +++ b/Minecraft.World/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) @@ -107,7 +107,7 @@ void Spider::checkHurtTarget(shared_ptr target, float d) if (d > 2 && d < 6 && random->nextInt(10) == 0) { - if (onGround) + if (onGround) { double xdd = target->x - x; double zdd = target->z - z; @@ -116,7 +116,7 @@ void Spider::checkHurtTarget(shared_ptr target, float d) zd = (zdd / dd * 0.5f) * 0.8f + zd * 0.2f; yd = 0.4f; } - } + } else { Monster::checkHurtTarget(target, d); @@ -143,11 +143,11 @@ void Spider::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) * to climb walls. */ -bool Spider::onLadder() +bool Spider::onLadder() { return isClimbing(); } - + void Spider::makeStuckInWeb() { // do nothing - spiders don't get stuck in web diff --git a/Minecraft.World/Spider.h b/Minecraft.World/Spider.h index f0257d6c..e73555cc 100644 --- a/Minecraft.World/Spider.h +++ b/Minecraft.World/Spider.h @@ -25,17 +25,17 @@ 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); public: virtual bool onLadder(); - + virtual void makeStuckInWeb(); virtual float getModelScale(); virtual MobType getMobType(); diff --git a/Minecraft.World/SpikeFeature.cpp b/Minecraft.World/SpikeFeature.cpp index e8886d00..cb24e457 100644 --- a/Minecraft.World/SpikeFeature.cpp +++ b/Minecraft.World/SpikeFeature.cpp @@ -26,7 +26,7 @@ bool SpikeFeature::place(Level *level, Random *random, int x, int y, int z) int zd = zz - z; if (xd * xd + zd * zd <= r * r + 1) { - if (level->getTile(xx, y - 1, zz) != tile) + if (level->getTile(xx, y - 1, zz) != tile) { return false; } @@ -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); @@ -111,8 +111,8 @@ bool SpikeFeature::placeWithIndex(Level *level, Random *random, int x, int y, in } } } - } - else + } + else { app.DebugPrintf("Breaking out of spike feature\n"); break; @@ -145,8 +145,8 @@ bool SpikeFeature::placeWithIndex(Level *level, Random *random, int x, int y, in } } } - } - else + } + else { app.DebugPrintf("Breaking out of spike feature\n"); break; @@ -155,7 +155,7 @@ bool SpikeFeature::placeWithIndex(Level *level, Random *random, int x, int y, in // and cap off the top int yy = y + hh + 3; - + if (yy < Level::genDepth) { for (int xx = x - 2; xx <= x + 2; xx++) @@ -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/Squid.cpp b/Minecraft.World/Squid.cpp index 3e36777c..06d0318d 100644 --- a/Minecraft.World/Squid.cpp +++ b/Minecraft.World/Squid.cpp @@ -47,27 +47,27 @@ int Squid::getMaxHealth() return 10; } -int Squid::getAmbientSound() +int Squid::getAmbientSound() { return -1; } -int Squid::getHurtSound() +int Squid::getHurtSound() { return -1; } -int Squid::getDeathSound() +int Squid::getDeathSound() { return -1; } -float Squid::getSoundVolume() +float Squid::getSoundVolume() { return 0.4f; } -int Squid::getDeathLoot() +int Squid::getDeathLoot() { return 0; } @@ -75,18 +75,18 @@ int Squid::getDeathLoot() void Squid::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) { int count = random->nextInt(3 + playerBonusLevel) + 1; - for (int i = 0; i < count; i++) + 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); } } -bool Squid::isInWater() +bool Squid::isInWater() { return level->checkAndHandleWater(bb->grow(0, -0.6f, 0), Material::water, shared_from_this() ); } -void Squid::aiStep() +void Squid::aiStep() { WaterAnimal::aiStep(); @@ -97,37 +97,37 @@ void Squid::aiStep() oldTentacleAngle = tentacleAngle; tentacleMovement += tentacleSpeed; - if (tentacleMovement > (float) PI * 2.0f) + if (tentacleMovement > (float) PI * 2.0f) { tentacleMovement -= (float) PI * 2.0f; if (random->nextInt(10) == 0) tentacleSpeed = 1 / (random->nextFloat() + 1) * 0.2f; } - if (isInWater()) + if (isInWater()) { - if (tentacleMovement < PI) + if (tentacleMovement < PI) { float tentacleScale = tentacleMovement / PI; tentacleAngle = Mth::sin(tentacleScale * tentacleScale * PI) * PI * 0.25f; - if (tentacleScale > .75) + if (tentacleScale > .75) { speed = 1.0f; rotateSpeed = 1.0f; - } - else + } + else { rotateSpeed = rotateSpeed * 0.8f; } - } - else + } + else { tentacleAngle = 0.0f; speed = speed * 0.9f; rotateSpeed = rotateSpeed * 0.99f; } - if (!level->isClientSide) + if (!level->isClientSide) { xd = tx * speed; yd = ty * speed; @@ -141,11 +141,11 @@ void Squid::aiStep() zBodyRot = zBodyRot + (float) PI * rotateSpeed * 1.5f; xBodyRot += ((-(float) atan2(horizontalMovement, this->yd) * 180 / PI) - xBodyRot) * 0.1f; } - else + else { tentacleAngle = Mth::abs(Mth::sin(tentacleMovement)) * PI * 0.25f; - if (!level->isClientSide) + if (!level->isClientSide) { // unable to move, apply gravity xd = 0.0f; @@ -173,7 +173,7 @@ void Squid::serverAiStep() { tx = ty = tz = 0; } - else if (random->nextInt(50) == 0 || !wasInWater || (tx == 0 && ty == 0 && tz == 0)) + else if (random->nextInt(50) == 0 || !wasInWater || (tx == 0 && ty == 0 && tz == 0)) { float angle = random->nextFloat() * PI * 2.0f; tx = Mth::cos(angle) * 0.2f; diff --git a/Minecraft.World/StairTile.cpp b/Minecraft.World/StairTile.cpp index 7a80e9ff..ca617494 100644 --- a/Minecraft.World/StairTile.cpp +++ b/Minecraft.World/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/StairTile.h b/Minecraft.World/StairTile.h index d4797f04..33c5a30e 100644 --- a/Minecraft.World/StairTile.h +++ b/Minecraft.World/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/Stat.h b/Minecraft.World/Stat.h index 3c2ab071..c9751d1c 100644 --- a/Minecraft.World/Stat.h +++ b/Minecraft.World/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/StemTile.cpp b/Minecraft.World/StemTile.cpp index 15c412eb..7ddbacef 100644 --- a/Minecraft.World/StemTile.cpp +++ b/Minecraft.World/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/StemTile.h b/Minecraft.World/StemTile.h index ac4fc40c..2f726c17 100644 --- a/Minecraft.World/StemTile.h +++ b/Minecraft.World/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/StoneMonsterTile.cpp b/Minecraft.World/StoneMonsterTile.cpp index d3d6a846..ad5982f8 100644 --- a/Minecraft.World/StoneMonsterTile.cpp +++ b/Minecraft.World/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/StoneMonsterTile.h b/Minecraft.World/StoneMonsterTile.h index 9c0b58fd..96063a14 100644 --- a/Minecraft.World/StoneMonsterTile.h +++ b/Minecraft.World/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/StoneMonsterTileItem.cpp b/Minecraft.World/StoneMonsterTileItem.cpp index 4ecdf627..fd6f1ee4 100644 --- a/Minecraft.World/StoneMonsterTileItem.cpp +++ b/Minecraft.World/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/StoneMonsterTileItem.h b/Minecraft.World/StoneMonsterTileItem.h index bb12d2e1..6a4ec228 100644 --- a/Minecraft.World/StoneMonsterTileItem.h +++ b/Minecraft.World/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/StoneSlabTile.cpp b/Minecraft.World/StoneSlabTile.cpp index 5c8d8b07..1a51ef11 100644 --- a/Minecraft.World/StoneSlabTile.cpp +++ b/Minecraft.World/StoneSlabTile.cpp @@ -32,7 +32,7 @@ Icon *StoneSlabTile::getTexture(int face, int data) case STONE_SLAB: if (face == Facing::UP || face == Facing::DOWN) return icon; return iconSide; - break; + break; case SAND_SLAB: return Tile::sandStone->getTexture(face); case WOOD_SLAB: @@ -48,7 +48,7 @@ Icon *StoneSlabTile::getTexture(int face, int data) case QUARTZ_SLAB: return Tile::quartzBlock->getTexture(face); } - + return icon; } @@ -69,16 +69,16 @@ unsigned int StoneSlabTile::getDescriptionId(int iData /*= -1*/) return StoneSlabTile::SLAB_NAMES[iData]; } -int StoneSlabTile::getAuxName(int auxValue) +int StoneSlabTile::getAuxName(int auxValue) { - if (auxValue < 0 || auxValue >= SLAB_NAMES_LENGTH) + if (auxValue < 0 || auxValue >= SLAB_NAMES_LENGTH) { auxValue = 0; } 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/StoneSlabTile.h b/Minecraft.World/StoneSlabTile.h index 4380b04c..42972c40 100644 --- a/Minecraft.World/StoneSlabTile.h +++ b/Minecraft.World/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/StoneSlabTileItem.cpp b/Minecraft.World/StoneSlabTileItem.cpp index ea636f65..8113600e 100644 --- a/Minecraft.World/StoneSlabTileItem.cpp +++ b/Minecraft.World/StoneSlabTileItem.cpp @@ -17,24 +17,24 @@ StoneSlabTileItem::StoneSlabTileItem(int id, HalfSlabTile *halfTile, HalfSlabTil setStackedByData(true); } -Icon *StoneSlabTileItem::getIcon(int itemAuxValue) +Icon *StoneSlabTileItem::getIcon(int itemAuxValue) { return Tile::tiles[id]->getTexture(2, itemAuxValue); } -int StoneSlabTileItem::getLevelDataForAuxValue(int auxValue) +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) + if (isFull) { return TileItem::useOn(instance, player, level, x, y, z, face, clickX, clickY, clickZ, bTestUseOnOnly); } @@ -47,14 +47,14 @@ bool StoneSlabTileItem::useOn(shared_ptr instance, shared_ptrid && slabType == instance->getAuxValue()) + if (((face == Facing::UP && !isUpper) || (face == Facing::DOWN && isUpper)) && currentTile == halfTile->id && slabType == instance->getAuxValue()) { if(bTestUseOnOnly) { return true; } - if (level->isUnobstructed(fullTile->getAABB(level, x, y, z)) && level->setTileAndData(x, y, z, fullTile->id, slabType)) + if (level->isUnobstructed(fullTile->getAABB(level, x, y, z)) && level->setTileAndData(x, y, z, fullTile->id, slabType)) { // level.playSound(x + 0.5f, y + 0.5f, z + 0.5f, fullTile.soundType.getPlaceSound(), (fullTile.soundType.getVolume() + 1) / 2, fullTile.soundType.getPitch() * 0.8f); // instance.count--; @@ -62,19 +62,19 @@ bool StoneSlabTileItem::useOn(shared_ptr instance, shared_ptrcount--; } return true; - } - else if (tryConvertTargetTile(instance, player, level, x, y, z, face, bTestUseOnOnly)) + } + else if (tryConvertTargetTile(instance, player, level, x, y, z, face, bTestUseOnOnly)) { return true; - } - else + } + else { return TileItem::useOn(instance, player, level, x, y, z, face, clickX, clickY, clickZ, bTestUseOnOnly); } } -bool StoneSlabTileItem::mayPlace(Level *level, int x, int y, int z, int face,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; @@ -83,7 +83,7 @@ bool StoneSlabTileItem::mayPlace(Level *level, int x, int y, int z, int face,sha int slabType = currentData & HalfSlabTile::TYPE_MASK; boolean isUpper = (currentData & HalfSlabTile::TOP_SLOT_BIT) != 0; - if (((face == Facing::UP && !isUpper) || (face == Facing::DOWN && isUpper)) && currentTile == halfTile->id && slabType == item->getAuxValue()) + if (((face == Facing::UP && !isUpper) || (face == Facing::DOWN && isUpper)) && currentTile == halfTile->id && slabType == item->getAuxValue()) { return true; } @@ -100,7 +100,7 @@ bool StoneSlabTileItem::mayPlace(Level *level, int x, int y, int z, int face,sha slabType = currentData & HalfSlabTile::TYPE_MASK; isUpper = (currentData & HalfSlabTile::TOP_SLOT_BIT) != 0; - if (currentTile == halfTile->id && slabType == item->getAuxValue()) + if (currentTile == halfTile->id && slabType == item->getAuxValue()) { return true; } @@ -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++; @@ -121,17 +121,17 @@ bool StoneSlabTileItem::tryConvertTargetTile(shared_ptr instance, int currentData = level->getData(x, y, z); int slabType = currentData & HalfSlabTile::TYPE_MASK; - if (currentTile == halfTile->id && slabType == instance->getAuxValue()) + if (currentTile == halfTile->id && slabType == instance->getAuxValue()) { if(bTestUseOnOnly) { return true; - } - if (level->isUnobstructed(fullTile->getAABB(level, x, y, z)) && level->setTileAndData(x, y, z, fullTile->id, slabType)) + } + if (level->isUnobstructed(fullTile->getAABB(level, x, y, z)) && level->setTileAndData(x, y, z, fullTile->id, slabType)) { //level.playSound(x + 0.5f, y + 0.5f, z + 0.5f, fullTile.soundType.getPlaceSound(), (fullTile.soundType.getVolume() + 1) / 2, fullTile.soundType.getPitch() * 0.8f); level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, fullTile->soundType->getStepSound(), (fullTile->soundType->getVolume() + 1) / 2, fullTile->soundType->getPitch() * 0.8f); - instance->count--; + instance->count--; } return true; } diff --git a/Minecraft.World/StoneSlabTileItem.h b/Minecraft.World/StoneSlabTileItem.h index 417dcba0..a54c7802 100644 --- a/Minecraft.World/StoneSlabTileItem.h +++ b/Minecraft.World/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/StrongholdPieces.cpp b/Minecraft.World/StrongholdPieces.cpp index 0168b2ba..05ccec39 100644 --- a/Minecraft.World/StrongholdPieces.cpp +++ b/Minecraft.World/StrongholdPieces.cpp @@ -352,13 +352,13 @@ StructurePiece *StrongholdPieces::StrongholdPiece::generateSmallDoorChildRight(S } return NULL; } - + bool StrongholdPieces::StrongholdPiece::isOkBox(BoundingBox *box, StartPiece *startRoom) { //return box != NULL && box->y0 > LOWEST_Y_POSITION; - + bool bIsOk = false; - + if(box != NULL) { if( box->y0 > LOWEST_Y_POSITION ) bIsOk = true; @@ -393,7 +393,7 @@ BoundingBox *StrongholdPieces::FillerCorridor::findPieceBox(listfront()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -582,7 +582,7 @@ StrongholdPieces::Straight *StrongholdPieces::Straight::createPiece(listfront()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -625,7 +625,7 @@ bool StrongholdPieces::Straight::postProcess(Level *level, Random *random, Bound return true; } -WeighedTreasure *StrongholdPieces::ChestCorridor::treasureItems[TREASURE_ITEMS_COUNT] = +WeighedTreasure *StrongholdPieces::ChestCorridor::treasureItems[TREASURE_ITEMS_COUNT] = { new WeighedTreasure(Item::enderPearl_Id, 0, 1, 1, 10), new WeighedTreasure(Item::diamond_Id, 0, 1, 3, 3), @@ -658,7 +658,7 @@ StrongholdPieces::ChestCorridor *StrongholdPieces::ChestCorridor::createPiece(li { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -1, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -724,7 +724,7 @@ StrongholdPieces::StraightStairsDown *StrongholdPieces::StraightStairsDown::crea { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 4 - height, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -790,7 +790,7 @@ StrongholdPieces::LeftTurn *StrongholdPieces::LeftTurn::createPiece(listfront()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -870,7 +870,7 @@ bool StrongholdPieces::RightTurn::postProcess(Level *level, Random *random, Boun StrongholdPieces::RoomCrossing::RoomCrossing(int genDepth, Random *random, BoundingBox *stairsBox, int direction) : StrongholdPiece(genDepth), entryDoor(randomSmallDoor(random)), type(random->nextInt(5)) { orientation = direction; - boundingBox = stairsBox; + boundingBox = stairsBox; } void StrongholdPieces::RoomCrossing::addChildren(StructurePiece *startPiece, list *pieces, Random *random) @@ -884,7 +884,7 @@ StrongholdPieces::RoomCrossing *StrongholdPieces::RoomCrossing::createPiece(list { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -4, -1, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; + StartPiece *startPiece = NULL; if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -896,7 +896,7 @@ StrongholdPieces::RoomCrossing *StrongholdPieces::RoomCrossing::createPiece(list return new RoomCrossing(genDepth, random, box, direction); } -WeighedTreasure *StrongholdPieces::RoomCrossing::smallTreasureItems[SMALL_TREASURE_ITEMS_COUNT] = +WeighedTreasure *StrongholdPieces::RoomCrossing::smallTreasureItems[SMALL_TREASURE_ITEMS_COUNT] = { new WeighedTreasure(Item::ironIngot_Id, 0, 1, 5, 10), new WeighedTreasure(Item::goldIngot_Id, 0, 1, 3, 5), @@ -1030,7 +1030,7 @@ StrongholdPieces::PrisonHall *StrongholdPieces::PrisonHall::createPiece(listfront()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -1091,7 +1091,7 @@ StrongholdPieces::Library *StrongholdPieces::Library::createPiece(listfront()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -1110,7 +1110,7 @@ StrongholdPieces::Library *StrongholdPieces::Library::createPiece(listfront()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -1358,7 +1358,7 @@ StrongholdPieces::PortalRoom *StrongholdPieces::PortalRoom::createPiece(listfront()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) @@ -1443,7 +1443,7 @@ bool StrongholdPieces::PortalRoom::postProcess(Level *level, Random *random, Bou } // 4J-PB - Removed for Christmas update since we don't have The End - + // 4J-PB - not going to remove it, so that maps generated will have it in, but it can't be activated placeBlock(level, Tile::endPortalFrameTile_Id, north + ((random->nextFloat() > 0.9f) ? TheEndPortalFrameTile::EYE_BIT : 0), 4, 3, 8, chunkBB); placeBlock(level, Tile::endPortalFrameTile_Id, north + ((random->nextFloat() > 0.9f) ? TheEndPortalFrameTile::EYE_BIT : 0), 5, 3, 8, chunkBB); @@ -1457,7 +1457,7 @@ bool StrongholdPieces::PortalRoom::postProcess(Level *level, Random *random, Bou placeBlock(level, Tile::endPortalFrameTile_Id, west + ((random->nextFloat() > 0.9f) ? TheEndPortalFrameTile::EYE_BIT : 0), 7, 3, 9, chunkBB); placeBlock(level, Tile::endPortalFrameTile_Id, west + ((random->nextFloat() > 0.9f) ? TheEndPortalFrameTile::EYE_BIT : 0), 7, 3, 10, chunkBB); placeBlock(level, Tile::endPortalFrameTile_Id, west + ((random->nextFloat() > 0.9f) ? TheEndPortalFrameTile::EYE_BIT : 0), 7, 3, 11, chunkBB); - + if (!hasPlacedMobSpawner) { @@ -1466,14 +1466,14 @@ bool StrongholdPieces::PortalRoom::postProcess(Level *level, Random *random, Bou if (chunkBB->isInside(x, y, z)) { // 4J Stu - The mob spawner location is close enough for the map icon display, and this ensures that we only need to set the position once - app.AddTerrainFeaturePosition(eTerrainFeature_StrongholdEndPortal,x,z); + app.AddTerrainFeaturePosition(eTerrainFeature_StrongholdEndPortal,x,z); level->getLevelData()->setXStrongholdEndPortal(x); level->getLevelData()->setZStrongholdEndPortal(z); level->getLevelData()->setHasStrongholdEndPortal(); 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/StructurePiece.cpp b/Minecraft.World/StructurePiece.cpp index 1d41a608..e4fd3fab 100644 --- a/Minecraft.World/StructurePiece.cpp +++ b/Minecraft.World/StructurePiece.cpp @@ -13,7 +13,7 @@ #include "DoorItem.h" /** -* +* * A structure piece is a construction or room, located somewhere in the world * with a given orientatino (out of Direction.java). Structure pieces have a * bounding box that says where the piece is located and its bounds, and the @@ -89,7 +89,7 @@ StructurePiece* StructurePiece::findCollisionPiece( list< StructurePiece* > *pie } // 4J-PB - Added from 1.2.3 -TilePos *StructurePiece::getLocatorPosition() +TilePos *StructurePiece::getLocatorPosition() { return new TilePos(boundingBox->getXCenter(), boundingBox->getYCenter(), boundingBox->getZCenter()); } @@ -523,7 +523,7 @@ void StructurePiece::placeBlock( Level* level, int block, int data, int x, int y * The purpose of this method is to wrap the getTile call on Level, in order * to prevent the level from generating chunks that shouldn't be loaded yet. * Returns 0 if the call is out of bounds. -* +* * @param level * @param x * @param y @@ -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/SwampRiversLayer.cpp b/Minecraft.World/SwampRiversLayer.cpp index cd22cae8..4840a434 100644 --- a/Minecraft.World/SwampRiversLayer.cpp +++ b/Minecraft.World/SwampRiversLayer.cpp @@ -3,7 +3,7 @@ #include "IntCache.h" #include "SwampRiversLayer.h" -SwampRiversLayer::SwampRiversLayer(int64_t seed, shared_ptr parent) : Layer(seed) +SwampRiversLayer::SwampRiversLayer(int64_t seed, std::shared_ptr parent) : Layer(seed) { this->parent = parent; } diff --git a/Minecraft.World/SwampRiversLayer.h b/Minecraft.World/SwampRiversLayer.h index 97bab0f4..3ede59d5 100644 --- a/Minecraft.World/SwampRiversLayer.h +++ b/Minecraft.World/SwampRiversLayer.h @@ -5,7 +5,7 @@ class SwampRiversLayer : public Layer { public: - SwampRiversLayer(int64_t seed, shared_ptr parent); + SwampRiversLayer(int64_t 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/SwellGoal.cpp b/Minecraft.World/SwellGoal.cpp index 9065ba16..289ada73 100644 --- a/Minecraft.World/SwellGoal.cpp +++ b/Minecraft.World/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/SynchedEntityData.cpp b/Minecraft.World/SynchedEntityData.cpp index 9f1aa1f7..b5f31bfa 100644 --- a/Minecraft.World/SynchedEntityData.cpp +++ b/Minecraft.World/SynchedEntityData.cpp @@ -19,7 +19,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; @@ -30,7 +30,7 @@ void SynchedEntityData::define(int id, byte 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; @@ -41,7 +41,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; @@ -52,7 +52,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; @@ -63,7 +63,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; @@ -109,7 +109,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(); @@ -123,7 +123,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()) @@ -136,7 +136,7 @@ void SynchedEntityData::set(int id, int value) void SynchedEntityData::set(int id, byte value) { - shared_ptr dataItem = itemsById[id]; + std::shared_ptr dataItem = itemsById[id]; // update the value if it has changed if (value != dataItem->getValue_byte()) @@ -149,7 +149,7 @@ void SynchedEntityData::set(int id, byte 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()) @@ -162,7 +162,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()) @@ -173,9 +173,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()) @@ -197,7 +197,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) @@ -205,7 +205,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); } } @@ -214,24 +214,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); } @@ -247,7 +247,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); } @@ -255,18 +255,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); } @@ -274,7 +274,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; @@ -285,7 +285,7 @@ void SynchedEntityData::writeDataItem(DataOutputStream *output, shared_ptrwriteByte( dataItem->getValue_byte()); - break; + break; case TYPE_INT: output->writeInt( dataItem->getValue_int()); break; @@ -295,23 +295,23 @@ void SynchedEntityData::writeDataItem(DataOutputStream *output, shared_ptrgetValue_wstring(), output); break; - case TYPE_ITEMINSTANCE: + case TYPE_ITEMINSTANCE: { - shared_ptr instance = (shared_ptr )dataItem->getValue_itemInstance(); + std::shared_ptr instance = (std::shared_ptr )dataItem->getValue_itemInstance(); Packet::writeItem(instance, output); } break; - + default: assert(false); // 4J - not implemented break; } } -vector > *SynchedEntityData::unpack(DataInputStream *input) //throws IOException +vector > *SynchedEntityData::unpack(DataInputStream *input) //throws IOException { - vector > *result = NULL; + vector > *result = NULL; int currentHeader = input->readByte(); @@ -320,40 +320,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: { byte 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: + 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: @@ -372,16 +372,16 @@ vector > *SynchedEntityData::unpack(Data /** * Assigns values from a list of data items. -* +* * @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() ) { @@ -418,11 +418,11 @@ bool SynchedEntityData::isEmpty() int SynchedEntityData::getSizeInBytes() { int size = 1; - + 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; @@ -431,7 +431,7 @@ int SynchedEntityData::getSizeInBytes() { case TYPE_BYTE: size += 1; - break; + break; case TYPE_SHORT: size += 2; break; @@ -481,7 +481,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; @@ -512,7 +512,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; } @@ -537,7 +537,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/SynchedEntityData.h b/Minecraft.World/SynchedEntityData.h index e79a10b8..05a6fef2 100644 --- a/Minecraft.World/SynchedEntityData.h +++ b/Minecraft.World/SynchedEntityData.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, byte 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); byte 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,35 +91,35 @@ 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, byte 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. - * + * * @param items */ public: - void assignValues(vector > *items); + void assignValues(vector > *items); bool isEmpty(); // 4J Added diff --git a/Minecraft.World/TakeFlowerGoal.cpp b/Minecraft.World/TakeFlowerGoal.cpp index 34c584c6..e67edd86 100644 --- a/Minecraft.World/TakeFlowerGoal.cpp +++ b/Minecraft.World/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/TakeItemEntityPacket.h b/Minecraft.World/TakeItemEntityPacket.h index 7c4b45fe..da785696 100644 --- a/Minecraft.World/TakeItemEntityPacket.h +++ b/Minecraft.World/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/TallGrass.cpp b/Minecraft.World/TallGrass.cpp index e2e7cb19..d4a3d027 100644 --- a/Minecraft.World/TallGrass.cpp +++ b/Minecraft.World/TallGrass.cpp @@ -79,17 +79,17 @@ 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) { player->awardStat( - GenericStats::blocksMined(id), + GenericStats::blocksMined(id), GenericStats::param_blocksMined(id,data,1) ); // 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/TallGrass.h b/Minecraft.World/TallGrass.h index 9b4c5515..78019c01 100644 --- a/Minecraft.World/TallGrass.h +++ b/Minecraft.World/TallGrass.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/TamableAnimal.cpp b/Minecraft.World/TamableAnimal.cpp index b065d7bd..abefb097 100644 --- a/Minecraft.World/TamableAnimal.cpp +++ b/Minecraft.World/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/TamableAnimal.h b/Minecraft.World/TamableAnimal.h index 71502788..5b4938cc 100644 --- a/Minecraft.World/TamableAnimal.h +++ b/Minecraft.World/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/TargetGoal.cpp b/Minecraft.World/TargetGoal.cpp index c3ac4f59..28102c60 100644 --- a/Minecraft.World/TargetGoal.cpp +++ b/Minecraft.World/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/TargetGoal.h b/Minecraft.World/TargetGoal.h index 3bb9da09..2e6765fe 100644 --- a/Minecraft.World/TargetGoal.h +++ b/Minecraft.World/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/TeleportEntityPacket.cpp b/Minecraft.World/TeleportEntityPacket.cpp index f0ed1e95..1ca53966 100644 --- a/Minecraft.World/TeleportEntityPacket.cpp +++ b/Minecraft.World/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); @@ -53,7 +53,7 @@ void TeleportEntityPacket::read(DataInputStream *dis) //throws IOException xRot = (byte) dis->read(); } -void TeleportEntityPacket::write(DataOutputStream *dos) //throws IOException +void TeleportEntityPacket::write(DataOutputStream *dos) //throws IOException { dos->writeShort(id); #ifdef _LARGE_WORLDS @@ -69,12 +69,12 @@ void TeleportEntityPacket::write(DataOutputStream *dos) //throws IOException dos->write(xRot); } -void TeleportEntityPacket::handle(PacketListener *listener) +void TeleportEntityPacket::handle(PacketListener *listener) { listener->handleTeleportEntity(shared_from_this()); } -int TeleportEntityPacket::getEstimatedSize() +int TeleportEntityPacket::getEstimatedSize() { return 2 + 2 + 2 + 2 + 1 + 1; } @@ -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/TeleportEntityPacket.h b/Minecraft.World/TeleportEntityPacket.h index 6fc28732..cccc1ce0 100644 --- a/Minecraft.World/TeleportEntityPacket.h +++ b/Minecraft.World/TeleportEntityPacket.h @@ -11,7 +11,7 @@ public: byte yRot, xRot; TeleportEntityPacket(); - TeleportEntityPacket(shared_ptr e); + TeleportEntityPacket(std::shared_ptr e); TeleportEntityPacket(int id, int x, int y, int z, byte yRot, byte 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/TemperatureLayer.cpp b/Minecraft.World/TemperatureLayer.cpp index b4963925..484f9506 100644 --- a/Minecraft.World/TemperatureLayer.cpp +++ b/Minecraft.World/TemperatureLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.biome.h" #include "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/TemperatureLayer.h b/Minecraft.World/TemperatureLayer.h index 34791caa..0da46402 100644 --- a/Minecraft.World/TemperatureLayer.h +++ b/Minecraft.World/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/TemperatureMixerLayer.cpp b/Minecraft.World/TemperatureMixerLayer.cpp index 27fbdf68..38358e92 100644 --- a/Minecraft.World/TemperatureMixerLayer.cpp +++ b/Minecraft.World/TemperatureMixerLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.biome.h" #include "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/TemperatureMixerLayer.h b/Minecraft.World/TemperatureMixerLayer.h index 3b3f56e0..0e7abf93 100644 --- a/Minecraft.World/TemperatureMixerLayer.h +++ b/Minecraft.World/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/TemptGoal.cpp b/Minecraft.World/TemptGoal.cpp index cf0ee3d2..d17c02bc 100644 --- a/Minecraft.World/TemptGoal.cpp +++ b/Minecraft.World/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/TextureAndGeometryChangePacket.cpp b/Minecraft.World/TextureAndGeometryChangePacket.cpp index 04c88bed..d3279ba2 100644 --- a/Minecraft.World/TextureAndGeometryChangePacket.cpp +++ b/Minecraft.World/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; @@ -28,26 +28,26 @@ TextureAndGeometryChangePacket::TextureAndGeometryChangePacket(shared_ptrreadInt(); dwSkinID = dis->readInt(); path = dis->readUTF(); } -void TextureAndGeometryChangePacket::write(DataOutputStream *dos) //throws IOException +void TextureAndGeometryChangePacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(id); dos->writeInt(dwSkinID); dos->writeUTF(path); } -void TextureAndGeometryChangePacket::handle(PacketListener *listener) +void TextureAndGeometryChangePacket::handle(PacketListener *listener) { listener->handleTextureAndGeometryChange(shared_from_this()); } -int TextureAndGeometryChangePacket::getEstimatedSize() +int TextureAndGeometryChangePacket::getEstimatedSize() { return 8 + (int)path.size(); } diff --git a/Minecraft.World/TextureAndGeometryChangePacket.h b/Minecraft.World/TextureAndGeometryChangePacket.h index dabe78fa..e13b547e 100644 --- a/Minecraft.World/TextureAndGeometryChangePacket.h +++ b/Minecraft.World/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/TextureAndGeometryPacket.h b/Minecraft.World/TextureAndGeometryPacket.h index 8577f03d..d2f8def0 100644 --- a/Minecraft.World/TextureAndGeometryPacket.h +++ b/Minecraft.World/TextureAndGeometryPacket.h @@ -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 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); virtual void handle(PacketListener *listener); virtual void read(DataInputStream *dis); @@ -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; } }; \ No newline at end of file diff --git a/Minecraft.World/TextureChangePacket.cpp b/Minecraft.World/TextureChangePacket.cpp index 2368136c..8a5dd9c0 100644 --- a/Minecraft.World/TextureChangePacket.cpp +++ b/Minecraft.World/TextureChangePacket.cpp @@ -14,33 +14,33 @@ 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; this->path = path; } -void TextureChangePacket::read(DataInputStream *dis) //throws IOException +void TextureChangePacket::read(DataInputStream *dis) //throws IOException { id = dis->readInt(); action = (ETextureChangeType)dis->readByte(); path = dis->readUTF(); } -void TextureChangePacket::write(DataOutputStream *dos) //throws IOException +void TextureChangePacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(id); dos->writeByte(action); dos->writeUTF(path); } -void TextureChangePacket::handle(PacketListener *listener) +void TextureChangePacket::handle(PacketListener *listener) { listener->handleTextureChange(shared_from_this()); } -int TextureChangePacket::getEstimatedSize() +int TextureChangePacket::getEstimatedSize() { return 5 + (int)path.size(); } diff --git a/Minecraft.World/TextureChangePacket.h b/Minecraft.World/TextureChangePacket.h index 959fc4fe..7d99b3b3 100644 --- a/Minecraft.World/TextureChangePacket.h +++ b/Minecraft.World/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/TexturePacket.h b/Minecraft.World/TexturePacket.h index c2dce25f..587a094e 100644 --- a/Minecraft.World/TexturePacket.h +++ b/Minecraft.World/TexturePacket.h @@ -11,7 +11,7 @@ public: DWORD dwBytes; TexturePacket(); - ~TexturePacket(); + ~TexturePacket(); TexturePacket(const wstring &textureName, PBYTE pbData, DWORD dwBytes); virtual void handle(PacketListener *listener); @@ -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/TheEndBiomeDecorator.cpp b/Minecraft.World/TheEndBiomeDecorator.cpp index 31823c80..a6360a73 100644 --- a/Minecraft.World/TheEndBiomeDecorator.cpp +++ b/Minecraft.World/TheEndBiomeDecorator.cpp @@ -58,14 +58,14 @@ 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); } // end podium radius is 4, position is 0,0, so chunk needs to be the -16,-16 one since this guarantees that all chunks required for the podium are loaded if (xo == -16 && zo == -16) - { + { endPodiumFeature->place(level, random, 0, Level::genDepth / 2, 0); } } \ No newline at end of file diff --git a/Minecraft.World/TheEndPortal.cpp b/Minecraft.World/TheEndPortal.cpp index 19d95b1f..78e154f4 100644 --- a/Minecraft.World/TheEndPortal.cpp +++ b/Minecraft.World/TheEndPortal.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/TheEndPortal.h b/Minecraft.World/TheEndPortal.h index 31cddb2d..5715fbd4 100644 --- a/Minecraft.World/TheEndPortal.h +++ b/Minecraft.World/TheEndPortal.h @@ -6,19 +6,19 @@ class TheEndPortal : public EntityTile public: static DWORD tlsIdx; // 4J - was just a static but implemented with TLS for our version - static bool allowAnywhere(); - static void allowAnywhere(bool set); + static bool allowAnywhere(); + static void allowAnywhere(bool set); 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/TheEndPortalFrameTile.cpp b/Minecraft.World/TheEndPortalFrameTile.cpp index cab8319f..2bf557f8 100644 --- a/Minecraft.World/TheEndPortalFrameTile.cpp +++ b/Minecraft.World/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/TheEndPortalFrameTile.h b/Minecraft.World/TheEndPortalFrameTile.h index b48d3c09..bedad14d 100644 --- a/Minecraft.World/TheEndPortalFrameTile.h +++ b/Minecraft.World/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/TheEndPortalTileEntity.cpp b/Minecraft.World/TheEndPortalTileEntity.cpp index fa9b3544..2dee6a6a 100644 --- a/Minecraft.World/TheEndPortalTileEntity.cpp +++ b/Minecraft.World/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/TheEndPortalTileEntity.h b/Minecraft.World/TheEndPortalTileEntity.h index 29752d44..0bc0b46c 100644 --- a/Minecraft.World/TheEndPortalTileEntity.h +++ b/Minecraft.World/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/ThinFenceTile.cpp b/Minecraft.World/ThinFenceTile.cpp index bd1f1687..3a102abe 100644 --- a/Minecraft.World/ThinFenceTile.cpp +++ b/Minecraft.World/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/ThinFenceTile.h b/Minecraft.World/ThinFenceTile.h index ca3c501f..ab3829ba 100644 --- a/Minecraft.World/ThinFenceTile.h +++ b/Minecraft.World/ThinFenceTile.h @@ -12,20 +12,20 @@ private: public: ThinFenceTile(int id, const wstring &tex, const wstring &edgeTex, Material *material, bool dropsResources); - virtual int getResource(int data, Random *random, int playerBonusLevel); + virtual int getResource(int data, Random *random, int playerBonusLevel); virtual bool isSolidRender(bool isServerLevel = false); 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/ThornsEnchantment.cpp b/Minecraft.World/ThornsEnchantment.cpp index e2d9f1fa..8fbfab63 100644 --- a/Minecraft.World/ThornsEnchantment.cpp +++ b/Minecraft.World/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/ThornsEnchantment.h b/Minecraft.World/ThornsEnchantment.h index 42f4326b..240888a0 100644 --- a/Minecraft.World/ThornsEnchantment.h +++ b/Minecraft.World/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/Throwable.cpp b/Minecraft.World/Throwable.cpp index 2f9567a1..7c5beb7d 100644 --- a/Minecraft.World/Throwable.cpp +++ b/Minecraft.World/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/Throwable.h b/Minecraft.World/Throwable.h index 4d7daea0..81f4cacc 100644 --- a/Minecraft.World/Throwable.h +++ b/Minecraft.World/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/ThrownEgg.cpp b/Minecraft.World/ThrownEgg.cpp index 45e5ca8c..dbdbf431 100644 --- a/Minecraft.World/ThrownEgg.cpp +++ b/Minecraft.World/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/ThrownEgg.h b/Minecraft.World/ThrownEgg.h index 864755b7..691ad5ae 100644 --- a/Minecraft.World/ThrownEgg.h +++ b/Minecraft.World/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/ThrownEnderpearl.cpp b/Minecraft.World/ThrownEnderpearl.cpp index 1cddfb1f..778a4701 100644 --- a/Minecraft.World/ThrownEnderpearl.cpp +++ b/Minecraft.World/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/ThrownEnderpearl.h b/Minecraft.World/ThrownEnderpearl.h index 6f16ebfc..fc4035f2 100644 --- a/Minecraft.World/ThrownEnderpearl.h +++ b/Minecraft.World/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/ThrownExpBottle.cpp b/Minecraft.World/ThrownExpBottle.cpp index 75d3d9a1..9640895e 100644 --- a/Minecraft.World/ThrownExpBottle.cpp +++ b/Minecraft.World/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/ThrownExpBottle.h b/Minecraft.World/ThrownExpBottle.h index 8430794b..555c51ae 100644 --- a/Minecraft.World/ThrownExpBottle.h +++ b/Minecraft.World/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/ThrownPotion.cpp b/Minecraft.World/ThrownPotion.cpp index 7375d661..09280476 100644 --- a/Minecraft.World/ThrownPotion.cpp +++ b/Minecraft.World/ThrownPotion.cpp @@ -14,7 +14,7 @@ const double ThrownPotion::SPLASH_RANGE = 4.0; const double ThrownPotion::SPLASH_RANGE_SQ = ThrownPotion::SPLASH_RANGE * ThrownPotion::SPLASH_RANGE; void ThrownPotion::_init() -{ +{ // 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 this->defineSynchedData(); @@ -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/ThrownPotion.h b/Minecraft.World/ThrownPotion.h index cf27491c..517b05ef 100644 --- a/Minecraft.World/ThrownPotion.h +++ b/Minecraft.World/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/Tile.cpp b/Minecraft.World/Tile.cpp index 77a62c8d..5862c934 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/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/Tile.h b/Minecraft.World/Tile.h index fb17f917..999f10c9 100644 --- a/Minecraft.World/Tile.h +++ b/Minecraft.World/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, int x, int y, int z); + virtual float getDestroyProgress(std::shared_ptr player, Level *level, int x, int y, int z); 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, float clickX, float clickY, float clickZ, 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, float clickX, float clickY, float clickZ, 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_t delta, int64_t newTime); diff --git a/Minecraft.World/TileDestructionPacket.cpp b/Minecraft.World/TileDestructionPacket.cpp index e009e0e0..98aa4ad5 100644 --- a/Minecraft.World/TileDestructionPacket.cpp +++ b/Minecraft.World/TileDestructionPacket.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.network.packet.h" #include "TileDestructionPacket.h" -TileDestructionPacket::TileDestructionPacket() +TileDestructionPacket::TileDestructionPacket() { id = 0; x = 0; @@ -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/TileDestructionPacket.h b/Minecraft.World/TileDestructionPacket.h index 20cd7db9..394ffaa1 100644 --- a/Minecraft.World/TileDestructionPacket.h +++ b/Minecraft.World/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/TileEntity.cpp b/Minecraft.World/TileEntity.cpp index 0790601d..d4874928 100644 --- a/Minecraft.World/TileEntity.cpp +++ b/Minecraft.World/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/TileEntity.h b/Minecraft.World/TileEntity.h index aa3ced4f..87a3483a 100644 --- a/Minecraft.World/TileEntity.h +++ b/Minecraft.World/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); }; \ No newline at end of file diff --git a/Minecraft.World/TileEntityDataPacket.h b/Minecraft.World/TileEntityDataPacket.h index 2ee998f3..522392ed 100644 --- a/Minecraft.World/TileEntityDataPacket.h +++ b/Minecraft.World/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/TileEventPacket.h b/Minecraft.World/TileEventPacket.h index ca2685fa..b1d60bad 100644 --- a/Minecraft.World/TileEventPacket.h +++ b/Minecraft.World/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/TileItem.cpp b/Minecraft.World/TileItem.cpp index 8f624bff..12ed3257 100644 --- a/Minecraft.World/TileItem.cpp +++ b/Minecraft.World/TileItem.cpp @@ -17,13 +17,13 @@ using namespace std; #include -TileItem::TileItem(int id) : Item(id) +TileItem::TileItem(int id) : Item(id) { this->tileId = id + 256; itemIcon = NULL; } -int TileItem::getTileId() +int TileItem::getTileId() { return tileId; } @@ -46,18 +46,18 @@ 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); - if (currentTile == Tile::topSnow_Id) + if (currentTile == Tile::topSnow_Id) { face = Facing::UP; } else if (currentTile == Tile::vine_Id || currentTile == Tile::tallgrass_Id || currentTile == Tile::deadBush_Id) { } - else + else { if (face == 0) y--; if (face == 1) y++; @@ -75,7 +75,7 @@ bool TileItem::useOn(shared_ptr instance, shared_ptr playe int undertile = level->getTile(x,y-1,z); // For 'BodyGuard' achievement. - if (level->mayPlace(tileId, x, y, z, false, face, player)) + if (level->mayPlace(tileId, x, y, z, false, face, player)) { if(!bTestUseOnOnly) { @@ -83,7 +83,7 @@ bool TileItem::useOn(shared_ptr instance, shared_ptr playe // 4J - Adding this from 1.6 int itemValue = getLevelDataForAuxValue(instance->getAuxValue()); int dataValue = Tile::tiles[tileId]->getPlacedOnFaceDataValue(level, x, y, z, face, clickX, clickY, clickZ, itemValue); - if (level->setTileAndData(x, y, z, tileId, dataValue)) + if (level->setTileAndData(x, y, z, tileId, dataValue)) { // 4J-JEV: Snow/Iron Golems do not have owners apparently. int newTileId = level->getTile(x,y,z); @@ -115,7 +115,7 @@ bool TileItem::useOn(shared_ptr instance, shared_ptr playe Tile::tiles[tileId]->setPlacedBy(level, x, y, z, player); Tile::tiles[tileId]->finalizePlacement(level, x, y, z, dataValue); } - + // 4J-PB - Java 1.4 change - getStepSound replaced with getPlaceSound //level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, tile->soundType->getStepSound(), (tile->soundType->getVolume() + 1) / 2, tile->soundType->getPitch() * 0.8f); #ifdef _DEBUG @@ -125,7 +125,7 @@ bool TileItem::useOn(shared_ptr instance, shared_ptr playe // char szPlaceSoundName[256]; // char szStepSoundName[256]; // Minecraft *pMinecraft = Minecraft::GetInstance(); -// +// // if(iPlaceSound==-1) // { // strcpy(szPlaceSoundName,"NULL"); @@ -162,14 +162,14 @@ 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) + if (currentTile == Tile::topSnow_Id) { face = Facing::UP; - } - else if (currentTile != Tile::vine_Id && currentTile != Tile::tallgrass_Id && currentTile != Tile::deadBush_Id) + } + else if (currentTile != Tile::vine_Id && currentTile != Tile::tallgrass_Id && currentTile != Tile::deadBush_Id) { if (face == 0) y--; if (face == 1) y++; @@ -188,25 +188,25 @@ 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(); } -unsigned int TileItem::getDescriptionId(int iData /*= -1*/) +unsigned int TileItem::getDescriptionId(int iData /*= -1*/) { return Tile::tiles[tileId]->getDescriptionId(iData); } -unsigned int TileItem::getUseDescriptionId(shared_ptr instance) +unsigned int TileItem::getUseDescriptionId(std::shared_ptr instance) { return Tile::tiles[tileId]->getUseDescriptionId(); } -unsigned int TileItem::getUseDescriptionId() +unsigned int TileItem::getUseDescriptionId() { return Tile::tiles[tileId]->getUseDescriptionId(); } diff --git a/Minecraft.World/TileItem.h b/Minecraft.World/TileItem.h index ac341acc..c1492c38 100644 --- a/Minecraft.World/TileItem.h +++ b/Minecraft.World/TileItem.h @@ -11,13 +11,13 @@ class TileItem : public Item public: static const int _class = 0; using Item::getColor; -private: +private: int tileId; Icon *itemIcon; public: - TileItem(int id); - + TileItem(int id); + virtual int getTileId(); //@Override @@ -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/TilePlanterItem.cpp b/Minecraft.World/TilePlanterItem.cpp index 883da76e..3b281ba9 100644 --- a/Minecraft.World/TilePlanterItem.cpp +++ b/Minecraft.World/TilePlanterItem.cpp @@ -15,14 +15,14 @@ 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); - if (currentTile == Tile::topSnow_Id) + if (currentTile == Tile::topSnow_Id) { face = Facing::UP; - } + } else if (currentTile == Tile::vine_Id || currentTile == Tile::tallgrass_Id || currentTile == Tile::deadBush_Id) { } @@ -39,7 +39,7 @@ bool TilePlanterItem::useOn(shared_ptr instance, shared_ptrmayBuild(x, y, z)) return false; if (instance->count == 0) return false; - if (level->mayPlace(tileId, x, y, z, false, face, nullptr)) + if (level->mayPlace(tileId, x, y, z, false, face, nullptr)) { if(!bTestUseOnOnly) { @@ -63,13 +63,13 @@ bool TilePlanterItem::useOn(shared_ptr instance, shared_ptrcount--; } } - } + } } else { diff --git a/Minecraft.World/TilePlanterItem.h b/Minecraft.World/TilePlanterItem.h index d1577cd1..a7cb4386 100644 --- a/Minecraft.World/TilePlanterItem.h +++ b/Minecraft.World/TilePlanterItem.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/TileUpdatePacket.h b/Minecraft.World/TileUpdatePacket.h index fe69c763..4ed1a9c8 100644 --- a/Minecraft.World/TileUpdatePacket.h +++ b/Minecraft.World/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/TimeCommand.cpp b/Minecraft.World/TimeCommand.cpp index e667a420..0c387b79 100644 --- a/Minecraft.World/TimeCommand.cpp +++ b/Minecraft.World/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() )); } \ No newline at end of file diff --git a/Minecraft.World/TimeCommand.h b/Minecraft.World/TimeCommand.h index f87fb27c..da7008b2 100644 --- a/Minecraft.World/TimeCommand.h +++ b/Minecraft.World/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/TntTile.cpp b/Minecraft.World/TntTile.cpp index b422959c..5d47a2ac 100644 --- a/Minecraft.World/TntTile.cpp +++ b/Minecraft.World/TntTile.cpp @@ -53,13 +53,13 @@ void TntTile::wasExploded(Level *level, int x, int y, int z) { // 4J - added - don't every create on the client, I think this must be the cause of a bug reported in the java // version where white tnts are created in the network game - if (level->isClientSide) return; + if (level->isClientSide) return; // 4J - added condition to have finite limit of these // 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,12 +107,12 @@ 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; } -void TntTile::registerIcons(IconRegister *iconRegister) +void TntTile::registerIcons(IconRegister *iconRegister) { icon = iconRegister->registerIcon(L"tnt_side"); iconTop = iconRegister->registerIcon(L"tnt_top"); diff --git a/Minecraft.World/TntTile.h b/Minecraft.World/TntTile.h index 27b788c6..b628e01c 100644 --- a/Minecraft.World/TntTile.h +++ b/Minecraft.World/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/ToggleDownfallCommand.cpp b/Minecraft.World/ToggleDownfallCommand.cpp index 1ae2f3a9..9eebc3f3 100644 --- a/Minecraft.World/ToggleDownfallCommand.cpp +++ b/Minecraft.World/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() )); } \ No newline at end of file diff --git a/Minecraft.World/ToggleDownfallCommand.h b/Minecraft.World/ToggleDownfallCommand.h index 2954962b..a19b7251 100644 --- a/Minecraft.World/ToggleDownfallCommand.h +++ b/Minecraft.World/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/TopSnowTile.cpp b/Minecraft.World/TopSnowTile.cpp index 9bcf5527..c9e92f4a 100644 --- a/Minecraft.World/TopSnowTile.cpp +++ b/Minecraft.World/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/TopSnowTile.h b/Minecraft.World/TopSnowTile.h index 059f0f42..ba4c69a5 100644 --- a/Minecraft.World/TopSnowTile.h +++ b/Minecraft.World/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); @@ -60,7 +60,7 @@ public: public: bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face); - + // 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/TorchTile.cpp b/Minecraft.World/TorchTile.cpp index ea1d2ab7..5cbeeae7 100644 --- a/Minecraft.World/TorchTile.cpp +++ b/Minecraft.World/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)); } @@ -75,7 +75,7 @@ bool TorchTile::isConnection(Level *level, int x, int y, int z) return true; } int tile = level->getTile(x, y, z); - if (tile == Tile::fence_Id || tile == Tile::netherFence_Id + if (tile == Tile::fence_Id || tile == Tile::netherFence_Id || tile == Tile::glass_Id || tile == Tile::cobbleWall_Id) { return true; diff --git a/Minecraft.World/TorchTile.h b/Minecraft.World/TorchTile.h index 7e27f2ee..7b6c8bac 100644 --- a/Minecraft.World/TorchTile.h +++ b/Minecraft.World/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); @@ -30,7 +30,7 @@ private: public: virtual HitResult *clip(Level *level, int x, int y, int z, Vec3 *a, Vec3 *b); virtual void animateTick(Level *level, int xt, int yt, int zt, Random *random); - + // 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/TradeItemPacket.h b/Minecraft.World/TradeItemPacket.h index ecd0f707..c6c8ae28 100644 --- a/Minecraft.World/TradeItemPacket.h +++ b/Minecraft.World/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/TradeWithPlayerGoal.cpp b/Minecraft.World/TradeWithPlayerGoal.cpp index e8b791d1..97d417e5 100644 --- a/Minecraft.World/TradeWithPlayerGoal.cpp +++ b/Minecraft.World/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/TrapDoorTile.cpp b/Minecraft.World/TrapDoorTile.cpp index fc9d6580..b8afca43 100644 --- a/Minecraft.World/TrapDoorTile.cpp +++ b/Minecraft.World/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/TrapDoorTile.h b/Minecraft.World/TrapDoorTile.h index 19cec150..5f6a52e7 100644 --- a/Minecraft.World/TrapDoorTile.h +++ b/Minecraft.World/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/TrapMenu.cpp b/Minecraft.World/TrapMenu.cpp index 5e59c6fe..da43347a 100644 --- a/Minecraft.World/TrapMenu.cpp +++ b/Minecraft.World/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/TrapMenu.h b/Minecraft.World/TrapMenu.h index e3fb4965..6e5cc517 100644 --- a/Minecraft.World/TrapMenu.h +++ b/Minecraft.World/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/TreeTile.cpp b/Minecraft.World/TreeTile.cpp index 29871625..fa734a7c 100644 --- a/Minecraft.World/TreeTile.cpp +++ b/Minecraft.World/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)); @@ -93,7 +93,7 @@ Icon *TreeTile::getTexture(int face, int data) if (dir == FACING_Y && (face == Facing::UP || face == Facing::DOWN)) { return iconTop; - } + } else if (dir == FACING_X && (face == Facing::EAST || face == Facing::WEST)) { return iconTop; @@ -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/TreeTile.h b/Minecraft.World/TreeTile.h index b7e0d56d..5a4f0a29 100644 --- a/Minecraft.World/TreeTile.h +++ b/Minecraft.World/TreeTile.h @@ -6,7 +6,7 @@ class ChunkRebuildData; class Player; class TreeTile : public Tile -{ +{ friend class Tile; friend class ChunkRebuildData; public: @@ -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/TreeTileItem.cpp b/Minecraft.World/TreeTileItem.cpp index 30406821..d260a556 100644 --- a/Minecraft.World/TreeTileItem.cpp +++ b/Minecraft.World/TreeTileItem.cpp @@ -15,12 +15,12 @@ Icon *TreeTileItem::getIcon(int itemAuxValue) return parentTile->getTexture(2, itemAuxValue); } -int TreeTileItem::getLevelDataForAuxValue(int auxValue) +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/TreeTileItem.h b/Minecraft.World/TreeTileItem.h index 7f7b2825..dea75075 100644 --- a/Minecraft.World/TreeTileItem.h +++ b/Minecraft.World/TreeTileItem.h @@ -3,7 +3,7 @@ using namespace std; #include "TileItem.h" -class TreeTileItem : public TileItem +class TreeTileItem : public TileItem { private: Tile *parentTile; @@ -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/TripWireSourceTile.cpp b/Minecraft.World/TripWireSourceTile.cpp index 33f857fa..1b560019 100644 --- a/Minecraft.World/TripWireSourceTile.cpp +++ b/Minecraft.World/TripWireSourceTile.cpp @@ -108,7 +108,7 @@ void TripWireSourceTile::neighborChanged(Level *level, int x, int y, int z, int } } -void TripWireSourceTile::calculateState(Level *level, int x, int y, int z, int id, int data, bool canUpdate, +void TripWireSourceTile::calculateState(Level *level, int x, int y, int z, int id, int data, bool canUpdate, /*4J-Jev, these parameters only used with 'updateSource' -->*/ int wireSource, int wireSourceData) { @@ -116,7 +116,7 @@ void TripWireSourceTile::calculateState(Level *level, int x, int y, int z, int i int dir = data & MASK_DIR; bool wasAttached = (data & MASK_ATTACHED) == MASK_ATTACHED; bool wasPowered = (data & MASK_POWERED) == MASK_POWERED; - bool attached = id == Tile::tripWireSource_Id; // id is only != TripwireSource_id when 'onRemove' + bool attached = id == Tile::tripWireSource_Id; // id is only != TripwireSource_id when 'onRemove' bool powered = false; bool suspended = !level->isTopSolidBlocking(x, y - 1, z); int stepX = Direction::STEP_X[dir]; @@ -208,7 +208,7 @@ void TripWireSourceTile::calculateState(Level *level, int x, int y, int z, int i wireData &= ~TripWireTile::MASK_ATTACHED; } - + level->setData(xx, y, zz, wireData); } } @@ -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/TripWireSourceTile.h b/Minecraft.World/TripWireSourceTile.h index c86e781d..a5a26ad1 100644 --- a/Minecraft.World/TripWireSourceTile.h +++ b/Minecraft.World/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/TripWireTile.cpp b/Minecraft.World/TripWireTile.cpp index 40ad93f8..92560185 100644 --- a/Minecraft.World/TripWireTile.cpp +++ b/Minecraft.World/TripWireTile.cpp @@ -13,7 +13,7 @@ TripWireTile::TripWireTile(int id) : Tile(id, Material::decoration, isSolidRende int TripWireTile::getTickDelay(Level *level) { - // 4J: Increased (x2); quick update caused problems with shared + // 4J: Increased (x2); quick update caused problems with shared // data between client and server. return 20; // 10; } @@ -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; @@ -164,9 +164,9 @@ void TripWireTile::checkPressed(Level *level, int x, int y, int z) int data = level->getData(x, y, z); bool wasPressed = (data & MASK_POWERED) == MASK_POWERED; 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/TripWireTile.h b/Minecraft.World/TripWireTile.h index 7880e664..664541c5 100644 --- a/Minecraft.World/TripWireTile.h +++ b/Minecraft.World/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/UntouchingEnchantment.cpp b/Minecraft.World/UntouchingEnchantment.cpp index 1e5a41b7..b0e2e295 100644 --- a/Minecraft.World/UntouchingEnchantment.cpp +++ b/Minecraft.World/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/UntouchingEnchantment.h b/Minecraft.World/UntouchingEnchantment.h index db827c27..14ce0b49 100644 --- a/Minecraft.World/UntouchingEnchantment.h +++ b/Minecraft.World/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/UpdateGameRuleProgressPacket.h b/Minecraft.World/UpdateGameRuleProgressPacket.h index b3384fa1..65df6dfe 100644 --- a/Minecraft.World/UpdateGameRuleProgressPacket.h +++ b/Minecraft.World/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/UpdateMobEffectPacket.cpp b/Minecraft.World/UpdateMobEffectPacket.cpp index dec8d79f..7274152e 100644 --- a/Minecraft.World/UpdateMobEffectPacket.cpp +++ b/Minecraft.World/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/UpdateMobEffectPacket.h b/Minecraft.World/UpdateMobEffectPacket.h index d17d1be4..a69d32b2 100644 --- a/Minecraft.World/UpdateMobEffectPacket.h +++ b/Minecraft.World/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/UpdateProgressPacket.h b/Minecraft.World/UpdateProgressPacket.h index beca6509..edfaef96 100644 --- a/Minecraft.World/UpdateProgressPacket.h +++ b/Minecraft.World/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/UseItemPacket.cpp b/Minecraft.World/UseItemPacket.cpp index d9699130..87180610 100644 --- a/Minecraft.World/UseItemPacket.cpp +++ b/Minecraft.World/UseItemPacket.cpp @@ -7,11 +7,11 @@ const float UseItemPacket::CLICK_ACCURACY = 16.0f; -UseItemPacket::~UseItemPacket() +UseItemPacket::~UseItemPacket() { } -UseItemPacket::UseItemPacket() +UseItemPacket::UseItemPacket() { x = 0; y = 0; @@ -23,20 +23,20 @@ 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; } -void UseItemPacket::read(DataInputStream *dis) //throws IOException +void UseItemPacket::read(DataInputStream *dis) //throws IOException { x = dis->readInt(); y = dis->read(); @@ -48,7 +48,7 @@ void UseItemPacket::read(DataInputStream *dis) //throws IOException clickZ = dis->read() / CLICK_ACCURACY; } -void UseItemPacket::write(DataOutputStream *dos) //throws IOException +void UseItemPacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(x); dos->write(y); @@ -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/UseItemPacket.h b/Minecraft.World/UseItemPacket.h index 44e20457..2619ce94 100644 --- a/Minecraft.World/UseItemPacket.h +++ b/Minecraft.World/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/Village.cpp b/Minecraft.World/Village.cpp index aef38066..51e89c25 100644 --- a/Minecraft.World/Village.cpp +++ b/Minecraft.World/Village.cpp @@ -8,7 +8,7 @@ #include "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/Village.h b/Minecraft.World/Village.h index 07858ef9..27839d4e 100644 --- a/Minecraft.World/Village.h +++ b/Minecraft.World/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/VillagePieces.cpp b/Minecraft.World/VillagePieces.cpp index 27b21aa5..e535675d 100644 --- a/Minecraft.World/VillagePieces.cpp +++ b/Minecraft.World/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); } @@ -620,14 +620,14 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, listx1 + 1, boundingBox->y0, boundingBox->z0, Direction::EAST, getGenDepth()); - break; - case Direction::SOUTH: + break; + case Direction::SOUTH: generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x1 + 1, boundingBox->y0, boundingBox->z1 - 2, Direction::EAST, getGenDepth()); - break; - case Direction::EAST: + break; + case Direction::EAST: generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x1 - 2, boundingBox->y0, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); - break; - case Direction::WEST: + break; + case Direction::WEST: generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x0, boundingBox->y0, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); break; } @@ -914,7 +914,7 @@ bool VillagePieces::SmallTemple::postProcess(Level *level, Random *random, Bound } - for (int z = 0; z < depth; z++) + for (int z = 0; z < depth; z++) { for (int x = 0; x < width; x++) { diff --git a/Minecraft.World/VillageSiege.cpp b/Minecraft.World/VillageSiege.cpp index 55b2a3e8..afd378fc 100644 --- a/Minecraft.World/VillageSiege.cpp +++ b/Minecraft.World/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/Villager.cpp b/Minecraft.World/Villager.cpp index 328c0c70..4618e4be 100644 --- a/Minecraft.World/Villager.cpp +++ b/Minecraft.World/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)); } @@ -705,7 +705,7 @@ void Villager::handleEntityEvent(byte id) { if (id == EntityEvent::LOVE_HEARTS) { - addParticlesAroundSelf(eParticleType_heart); + addParticlesAroundSelf(eParticleType_heart); } else if (id == EntityEvent::VILLAGER_ANGRY) { @@ -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/Villager.h b/Minecraft.World/Villager.h index b6ad7d1c..98bfa692 100644 --- a/Minecraft.World/Villager.h +++ b/Minecraft.World/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(byte 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/VillagerGolem.cpp b/Minecraft.World/VillagerGolem.cpp index a0f05472..3856aff6 100644 --- a/Minecraft.World/VillagerGolem.cpp +++ b/Minecraft.World/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(byte id) else Golem::handleEntityEvent(id); } -shared_ptr VillagerGolem::getVillage() +std::shared_ptr VillagerGolem::getVillage() { return village.lock(); } diff --git a/Minecraft.World/VillagerGolem.h b/Minecraft.World/VillagerGolem.h index dfcd3ac0..c5e4b4e8 100644 --- a/Minecraft.World/VillagerGolem.h +++ b/Minecraft.World/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(byte id); - virtual shared_ptr getVillage(); + virtual std::shared_ptr getVillage(); virtual int getAttackAnimationTick(); virtual void offerFlower(bool offer); diff --git a/Minecraft.World/Villages.cpp b/Minecraft.World/Villages.cpp index 995befe8..826e9bbe 100644 --- a/Minecraft.World/Villages.cpp +++ b/Minecraft.World/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/Villages.h b/Minecraft.World/Villages.h index 030edc33..e6715372 100644 --- a/Minecraft.World/Villages.h +++ b/Minecraft.World/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/Minecraft.World/VineTile.cpp b/Minecraft.World/VineTile.cpp index 1170caf2..a5e4ad7e 100644 --- a/Minecraft.World/VineTile.cpp +++ b/Minecraft.World/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/VineTile.h b/Minecraft.World/VineTile.h index bdea2cdc..c4e891d0 100644 --- a/Minecraft.World/VineTile.h +++ b/Minecraft.World/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/VoronoiZoom.cpp b/Minecraft.World/VoronoiZoom.cpp index f62cc9b6..58f27d53 100644 --- a/Minecraft.World/VoronoiZoom.cpp +++ b/Minecraft.World/VoronoiZoom.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.newbiome.layer.h" #include "System.h" -VoronoiZoom::VoronoiZoom(int64_t seedMixup, shared_ptrparent) : Layer(seedMixup) +VoronoiZoom::VoronoiZoom(int64_t seedMixup, std::shared_ptrparent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/VoronoiZoom.h b/Minecraft.World/VoronoiZoom.h index 43a8de66..131388d1 100644 --- a/Minecraft.World/VoronoiZoom.h +++ b/Minecraft.World/VoronoiZoom.h @@ -5,7 +5,7 @@ class VoronoiZoom : public Layer { public: - VoronoiZoom(int64_t seedMixup, shared_ptrparent); + VoronoiZoom(int64_t seedMixup, std::shared_ptrparent); virtual intArray getArea(int xo, int yo, int w, int h); diff --git a/Minecraft.World/WallTile.cpp b/Minecraft.World/WallTile.cpp index 6275eef7..4e92b923 100644 --- a/Minecraft.World/WallTile.cpp +++ b/Minecraft.World/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); @@ -131,7 +131,7 @@ AABB *WallTile::getAABB(Level *level, int x, int y, int z) /* 4J-JEV: Stopping the width changing here, it's causing cows/mobs/passers-by to 'jump' up when they are pressed against the - wall and then the wall section is upgraded to a wall post expanding the bounding box. + wall and then the wall section is upgraded to a wall post expanding the bounding box. It's only a 1/16 of a block difference, it shouldn't matter if we leave it a little larger. */ if (n && s && !w && !e) diff --git a/Minecraft.World/WallTile.h b/Minecraft.World/WallTile.h index a9a383d1..e693f9a4 100644 --- a/Minecraft.World/WallTile.h +++ b/Minecraft.World/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/WaterAnimal.cpp b/Minecraft.World/WaterAnimal.cpp index 0a7313d1..654f930b 100644 --- a/Minecraft.World/WaterAnimal.cpp +++ b/Minecraft.World/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/WaterAnimal.h b/Minecraft.World/WaterAnimal.h index 23b984f5..db7272bb 100644 --- a/Minecraft.World/WaterAnimal.h +++ b/Minecraft.World/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/WaterLevelChunk.cpp b/Minecraft.World/WaterLevelChunk.cpp index 19f3e8a1..ba1414c9 100644 --- a/Minecraft.World/WaterLevelChunk.cpp +++ b/Minecraft.World/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/WaterLevelChunk.h b/Minecraft.World/WaterLevelChunk.h index 43e7e0c6..5014d8b3 100644 --- a/Minecraft.World/WaterLevelChunk.h +++ b/Minecraft.World/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/WaterLilyTile.cpp b/Minecraft.World/WaterLilyTile.cpp index 91203922..936005dd 100644 --- a/Minecraft.World/WaterLilyTile.cpp +++ b/Minecraft.World/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/WaterLilyTile.h b/Minecraft.World/WaterLilyTile.h index af07269c..213af5c5 100644 --- a/Minecraft.World/WaterLilyTile.h +++ b/Minecraft.World/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/WaterLilyTileItem.cpp b/Minecraft.World/WaterLilyTileItem.cpp index 13814e5c..de125008 100644 --- a/Minecraft.World/WaterLilyTileItem.cpp +++ b/Minecraft.World/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/WaterLilyTileItem.h b/Minecraft.World/WaterLilyTileItem.h index c0c5db99..3fc23314 100644 --- a/Minecraft.World/WaterLilyTileItem.h +++ b/Minecraft.World/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/WeaponItem.cpp b/Minecraft.World/WeaponItem.cpp index 82b16bde..0dd58d83 100644 --- a/Minecraft.World/WeaponItem.cpp +++ b/Minecraft.World/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/WeaponItem.h b/Minecraft.World/WeaponItem.h index 2150f6e9..162866d6 100644 --- a/Minecraft.World/WeaponItem.h +++ b/Minecraft.World/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/WebTile.cpp b/Minecraft.World/WebTile.cpp index a724c36d..0642bb57 100644 --- a/Minecraft.World/WebTile.cpp +++ b/Minecraft.World/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/WebTile.h b/Minecraft.World/WebTile.h index ca1f4dae..54661717 100644 --- a/Minecraft.World/WebTile.h +++ b/Minecraft.World/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/WeighedTreasure.cpp b/Minecraft.World/WeighedTreasure.cpp index d7044644..540727e3 100644 --- a/Minecraft.World/WeighedTreasure.cpp +++ b/Minecraft.World/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/WeighedTreasure.h b/Minecraft.World/WeighedTreasure.h index a37bc6ae..7b0ecd4c 100644 --- a/Minecraft.World/WeighedTreasure.h +++ b/Minecraft.World/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/Wolf.cpp b/Minecraft.World/Wolf.cpp index 8ffc45c6..2e98e7cc 100644 --- a/Minecraft.World/Wolf.cpp +++ b/Minecraft.World/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 ) @@ -87,7 +87,7 @@ int Wolf::getMaxHealth() return START_HEALTH; } -void Wolf::defineSynchedData() +void Wolf::defineSynchedData() { TamableAnimal::defineSynchedData(); entityData->define(DATA_HEALTH_ID, getHealth()); @@ -95,25 +95,25 @@ void Wolf::defineSynchedData() entityData->define(DATA_COLLAR_COLOR, (byte) ClothTile::getTileDataForItemAuxValue(DyePowderItem::RED)); } -bool Wolf::makeStepSound() +bool Wolf::makeStepSound() { return false; } -int Wolf::getTexture() +int Wolf::getTexture() { - if (isTame()) + if (isTame()) { return TN_MOB_WOLF_TAME; // 4J was L"/mob/wolf_tame.png"; } - if (isAngry()) + if (isAngry()) { return TN_MOB_WOLF_ANGRY; // 4J was L"/mob/wolf_angry.png"; } return TamableAnimal::getTexture(); } -void Wolf::addAdditonalSaveData(CompoundTag *tag) +void Wolf::addAdditonalSaveData(CompoundTag *tag) { TamableAnimal::addAdditonalSaveData(tag); @@ -121,7 +121,7 @@ void Wolf::addAdditonalSaveData(CompoundTag *tag) tag->putByte(L"CollarColor", (byte) getCollarColor()); } -void Wolf::readAdditionalSaveData(CompoundTag *tag) +void Wolf::readAdditionalSaveData(CompoundTag *tag) { TamableAnimal::readAdditionalSaveData(tag); @@ -129,20 +129,20 @@ void Wolf::readAdditionalSaveData(CompoundTag *tag) if (tag->contains(L"CollarColor")) setCollarColor(tag->getByte(L"CollarColor")); } -bool Wolf::removeWhenFarAway() +bool Wolf::removeWhenFarAway() { return !isTame(); } -int Wolf::getAmbientSound() +int Wolf::getAmbientSound() { - if (isAngry()) + if (isAngry()) { return eSoundType_MOB_WOLF_GROWL; } - if (random->nextInt(3) == 0) + if (random->nextInt(3) == 0) { - if (isTame() && entityData->getInteger(DATA_HEALTH_ID) < 10) + if (isTame() && entityData->getInteger(DATA_HEALTH_ID) < 10) { return eSoundType_MOB_WOLF_WHINE; } @@ -151,31 +151,31 @@ int Wolf::getAmbientSound() return eSoundType_MOB_WOLF_BARK; } -int Wolf::getHurtSound() +int Wolf::getHurtSound() { return eSoundType_MOB_WOLF_HURT; } -int Wolf::getDeathSound() +int Wolf::getDeathSound() { return eSoundType_MOB_WOLF_DEATH; } -float Wolf::getSoundVolume() +float Wolf::getSoundVolume() { return 0.4f; } -int Wolf::getDeathLoot() +int Wolf::getDeathLoot() { return -1; } -void Wolf::aiStep() +void Wolf::aiStep() { TamableAnimal::aiStep(); - if (!level->isClientSide && m_isWet && !isShaking && !isPathFinding() && onGround) + if (!level->isClientSide && m_isWet && !isShaking && !isPathFinding() && onGround) { isShaking = true; shakeAnim = 0; @@ -185,37 +185,37 @@ void Wolf::aiStep() } } -void Wolf::tick() +void Wolf::tick() { TamableAnimal::tick(); interestedAngleO = interestedAngle; - if (isInterested()) + if (isInterested()) { interestedAngle = interestedAngle + (1 - interestedAngle) * 0.4f; - } - else + } + else { interestedAngle = interestedAngle + (0 - interestedAngle) * 0.4f; } - if (isInterested()) + if (isInterested()) { lookTime = 10; } - if (isInWaterOrRain()) + if (isInWaterOrRain()) { m_isWet = true; isShaking = false; shakeAnim = 0; shakeAnimO = 0; - } - else if (m_isWet || isShaking) + } + else if (m_isWet || isShaking) { - if (isShaking) + if (isShaking) { - if (shakeAnim == 0) + if (shakeAnim == 0) { level->playSound(shared_from_this(), eSoundType_MOB_WOLF_SHAKE, getSoundVolume(), (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f); } @@ -223,7 +223,7 @@ void Wolf::tick() shakeAnimO = shakeAnim; shakeAnim += 0.05f; - if (shakeAnimO >= 2) + if (shakeAnimO >= 2) { m_isWet = false; isShaking = false; @@ -231,11 +231,11 @@ void Wolf::tick() shakeAnim = 0; } - if (shakeAnim > 0.4f) + if (shakeAnim > 0.4f) { float yt = (float) bb->y0; int shakeCount = (int) (Mth::sin((shakeAnim - 0.4f) * PI) * 7.0f); - for (int i = 0; i < shakeCount; i++) + for (int i = 0; i < shakeCount; i++) { float xo = (random->nextFloat() * 2 - 1) * bbWidth * 0.5f; float zo = (random->nextFloat() * 2 - 1) * bbWidth * 0.5f; @@ -246,55 +246,55 @@ void Wolf::tick() } } -bool Wolf::isWet() +bool Wolf::isWet() { return m_isWet; } -float Wolf::getWetShade(float a) +float Wolf::getWetShade(float a) { return 0.75f + ((shakeAnimO + (shakeAnim - shakeAnimO) * a) / 2.0f) * 0.25f; } -float Wolf::getBodyRollAngle(float a, float offset) +float Wolf::getBodyRollAngle(float a, float offset) { float progress = ((shakeAnimO + (shakeAnim - shakeAnimO) * a) + offset) / 1.8f; - if (progress < 0) + if (progress < 0) { progress = 0; - } - else if (progress > 1) + } + else if (progress > 1) { progress = 1; } return Mth::sin(progress * PI) * Mth::sin(progress * PI * 11.0f) * 0.15f * PI; } -float Wolf::getHeadRollAngle(float a) +float Wolf::getHeadRollAngle(float a) { return (interestedAngleO + (interestedAngle - interestedAngleO) * a) * 0.15f * PI; } -float Wolf::getHeadHeight() +float Wolf::getHeadHeight() { return bbHeight * 0.8f; } -int Wolf::getMaxHeadXRot() +int Wolf::getMaxHeadXRot() { - if (isSitting()) + if (isSitting()) { return 20; } return TamableAnimal::getMaxHeadXRot(); } -bool Wolf::hurt(DamageSource *source, int dmg) +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)) + if (sourceEntity != NULL && !(dynamic_pointer_cast(sourceEntity) != NULL || dynamic_pointer_cast(sourceEntity) != NULL)) { // take half damage from non-players and arrows dmg = (dmg + 1) / 2; @@ -302,13 +302,13 @@ 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); } -void Wolf::tame(const wstring &wsOwnerUUID, bool bDisplayTamingParticles, bool bSetSitting) +void Wolf::tame(const wstring &wsOwnerUUID, bool bDisplayTamingParticles, bool bSetSitting) { setTame(true); setPath(NULL); @@ -322,11 +322,11 @@ 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()) + if (isTame()) { if (item != NULL) { @@ -343,7 +343,7 @@ bool Wolf::interact(shared_ptr player) if (player->abilities.instabuild==false) { item->count--; - if (item->count <= 0) + if (item->count <= 0) { player->inventory->setItem(player->inventory->selected, nullptr); } @@ -351,7 +351,7 @@ bool Wolf::interact(shared_ptr player) return true; } else return TamableAnimal::interact(player); - } + } } else if (item->id == Item::dye_powder_Id) { @@ -381,7 +381,7 @@ bool Wolf::interact(shared_ptr player) } else { - if (item != NULL && item->id == Item::bone->id && !isAngry()) + if (item != NULL && item->id == Item::bone->id && !isAngry()) { // 4J-PB - don't lose the bone in creative mode if (player->abilities.instabuild==false) @@ -393,9 +393,9 @@ bool Wolf::interact(shared_ptr player) } } - if (!level->isClientSide) + if (!level->isClientSide) { - if (random->nextInt(3) == 0) + if (random->nextInt(3) == 0) { // 4J : WESTY: Added for new acheivements. player->awardStat(GenericStats::tamedEntity(eTYPE_WOLF),GenericStats::param_tamedEntity(eTYPE_WOLF)); @@ -404,8 +404,8 @@ bool Wolf::interact(shared_ptr player) tame(player->getUUID(),true,true); level->broadcastEntityEvent(shared_from_this(), EntityEvent::TAMING_SUCCEEDED); - } - else + } + else { spawnTamingParticles(false); level->broadcastEntityEvent(shared_from_this(), EntityEvent::TAMING_FAILED); @@ -424,15 +424,15 @@ bool Wolf::interact(shared_ptr player) return TamableAnimal::interact(player); } -void Wolf::handleEntityEvent(byte id) +void Wolf::handleEntityEvent(byte id) { if (id == EntityEvent::SHAKE_WETNESS) { isShaking = true; shakeAnim = 0; shakeAnimO = 0; - } - else + } + else { TamableAnimal::handleEntityEvent(id); } @@ -440,18 +440,18 @@ void Wolf::handleEntityEvent(byte id) float Wolf::getTailAngle() { - if (isAngry()) + if (isAngry()) { return 0.49f * PI; - } - else if (isTame()) + } + else if (isTame()) { return (0.55f - (MAX_HEALTH - entityData->getInteger(DATA_HEALTH_ID)) * 0.02f) * PI; } 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; @@ -464,18 +464,18 @@ int Wolf::getMaxSpawnClusterSize() return 4; } -bool Wolf::isAngry() +bool Wolf::isAngry() { return (entityData->getByte(DATA_FLAGS_ID) & 0x02) != 0; } -void Wolf::setAngry(bool value) +void Wolf::setAngry(bool value) { byte current = entityData->getByte(DATA_FLAGS_ID); - if (value) + if (value) { entityData->set(DATA_FLAGS_ID, (byte) (current | 0x02)); - } + } else { entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x02)); @@ -493,17 +493,17 @@ void Wolf::setCollarColor(int color) } // 4J-PB added for tooltips -int Wolf::GetSynchedHealth() +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/Wolf.h b/Minecraft.World/Wolf.h index 52f2a23b..8667a0f5 100644 --- a/Minecraft.World/Wolf.h +++ b/Minecraft.World/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(byte 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/WoodSlabTile.cpp b/Minecraft.World/WoodSlabTile.cpp index ba3a98e5..92244069 100644 --- a/Minecraft.World/WoodSlabTile.cpp +++ b/Minecraft.World/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/WoodSlabTile.h b/Minecraft.World/WoodSlabTile.h index b91f7136..bf78d2a9 100644 --- a/Minecraft.World/WoodSlabTile.h +++ b/Minecraft.World/WoodSlabTile.h @@ -6,7 +6,7 @@ class Player; class WoodSlabTile : HalfSlabTile -{ +{ friend class Tile; public: @@ -18,11 +18,11 @@ public: WoodSlabTile(int id, bool fullSize); virtual Icon *getTexture(int face, int data); virtual int getResource(int data, Random *random, int playerBonusLevel); - virtual int getAuxName(int auxValue); + virtual int getAuxName(int auxValue); - virtual shared_ptr getSilkTouchItemInstance(int data); + virtual std::shared_ptr getSilkTouchItemInstance(int data); void registerIcons(IconRegister *iconRegister); - + // 4J added virtual unsigned int getDescriptionId(int iData = -1); }; \ No newline at end of file diff --git a/Minecraft.World/WoolCarpetTile.cpp b/Minecraft.World/WoolCarpetTile.cpp index 16a3d0aa..b1534219 100644 --- a/Minecraft.World/WoolCarpetTile.cpp +++ b/Minecraft.World/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/WoolCarpetTile.h b/Minecraft.World/WoolCarpetTile.h index af0cd28a..ef84514c 100644 --- a/Minecraft.World/WoolCarpetTile.h +++ b/Minecraft.World/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/WorkbenchTile.cpp b/Minecraft.World/WorkbenchTile.cpp index 7af19755..108ec546 100644 --- a/Minecraft.World/WorkbenchTile.cpp +++ b/Minecraft.World/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/WorkbenchTile.h b/Minecraft.World/WorkbenchTile.h index 1e7fd4ec..bbbdcb85 100644 --- a/Minecraft.World/WorkbenchTile.h +++ b/Minecraft.World/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/XZPacket.h b/Minecraft.World/XZPacket.h index 0c4115e0..4154084f 100644 --- a/Minecraft.World/XZPacket.h +++ b/Minecraft.World/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/Zombie.cpp b/Minecraft.World/Zombie.cpp index b167635f..ba6d30a5 100644 --- a/Minecraft.World/Zombie.cpp +++ b/Minecraft.World/Zombie.cpp @@ -29,7 +29,7 @@ Zombie::Zombie(Level *level) : Monster( level ) attackDamage = 4; villagerConversionTime = 0; - + registeredBBWidth = -1; registeredBBHeight = 0; @@ -153,7 +153,7 @@ int Zombie::getHurtSound() int Zombie::getDeathSound() { return eSoundType_MOB_ZOMBIE_DEATH; -} +} int Zombie::getDeathLoot() { @@ -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/Zombie.h b/Minecraft.World/Zombie.h index 237db15b..ffb48e5d 100644 --- a/Minecraft.World/Zombie.h +++ b/Minecraft.World/Zombie.h @@ -48,7 +48,7 @@ public: void setVillager(bool villager); virtual void aiStep(); virtual void tick(); - + protected: virtual int getAmbientSound(); virtual int getHurtSound(); @@ -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/ZonedChunkStorage.cpp b/Minecraft.World/ZonedChunkStorage.cpp index aed408c6..0e3851c6 100644 --- a/Minecraft.World/ZonedChunkStorage.cpp +++ b/Minecraft.World/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/ZoomLayer.cpp b/Minecraft.World/ZoomLayer.cpp index c2123785..cc6a6f1d 100644 --- a/Minecraft.World/ZoomLayer.cpp +++ b/Minecraft.World/ZoomLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.newbiome.layer.h" #include "System.h" -ZoomLayer::ZoomLayer(int64_t seedMixup, shared_ptrparent) : Layer(seedMixup) +ZoomLayer::ZoomLayer(int64_t 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_t seed, shared_ptr sup, int count) +std::shared_ptrZoomLayer::zoom(int64_t 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/ZoomLayer.h b/Minecraft.World/ZoomLayer.h index 8ec93c8a..76d41a4e 100644 --- a/Minecraft.World/ZoomLayer.h +++ b/Minecraft.World/ZoomLayer.h @@ -5,7 +5,7 @@ class ZoomLayer : public Layer { public: - ZoomLayer(int64_t seedMixup, shared_ptr parent); + ZoomLayer(int64_t 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_t seed, shared_ptrsup, int count); + static std::shared_ptr zoom(int64_t seed, std::shared_ptrsup, int count); }; \ No newline at end of file diff --git a/Minecraft.World/net.minecraft.world.ContainerListener.h b/Minecraft.World/net.minecraft.world.ContainerListener.h index 1ac036a5..8ef4d63a 100644 --- a/Minecraft.World/net.minecraft.world.ContainerListener.h +++ b/Minecraft.World/net.minecraft.world.ContainerListener.h @@ -3,7 +3,7 @@ class SimpleContainer; // TODO 4J Stu -// There are 2 classes called ContainerListener. One in net.minecraft.world.inventory and +// There are 2 classes called ContainerListener. One in net.minecraft.world.inventory and // another one in net.minecraft.world . To avoid clashes I have renamed both and put them in a namespace // to avoid confusion. @@ -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/net.minecraft.world.inventory.ContainerListener.h b/Minecraft.World/net.minecraft.world.inventory.ContainerListener.h index ff9dfa2e..979311a3 100644 --- a/Minecraft.World/net.minecraft.world.inventory.ContainerListener.h +++ b/Minecraft.World/net.minecraft.world.inventory.ContainerListener.h @@ -3,7 +3,7 @@ using namespace std; class AbstractContainerMenu; // 4J Stu -// There are 2 classes called ContainerListener. Once here in net.minecraft.world.inventory and +// There are 2 classes called ContainerListener. Once here in net.minecraft.world.inventory and // another once in net.minecraft.world . To avoid clashes I have renamed both and put them in a namespace // to avoid confusion. @@ -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; }; -- cgit v1.2.3