From c4d10f56375401b6e53b852bbb75a70471fd85f4 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 25 Sep 2011 14:57:54 +1300 Subject: [PATCH] start similarly tidying CncServerBrowserLogic --- .../Widgets/Logic/CncServerBrowserLogic.cs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncServerBrowserLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncServerBrowserLogic.cs index 12afa2d042..d80b9a7f83 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncServerBrowserLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncServerBrowserLogic.cs @@ -22,13 +22,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic GameServer currentServer; ScrollItemWidget serverTemplate; bool refreshing; - enum SearchStatus - { - Fetching, - Failed, - NoGames, - Hidden - } + + enum SearchStatus { Fetching, Failed, NoGames, Hidden } SearchStatus searchStatus = SearchStatus.Fetching; public string ProgressLabelText() @@ -73,8 +68,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic if (currentServer == null) return; - string host = currentServer.Address.Split(':')[0]; - int port = int.Parse(currentServer.Address.Split(':')[1]); + var host = currentServer.Address.Split(':')[0]; + var port = int.Parse(currentServer.Address.Split(':')[1]); Widget.CloseWindow(); CncConnectingLogic.Connect(host, port, openLobby, onExit); @@ -151,8 +146,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic } searchStatus = SearchStatus.Hidden; + currentServer = gamesWaiting.FirstOrDefault(); - int i = 0; foreach (var loop in gamesWaiting) { var game = loop; @@ -165,9 +160,6 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic item.GetWidget("PLAYERS").GetText = () => GetPlayersLabel(game); item.GetWidget("IP").GetText = () => game.Address; sl.AddChild(item); - - if (i == 0) currentServer = game; - i++; } } }