Complain more informatively about incorrect ENet versions

This was SVN commit r7897.
This commit is contained in:
Ykkrosh 2010-08-10 21:49:33 +00:00
parent 08cdb0b9c2
commit 4f1b7bb0e6
6 changed files with 43 additions and 10 deletions

View File

@ -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 <enet/enet.h>
#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

View File

@ -19,11 +19,10 @@
#include "NetHost.h"
#include "lib/external_libraries/enet.h"
#include "network/NetMessage.h"
#include "ps/CLogger.h"
#include <enet/enet.h>
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();
}
}

View File

@ -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 <enet/enet.h>
#define DEFAULT_SERVER_NAME L"Unnamed Server"
#define DEFAULT_WELCOME_MESSAGE L"Welcome"
#define MAX_CLIENTS 8

View File

@ -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 <enet/enet.h>
static const int CHANNEL_COUNT = 1;
CNetClientSession::CNetClientSession(CNetClient& client) :

View File

@ -19,7 +19,7 @@
#include "NetStats.h"
#include <enet/enet.h>
#include "lib/external_libraries/enet.h"
enum
{

View File

@ -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 <enet/enet.h>
class TestNetComms : public CxxTest::TestSuite
{
public: