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/CraftingMenu.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/CraftingMenu.cpp')
| -rw-r--r-- | Minecraft.World/CraftingMenu.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
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> inventory, Level *level, int xt, int yt, int zt) : AbstractContainerMenu() +CraftingMenu::CraftingMenu(std::shared_ptr<Inventory> inventory, Level *level, int xt, int yt, int zt) : AbstractContainerMenu() { - craftSlots = shared_ptr<CraftingContainer>( new CraftingContainer(this, 3, 3) ); - resultSlots = shared_ptr<ResultContainer>( new ResultContainer() ); + craftSlots = std::shared_ptr<CraftingContainer>( new CraftingContainer(this, 3, 3) ); + resultSlots = std::shared_ptr<ResultContainer>( new ResultContainer() ); this->level = level; this->x = xt; @@ -51,19 +51,19 @@ CraftingMenu::CraftingMenu(shared_ptr<Inventory> inventory, Level *level, int xt slotsChanged(); // 4J - removed craftSlots parameter, see comment below } -void CraftingMenu::slotsChanged() // 4J used to take a shared_ptr<Container> but wasn't using it, so removed to simplify things +void CraftingMenu::slotsChanged() // 4J used to take a std::shared_ptr<Container> but wasn't using it, so removed to simplify things { resultSlots->setItem(0, Recipes::getInstance()->getItemFor(craftSlots, level)); } -void CraftingMenu::removed(shared_ptr<Player> player) +void CraftingMenu::removed(std::shared_ptr<Player> player) { AbstractContainerMenu::removed(player); if (level->isClientSide) return; for (int i = 0; i < 9; i++) { - shared_ptr<ItemInstance> item = craftSlots->removeItemNoUpdate(i); + std::shared_ptr<ItemInstance> item = craftSlots->removeItemNoUpdate(i); if (item != NULL) { player->drop(item); @@ -71,20 +71,20 @@ void CraftingMenu::removed(shared_ptr<Player> player) } } -bool CraftingMenu::stillValid(shared_ptr<Player> player) +bool CraftingMenu::stillValid(std::shared_ptr<Player> 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<ItemInstance> CraftingMenu::quickMoveStack(shared_ptr<Player> player, int slotIndex) +std::shared_ptr<ItemInstance> CraftingMenu::quickMoveStack(std::shared_ptr<Player> player, int slotIndex) { - shared_ptr<ItemInstance> clicked = nullptr; + std::shared_ptr<ItemInstance> clicked = nullptr; Slot *slot = slots->at(slotIndex); if (slot != NULL && slot->hasItem()) { - shared_ptr<ItemInstance> stack = slot->getItem(); + std::shared_ptr<ItemInstance> stack = slot->getItem(); clicked = stack->copy(); if (slotIndex == RESULT_SLOT) |
