Report custom map rule errors in the lint output.

This commit is contained in:
Paul Chote
2018-06-12 18:31:52 +00:00
committed by abcdefg30
parent 15e78332a3
commit 4d664d4f74
3 changed files with 10 additions and 3 deletions

View File

@@ -215,6 +215,7 @@ namespace OpenRA
public Ruleset Rules { get; private set; } public Ruleset Rules { get; private set; }
public bool InvalidCustomRules { get; private set; } public bool InvalidCustomRules { get; private set; }
public Exception InvalidCustomRulesException { get; private set; }
/// <summary> /// <summary>
/// The top-left of the playable area in projected world coordinates /// The top-left of the playable area in projected world coordinates
@@ -405,6 +406,7 @@ namespace OpenRA
{ {
Log.Write("debug", "Failed to load rules for {0} with error {1}", Title, e); Log.Write("debug", "Failed to load rules for {0} with error {1}", Title, e);
InvalidCustomRules = true; InvalidCustomRules = true;
InvalidCustomRulesException = e;
Rules = Ruleset.LoadDefaultsForTileSet(modData, Tileset); Rules = Ruleset.LoadDefaultsForTileSet(modData, Tileset);
} }

View File

@@ -31,9 +31,6 @@ namespace OpenRA.Mods.Common.Lint
if (!map.Categories.Any()) if (!map.Categories.Any())
emitError("Map does not define any categories."); emitError("Map does not define any categories.");
if (map.InvalidCustomRules)
emitError("Map contains invalid custom rules.");
} }
} }
} }

View File

@@ -87,6 +87,14 @@ namespace OpenRA.Mods.Common.UtilityCommands
{ {
Console.WriteLine("Testing map: {0}".F(testMap.Title)); 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. // Run all rule checks on the map if it defines custom rules.
if (testMap.RuleDefinitions != null || testMap.VoiceDefinitions != null || testMap.WeaponDefinitions != null) if (testMap.RuleDefinitions != null || testMap.VoiceDefinitions != null || testMap.WeaponDefinitions != null)
CheckRules(modData, testMap.Rules, testMap); CheckRules(modData, testMap.Rules, testMap);