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/ItemInstance.h | 54 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'Minecraft.World/ItemInstance.h') 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); -- cgit v1.2.3