Rewrite sequence linting / missing file handling.

- Distinguish between missing sequences and missing sprites
- Lint default sequences as well as maps
- Improved performance
- Correctly handle null images
This commit is contained in:
Paul Chote
2020-08-12 23:53:22 +01:00
committed by abcdefg30
parent b8e60ca8ec
commit 7803686aec
21 changed files with 177 additions and 180 deletions

View File

@@ -41,7 +41,6 @@ namespace OpenRA.Graphics
public interface ISpriteSequenceLoader
{
Action<string> OnMissingSpriteError { get; set; }
IReadOnlyDictionary<string, ISpriteSequence> ParseSequences(ModData modData, TileSet tileSet, SpriteCache cache, MiniYamlNode node);
}
@@ -79,6 +78,8 @@ namespace OpenRA.Graphics
return seq;
}
public IEnumerable<string> Images { get { return sequences.Value.Keys; } }
public bool HasSequence(string unitName)
{
return sequences.Value.ContainsKey(unitName);
@@ -104,10 +105,11 @@ namespace OpenRA.Graphics
{
var nodes = MiniYaml.Load(fileSystem, modData.Manifest.Sequences, additionalSequences);
var items = new Dictionary<string, UnitSequences>();
foreach (var n in nodes)
foreach (var node in nodes)
{
// Work around the loop closure issue in older versions of C#
var node = n;
// Nodes starting with ^ are inheritable but never loaded directly
if (node.Key.StartsWith(ActorInfo.AbstractActorPrefix, StringComparison.Ordinal))
continue;
var key = node.Value.ToLines(node.Key).JoinWith("|");