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/MerchantResultSlot.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'Minecraft.World/MerchantResultSlot.cpp') 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) { -- cgit v1.2.3