diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index 4b52f8ccc..e62c4f302 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -432,3 +432,8 @@ unsigned short Networking::NumberOfConnections() const { return peer->NumberOfConnections(); } + +unsigned int Networking::MaxConnections() const +{ + return peer->GetMaximumIncomingConnections(); +} \ No newline at end of file diff --git a/apps/openmw-mp/Networking.hpp b/apps/openmw-mp/Networking.hpp index 62fd77ea6..04399d69a 100644 --- a/apps/openmw-mp/Networking.hpp +++ b/apps/openmw-mp/Networking.hpp @@ -21,6 +21,7 @@ namespace mwmp void KickPlayer(RakNet::RakNetGUID guid); void Update(RakNet::Packet *packet); unsigned short NumberOfConnections() const; + unsigned int MaxConnections() const; int MainLoop(); diff --git a/apps/openmw-mp/Player.cpp b/apps/openmw-mp/Player.cpp index 8716bb047..0982980a5 100644 --- a/apps/openmw-mp/Player.cpp +++ b/apps/openmw-mp/Player.cpp @@ -3,6 +3,7 @@ // #include "Player.hpp" +#include "Networking.hpp" TPlayers Players::players; TSlots Players::slots; @@ -35,7 +36,7 @@ void Players::NewPlayer(RakNet::RakNetGUID id) players[id]->NpcStats()->blank(); players[id]->CreatureStats()->blank(); - for (int i = 0; i < 16; i++) + for (int i = 0; i < mwmp::Networking::Get().MaxConnections(); i++) { if (slots[i] == 0) {