diff --git a/Server/Models/ServerCommunication.cs b/Server/Models/ServerCommunication.cs index 8bfdcc1..afc9a14 100644 --- a/Server/Models/ServerCommunication.cs +++ b/Server/Models/ServerCommunication.cs @@ -18,6 +18,7 @@ namespace Server.Models public List lobbies; private Dictionary> serverClientsInlobbies; public Action newClientAction; + /// /// use a padlock object to make sure the singleton is thread-safe @@ -132,7 +133,8 @@ namespace Server.Models { foreach(ServerClient sc in serverClients) { - if (sc.Username == username) + + if (sc.Username == user.Username) { serverClientsInlobbies[l].Add(sc); break; diff --git a/SharedClientServer/Lobby.cs b/SharedClientServer/Lobby.cs index 6961ca6..06dec00 100644 --- a/SharedClientServer/Lobby.cs +++ b/SharedClientServer/Lobby.cs @@ -41,7 +41,7 @@ namespace Client succes = false; if (_users.Count < _maxPlayers) { - _users.Add(new User(username, 0)); + _users.Add(new User(username, 0,false)); succes = true; } }