mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-26 18:21:04 +00:00
Replace NetworkPacket pointers to references
This commit is contained in:
parent
74d34da6cb
commit
083c8c734e
8 changed files with 256 additions and 295 deletions
|
@ -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()
|
||||
|
|
|
@ -77,8 +77,8 @@ void Client::handleCommand_AuthAccept(NetworkPacket* pkt)
|
|||
<< m_recommended_send_interval<<std::endl;
|
||||
|
||||
// Reply to server
|
||||
NetworkPacket* resp_pkt = new NetworkPacket(TOSERVER_INIT2, 0);
|
||||
Send(resp_pkt);
|
||||
NetworkPacket resp_pkt(TOSERVER_INIT2, 0);
|
||||
Send(&resp_pkt);
|
||||
|
||||
m_state = LC_Init;
|
||||
}
|
||||
|
@ -128,8 +128,8 @@ void Client::handleCommand_InitLegacy(NetworkPacket* pkt)
|
|||
}
|
||||
|
||||
// Reply to server
|
||||
NetworkPacket* resp_pkt = new NetworkPacket(TOSERVER_INIT2, 0);
|
||||
Send(resp_pkt);
|
||||
NetworkPacket resp_pkt(TOSERVER_INIT2, 0);
|
||||
Send(&resp_pkt);
|
||||
|
||||
m_state = LC_Init;
|
||||
}
|
||||
|
|
|
@ -617,14 +617,14 @@ void Server::handleCommand_Init_Legacy(NetworkPacket* pkt)
|
|||
Answer with a TOCLIENT_INIT
|
||||
*/
|
||||
|
||||
NetworkPacket* resp_pkt = new NetworkPacket(TOCLIENT_INIT_LEGACY, 1 + 6 + 8 + 4,
|
||||
NetworkPacket resp_pkt(TOCLIENT_INIT_LEGACY, 1 + 6 + 8 + 4,
|
||||
pkt->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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue