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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user