diff options
| author | void_17 <heroerror3@gmail.com> | 2026-03-02 15:58:20 +0700 |
|---|---|---|
| committer | void_17 <heroerror3@gmail.com> | 2026-03-02 15:58:20 +0700 |
| commit | 7074f35e4ba831e358117842b99ee35b87f85ae5 (patch) | |
| tree | 7d440d23473196af3056bf2ff4c59d9e740a06f5 /Minecraft.World/ResultSlot.cpp | |
| parent | d63f79325f85e014361eb8cf1e41eaebedb1ae71 (diff) | |
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.
Diffstat (limited to 'Minecraft.World/ResultSlot.cpp')
| -rw-r--r-- | Minecraft.World/ResultSlot.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
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<Container> craftSlots, shared_ptr<Container> container, int id, int x, int y) : Slot( container, id, x, y ) +ResultSlot::ResultSlot(Player *player, std::shared_ptr<Container> craftSlots, std::shared_ptr<Container> 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<ItemInstance> item) +bool ResultSlot::mayPlace(std::shared_ptr<ItemInstance> item) { return false; } -shared_ptr<ItemInstance> ResultSlot::remove(int c) +std::shared_ptr<ItemInstance> ResultSlot::remove(int c) { if (hasItem()) { @@ -27,13 +27,13 @@ shared_ptr<ItemInstance> ResultSlot::remove(int c) return Slot::remove(c); } -void ResultSlot::onQuickCraft(shared_ptr<ItemInstance> picked, int count) +void ResultSlot::onQuickCraft(std::shared_ptr<ItemInstance> picked, int count) { removeCount += count; checkTakeAchievements(picked); } -void ResultSlot::checkTakeAchievements(shared_ptr<ItemInstance> carried) +void ResultSlot::checkTakeAchievements(std::shared_ptr<ItemInstance> carried) { carried->onCraftedBy(player->level, dynamic_pointer_cast<Player>( player->shared_from_this() ), removeCount); removeCount = 0; @@ -49,17 +49,17 @@ void ResultSlot::checkTakeAchievements(shared_ptr<ItemInstance> 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> player, shared_ptr<ItemInstance> carried) +void ResultSlot::onTake(std::shared_ptr<Player> player, std::shared_ptr<ItemInstance> carried) { checkTakeAchievements(carried); for (unsigned int i = 0; i < craftSlots->getContainerSize(); i++) { - shared_ptr<ItemInstance> item = craftSlots->getItem(i); + std::shared_ptr<ItemInstance> item = craftSlots->getItem(i); if (item != NULL) { craftSlots->removeItem(i, 1); @@ -68,7 +68,7 @@ void ResultSlot::onTake(shared_ptr<Player> player, shared_ptr<ItemInstance> carr { // (TheApathetic) - shared_ptr<ItemInstance> craftResult = shared_ptr<ItemInstance>(new ItemInstance(item->getItem()->getCraftingRemainingItem())); + std::shared_ptr<ItemInstance> craftResult = std::shared_ptr<ItemInstance>(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> player, shared_ptr<ItemInstance> carr } } -bool ResultSlot::mayCombine(shared_ptr<ItemInstance> second) +bool ResultSlot::mayCombine(std::shared_ptr<ItemInstance> second) { return false; } |
