refactor: use of unique_ptr instead of new
This commit is contained in:
@@ -47,9 +47,8 @@ bool Connexion::updateSocket() {
|
||||
protocol::PacketType packetType;
|
||||
decompressed >> packetType;
|
||||
|
||||
protocol::Packet* packet = protocol::PacketFactory::createPacket(packetType, decompressed);
|
||||
PacketPtr packet = protocol::PacketFactory::createPacket(packetType, decompressed);
|
||||
GetDispatcher()->Dispatch(packet);
|
||||
delete packet;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -62,7 +61,7 @@ bool Connexion::connect(const std::string& address, std::uint16_t port) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Connexion::sendPacket(protocol::Packet* packet) {
|
||||
void Connexion::sendPacket(const protocol::Packet* packet) {
|
||||
network::SendPacket(packet->Serialize(), m_Socket);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user