Report custom map rule errors in the lint output.
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user