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/EnchantmentMenu.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/EnchantmentMenu.cpp')
| -rw-r--r-- | Minecraft.World/EnchantmentMenu.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
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> inventory, Level *level, int xt, int yt, int zt) +EnchantmentMenu::EnchantmentMenu(std::shared_ptr<Inventory> inventory, Level *level, int xt, int yt, int zt) { - enchantSlots = shared_ptr<EnchantmentContainer>( new EnchantmentContainer(this) ); + enchantSlots = std::shared_ptr<EnchantmentContainer>( 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> container but wasn't using it, so removed to simplify things +void EnchantmentMenu::slotsChanged() // 4J used to take a std::shared_ptr<Container> container but wasn't using it, so removed to simplify things { - shared_ptr<ItemInstance> item = enchantSlots->getItem(0); + std::shared_ptr<ItemInstance> item = enchantSlots->getItem(0); if (item == NULL || !item->isEnchantable()) { @@ -150,9 +150,9 @@ void EnchantmentMenu::slotsChanged() // 4J used to take a shared_ptr<Container> } } -bool EnchantmentMenu::clickMenuButton(shared_ptr<Player> player, int i) +bool EnchantmentMenu::clickMenuButton(std::shared_ptr<Player> player, int i) { - shared_ptr<ItemInstance> item = enchantSlots->getItem(0); + std::shared_ptr<ItemInstance> 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> player, int i) } -void EnchantmentMenu::removed(shared_ptr<Player> player) +void EnchantmentMenu::removed(std::shared_ptr<Player> player) { AbstractContainerMenu::removed(player); if (level->isClientSide) return; - shared_ptr<ItemInstance> item = enchantSlots->removeItemNoUpdate(0); + std::shared_ptr<ItemInstance> item = enchantSlots->removeItemNoUpdate(0); if (item != NULL) { player->drop(item); } } -bool EnchantmentMenu::stillValid(shared_ptr<Player> player) +bool EnchantmentMenu::stillValid(std::shared_ptr<Player> 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<ItemInstance> EnchantmentMenu::quickMoveStack(shared_ptr<Player> player, int slotIndex) +std::shared_ptr<ItemInstance> EnchantmentMenu::quickMoveStack(std::shared_ptr<Player> player, int slotIndex) { - shared_ptr<ItemInstance> clicked = nullptr; + std::shared_ptr<ItemInstance> clicked = nullptr; Slot *slot = slots->at(slotIndex); Slot *IngredientSlot = slots->at(INGREDIENT_SLOT); if (slot != NULL && slot->hasItem()) { - shared_ptr<ItemInstance> stack = slot->getItem(); + std::shared_ptr<ItemInstance> stack = slot->getItem(); clicked = stack->copy(); if (slotIndex == INGREDIENT_SLOT) @@ -238,8 +238,8 @@ shared_ptr<ItemInstance> EnchantmentMenu::quickMoveStack(shared_ptr<Player> 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<ItemInstance> EnchantmentMenu::quickMoveStack(shared_ptr<Player> 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)) { |
