From 1948e16a3f9e5ac3500e95cc67b558e0be91062e Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Thu, 26 Nov 2009 20:49:54 +1300 Subject: [PATCH] works *without* aftermath again. --- OpenRa.Game/Game.cs | 1 + OpenRa.Game/Graphics/SequenceProvider.cs | 11 +++++++++-- OpenRa.Game/Traits/Activities/DeliverOre.cs | 4 ++-- sequences-aftermath.xml | 20 ++++++++++++++++++++ sequences.xml | 16 ---------------- 5 files changed, 32 insertions(+), 20 deletions(-) create mode 100644 sequences-aftermath.xml diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index 3b3c6716eb..8a7ab9ed7e 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -63,6 +63,7 @@ namespace OpenRa.Game controller = new Controller(); worldRenderer = new WorldRenderer( renderer ); + SequenceProvider.Initialize(useAftermath); viewport = new Viewport( clientSize, Rules.Map.Offset, Rules.Map.Offset + Rules.Map.Size, renderer ); world = new World(); diff --git a/OpenRa.Game/Graphics/SequenceProvider.cs b/OpenRa.Game/Graphics/SequenceProvider.cs index 881c7477a5..e26cecac44 100644 --- a/OpenRa.Game/Graphics/SequenceProvider.cs +++ b/OpenRa.Game/Graphics/SequenceProvider.cs @@ -12,10 +12,17 @@ namespace OpenRa.Game.Graphics static Dictionary cursors = new Dictionary(); - static SequenceProvider() + public static void Initialize( bool useAftermath ) + { + LoadSequenceSource("sequences.xml"); + if (useAftermath) + LoadSequenceSource("sequences-aftermath.xml"); + } + + static void LoadSequenceSource(string filename) { XmlDocument document = new XmlDocument(); - document.Load(FileSystem.Open("sequences.xml")); + document.Load(FileSystem.Open(filename)); foreach (XmlElement eUnit in document.SelectNodes("/sequences/unit")) LoadSequencesForUnit(eUnit); diff --git a/OpenRa.Game/Traits/Activities/DeliverOre.cs b/OpenRa.Game/Traits/Activities/DeliverOre.cs index 89e3e7db4a..c81d6ee416 100644 --- a/OpenRa.Game/Traits/Activities/DeliverOre.cs +++ b/OpenRa.Game/Traits/Activities/DeliverOre.cs @@ -45,8 +45,8 @@ namespace OpenRa.Game.Traits.Activities umt = mobile.GetMovementType(), checkForBlocked = false, }; - var refineries = Game.world.Actors.Where( x => x.unitInfo != null - && x.unitInfo.Name == "proc" && x.Owner == self.Owner ).ToList(); + var refineries = Game.world.Actors.Where( x => x.traits.Contains() + && x.Owner == self.Owner ).ToList(); if( refinery != null ) search.AddInitialCell( refinery.Location + refineryDeliverOffset ); else diff --git a/sequences-aftermath.xml b/sequences-aftermath.xml new file mode 100644 index 0000000000..3ac918ed03 --- /dev/null +++ b/sequences-aftermath.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/sequences.xml b/sequences.xml index ee90cf9a03..b4822c05c7 100644 --- a/sequences.xml +++ b/sequences.xml @@ -520,20 +520,4 @@ - - - - - - - - - - - - - - - -