diff --git a/OpenRA.Game/Map/MapPlayers.cs b/OpenRA.Game/Map/MapPlayers.cs index 61eed5d90e..e6884278b6 100644 --- a/OpenRA.Game/Map/MapPlayers.cs +++ b/OpenRA.Game/Map/MapPlayers.cs @@ -29,7 +29,7 @@ namespace OpenRA public MapPlayers(Ruleset rules, int playerCount) { var firstRace = rules.Actors["world"].Traits - .WithInterface().First(c => c.Selectable).Race; + .WithInterface().First(f => f.Selectable).Race; Players = new Dictionary { diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index d7ea45367c..035ddf3832 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -181,8 +181,8 @@ - + diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index 08ca34656b..e844164396 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -31,14 +31,14 @@ namespace OpenRA public readonly string PlayerName; public readonly string InternalName; - public readonly CountryInfo Country; + public readonly FactionInfo Country; public readonly bool NonCombatant = false; public readonly bool Playable = true; public readonly int ClientIndex; public readonly PlayerReference PlayerReference; // The country (including Random, etc) that was selected in the lobby - public readonly CountryInfo DisplayCountry; + public readonly FactionInfo DisplayCountry; public WinState WinState = WinState.Undefined; public bool IsBot; @@ -51,20 +51,20 @@ namespace OpenRA readonly IFogVisibilityModifier[] fogVisibilities; - CountryInfo ChooseCountry(World world, string name, bool requireSelectable = true) + FactionInfo ChooseCountry(World world, string name, bool requireSelectable = true) { var selectableCountries = world.Map.Rules.Actors["world"].Traits - .WithInterface().Where(c => !requireSelectable || c.Selectable) + .WithInterface().Where(f => !requireSelectable || f.Selectable) .ToList(); - var selected = selectableCountries.FirstOrDefault(c => c.Race == name) + var selected = selectableCountries.FirstOrDefault(f => f.Race == name) ?? selectableCountries.Random(world.SharedRandom); // Don't loop infinite for (var i = 0; i <= 10 && selected.RandomRaceMembers.Any(); i++) { var race = selected.RandomRaceMembers.Random(world.SharedRandom); - selected = selectableCountries.FirstOrDefault(c => c.Race == race); + selected = selectableCountries.FirstOrDefault(f => f.Race == race); if (selected == null) throw new YamlException("Unknown race: {0}".F(race)); @@ -73,12 +73,12 @@ namespace OpenRA return selected; } - CountryInfo ChooseDisplayCountry(World world, string race) + FactionInfo ChooseDisplayCountry(World world, string race) { var countries = world.Map.Rules.Actors["world"].Traits - .WithInterface(); + .WithInterface().ToArray(); - return countries.FirstOrDefault(c => c.Race == race) ?? countries.First(); + return countries.FirstOrDefault(f => f.Race == race) ?? countries.First(); } public Player(World world, Session.Client client, Session.Slot slot, PlayerReference pr) diff --git a/OpenRA.Game/Traits/World/Country.cs b/OpenRA.Game/Traits/World/Faction.cs similarity index 89% rename from OpenRA.Game/Traits/World/Country.cs rename to OpenRA.Game/Traits/World/Faction.cs index 0df8d54247..e1c8fbcbac 100644 --- a/OpenRA.Game/Traits/World/Country.cs +++ b/OpenRA.Game/Traits/World/Faction.cs @@ -11,7 +11,7 @@ namespace OpenRA.Traits { [Desc("Attach this to the `World` actor.")] - public class CountryInfo : TraitInfo + public class FactionInfo : TraitInfo { [Desc("This is the name exposed to the players.")] public readonly string Name = null; @@ -31,5 +31,5 @@ namespace OpenRA.Traits public readonly bool Selectable = true; } - public class Country { /* we're only interested in the Info */ } + public class Faction { /* we're only interested in the Info */ } } diff --git a/OpenRA.Mods.Common/Lint/CheckPlayers.cs b/OpenRA.Mods.Common/Lint/CheckPlayers.cs index fca834d303..dd5689dc8a 100644 --- a/OpenRA.Mods.Common/Lint/CheckPlayers.cs +++ b/OpenRA.Mods.Common/Lint/CheckPlayers.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Lint var worldActor = map.Rules.Actors["world"]; - var races = worldActor.Traits.WithInterface().Select(c => c.Race); + var races = worldActor.Traits.WithInterface().Select(c => c.Race); foreach (var player in players.Values) if (!string.IsNullOrWhiteSpace(player.Race) && !races.Contains(player.Race)) emitError("Invalid race {0} chosen for player {1}.".F(player.Race, player.Name)); diff --git a/OpenRA.Mods.Common/Lint/CheckSequences.cs b/OpenRA.Mods.Common/Lint/CheckSequences.cs index 979c3219c9..f0d4ced841 100644 --- a/OpenRA.Mods.Common/Lint/CheckSequences.cs +++ b/OpenRA.Mods.Common/Lint/CheckSequences.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Lint sequenceDefinitions = MiniYaml.MergeLiberal(map.SequenceDefinitions, Game.ModData.Manifest.Sequences.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal)); - var races = map.Rules.Actors["world"].Traits.WithInterface().Select(c => c.Race); + var races = map.Rules.Actors["world"].Traits.WithInterface().Select(c => c.Race); foreach (var actorInfo in map.Rules.Actors) { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 8f4ab743b9..aeedd1b27b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -144,8 +144,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic colorPreview = lobby.Get("COLOR_MANAGER"); colorPreview.Color = Game.Settings.Player.Color; - foreach (var c in modRules.Actors["world"].Traits.WithInterface()) - countries.Add(c.Race, new LobbyCountry { Selectable = c.Selectable, Name = c.Name, Side = c.Side, Description = c.Description }); + foreach (var f in modRules.Actors["world"].Traits.WithInterface()) + countries.Add(f.Race, new LobbyCountry { Selectable = f.Selectable, Name = f.Name, Side = f.Side, Description = f.Description }); var gameStarting = false; Func configurationDisabled = () => !Game.IsHost || gameStarting ||