From 451e06190f49126f2f37279dbc34888448fdff94 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 3 Feb 2011 08:27:35 +1300 Subject: [PATCH] Sync harvester contents. Add ISync to ProductionQueue. --- OpenRA.Mods.RA/Harvester.cs | 8 ++++++-- OpenRA.Mods.RA/Player/ProductionQueue.cs | 5 ++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.RA/Harvester.cs b/OpenRA.Mods.RA/Harvester.cs index e7e63f39da..1e8be34a1c 100644 --- a/OpenRA.Mods.RA/Harvester.cs +++ b/OpenRA.Mods.RA/Harvester.cs @@ -43,6 +43,12 @@ namespace OpenRA.Mods.RA [Sync] public int2 LastHarvestedCell = int2.Zero; + + [Sync] + public int ContentValue { get { return contents.Sum(c => c.Key.ValuePerUnit*c.Value); } } + + [Sync] + int currentUnloadTicks; readonly HarvesterInfo Info; public Harvester(Actor self, HarvesterInfo info) @@ -82,9 +88,7 @@ namespace OpenRA.Mods.RA else contents[type.info]++; } - // TODO: N-tick harvester unload. // Returns true when unloading is complete - int currentUnloadTicks; public bool TickUnload(Actor self, Actor proc) { if (!proc.IsInWorld) diff --git a/OpenRA.Mods.RA/Player/ProductionQueue.cs b/OpenRA.Mods.RA/Player/ProductionQueue.cs index 2f2338f75c..1918c06c95 100755 --- a/OpenRA.Mods.RA/Player/ProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ProductionQueue.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA public virtual object Create(ActorInitializer init) { return new ProductionQueue(init.self, init.self.Owner.PlayerActor, this); } } - public class ProductionQueue : IResolveOrder, ITick, ITechTreeElement, INotifyCapture + public class ProductionQueue : IResolveOrder, ITick, ITechTreeElement, INotifyCapture, ISync { public readonly Actor self; public ProductionQueueInfo Info; @@ -40,8 +40,7 @@ namespace OpenRA.Mods.RA // A list of things we are currently building public List Queue = new List(); - - + [Sync] public int QueueLength { get { return Queue.Count; } } [Sync]