Remove unused ConnectionCommand::sendToAll function. NetworkPacket::oldForgePacket...
authorLoic Blot <loic.blot@unix-experience.fr>
Sun, 22 Mar 2015 11:18:16 +0000 (12:18 +0100)
committerLoic Blot <loic.blot@unix-experience.fr>
Sun, 22 Mar 2015 11:18:16 +0000 (12:18 +0100)
This remove the NetworkPacket buffer => SharedBuffer => Buffer copy. Now NetworkPacket => Buffer

src/network/connection.cpp
src/network/connection.h
src/network/networkpacket.cpp
src/network/networkpacket.h

index 69deb4dd5fa1f9e04d86200261f9f54685eec80d..d51324ed4f70e3040f51ee9c1c06144e0766e14b 100644 (file)
@@ -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);
 }
 
index 33b7d0f7f8ef144c8dc75397dbff8832299a18af..0aa63d4cf21d3c7d268bbba8ba815e07aeef11aa 100644 (file)
@@ -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_;
        }
 
index b2b1974d7d15e9a30a66eaa5648c002bbd0d5087..cfbca32d33a70372feb5c5acd55b97d3eeae10a3 100644 (file)
@@ -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);
index e8c8565b0190222cd69ee774f80b5474c33cc7ba..4a801b44426b81d0cd60e4f9fa83732852860b63 100644 (file)
@@ -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()
                {