From 083c8c734e8af037d8ad3a1a35475a5d4756572c Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Fri, 13 Mar 2015 22:01:49 +0100 Subject: Replace NetworkPacket pointers to references --- src/network/connection.cpp | 5 ++--- src/network/packethandlers/client.cpp | 8 ++++---- src/network/packethandlers/server.cpp | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/network') diff --git a/src/network/connection.cpp b/src/network/connection.cpp index fb31a07f0..69deb4dd5 100644 --- a/src/network/connection.cpp +++ b/src/network/connection.cpp @@ -1725,9 +1725,8 @@ void ConnectionSendThread::connect(Address address) // Send a dummy packet to server with peer_id = PEER_ID_INEXISTENT m_connection->SetPeerID(PEER_ID_INEXISTENT); - NetworkPacket* pkt = new NetworkPacket(0,0); - m_connection->Send(PEER_ID_SERVER, 0, pkt, true); - delete pkt; + NetworkPacket pkt(0,0); + m_connection->Send(PEER_ID_SERVER, 0, &pkt, true); } void ConnectionSendThread::disconnect() diff --git a/src/network/packethandlers/client.cpp b/src/network/packethandlers/client.cpp index 838c85989..5acf04f91 100644 --- a/src/network/packethandlers/client.cpp +++ b/src/network/packethandlers/client.cpp @@ -77,8 +77,8 @@ void Client::handleCommand_AuthAccept(NetworkPacket* pkt) << m_recommended_send_interval<getPeerId()); - *resp_pkt << (u8) deployed << (v3s16) floatToInt(v3f(0,0,0), BS) + resp_pkt << (u8) deployed << (v3s16) floatToInt(v3f(0,0,0), BS) << (u64) m_env->getServerMap().getSeed() << g_settings->getFloat("dedicated_server_step"); - Send(resp_pkt); + Send(&resp_pkt); m_clients.event(pkt->getPeerId(), CSE_Init); } -- cgit v1.2.3