diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-08-09 18:53:40 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-08-09 18:53:40 -0600 |
commit | b5c98b278ea09934700ca2e8f03650ea19be1fd1 (patch) | |
tree | 17eebf4edffc46dbf37ba62a8dd6a37d0e1811ee | |
parent | ce8ad18e97aa47c34acad2d9ca7a785718e51740 (diff) | |
download | manaserv-b5c98b278ea09934700ca2e8f03650ea19be1fd1.tar.gz manaserv-b5c98b278ea09934700ca2e8f03650ea19be1fd1.tar.bz2 manaserv-b5c98b278ea09934700ca2e8f03650ea19be1fd1.tar.xz manaserv-b5c98b278ea09934700ca2e8f03650ea19be1fd1.zip |
Fix enet version check
Reviewed-by: Chuck Miller
-rw-r--r-- | src/net/connection.cpp | 10 | ||||
-rw-r--r-- | src/net/connectionhandler.cpp | 8 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/net/connection.cpp b/src/net/connection.cpp index ceed6f02..42751050 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 986d9dec..314eb0f7 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 */, |