summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-08-02 21:05:05 -0600
committerJared Adams <jaxad0127@gmail.com>2010-08-02 21:05:05 -0600
commit60f0f47c81eefb91863549d3dc37aa58422e3675 (patch)
tree8dbe2c15e6f9096fdb7147f882086e95e900621d /src
parenteaa8288a73872cb8d8b3d0b3455d79ce2579f438 (diff)
downloadmanaserv-60f0f47c81eefb91863549d3dc37aa58422e3675.tar.gz
manaserv-60f0f47c81eefb91863549d3dc37aa58422e3675.tar.xz
manaserv-60f0f47c81eefb91863549d3dc37aa58422e3675.zip
Fix enet version check
Tested-by: BaseBallBoy
Diffstat (limited to 'src')
-rw-r--r--src/net/connection.cpp14
-rw-r--r--src/net/connectionhandler.cpp6
2 files changed, 7 insertions, 13 deletions
diff --git a/src/net/connection.cpp b/src/net/connection.cpp
index 790b6ac..ceed6f0 100644
--- a/src/net/connection.cpp
+++ b/src/net/connection.cpp
@@ -36,17 +36,15 @@ bool Connection::start(const std::string &address, int port)
enet_address_set_host(&enetAddress, address.c_str());
enetAddress.port = port;
-#if ENET_VERSION_MAJOR != 1
-#error Unsuported enet version!
-#elif ENET_VERSION_MINOR < 3
+#ifdef ENET_VERSION_MAJOR
mLocal = enet_host_create(NULL /* create a client host */,
1 /* allow one outgoing connection */,
+ 0 /* unlimited channel count */,
0 /* assume any amount of incoming bandwidth */,
0 /* assume any amount of outgoing bandwidth */);
#else
mLocal = enet_host_create(NULL /* create a client host */,
1 /* allow one outgoing connection */,
- 0 /* unlimited channel count */,
0 /* assume any amount of incoming bandwidth */,
0 /* assume any amount of outgoing bandwidth */);
#endif
@@ -55,12 +53,10 @@ bool Connection::start(const std::string &address, int port)
return false;
// Initiate the connection, allocating channel 0.
-#if ENET_VERSION_MAJOR != 1
-#error Unsuported enet version!
-#elif ENET_VERSION_MINOR < 3
- mRemote = enet_host_connect(mLocal, &enetAddress, 1);
-#else
+#ifdef ENET_VERSION_MAJOR
mRemote = enet_host_connect(mLocal, &enetAddress, 1, 0);
+#else
+ mRemote = enet_host_connect(mLocal, &enetAddress, 1);
#endif
ENetEvent event;
diff --git a/src/net/connectionhandler.cpp b/src/net/connectionhandler.cpp
index 6aa5856..986d9de 100644
--- a/src/net/connectionhandler.cpp
+++ b/src/net/connectionhandler.cpp
@@ -40,19 +40,17 @@ bool ConnectionHandler::startListen(enet_uint16 port,
enet_address_set_host(&address, listenHost.c_str());
LOG_INFO("Listening on port " << port << "...");
-#if ENET_VERSION_MAJOR != 1
-#error Unsuported enet version!
-#elif ENET_VERSION_MINOR < 3
+#ifdef ENET_VERSION_MAJOR
host = enet_host_create(
&address /* the address to bind the server host to */,
Configuration::getValue("net_maxClients", 1000) /* allowed connections */,
+ 0 /* unlimited channel count */,
0 /* assume any amount of incoming bandwidth */,
0 /* assume any amount of outgoing bandwidth */);
#else
host = enet_host_create(
&address /* the address to bind the server host to */,
Configuration::getValue("net_maxClients", 1000) /* allowed connections */,
- 0 /* unlimited channel count */,
0 /* assume any amount of incoming bandwidth */,
0 /* assume any amount of outgoing bandwidth */);
#endif