From 29be79e852b1b48b6f659876b8f1644890a4e9c3 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 19 Jun 2018 00:37:52 +0300 Subject: [PATCH 1/2] [General] Switch RakNet enums to CrabNet enums CrabNet is TES3MP's fork of RakNet that has deviated too far from RakNet to still be compatible with it. --- apps/openmw-mp/Networking.cpp | 2 +- apps/openmw-mp/main.cpp | 4 ++-- apps/openmw/mwmp/Networking.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index 7a0339c81..57e44c628 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -292,7 +292,7 @@ void Networking::newPlayer(RakNet::RakNetGUID guid) if (pl->first == guid) continue; // If an invalid key makes it into the Players map, ignore it - else if (pl->first == RakNet::UNASSIGNED_RAKNET_GUID) continue; + else if (pl->first == RakNet::UNASSIGNED_CRABNET_GUID) continue; // if player not fully connected else if (pl->second == nullptr) continue; diff --git a/apps/openmw-mp/main.cpp b/apps/openmw-mp/main.cpp index f9c490a08..1e69f6542 100644 --- a/apps/openmw-mp/main.cpp +++ b/apps/openmw-mp/main.cpp @@ -239,9 +239,9 @@ int main(int argc, char *argv[]) switch (peer->Startup((unsigned) players, &sd, 1)) { - case RakNet::RAKNET_STARTED: + case RakNet::CRABNET_STARTED: break; - case RakNet::RAKNET_ALREADY_STARTED: + case RakNet::CRABNET_ALREADY_STARTED: throw runtime_error("Already started"); case RakNet::INVALID_SOCKET_DESCRIPTORS: throw runtime_error("Incorrect port or address"); diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index b4714a922..7e4bc8d30 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -203,7 +203,7 @@ Networking::Networking(): peer(RakNet::RakPeerInterface::GetInstance()), playerP RakNet::SocketDescriptor sd; sd.port=0; auto b = peer->Startup(1, &sd, 1); - RakAssert(b==RakNet::RAKNET_STARTED); + RakAssert(b==RakNet::CRABNET_STARTED); playerPacketController.SetStream(0, &bsOut); actorPacketController.SetStream(0, &bsOut); From 5b461b09ca29c9b311e367f4dc8c1bd65d0e6d07 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 19 Jun 2018 05:24:26 +0300 Subject: [PATCH 2/2] [Client] Display error when receiving ID_INCOMPATIBLE_PROTOCOL_VERSION --- apps/openmw/mwmp/Networking.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 7e4bc8d30..3b54f15ff 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -305,6 +305,13 @@ void Networking::connect(const std::string &ip, unsigned short port, std::vector queue = false; break; } + case ID_INCOMPATIBLE_PROTOCOL_VERSION: + { + errmsg = "Network protocol mismatch!\nMake sure your client is really on the same version\n" + "as the server you are trying to connect to."; + queue = false; + break; + } case ID_CONNECTION_REQUEST_ACCEPTED: { serverAddr = packet->systemAddress;