diff --git a/OpenRa.Game/Graphics/Animation.cs b/OpenRa.Game/Graphics/Animation.cs index a1025befbe..563f1d478e 100644 --- a/OpenRa.Game/Graphics/Animation.cs +++ b/OpenRa.Game/Graphics/Animation.cs @@ -13,7 +13,6 @@ namespace OpenRa.Game.Graphics public Animation( string name ) { this.name = name.ToLowerInvariant(); - // Play( "idle" ); } public Sprite Image diff --git a/OpenRa.Game/Graphics/Sequence.cs b/OpenRa.Game/Graphics/Sequence.cs index b46f66c893..ff78034bc9 100644 --- a/OpenRa.Game/Graphics/Sequence.cs +++ b/OpenRa.Game/Graphics/Sequence.cs @@ -7,6 +7,7 @@ namespace OpenRa.Game.Graphics { readonly int start, length; + public readonly string Name; public int Start { get { return start; } } public int End { get { return start + length; } } public int Length { get { return length; } } @@ -14,6 +15,7 @@ namespace OpenRa.Game.Graphics public Sequence(string unit, XmlElement e) { string srcOverride = e.GetAttribute("src"); + Name = e.GetAttribute("name"); Range src = UnitSheetBuilder.GetUnit( string.IsNullOrEmpty(srcOverride) ? unit : srcOverride); diff --git a/OpenRa.Game/Graphics/SequenceProvider.cs b/OpenRa.Game/Graphics/SequenceProvider.cs index 79cfad0b69..848e8e0920 100644 --- a/OpenRa.Game/Graphics/SequenceProvider.cs +++ b/OpenRa.Game/Graphics/SequenceProvider.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Xml; +using System.Linq; using OpenRa.FileFormats; namespace OpenRa.Game.Graphics @@ -38,11 +39,11 @@ namespace OpenRa.Game.Graphics static void LoadSequencesForUnit(XmlElement eUnit) { string unitName = eUnit.GetAttribute("name"); - Dictionary sequences = new Dictionary(); - - foreach (XmlElement eSequence in eUnit.SelectNodes("./sequence")) - sequences.Add(eSequence.GetAttribute("name"), new Sequence(unitName, eSequence)); - + + var sequences = eUnit.SelectNodes("./sequence").OfType() + .Select(e => new Sequence(unitName, e)) + .ToDictionary(s => s.Name); + units.Add(unitName, sequences); } diff --git a/OpenRa.Game/Traits/Activities/Harvest.cs b/OpenRa.Game/Traits/Activities/Harvest.cs index 5e9c05ada6..9ab9aaa345 100644 --- a/OpenRa.Game/Traits/Activities/Harvest.cs +++ b/OpenRa.Game/Traits/Activities/Harvest.cs @@ -22,10 +22,6 @@ namespace OpenRa.Game.Traits.Activities return; } - /* nothing to do here, either: - * - return to base, if full, or - * - seek out new ore, schedule a move there, and then this activity */ - if (harv.IsFull) PlanReturnToBase(self, mobile); else