mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-30 21:56:44 +00:00
refactor: unglob std::shared_ptr
This commit is contained in:
@@ -211,7 +211,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
|
||||
@@ -289,7 +289,7 @@ __int64 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
|
||||
@@ -330,7 +330,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();
|
||||
|
||||
@@ -349,7 +349,7 @@ 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?
|
||||
{
|
||||
// N packet ID
|
||||
static int s_clientPktHistory[64];
|
||||
@@ -360,7 +360,7 @@ shared_ptr<Packet> Packet::readPacket(DataInputStream *dis, bool isServer) // th
|
||||
static bool s_serverDesyncLogged = false;
|
||||
|
||||
int id = 0;
|
||||
shared_ptr<Packet> packet = nullptr;
|
||||
std::shared_ptr<Packet> packet = nullptr;
|
||||
|
||||
// 4J - removed try/catch
|
||||
// try
|
||||
@@ -430,7 +430,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());
|
||||
@@ -548,7 +548,7 @@ bool Packet::canBeInvalidated()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Packet::isInvalidatedBy(shared_ptr<Packet> packet)
|
||||
bool Packet::isInvalidatedBy(std::shared_ptr<Packet> packet)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -559,16 +559,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())
|
||||
{
|
||||
@@ -579,7 +579,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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user