Removed sendPacket function and destructor.

This commit is contained in:
hiker 2015-10-26 17:55:19 +11:00
parent cf51d2f0e0
commit 0bd2b48ea0
3 changed files with 9 additions and 35 deletions

View File

@ -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
//-----------------------------------------------------------------------------

View File

@ -49,7 +49,7 @@ class NetworkManager : public AbstractSingleton<NetworkManager>
{
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;

View File

@ -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
// ----------------------------------------------------------------------------