Fix most of the style violations in Game.cs.

This commit is contained in:
Paul Chote
2013-12-18 21:41:12 +13:00
parent ff5cbc65c5
commit b96c36f38f

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -81,7 +81,6 @@ namespace OpenRA
static ConnectionState lastConnectionState = ConnectionState.PreConnecting; static ConnectionState lastConnectionState = ConnectionState.PreConnecting;
public static int LocalClientId { get { return orderManager.Connection.LocalClientId; } } public static int LocalClientId { get { return orderManager.Connection.LocalClientId; } }
// Hacky workaround for orderManager visibility // Hacky workaround for orderManager visibility
public static Widget OpenWindow(World world, string widget) public static Widget OpenWindow(World world, string widget)
{ {
@@ -249,9 +248,9 @@ namespace OpenRA
{ {
get get
{ {
var client= orderManager.LobbyInfo.ClientWithIndex( var id = orderManager.Connection.LocalClientId;
orderManager.Connection.LocalClientId); var client = orderManager.LobbyInfo.ClientWithIndex(id);
return ((client!=null) && client.IsAdmin); return client != null && client.IsAdmin;
} }
} }
@@ -302,6 +301,7 @@ namespace OpenRA
Console.WriteLine("Renderer initialization failed. Fallback in place. Check graphics.log for details."); Console.WriteLine("Renderer initialization failed. Fallback in place. Check graphics.log for details.");
} }
} }
Renderer = new Renderer(); Renderer = new Renderer();
try try
@@ -323,11 +323,7 @@ namespace OpenRA
InitializeWithMod(Settings.Game.Mod); InitializeWithMod(Settings.Game.Mod);
if (Settings.Server.DiscoverNatDevices) if (Settings.Server.DiscoverNatDevices)
{ RunAfterDelay(Settings.Server.NatDiscoveryTimeout, UPnP.TryStoppingNatDiscovery);
RunAfterDelay(Settings.Server.NatDiscoveryTimeout, () =>
UPnP.TryStoppingNatDiscovery()
);
}
} }
public static void InitializeWithMod(string mod) public static void InitializeWithMod(string mod)
@@ -378,21 +374,23 @@ namespace OpenRA
{ {
System.Threading.Thread.Sleep(100); System.Threading.Thread.Sleep(100);
if ((server.State == Server.ServerState.GameStarted) if (server.State == Server.ServerState.GameStarted && server.Conns.Count <= 1)
&& (server.Conns.Count<=1))
{ {
Console.WriteLine("No one is playing, shutting down..."); Console.WriteLine("No one is playing, shutting down...");
server.Shutdown(); server.Shutdown();
break; break;
} }
} }
if (Settings.Server.DedicatedLoop) if (Settings.Server.DedicatedLoop)
{ {
Console.WriteLine("Starting a new server instance..."); Console.WriteLine("Starting a new server instance...");
continue; continue;
} }
break; break;
} }
Environment.Exit(0); Environment.Exit(0);
} }
else else
@@ -453,7 +451,7 @@ namespace OpenRA
public static void Debug(string s, params object[] args) public static void Debug(string s, params object[] args)
{ {
AddChatLine(Color.White, "Debug", String.Format(s,args)); AddChatLine(Color.White, "Debug", string.Format(s, args));
} }
public static void Disconnect() public static void Disconnect()