Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions DXMainClient/DXGUI/Multiplayer/GameLoadingLobbyBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,6 @@ private void BtnLoadGame_LeftClick(object sender, EventArgs e)
return;
}

if (Players.Count != SGPlayers.Count)
{
NotAllPresentNotification();
return;
}

HostStartGame();
}

Expand Down Expand Up @@ -304,21 +298,27 @@ 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;

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);
Expand Down
Loading