Remove explicit line numbers from update rule reports.

Additions/removals by other rules in the set will almost certainly
invalidate these.  Reporting the block and file is the best we can
reasonably do.
This commit is contained in:
Paul Chote
2018-04-28 18:49:46 +01:00
committed by abcdefg30
parent 677d004cfa
commit 8c2f25e249
4 changed files with 37 additions and 41 deletions

View File

@@ -26,34 +26,23 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
}
}
readonly List<MiniYamlNode.SourceLocation> locations = new List<MiniYamlNode.SourceLocation>();
public override IEnumerable<string> BeforeUpdate(ModData modData)
{
// Reset state for each mod/map
locations.Clear();
yield break;
}
readonly List<string> locations = new List<string>();
public override IEnumerable<string> AfterUpdate(ModData modData)
{
if (locations.Any())
yield return "The automatic exclusion of harvesters from AI squads has been removed.\n"
+ "You may wish to add your harvester-type actors to `ExcludeFromSquads` under `UnitCommonNames`\n"
+ "at the following locations.\n"
+ UpdateUtils.FormatMessageList(locations.Select(l => l.ToString()));
+ "on the following definitions:\n"
+ UpdateUtils.FormatMessageList(locations);
locations.Clear();
}
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
foreach (var hackyAINode in actorNode.ChildrenMatching("HackyAI"))
{
var commonNamesNode = hackyAINode.LastChildMatching("UnitsCommonNames");
if (commonNamesNode != null)
locations.Add(commonNamesNode.Location);
else
locations.Add(hackyAINode.Location);
}
locations.Add("{0} ({1})".F(hackyAINode.Key, hackyAINode.Location.Filename));
yield break;
}