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/GiveItemCommand.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/GiveItemCommand.cpp')
| -rw-r--r-- | Minecraft.World/GiveItemCommand.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Minecraft.World/GiveItemCommand.cpp b/Minecraft.World/GiveItemCommand.cpp index 1d13592f..076c3ade 100644 --- a/Minecraft.World/GiveItemCommand.cpp +++ b/Minecraft.World/GiveItemCommand.cpp @@ -10,7 +10,7 @@ EGameCommand GiveItemCommand::getId() return eGameCommand_Give; } -void GiveItemCommand::execute(shared_ptr<CommandSender> source, byteArray commandData) +void GiveItemCommand::execute(std::shared_ptr<CommandSender> source, byteArray commandData) { ByteArrayInputStream bais(commandData); DataInputStream dis(&bais); @@ -20,20 +20,20 @@ void GiveItemCommand::execute(shared_ptr<CommandSender> source, byteArray comman int amount = dis.readInt(); int aux = dis.readInt(); wstring tag = dis.readUTF(); - + bais.reset(); - shared_ptr<ServerPlayer> player = getPlayer(uid); + std::shared_ptr<ServerPlayer> player = getPlayer(uid); if(player != NULL && item > 0 && Item::items[item] != NULL) { - shared_ptr<ItemInstance> itemInstance = shared_ptr<ItemInstance>(new ItemInstance(item, amount, aux)); + std::shared_ptr<ItemInstance> itemInstance = std::shared_ptr<ItemInstance>(new ItemInstance(item, amount, aux)); player->drop(itemInstance); //logAdminAction(source, L"commands.give.success", ChatPacket::e_ChatCustom, Item::items[item]->getName(itemInstance), item, amount, player->getAName()); logAdminAction(source, ChatPacket::e_ChatCustom, L"commands.give.success", item, player->getAName()); } } -shared_ptr<GameCommandPacket> GiveItemCommand::preparePacket(shared_ptr<Player> player, int item, int amount, int aux, const wstring &tag) +std::shared_ptr<GameCommandPacket> GiveItemCommand::preparePacket(std::shared_ptr<Player> player, int item, int amount, int aux, const wstring &tag) { if(player == NULL) return nullptr; @@ -46,5 +46,5 @@ shared_ptr<GameCommandPacket> GiveItemCommand::preparePacket(shared_ptr<Player> dos.writeInt(aux); dos.writeUTF(tag); - return shared_ptr<GameCommandPacket>( new GameCommandPacket(eGameCommand_Give, baos.toByteArray() )); + return std::shared_ptr<GameCommandPacket>( new GameCommandPacket(eGameCommand_Give, baos.toByteArray() )); }
\ No newline at end of file |
