diff options
| author | void_17 <heroerror3@gmail.com> | 2026-03-02 17:37:16 +0700 |
|---|---|---|
| committer | void_17 <heroerror3@gmail.com> | 2026-03-02 17:37:16 +0700 |
| commit | 119bff351450ea16ffda550b6e0f67379b29f708 (patch) | |
| tree | d9f28714afd516bc2450f33b0a77c5e05ff4de90 /Minecraft.World/InventoryMenu.cpp | |
| parent | 8a2a62ea1d47364f802cf9aae97668bc4a7007b5 (diff) | |
Revert "shared_ptr -> std::shared_ptr"
This reverts commit 7074f35e4ba831e358117842b99ee35b87f85ae5.
Diffstat (limited to 'Minecraft.World/InventoryMenu.cpp')
| -rw-r--r-- | Minecraft.World/InventoryMenu.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/Minecraft.World/InventoryMenu.cpp b/Minecraft.World/InventoryMenu.cpp index 32370af9..979243c1 100644 --- a/Minecraft.World/InventoryMenu.cpp +++ b/Minecraft.World/InventoryMenu.cpp @@ -20,16 +20,16 @@ const int InventoryMenu::INV_SLOT_END = InventoryMenu::INV_SLOT_START + 9 * 3; const int InventoryMenu::USE_ROW_SLOT_START = InventoryMenu::INV_SLOT_END; const int InventoryMenu::USE_ROW_SLOT_END = InventoryMenu::USE_ROW_SLOT_START + 9; -InventoryMenu::InventoryMenu(std::shared_ptr<Inventory> inventory, bool active, Player *player) : AbstractContainerMenu() +InventoryMenu::InventoryMenu(shared_ptr<Inventory> inventory, bool active, Player *player) : AbstractContainerMenu() { owner = player; _init( inventory, active ); } -void InventoryMenu::_init(std::shared_ptr<Inventory> inventory, bool active) +void InventoryMenu::_init(shared_ptr<Inventory> inventory, bool active) { - craftSlots = std::shared_ptr<CraftingContainer>( new CraftingContainer(this, 2, 2) ); - resultSlots = std::shared_ptr<ResultContainer>( new ResultContainer() ); + craftSlots = shared_ptr<CraftingContainer>( new CraftingContainer(this, 2, 2) ); + resultSlots = shared_ptr<ResultContainer>( new ResultContainer() ); this->active = active; addSlot(new ResultSlot( inventory->player, craftSlots, resultSlots, 0, 144, 36)); @@ -64,19 +64,19 @@ void InventoryMenu::_init(std::shared_ptr<Inventory> inventory, bool active) slotsChanged(); // 4J removed craftSlots parameter, see comment below } -void InventoryMenu::slotsChanged() // 4J used to take a std::shared_ptr<Container> but wasn't using it, so removed to simplify things +void InventoryMenu::slotsChanged() // 4J used to take a shared_ptr<Container> but wasn't using it, so removed to simplify things { MemSect(23); resultSlots->setItem(0, Recipes::getInstance()->getItemFor(craftSlots, owner->level) ); MemSect(0); } -void InventoryMenu::removed(std::shared_ptr<Player> player) +void InventoryMenu::removed(shared_ptr<Player> player) { AbstractContainerMenu::removed(player); for (int i = 0; i < 4; i++) { - std::shared_ptr<ItemInstance> item = craftSlots->removeItemNoUpdate(i); + shared_ptr<ItemInstance> item = craftSlots->removeItemNoUpdate(i); if (item != NULL) { player->drop(item); @@ -86,16 +86,16 @@ void InventoryMenu::removed(std::shared_ptr<Player> player) resultSlots->setItem(0, nullptr); } -bool InventoryMenu::stillValid(std::shared_ptr<Player> player) +bool InventoryMenu::stillValid(shared_ptr<Player> player) { return true; } -std::shared_ptr<ItemInstance> InventoryMenu::quickMoveStack(std::shared_ptr<Player> player, int slotIndex) +shared_ptr<ItemInstance> InventoryMenu::quickMoveStack(shared_ptr<Player> player, int slotIndex) { - std::shared_ptr<ItemInstance> clicked = nullptr; + shared_ptr<ItemInstance> clicked = nullptr; Slot *slot = slots->at(slotIndex); - + Slot *HelmetSlot = slots->at(ARMOR_SLOT_START); Slot *ChestplateSlot = slots->at(ARMOR_SLOT_START+1); Slot *LeggingsSlot = slots->at(ARMOR_SLOT_START+2); @@ -104,7 +104,7 @@ std::shared_ptr<ItemInstance> InventoryMenu::quickMoveStack(std::shared_ptr<Play if (slot != NULL && slot->hasItem()) { - std::shared_ptr<ItemInstance> stack = slot->getItem(); + shared_ptr<ItemInstance> stack = slot->getItem(); clicked = stack->copy(); if (slotIndex == RESULT_SLOT) @@ -119,28 +119,28 @@ std::shared_ptr<ItemInstance> InventoryMenu::quickMoveStack(std::shared_ptr<Play else if (slotIndex >= INV_SLOT_START && slotIndex < INV_SLOT_END) { // 4J-PB - added for quick equip - if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Helmet && (!HelmetSlot->hasItem() ) ) + if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Helmet && (!HelmetSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START, ARMOR_SLOT_START+1, false)) { return nullptr; } } - else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Chestplate && (!ChestplateSlot->hasItem() ) ) + else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Chestplate && (!ChestplateSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START+1, ARMOR_SLOT_START+2, false)) { return nullptr; } } - else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Leggings && (!LeggingsSlot->hasItem() ) ) + else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Leggings && (!LeggingsSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START+2, ARMOR_SLOT_START+3, false)) { return nullptr; } } - else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Boots && (!BootsSlot->hasItem() ) ) + else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Boots && (!BootsSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START+3, ARMOR_SLOT_START+4, false)) { @@ -157,28 +157,28 @@ std::shared_ptr<ItemInstance> InventoryMenu::quickMoveStack(std::shared_ptr<Play { //ArmorRecipes::_eArmorType eArmourType=ArmorRecipes::GetArmorType(stack->id); - if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Helmet && (!HelmetSlot->hasItem() ) ) + if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Helmet && (!HelmetSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START, ARMOR_SLOT_START+1, false)) { return nullptr; } } - else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Chestplate && (!ChestplateSlot->hasItem() ) ) + else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Chestplate && (!ChestplateSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START+1, ARMOR_SLOT_START+2, false)) { return nullptr; } } - else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Leggings && (!LeggingsSlot->hasItem() ) ) + else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Leggings && (!LeggingsSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START+2, ARMOR_SLOT_START+3, false)) { return nullptr; } } - else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Boots && (!BootsSlot->hasItem() ) ) + else if(ArmorRecipes::GetArmorType(stack->id)==ArmorRecipes::eArmorType_Boots && (!BootsSlot->hasItem() ) ) { if(!moveItemStackTo(stack, ARMOR_SLOT_START+3, ARMOR_SLOT_START+4, false)) { @@ -220,15 +220,15 @@ std::shared_ptr<ItemInstance> InventoryMenu::quickMoveStack(std::shared_ptr<Play return clicked; } -bool InventoryMenu::mayCombine(Slot *slot, std::shared_ptr<ItemInstance> item) +bool InventoryMenu::mayCombine(Slot *slot, shared_ptr<ItemInstance> item) { return slot->mayCombine(item); } // 4J-JEV: Added for achievement 'Iron Man'. -std::shared_ptr<ItemInstance> InventoryMenu::clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr<Player> player) +shared_ptr<ItemInstance> InventoryMenu::clicked(int slotIndex, int buttonNum, int clickType, shared_ptr<Player> player) { - std::shared_ptr<ItemInstance> out = AbstractContainerMenu::clicked(slotIndex, buttonNum, clickType, player); + shared_ptr<ItemInstance> out = AbstractContainerMenu::clicked(slotIndex, buttonNum, clickType, player); #ifdef _EXTENDED_ACHIEVEMENTS static int ironItems[4] = {Item::helmet_iron_Id,Item::chestplate_iron_Id,Item::leggings_iron_Id,Item::boots_iron_Id}; |
