Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report custom map rule errors in the lint output. #15252

Merged
merged 1 commit into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions OpenRA.Game/Map/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ public class Map : IReadOnlyFileSystem

public Ruleset Rules { get; private set; }
public bool InvalidCustomRules { get; private set; }
public Exception InvalidCustomRulesException { get; private set; }

/// <summary>
/// The top-left of the playable area in projected world coordinates
Expand Down Expand Up @@ -405,6 +406,7 @@ void PostInit()
{
Log.Write("debug", "Failed to load rules for {0} with error {1}", Title, e);
InvalidCustomRules = true;
InvalidCustomRulesException = e;
Rules = Ruleset.LoadDefaultsForTileSet(modData, Tileset);
}

Expand Down
3 changes: 0 additions & 3 deletions OpenRA.Mods.Common/Lint/CheckMapMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public void Run(Action<string> emitError, Action<string> emitWarning, Map map)

if (!map.Categories.Any())
emitError("Map does not define any categories.");

if (map.InvalidCustomRules)
emitError("Map contains invalid custom rules.");
}
}
}
8 changes: 8 additions & 0 deletions OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ void IUtilityCommand.Run(Utility utility, string[] args)
{
Console.WriteLine("Testing map: {0}".F(testMap.Title));

// Lint tests can't be trusted if the map rules are bogus
// so report that problem then skip the tests
if (testMap.InvalidCustomRules)
{
EmitError(testMap.InvalidCustomRulesException.ToString());
continue;
}

// Run all rule checks on the map if it defines custom rules.
if (testMap.RuleDefinitions != null || testMap.VoiceDefinitions != null || testMap.WeaponDefinitions != null)
CheckRules(modData, testMap.Rules, testMap);
Expand Down