summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-08-09 18:53:40 -0600
committerJared Adams <jaxad0127@gmail.com>2010-08-09 18:53:40 -0600
commitb5c98b278ea09934700ca2e8f03650ea19be1fd1 (patch)
tree17eebf4edffc46dbf37ba62a8dd6a37d0e1811ee /src
parentce8ad18e97aa47c34acad2d9ca7a785718e51740 (diff)
downloadmanaserv-b5c98b278ea09934700ca2e8f03650ea19be1fd1.tar.gz
manaserv-b5c98b278ea09934700ca2e8f03650ea19be1fd1.tar.xz
manaserv-b5c98b278ea09934700ca2e8f03650ea19be1fd1.zip
Fix enet version check
Reviewed-by: Chuck Miller
Diffstat (limited to 'src')
-rw-r--r--src/net/connection.cpp10
-rw-r--r--src/net/connectionhandler.cpp8
2 files changed, 15 insertions, 3 deletions
diff --git a/src/net/connection.cpp b/src/net/connection.cpp
index ceed6f0..4275105 100644
--- a/src/net/connection.cpp
+++ b/src/net/connection.cpp
@@ -24,6 +24,12 @@
#include "net/messageout.hpp"
#include "utils/logger.h"
+#ifdef ENET_VERSION_CREATE
+#define ENET_CUTOFF ENET_VERSION_CREATE(1,3,0)
+#else
+#define ENET_CUTOFF 0xFFFFFFFF
+#endif
+
Connection::Connection():
mRemote(0),
mLocal(0)
@@ -36,7 +42,7 @@ bool Connection::start(const std::string &address, int port)
enet_address_set_host(&enetAddress, address.c_str());
enetAddress.port = port;
-#ifdef ENET_VERSION_MAJOR
+#ifdef defined(ENET_VERSION) && ENET_VERSION >= ENET_CUTOFF
mLocal = enet_host_create(NULL /* create a client host */,
1 /* allow one outgoing connection */,
0 /* unlimited channel count */,
@@ -53,7 +59,7 @@ bool Connection::start(const std::string &address, int port)
return false;
// Initiate the connection, allocating channel 0.
-#ifdef ENET_VERSION_MAJOR
+#ifdef defined(ENET_VERSION) && ENET_VERSION >= ENET_CUTOFF
mRemote = enet_host_connect(mLocal, &enetAddress, 1, 0);
#else
mRemote = enet_host_connect(mLocal, &enetAddress, 1);
diff --git a/src/net/connectionhandler.cpp b/src/net/connectionhandler.cpp
index 986d9de..314eb0f 100644
--- a/src/net/connectionhandler.cpp
+++ b/src/net/connectionhandler.cpp
@@ -29,6 +29,12 @@
#include "net/netcomputer.hpp"
#include "utils/logger.h"
+#ifdef ENET_VERSION_CREATE
+#define ENET_CUTOFF ENET_VERSION_CREATE(1,3,0)
+#else
+#define ENET_CUTOFF 0xFFFFFFFF
+#endif
+
bool ConnectionHandler::startListen(enet_uint16 port,
const std::string &listenHost)
{
@@ -40,7 +46,7 @@ bool ConnectionHandler::startListen(enet_uint16 port,
enet_address_set_host(&address, listenHost.c_str());
LOG_INFO("Listening on port " << port << "...");
-#ifdef ENET_VERSION_MAJOR
+#ifdef defined(ENET_VERSION) && ENET_VERSION >= ENET_CUTOFF
host = enet_host_create(
&address /* the address to bind the server host to */,
Configuration::getValue("net_maxClients", 1000) /* allowed connections */,