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/Packet.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/Packet.cpp')
| -rw-r--r-- | Minecraft.World/Packet.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Minecraft.World/Packet.cpp b/Minecraft.World/Packet.cpp index 8bac8629..48e203f7 100644 --- a/Minecraft.World/Packet.cpp +++ b/Minecraft.World/Packet.cpp @@ -207,7 +207,7 @@ void Packet::map(int id, bool receiveOnClient, bool receiveOnServer, bool sendTo } // 4J Added to record data for outgoing packets -void Packet::recordOutgoingPacket(shared_ptr<Packet> packet) +void Packet::recordOutgoingPacket(std::shared_ptr<Packet> packet) { #ifndef _CONTENT_PACKAGE #if PACKET_ENABLE_STAT_TRACKING @@ -285,7 +285,7 @@ int64_t Packet::getIndexedStatValue(unsigned int samplePos, unsigned int rendera } -shared_ptr<Packet> Packet::getPacket(int id) +std::shared_ptr<Packet> Packet::getPacket(int id) { // 4J - removed try/catch // try @@ -326,7 +326,7 @@ byteArray Packet::readBytes(DataInputStream *datainputstream) } -bool Packet::canSendToAnyClient(shared_ptr<Packet> packet) +bool Packet::canSendToAnyClient(std::shared_ptr<Packet> packet) { int packetId = packet->getId(); @@ -345,10 +345,10 @@ unordered_map<int, Packet::PacketStatistics *> Packet::statistics = unordered_ma //int Packet::nextPrint = 0; -shared_ptr<Packet> Packet::readPacket(DataInputStream *dis, bool isServer) // throws IOException TODO 4J JEV, should this declare a throws? +std::shared_ptr<Packet> Packet::readPacket(DataInputStream *dis, bool isServer) // throws IOException TODO 4J JEV, should this declare a throws? { int id = 0; - shared_ptr<Packet> packet = nullptr; + std::shared_ptr<Packet> packet = nullptr; // 4J - removed try/catch // try @@ -399,7 +399,7 @@ shared_ptr<Packet> Packet::readPacket(DataInputStream *dis, bool isServer) // th return packet; } -void Packet::writePacket(shared_ptr<Packet> packet, DataOutputStream *dos) // throws IOException TODO 4J JEV, should this declare a throws? +void Packet::writePacket(std::shared_ptr<Packet> packet, DataOutputStream *dos) // throws IOException TODO 4J JEV, should this declare a throws? { //app.DebugPrintf("Writing packet %d\n", packet->getId()); dos->write(packet->getId()); @@ -519,7 +519,7 @@ bool Packet::canBeInvalidated() return false; } -bool Packet::isInvalidatedBy(shared_ptr<Packet> packet) +bool Packet::isInvalidatedBy(std::shared_ptr<Packet> packet) { return false; } @@ -530,16 +530,16 @@ bool Packet::isAync() } // 4J Stu - Brought these functions forward for enchanting/game rules -shared_ptr<ItemInstance> Packet::readItem(DataInputStream *dis) +std::shared_ptr<ItemInstance> Packet::readItem(DataInputStream *dis) { - shared_ptr<ItemInstance> item = nullptr; + std::shared_ptr<ItemInstance> item = nullptr; int id = dis->readShort(); if (id >= 0) { int count = dis->readByte(); int damage = dis->readShort(); - item = shared_ptr<ItemInstance>( new ItemInstance(id, count, damage) ); + item = std::shared_ptr<ItemInstance>( new ItemInstance(id, count, damage) ); // 4J Stu - Always read/write the tag //if (Item.items[id].canBeDepleted() || Item.items[id].shouldOverrideMultiplayerNBT()) { @@ -550,7 +550,7 @@ shared_ptr<ItemInstance> Packet::readItem(DataInputStream *dis) return item; } -void Packet::writeItem(shared_ptr<ItemInstance> item, DataOutputStream *dos) +void Packet::writeItem(std::shared_ptr<ItemInstance> item, DataOutputStream *dos) { if (item == NULL) { |
