aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/Packet.cpp
diff options
context:
space:
mode:
authorLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
committerLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
commit087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch)
tree69454763e73ca764af4e682d3573080b13138a0e /Minecraft.World/Packet.cpp
parenta9be52c41a02d207233199e98898fe7483d7e817 (diff)
Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore functionality of the nightly. All in-game menus do not work and generating a world crashes. This reverts commit a9be52c41a02d207233199e98898fe7483d7e817.
Diffstat (limited to 'Minecraft.World/Packet.cpp')
-rw-r--r--Minecraft.World/Packet.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Minecraft.World/Packet.cpp b/Minecraft.World/Packet.cpp
index 4125f103..61e3cc63 100644
--- a/Minecraft.World/Packet.cpp
+++ b/Minecraft.World/Packet.cpp
@@ -336,7 +336,7 @@ shared_ptr<Packet> Packet::readPacket(DataInputStream *dis, bool isServer) // th
}
packet = getPacket(id);
- if (packet == nullptr) assert(false);//throw new IOException(wstring(L"Bad packet id ") + std::to_wstring(id));
+ if (packet == NULL) assert(false);//throw new IOException(wstring(L"Bad packet id ") + std::to_wstring(id));
//app.DebugPrintf("%s reading packet %d\n", isServer ? "Server" : "Client", packet->getId());
packet->read(dis);
@@ -345,7 +345,7 @@ shared_ptr<Packet> Packet::readPacket(DataInputStream *dis, bool isServer) // th
// {
// // reached end of stream
// OutputDebugString("Reached end of stream");
- // return nullptr;
+ // return NULL;
// }
// 4J - Don't bother tracking stats in a content package
@@ -386,7 +386,7 @@ void Packet::writeUtf(const wstring& value, DataOutputStream *dos) // throws IOE
}
#endif
- dos->writeShort(static_cast<short>(value.length()));
+ dos->writeShort((short)value.length());
dos->writeChars(value);
}
@@ -443,7 +443,7 @@ double Packet::PacketStatistics::getAverageSize()
{
return 0;
}
- return static_cast<double>(totalSize) / count;
+ return (double) totalSize / count;
}
int Packet::PacketStatistics::getTotalSize()
@@ -512,7 +512,7 @@ shared_ptr<ItemInstance> Packet::readItem(DataInputStream *dis)
int count = dis->readByte();
int damage = dis->readShort();
- item = std::make_shared<ItemInstance>(id, count, damage);
+ item = shared_ptr<ItemInstance>( new ItemInstance(id, count, damage) );
// 4J Stu - Always read/write the tag
//if (Item.items[id].canBeDepleted() || Item.items[id].shouldOverrideMultiplayerNBT())
{
@@ -525,7 +525,7 @@ shared_ptr<ItemInstance> Packet::readItem(DataInputStream *dis)
void Packet::writeItem(shared_ptr<ItemInstance> item, DataOutputStream *dos)
{
- if (item == nullptr)
+ if (item == NULL)
{
dos->writeShort(-1);
}
@@ -545,7 +545,7 @@ void Packet::writeItem(shared_ptr<ItemInstance> item, DataOutputStream *dos)
CompoundTag *Packet::readNbt(DataInputStream *dis)
{
int size = dis->readShort();
- if (size < 0) return nullptr;
+ if (size < 0) return NULL;
byteArray buff(size);
dis->readFully(buff);
CompoundTag *result = (CompoundTag *) NbtIo::decompress(buff);
@@ -555,14 +555,14 @@ CompoundTag *Packet::readNbt(DataInputStream *dis)
void Packet::writeNbt(CompoundTag *tag, DataOutputStream *dos)
{
- if (tag == nullptr)
+ if (tag == NULL)
{
dos->writeShort(-1);
}
else
{
byteArray buff = NbtIo::compress(tag);
- dos->writeShort(static_cast<short>(buff.length));
+ dos->writeShort((short) buff.length);
dos->write(buff);
delete [] buff.data;
}