Merge pull request #8309 from Mailaender/lint-neutral

Added a lint rule to check if Neutral is set up correctly
This commit is contained in:
Pavel Penev
2015-06-01 02:06:06 +03:00
14 changed files with 13 additions and 28 deletions

View File

@@ -22,22 +22,26 @@ namespace OpenRA.Mods.Common.Lint
var players = new MapPlayers(map.PlayerDefinitions).Players;
var playerNames = players.Values.Select(p => p.Name);
foreach (var player in players)
foreach (var ally in player.Value.Allies)
foreach (var player in players.Values)
{
foreach (var ally in player.Allies)
if (!playerNames.Contains(ally))
emitError("Allies contains player {0} that is not in list.".F(ally));
foreach (var player in players)
foreach (var enemy in player.Value.Enemies)
foreach (var enemy in player.Enemies)
if (!playerNames.Contains(enemy))
emitError("Enemies contains player {0} that is not in list.".F(enemy));
if (player.OwnsWorld && (player.Enemies.Any() || player.Allies.Any()))
emitWarning("The player {0} owning the world should not have any allies or enemies.".F(player.Name));
}
var worldActor = map.Rules.Actors["world"];
var races = worldActor.Traits.WithInterface<CountryInfo>().Select(c => c.Race);
foreach (var player in players)
if (!string.IsNullOrWhiteSpace(player.Value.Race) && player.Value.Race != "Random" && !races.Contains(player.Value.Race))
emitError("Invalid race {0} chosen for player {1}.".F(player.Value.Race, player.Value.Name));
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 (worldActor.Traits.Contains<MPStartLocationsInfo>())
{

View File

@@ -47,7 +47,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: gdi
Enemies: Nod
PlayerReference@GDI:
Name: GDI
Playable: True

View File

@@ -42,7 +42,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: gdi
Enemies: Nod, GDI
PlayerReference@Nod:
Name: Nod
Race: nod

View File

@@ -41,8 +41,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: gdi
Allies: GDI
Enemies: Nod
PlayerReference@GDI:
Name: GDI
Race: gdi

View File

@@ -41,8 +41,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: gdi
Allies: GDI
Enemies: Nod
PlayerReference@GDI:
Name: GDI
Race: gdi

View File

@@ -40,8 +40,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: gdi
Allies: Nod
Enemies: GDI
PlayerReference@NodSupporter:
Name: NodSupporter
NonCombatant: True

View File

@@ -44,8 +44,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: gdi
Allies: GDI
Enemies: Nod
PlayerReference@Nod:
Name: Nod
Playable: True

View File

@@ -48,8 +48,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: gdi
Allies: GDI
Enemies: Nod
PlayerReference@Nod:
Name: Nod
Playable: True

View File

@@ -40,7 +40,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: gdi
Enemies: GDI, Nod
PlayerReference@GDI:
Name: GDI
Playable: False

View File

@@ -46,7 +46,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: gdi
Enemies: Nod, GDI
PlayerReference@Civilians:
Name: Civilians
NonCombatant: True

View File

@@ -28,7 +28,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: atreides
Allies: Atreides
PlayerReference@Atreides:
Name: Atreides
Race: atreides

View File

@@ -45,7 +45,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: allies
Enemies: USSR, Greece, England
PlayerReference@Greece:
Name: Greece
Playable: True
@@ -58,7 +57,7 @@ Players:
LockSpawn: True
LockTeam: True
Allies: England
Enemies: Neutral, USSR
Enemies: USSR
PlayerReference@England:
Name: England
Race: allies

View File

@@ -28,7 +28,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: allies
Allies: Allies
PlayerReference@Creeps:
Name: Creeps
NonCombatant: True
@@ -37,7 +36,6 @@ Players:
Name: Allies
Race: allies
ColorRamp: 161,134,200
Allies: Neutral
Enemies: Soviets
PlayerReference@Soviets:
Name: Soviets

View File

@@ -60,7 +60,6 @@ Players:
OwnsWorld: True
NonCombatant: True
Race: allies
Enemies: Turkey
PlayerReference@Ukraine:
Name: Ukraine
Race: soviet
@@ -71,7 +70,7 @@ Players:
Name: Turkey
Race: soviet
ColorRamp: 14,123,167
Enemies: Greece, BadGuy, USSR, Ukraine, Neutral, Outpost
Enemies: Greece, BadGuy, USSR, Ukraine, Outpost
PlayerReference@Outpost:
Name: Outpost
NonCombatant: True