From 1d49c23af00764ad08342dc19804827c019a83fa Mon Sep 17 00:00:00 2001 From: penev92 Date: Sun, 5 Jul 2015 23:08:49 +0300 Subject: [PATCH] Rename PlayerReference.Race and LockRace to Faction and LockFaction --- OpenRA.Game/Map/MapPlayers.cs | 6 +++--- OpenRA.Game/Map/PlayerReference.cs | 12 ++++++------ OpenRA.Game/Player.cs | 6 +++--- OpenRA.Game/Server/Server.cs | 4 ++-- OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs | 2 +- OpenRA.Mods.Common/Lint/CheckPlayers.cs | 4 ++-- .../Scripting/Properties/PlayerProperties.cs | 2 +- OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs | 2 +- OpenRA.Mods.Common/Traits/World/CreateMPPlayers.cs | 2 +- OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs | 2 +- .../Traits/World/EditorActorPreview.cs | 4 ++-- .../UtilityCommands/LegacyMapImporter.cs | 2 +- OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs | 2 +- .../Widgets/Logic/Editor/ActorSelectorLogic.cs | 2 +- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/OpenRA.Game/Map/MapPlayers.cs b/OpenRA.Game/Map/MapPlayers.cs index 61eed5d90e..1bf44d0321 100644 --- a/OpenRA.Game/Map/MapPlayers.cs +++ b/OpenRA.Game/Map/MapPlayers.cs @@ -37,7 +37,7 @@ namespace OpenRA "Neutral", new PlayerReference { Name = "Neutral", - Race = firstRace, + Faction = firstRace, OwnsWorld = true, NonCombatant = true } @@ -46,7 +46,7 @@ namespace OpenRA "Creeps", new PlayerReference { Name = "Creeps", - Race = firstRace, + Faction = firstRace, NonCombatant = true, Enemies = Exts.MakeArray(playerCount, i => "Multi{0}".F(i)) } @@ -58,7 +58,7 @@ namespace OpenRA var p = new PlayerReference { Name = "Multi{0}".F(index), - Race = "Random", + Faction = "Random", Playable = true, Enemies = new[] { "Creeps" } }; diff --git a/OpenRA.Game/Map/PlayerReference.cs b/OpenRA.Game/Map/PlayerReference.cs index c77da7606c..9a6b56bce8 100644 --- a/OpenRA.Game/Map/PlayerReference.cs +++ b/OpenRA.Game/Map/PlayerReference.cs @@ -16,17 +16,17 @@ namespace OpenRA { public string Name; public string Palette; - public bool OwnsWorld = false; - public bool NonCombatant = false; - public bool Playable = false; - public bool Spectating = false; public string Bot = null; public string StartingUnitsClass = null; public bool AllowBots = true; + public bool Playable = false; public bool Required = false; + public bool OwnsWorld = false; + public bool Spectating = false; + public bool NonCombatant = false; - public bool LockRace = false; - public string Race; + public bool LockFaction = false; + public string Faction; // ColorRamp naming retained for backward compatibility public bool LockColor = false; diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index 08ca34656b..22228f796e 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -95,7 +95,7 @@ namespace OpenRA Color = client.Color; PlayerName = client.Name; botType = client.Bot; - Country = ChooseCountry(world, client.Race, !pr.LockRace); + Country = ChooseCountry(world, client.Race, !pr.LockFaction); DisplayCountry = ChooseDisplayCountry(world, client.Race); } else @@ -108,8 +108,8 @@ namespace OpenRA Playable = pr.Playable; Spectating = pr.Spectating; botType = pr.Bot; - Country = ChooseCountry(world, pr.Race, false); - DisplayCountry = ChooseDisplayCountry(world, pr.Race); + Country = ChooseCountry(world, pr.Faction, false); + DisplayCountry = ChooseDisplayCountry(world, pr.Faction); } PlayerActor = world.CreateActor("Player", new TypeDictionary { new OwnerInit(this) }); diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 77340ce70d..8749111ea8 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -72,8 +72,8 @@ namespace OpenRA.Server if (pr == null) return; - if (pr.LockRace) - c.Race = pr.Race; + if (pr.LockFaction) + c.Race = pr.Faction; if (pr.LockSpawn) c.SpawnPoint = pr.Spawn; if (pr.LockTeam) diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs index ee4436a73e..e8a1d720a7 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs @@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Widgets td.Add(new FacingInit(facing)); td.Add(new TurretFacingInit(facing)); td.Add(new OwnerInit(owner.Name)); - td.Add(new RaceInit(owner.Race)); + td.Add(new RaceInit(owner.Faction)); preview.SetPreview(actor, td); var ios = actor.Traits.GetOrDefault(); diff --git a/OpenRA.Mods.Common/Lint/CheckPlayers.cs b/OpenRA.Mods.Common/Lint/CheckPlayers.cs index fca834d303..fcf0118e1a 100644 --- a/OpenRA.Mods.Common/Lint/CheckPlayers.cs +++ b/OpenRA.Mods.Common/Lint/CheckPlayers.cs @@ -40,8 +40,8 @@ namespace OpenRA.Mods.Common.Lint 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)); + if (!string.IsNullOrWhiteSpace(player.Faction) && !races.Contains(player.Faction)) + emitError("Invalid race {0} chosen for player {1}.".F(player.Faction, player.Name)); if (worldActor.Traits.Contains()) { diff --git a/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs index e5841b1596..02066913a3 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Scripting public HSLColor Color { get { return Player.Color; } } [Desc("The player's race.")] - public string Race { get { return Player.PlayerReference.Race; } } + public string Race { get { return Player.PlayerReference.Faction; } } [Desc("The player's spawnpoint ID.")] public int Spawn { get { return Player.SpawnPoint; } } diff --git a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs index 2a1c2304e1..71e8bf7f83 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs @@ -897,7 +897,7 @@ namespace OpenRA.Mods.Common.Server PlayerReference = pr.Name, Closed = false, AllowBots = pr.AllowBots, - LockRace = pr.LockRace, + LockRace = pr.LockFaction, LockColor = pr.LockColor, LockTeam = pr.LockTeam, LockSpawn = pr.LockSpawn, diff --git a/OpenRA.Mods.Common/Traits/World/CreateMPPlayers.cs b/OpenRA.Mods.Common/Traits/World/CreateMPPlayers.cs index 48dc63019a..3d3a4b7bcc 100644 --- a/OpenRA.Mods.Common/Traits/World/CreateMPPlayers.cs +++ b/OpenRA.Mods.Common/Traits/World/CreateMPPlayers.cs @@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits Name = "Everyone", NonCombatant = true, Spectating = true, - Race = "Random", + Faction = "Random", Allies = w.Players.Where(p => !p.NonCombatant && p.Playable).Select(p => p.InternalName).ToArray() })); diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs index 8f717b69a9..8c956627e1 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs @@ -178,7 +178,7 @@ namespace OpenRA.Mods.Common.Traits var pr = new PlayerReference { Name = "Multi{0}".F(index), - Race = "Random", + Faction = "Random", Playable = true, Enemies = new[] { "Creeps" } }; diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs index 9ee059e964..b101940746 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits this.worldRenderer = worldRenderer; if (!actor.InitDict.Contains()) - actor.InitDict.Add(new RaceInit(owner.Race)); + actor.InitDict.Add(new RaceInit(owner.Faction)); if (!actor.InitDict.Contains()) actor.InitDict.Add(new OwnerInit(owner.Name)); @@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits Func saveInit = init => { var race = init as RaceInit; - if (race != null && race.Race == Owner.Race) + if (race != null && race.Race == Owner.Faction) return false; // TODO: Other default values will need to be filtered diff --git a/OpenRA.Mods.Common/UtilityCommands/LegacyMapImporter.cs b/OpenRA.Mods.Common/UtilityCommands/LegacyMapImporter.cs index e7d1f24007..9cf4f76163 100644 --- a/OpenRA.Mods.Common/UtilityCommands/LegacyMapImporter.cs +++ b/OpenRA.Mods.Common/UtilityCommands/LegacyMapImporter.cs @@ -500,7 +500,7 @@ namespace OpenRA.Mods.Common.UtilityCommands Name = section, OwnsWorld = section == "Neutral", NonCombatant = section == "Neutral", - Race = race, + Faction = race, Color = namedColorMapping[c] }; diff --git a/OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs index 26fa32c46b..0724e535d8 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var td = new TypeDictionary(); td.Add(new HideBibPreviewInit()); td.Add(new OwnerInit(world.WorldActor.Owner)); - td.Add(new RaceInit(world.WorldActor.Owner.PlayerReference.Race)); + td.Add(new RaceInit(world.WorldActor.Owner.PlayerReference.Faction)); if (preview != null) preview.SetPreview(actor, td); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs index 40cff401cf..74772978ab 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs @@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic td.Add(new TurretFacingInit(92)); td.Add(new HideBibPreviewInit()); td.Add(new OwnerInit(selectedOwner.Name)); - td.Add(new RaceInit(selectedOwner.Race)); + td.Add(new RaceInit(selectedOwner.Faction)); try {