summaryrefslogtreecommitdiff
path: root/src/net/manaserv/connection.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-11-03 10:18:25 -0700
committerJared Adams <jaxad0127@gmail.com>2009-11-03 10:18:25 -0700
commitacd557f9472c711fe92b9c158ec336abf688bf7b (patch)
tree2295d13589411ee88afe16f4997bea65b4ebba94 /src/net/manaserv/connection.cpp
parentc60d3a98dbbb20621742bfd82bbaaa6b7085a8ae (diff)
downloadmana-acd557f9472c711fe92b9c158ec336abf688bf7b.tar.gz
mana-acd557f9472c711fe92b9c158ec336abf688bf7b.tar.bz2
mana-acd557f9472c711fe92b9c158ec336abf688bf7b.tar.xz
mana-acd557f9472c711fe92b9c158ec336abf688bf7b.zip
Remove more _SUPPORT ifdefs and do some cleanup
Diffstat (limited to 'src/net/manaserv/connection.cpp')
-rw-r--r--src/net/manaserv/connection.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/net/manaserv/connection.cpp b/src/net/manaserv/connection.cpp
index b73f867f..6ddcf186 100644
--- a/src/net/manaserv/connection.cpp
+++ b/src/net/manaserv/connection.cpp
@@ -22,26 +22,28 @@
#include "net/manaserv/connection.h"
#include "net/manaserv/internal.h"
-
-#include "net/messageout.h"
+#include "net/manaserv/messageout.h"
#include "log.h"
#include <string>
-Net::Connection::Connection(ENetHost *client):
+namespace ManaServ
+{
+
+Connection::Connection(ENetHost *client):
mConnection(0), mClient(client)
{
mPort = 0;
- Net::connections++;
+ connections++;
}
-Net::Connection::~Connection()
+Connection::~Connection()
{
- Net::connections--;
+ connections--;
}
-bool Net::Connection::connect(const std::string &address, short port)
+bool Connection::connect(const std::string &address, short port)
{
logger->log("Net::Connection::connect(%s, %i)", address.c_str(), port);
@@ -72,7 +74,7 @@ bool Net::Connection::connect(const std::string &address, short port)
return true;
}
-void Net::Connection::disconnect()
+void Connection::disconnect()
{
if (!mConnection)
return;
@@ -84,13 +86,13 @@ void Net::Connection::disconnect()
mConnection = 0;
}
-bool Net::Connection::isConnected()
+bool Connection::isConnected()
{
return (mConnection) ?
(mConnection->state == ENET_PEER_STATE_CONNECTED) : false;
}
-void Net::Connection::send(const MessageOut &msg)
+void Connection::send(const ManaServ::MessageOut &msg)
{
if (!isConnected())
{
@@ -103,3 +105,5 @@ void Net::Connection::send(const MessageOut &msg)
ENET_PACKET_FLAG_RELIABLE);
enet_peer_send(mConnection, 0, packet);
}
+
+} // namespace ManaServ