diff --git a/source/lib/external_libraries/enet.h b/source/lib/external_libraries/enet.h new file mode 100644 index 0000000000..71b611e137 --- /dev/null +++ b/source/lib/external_libraries/enet.h @@ -0,0 +1,37 @@ +/* Copyright (c) 2010 Wildfire Games + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * bring in ENet header, with version check + */ + +#ifndef INCLUDED_ENET +#define INCLUDED_ENET + +#include + +#if defined(ENET_VERSION_MAJOR) && (ENET_VERSION_MAJOR > 1 || ENET_VERSION_MINOR > 2) +#error The game currently requires ENet 1.2.x. You are using a newer version, which\ + has an incompatible API and network protocol. Please switch to an older version. +#endif + +#endif // #ifndef INCLUDED_ENET diff --git a/source/network/NetHost.cpp b/source/network/NetHost.cpp index 5092ab76fc..c31043ee60 100644 --- a/source/network/NetHost.cpp +++ b/source/network/NetHost.cpp @@ -19,11 +19,10 @@ #include "NetHost.h" +#include "lib/external_libraries/enet.h" #include "network/NetMessage.h" #include "ps/CLogger.h" -#include - bool CNetHost::SendMessage(const CNetMessage* message, ENetPeer* peer, const char* peerName) { ENetPacket* packet = CreatePacket(message); @@ -77,4 +76,4 @@ void CNetHost::Initialize() void CNetHost::Deinitialize() { enet_deinitialize(); -} \ No newline at end of file +} diff --git a/source/network/NetServer.cpp b/source/network/NetServer.cpp index 892a4db036..fd0c81f9f4 100644 --- a/source/network/NetServer.cpp +++ b/source/network/NetServer.cpp @@ -25,12 +25,11 @@ #include "NetStats.h" #include "NetTurnManager.h" +#include "lib/external_libraries/enet.h" #include "ps/CLogger.h" #include "scriptinterface/ScriptInterface.h" #include "simulation2/Simulation2.h" -#include - #define DEFAULT_SERVER_NAME L"Unnamed Server" #define DEFAULT_WELCOME_MESSAGE L"Welcome" #define MAX_CLIENTS 8 diff --git a/source/network/NetSession.cpp b/source/network/NetSession.cpp index 117787e3c9..ae6b316d68 100644 --- a/source/network/NetSession.cpp +++ b/source/network/NetSession.cpp @@ -21,11 +21,10 @@ #include "NetServer.h" #include "NetMessage.h" #include "NetStats.h" +#include "lib/external_libraries/enet.h" #include "ps/CLogger.h" #include "scriptinterface/ScriptInterface.h" -#include - static const int CHANNEL_COUNT = 1; CNetClientSession::CNetClientSession(CNetClient& client) : diff --git a/source/network/NetStats.cpp b/source/network/NetStats.cpp index 880c9de8f1..e4442d27af 100644 --- a/source/network/NetStats.cpp +++ b/source/network/NetStats.cpp @@ -19,7 +19,7 @@ #include "NetStats.h" -#include +#include "lib/external_libraries/enet.h" enum { diff --git a/source/network/tests/test_Net.h b/source/network/tests/test_Net.h index b9ffbd79e1..4d2a3ddd8e 100644 --- a/source/network/tests/test_Net.h +++ b/source/network/tests/test_Net.h @@ -17,6 +17,7 @@ #include "lib/self_test.h" +#include "lib/external_libraries/enet.h" #include "lib/external_libraries/sdl.h" #include "network/NetServer.h" #include "network/NetClient.h" @@ -29,8 +30,6 @@ #include "scriptinterface/ScriptInterface.h" #include "simulation2/Simulation2.h" -#include - class TestNetComms : public CxxTest::TestSuite { public: