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/Slot.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/Slot.cpp')
| -rw-r--r-- | Minecraft.World/Slot.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/Minecraft.World/Slot.cpp b/Minecraft.World/Slot.cpp index 30fd9125..1f7415f2 100644 --- a/Minecraft.World/Slot.cpp +++ b/Minecraft.World/Slot.cpp @@ -5,7 +5,7 @@ #include "net.minecraft.world.item.crafting.h" #include "Slot.h" -Slot::Slot(shared_ptr<Container> container, int slot, int x, int y) : container( container ), slot( slot ) +Slot::Slot(std::shared_ptr<Container> container, int slot, int x, int y) : container( container ), slot( slot ) { this->x = x; this->y = y; @@ -13,7 +13,7 @@ Slot::Slot(shared_ptr<Container> container, int slot, int x, int y) : container( this->index = 0; } -void Slot::onQuickCraft(shared_ptr<ItemInstance> picked, shared_ptr<ItemInstance> original) +void Slot::onQuickCraft(std::shared_ptr<ItemInstance> picked, std::shared_ptr<ItemInstance> original) { if (picked == NULL || original == NULL) { @@ -31,18 +31,18 @@ void Slot::onQuickCraft(shared_ptr<ItemInstance> picked, shared_ptr<ItemInstance } -void Slot::onQuickCraft(shared_ptr<ItemInstance> picked, int count) +void Slot::onQuickCraft(std::shared_ptr<ItemInstance> picked, int count) { } -void Slot::checkTakeAchievements(shared_ptr<ItemInstance> picked) +void Slot::checkTakeAchievements(std::shared_ptr<ItemInstance> picked) { } void Slot::swap(Slot *other) { - shared_ptr<ItemInstance> item1 = container->getItem(slot); - shared_ptr<ItemInstance> item2 = other->container->getItem(other->slot); + std::shared_ptr<ItemInstance> item1 = container->getItem(slot); + std::shared_ptr<ItemInstance> item2 = other->container->getItem(other->slot); if (item1 != NULL && item1->count > other->getMaxStackSize()) { @@ -60,17 +60,17 @@ void Slot::swap(Slot *other) setChanged(); } -void Slot::onTake(shared_ptr<Player> player, shared_ptr<ItemInstance> carried) +void Slot::onTake(std::shared_ptr<Player> player, std::shared_ptr<ItemInstance> carried) { setChanged(); } -bool Slot::mayPlace(shared_ptr<ItemInstance> item) +bool Slot::mayPlace(std::shared_ptr<ItemInstance> item) { return true; } -shared_ptr<ItemInstance> Slot::getItem() +std::shared_ptr<ItemInstance> Slot::getItem() { return container->getItem(slot); } @@ -80,7 +80,7 @@ bool Slot::hasItem() return getItem() != NULL; } -void Slot::set(shared_ptr<ItemInstance> item) +void Slot::set(std::shared_ptr<ItemInstance> item) { container->setItem(slot, item); setChanged(); @@ -101,24 +101,24 @@ Icon *Slot::getNoItemIcon() return NULL; } -shared_ptr<ItemInstance> Slot::remove(int c) +std::shared_ptr<ItemInstance> Slot::remove(int c) { return container->removeItem(slot, c); } -bool Slot::isAt(shared_ptr<Container> c, int s) +bool Slot::isAt(std::shared_ptr<Container> c, int s) { return c == container && s == slot; } -bool Slot::mayPickup(shared_ptr<Player> player) +bool Slot::mayPickup(std::shared_ptr<Player> player) { return true; } -bool Slot::mayCombine(shared_ptr<ItemInstance> second) +bool Slot::mayCombine(std::shared_ptr<ItemInstance> second) { - shared_ptr<ItemInstance> first = getItem(); + std::shared_ptr<ItemInstance> first = getItem(); if(first == NULL || second == NULL) return false; @@ -138,12 +138,12 @@ bool Slot::mayCombine(shared_ptr<ItemInstance> second) return false; } -shared_ptr<ItemInstance> Slot::combine(shared_ptr<ItemInstance> item) +std::shared_ptr<ItemInstance> Slot::combine(std::shared_ptr<ItemInstance> item) { - shared_ptr<ItemInstance> result = nullptr; - shared_ptr<ItemInstance> first = getItem(); + std::shared_ptr<ItemInstance> result = nullptr; + std::shared_ptr<ItemInstance> first = getItem(); - shared_ptr<CraftingContainer> craftSlots = shared_ptr<CraftingContainer>( new CraftingContainer(NULL, 2, 2) ); + std::shared_ptr<CraftingContainer> craftSlots = std::shared_ptr<CraftingContainer>( new CraftingContainer(NULL, 2, 2) ); craftSlots->setItem(0, item); craftSlots->setItem(1, first); |
