diff --git a/DXMainClient/DXGUI/Multiplayer/GameLoadingLobbyBase.cs b/DXMainClient/DXGUI/Multiplayer/GameLoadingLobbyBase.cs index 5884f87a7..69ff71ce8 100644 --- a/DXMainClient/DXGUI/Multiplayer/GameLoadingLobbyBase.cs +++ b/DXMainClient/DXGUI/Multiplayer/GameLoadingLobbyBase.cs @@ -254,12 +254,6 @@ private void BtnLoadGame_LeftClick(object sender, EventArgs e) return; } - if (Players.Count != SGPlayers.Count) - { - NotAllPresentNotification(); - return; - } - HostStartGame(); } @@ -304,10 +298,12 @@ protected void LoadGame() return; spawnIni.SetIntValue("Settings", "Port", localPlayer.Port); + spawnIni.SetIntValue("Settings", "PlayerCount", SGPlayers.Count); - for (int i = 1; i < Players.Count; i++) + for (int i = 1; i < SGPlayers.Count; i++) { - string otherName = spawnIni.GetStringValue("Other" + i, "Name", string.Empty); + string otherSectionName = $"Other{i}"; + string otherName = spawnIni.GetStringValue(otherSectionName, "Name", string.Empty); if (string.IsNullOrEmpty(otherName)) continue; @@ -315,10 +311,14 @@ protected void LoadGame() PlayerInfo otherPlayer = Players.Find(p => p.Name == otherName); if (otherPlayer == null) - continue; - - spawnIni.SetStringValue("Other" + i, "Ip", otherPlayer.IPAddress); - spawnIni.SetIntValue("Other" + i, "Port", otherPlayer.Port); + { + spawnIni.RemoveSection(otherSectionName); // don't connect to missing players + } + else + { + spawnIni.SetStringValue(otherSectionName, "Ip", otherPlayer.IPAddress); + spawnIni.SetIntValue(otherSectionName, "Port", otherPlayer.Port); + } } WriteSpawnIniAdditions(spawnIni);