From da5c70184ebe3ebf1077ba7fa82f9ccb04b18e48 Mon Sep 17 00:00:00 2001 From: rob-v Date: Sun, 18 Jun 2017 13:08:26 +0200 Subject: [PATCH] Refactor RefreshServerListInner's games+lanGames argument --- OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs index 913df4f307..2fbbb2a4f8 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs @@ -356,9 +356,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic } } - lanGames = lanGames.GroupBy(gs => gs.Address).Select(g => g.Last()).ToList(); + var groupedLanGames = lanGames.GroupBy(gs => gs.Address).Select(g => g.Last()); + if (games != null) + games.AddRange(groupedLanGames); + else if (groupedLanGames.Any()) + games = groupedLanGames.ToList(); - Game.RunAfterTick(() => RefreshServerListInner(games == null ? (lanGames.Count == 0 ? null : lanGames.ToList()) : games.Concat(lanGames).ToList())); + Game.RunAfterTick(() => RefreshServerListInner(games)); }; var queryURL = services.ServerList + "games?version={0}&mod={1}&modversion={2}".F(