Files
OpenRA/OpenRA.Mods.RA/Lint/CheckSequences.cs
Matthias Mailänder cb43581c91 also check map.yaml Sequences:
closes #4765
2014-03-03 15:52:56 +01:00

36 lines
1.1 KiB
C#

#region Copyright & License Information
/*
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class CheckSequences : ILintPass
{
public void Run(Action<string> emitError, Action<string> emitWarning, Map map)
{
var sequences = MiniYaml.MergeLiberal(map.Sequences,
Game.modData.Manifest.Sequences.Select(s => MiniYaml.FromFile(s))
.Aggregate(MiniYaml.MergeLiberal));
foreach (var actorInfo in Rules.Info)
foreach (var renderInfo in actorInfo.Value.Traits.WithInterface<RenderSimpleInfo>())
{
var image = renderInfo.Image ?? actorInfo.Value.Name;
if (!sequences.Any(s => s.Key == image.ToLower()) && !actorInfo.Value.Name.Contains("^"))
emitWarning("Sprite image {0} from actor {1} has no sequence definition.".F(image, actorInfo.Value.Name));
}
}
}
}