From 0bd2b48ea0e67c8c181db66451206f168aa7b92c Mon Sep 17 00:00:00 2001 From: hiker Date: Mon, 26 Oct 2015 17:55:19 +1100 Subject: [PATCH] Removed sendPacket function and destructor. --- src/network/network_manager.cpp | 22 ---------------------- src/network/network_manager.hpp | 6 +----- src/network/protocol_manager.cpp | 16 ++++++++-------- 3 files changed, 9 insertions(+), 35 deletions(-) diff --git a/src/network/network_manager.cpp b/src/network/network_manager.cpp index 058bcd703..2d393f80e 100644 --- a/src/network/network_manager.cpp +++ b/src/network/network_manager.cpp @@ -32,15 +32,6 @@ NetworkManager::NetworkManager() { } // NetworkManager -//----------------------------------------------------------------------------- - -NetworkManager::~NetworkManager() -{ - ProtocolManager::kill(); - - STKHost::destroy(); -} // ~Networkmanager - //---------------------------------------------------------------------------- /** \brief Function to start the Network Manager (start threads). */ @@ -60,16 +51,3 @@ bool NetworkManager::connect(const TransportAddress& address) return STKPeer::connectToHost(STKHost::get(), address, 2, 0); } // connect - -//----------------------------------------------------------------------------- - -void NetworkManager::sendPacket(STKPeer* peer, const NetworkString& data, - bool reliable) -{ - if (peer) - peer->sendPacket(data, reliable); -} // sendPacket - - - -//----------------------------------------------------------------------------- diff --git a/src/network/network_manager.hpp b/src/network/network_manager.hpp index 9c0e88951..395abc6fc 100644 --- a/src/network/network_manager.hpp +++ b/src/network/network_manager.hpp @@ -49,7 +49,7 @@ class NetworkManager : public AbstractSingleton { protected: NetworkManager(); - virtual ~NetworkManager(); + virtual ~NetworkManager() {}; private: @@ -63,10 +63,6 @@ public: virtual bool connect(const TransportAddress& peer); virtual void sendPacket(const NetworkString& data, bool reliable = true) = 0; - virtual void sendPacket(STKPeer* peer, - const NetworkString& data, - bool reliable = true); - // Game related functions virtual bool isServer() = 0; diff --git a/src/network/protocol_manager.cpp b/src/network/protocol_manager.cpp index 8587a8e4e..c485faf9c 100644 --- a/src/network/protocol_manager.cpp +++ b/src/network/protocol_manager.cpp @@ -173,20 +173,20 @@ void ProtocolManager::propagateEvent(Event* event) void ProtocolManager::sendMessage(Protocol* sender, const NetworkString& message, bool reliable) { - NetworkString newMessage(1+message.size()); - newMessage.ai8(sender->getProtocolType()); // add one byte to add protocol type - newMessage += message; - NetworkManager::getInstance()->sendPacket(newMessage, reliable); + NetworkString new_message(1+message.size()); + new_message.ai8(sender->getProtocolType()); // add one byte to add protocol type + new_message += message; + NetworkManager::getInstance()->sendPacket(new_message, reliable); } // sendMessage // ---------------------------------------------------------------------------- void ProtocolManager::sendMessage(Protocol* sender, STKPeer* peer, const NetworkString& message, bool reliable) { - NetworkString newMessage(1+message.size()); - newMessage.ai8(sender->getProtocolType()); // add one byte to add protocol type - newMessage += message; - NetworkManager::getInstance()->sendPacket(peer, newMessage, reliable); + NetworkString new_message(1+message.size()); + new_message.ai8(sender->getProtocolType()); // add one byte to add protocol type + new_message += message; + peer->sendPacket(new_message, reliable); } // sendMessage // ----------------------------------------------------------------------------