diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2015-03-22 12:18:16 +0100 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2015-03-22 12:18:16 +0100 |
commit | 61f2d0ca3417b2a18a60015bf5423629d81bb754 (patch) | |
tree | f2a3dabfb256b7dc082a1b3d828f720adb283948 /src/network | |
parent | 761b127060b924a43a79c72d5488dbe9c186acc0 (diff) | |
download | minetest-61f2d0ca3417b2a18a60015bf5423629d81bb754.tar.gz minetest-61f2d0ca3417b2a18a60015bf5423629d81bb754.tar.bz2 minetest-61f2d0ca3417b2a18a60015bf5423629d81bb754.zip |
Remove unused ConnectionCommand::sendToAll function. NetworkPacket::oldForgePacket returns Buffer instead of SharedBuffer and is used in ConnectionCommand instead of Connection::Send
This remove the NetworkPacket buffer => SharedBuffer => Buffer copy. Now NetworkPacket => Buffer
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/connection.cpp | 2 | ||||
-rw-r--r-- | src/network/connection.h | 11 | ||||
-rw-r--r-- | src/network/networkpacket.cpp | 2 | ||||
-rw-r--r-- | src/network/networkpacket.h | 2 |
4 files changed, 5 insertions, 12 deletions
diff --git a/src/network/connection.cpp b/src/network/connection.cpp index 69deb4dd5..d51324ed4 100644 --- a/src/network/connection.cpp +++ b/src/network/connection.cpp @@ -2924,7 +2924,7 @@ void Connection::Send(u16 peer_id, u8 channelnum, ConnectionCommand c; - c.send(peer_id, channelnum, pkt->oldForgePacket(), reliable); + c.send(peer_id, channelnum, pkt, reliable); putCommand(c); } diff --git a/src/network/connection.h b/src/network/connection.h index 33b7d0f7f..0aa63d4cf 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -437,19 +437,12 @@ struct ConnectionCommand peer_id = peer_id_; } void send(u16 peer_id_, u8 channelnum_, - SharedBuffer<u8> data_, bool reliable_) + NetworkPacket* pkt, bool reliable_) { type = CONNCMD_SEND; peer_id = peer_id_; channelnum = channelnum_; - data = data_; - reliable = reliable_; - } - void sendToAll(u8 channelnum_, SharedBuffer<u8> data_, bool reliable_) - { - type = CONNCMD_SEND_TO_ALL; - channelnum = channelnum_; - data = data_; + data = pkt->oldForgePacket(); reliable = reliable_; } diff --git a/src/network/networkpacket.cpp b/src/network/networkpacket.cpp index b2b1974d7..cfbca32d3 100644 --- a/src/network/networkpacket.cpp +++ b/src/network/networkpacket.cpp @@ -510,7 +510,7 @@ NetworkPacket& NetworkPacket::operator<<(video::SColor src) return *this; } -SharedBuffer<u8> NetworkPacket::oldForgePacket() +Buffer<u8> NetworkPacket::oldForgePacket() { SharedBuffer<u8> sb(m_datasize + 2); writeU16(&sb[0], m_command); diff --git a/src/network/networkpacket.h b/src/network/networkpacket.h index e8c8565b0..4a801b444 100644 --- a/src/network/networkpacket.h +++ b/src/network/networkpacket.h @@ -104,7 +104,7 @@ public: NetworkPacket& operator<<(video::SColor src); // Temp, we remove SharedBuffer when migration finished - SharedBuffer<u8> oldForgePacket(); + Buffer<u8> oldForgePacket(); private: template<typename T> void checkDataSize() { |