diff --git a/OpenRA.Game/GameInformation.cs b/OpenRA.Game/GameInformation.cs index 377b62e01f..5a730626bc 100644 --- a/OpenRA.Game/GameInformation.cs +++ b/OpenRA.Game/GameInformation.cs @@ -37,7 +37,7 @@ namespace OpenRA public IEnumerable HumanPlayers { get { return Players.Where(p => p.IsHuman); } } public bool IsSinglePlayer { get { return HumanPlayers.Count() == 1; } } - Dictionary playersByRuntime; + readonly Dictionary playersByRuntime; public GameInformation() { @@ -79,9 +79,10 @@ namespace OpenRA public string Serialize() { - var nodes = new List(); - - nodes.Add(new MiniYamlNode("Root", FieldSaver.Save(this))); + var nodes = new List + { + new MiniYamlNode("Root", FieldSaver.Save(this)) + }; for (var i = 0; i < Players.Count; i++) nodes.Add(new MiniYamlNode("Player@{0}".F(i), FieldSaver.Save(Players[i]))); @@ -118,7 +119,7 @@ namespace OpenRA Color = runtimePlayer.Color, Team = client.Team, SpawnPoint = runtimePlayer.SpawnPoint, - IsRandomFaction = runtimePlayer.Faction.InternalName != client.Race, + IsRandomFaction = runtimePlayer.Faction.InternalName != client.Faction, IsRandomSpawnPoint = runtimePlayer.SpawnPoint != client.SpawnPoint }; diff --git a/OpenRA.Game/Network/Session.cs b/OpenRA.Game/Network/Session.cs index 8f0539df57..d687996ac9 100644 --- a/OpenRA.Game/Network/Session.cs +++ b/OpenRA.Game/Network/Session.cs @@ -102,13 +102,13 @@ namespace OpenRA.Network public int Index; public HSLColor PreferredColor; // Color that the client normally uses from settings.yaml. public HSLColor Color; // Actual color that the client is using. Usually the same as PreferredColor but can be different on maps with locked colors. - public string Race; + public string Faction; public int SpawnPoint; public string Name; public string IpAddress; public ClientState State = ClientState.Invalid; public int Team; - public string Slot; // slot ID, or null for observer + public string Slot; // Slot ID, or null for observer public string Bot; // Bot type, null for real clients public int BotControllerClientIndex; // who added the bot to the slot public bool IsAdmin; @@ -118,7 +118,7 @@ namespace OpenRA.Network public MiniYamlNode Serialize() { - return new MiniYamlNode("Client@{0}".F(this.Index), FieldSaver.Save(this)); + return new MiniYamlNode("Client@{0}".F(Index), FieldSaver.Save(this)); } } @@ -141,14 +141,14 @@ namespace OpenRA.Network public MiniYamlNode Serialize() { - return new MiniYamlNode("ClientPing@{0}".F(this.Index), FieldSaver.Save(this)); + return new MiniYamlNode("ClientPing@{0}".F(Index), FieldSaver.Save(this)); } } public class Slot { - public string PlayerReference; // playerReference to bind against. - public bool Closed; // host has explicitly closed this slot. + public string PlayerReference; // PlayerReference to bind against. + public bool Closed; // Host has explicitly closed this slot. public bool AllowBots; public bool LockRace; @@ -164,7 +164,7 @@ namespace OpenRA.Network public MiniYamlNode Serialize() { - return new MiniYamlNode("Slot@{0}".F(this.PlayerReference), FieldSaver.Save(this)); + return new MiniYamlNode("Slot@{0}".F(PlayerReference), FieldSaver.Save(this)); } } diff --git a/OpenRA.Game/Network/UnitOrders.cs b/OpenRA.Game/Network/UnitOrders.cs index 311ed4caa1..0264d37978 100644 --- a/OpenRA.Game/Network/UnitOrders.cs +++ b/OpenRA.Game/Network/UnitOrders.cs @@ -161,7 +161,7 @@ namespace OpenRA.Network Name = Game.Settings.Player.Name, PreferredColor = Game.Settings.Player.Color, Color = Game.Settings.Player.Color, - Race = "Random", + Faction = "Random", SpawnPoint = 0, Team = 0, State = Session.ClientState.Invalid diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index 1805074320..680bc282b1 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -95,8 +95,8 @@ namespace OpenRA Color = client.Color; PlayerName = client.Name; botType = client.Bot; - Faction = ChooseFaction(world, client.Race, !pr.LockFaction); - DisplayFaction = ChooseDisplayFaction(world, client.Race); + Faction = ChooseFaction(world, client.Faction, !pr.LockFaction); + DisplayFaction = ChooseDisplayFaction(world, client.Faction); } else { diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index a808c73f12..dec8dbd783 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -73,7 +73,7 @@ namespace OpenRA.Server return; if (pr.LockFaction) - c.Race = pr.Faction; + c.Faction = pr.Faction; if (pr.LockSpawn) c.SpawnPoint = pr.Spawn; if (pr.LockTeam) @@ -308,7 +308,7 @@ namespace OpenRA.Server Slot = LobbyInfo.FirstEmptySlot(), PreferredColor = handshake.Client.Color, Color = handshake.Client.Color, - Race = "Random", + Faction = "Random", SpawnPoint = 0, Team = 0, State = Session.ClientState.Invalid, diff --git a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs index ffa18b3719..2ff1bb7809 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs @@ -277,7 +277,7 @@ namespace OpenRA.Mods.Common.Server Name = botType, Bot = botType, Slot = parts[0], - Race = "Random", + Faction = "Random", SpawnPoint = 0, Team = 0, State = Session.ClientState.NotReady, @@ -752,7 +752,7 @@ namespace OpenRA.Mods.Common.Server if (server.LobbyInfo.Slots[targetClient.Slot].LockRace) return true; - targetClient.Race = parts[1]; + targetClient.Faction = parts[1]; server.SyncLobbyClients(); return true; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index 29c090f4e5..22a02be168 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic Func setupItem = (race, itemTemplate) => { var item = ScrollItemWidget.Setup(itemTemplate, - () => client.Race == race, + () => client.Faction == race, () => orderManager.IssueOrder(Order.Command("race {0} {1}".F(client.Index, race)))); var faction = factions[race]; item.Get("LABEL").GetText = () => faction.Name; @@ -400,7 +400,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var dropdown = parent.Get("FACTION"); dropdown.IsDisabled = () => s.LockRace || orderManager.LocalClient.IsReady; dropdown.OnMouseDown = _ => ShowRaceDropDown(dropdown, c, orderManager, factions); - var factionDescription = factions[c.Race].Description; + var factionDescription = factions[c.Faction].Description; dropdown.GetTooltipText = () => factionDescription; SetupFactionWidget(dropdown, s, c, factions); } @@ -409,9 +409,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic Dictionary factions) { var factionName = parent.Get("FACTIONNAME"); - factionName.GetText = () => factions[c.Race].Name; + factionName.GetText = () => factions[c.Faction].Name; var factionFlag = parent.Get("FACTIONFLAG"); - factionFlag.GetImageName = () => c.Race; + factionFlag.GetImageName = () => c.Faction; factionFlag.GetImageCollection = () => "flags"; } diff --git a/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs b/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs index 8f6e3610a1..bf83048d7e 100644 --- a/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs +++ b/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Widgets ClientIndex = client.Index; PlayerName = client.Name; Team = client.Team; - Faction = client.Race; + Faction = client.Faction; SpawnPoint = client.SpawnPoint; }