Unit order client != null check fixed (int != null -> always true!) .

Removed if-else branch in favour of sugar construct a?b:c.

Note: One should (at least) consider to move var client = ... to the
start of the switch construct. 4 branches of this switch are using this.
(DRY)
This commit is contained in:
Remco van der Zon
2012-06-06 10:54:21 +02:00
parent 8f981977e0
commit 8ad4e08651

View File

@@ -97,19 +97,13 @@ namespace OpenRA.Network
case "PauseGame":
{
if(clientId != null)
var client = orderManager.LobbyInfo.ClientWithIndex(clientId);
if(client != null)
{
var client = orderManager.LobbyInfo.ClientWithIndex(clientId);
orderManager.GamePaused = !orderManager.GamePaused;
if(orderManager.GamePaused)
{
Game.AddChatLine(Color.White, "", "The game is paused by "+client.Name);
}
else
{
Game.AddChatLine(Color.White, "", "The game is un-paused by "+client.Name);
}
var pausetext = "The game is {0} by {1}".F( orderManager.GamePaused ? "paused" : "un-paused", client.Name );
Game.AddChatLine(Color.White, "", pausetext);
}
break;
}