working on letting _any_ actor be a production-queue. (chrome still needs work)

This commit is contained in:
Bob
2009-12-15 22:59:48 +13:00
parent 47d5b8508c
commit e505726a8b
7 changed files with 86 additions and 73 deletions

View File

@@ -35,9 +35,6 @@ namespace OpenRa.Game
this.Ore = 0;
this.DisplayCash = 0;
this.powerProvided = this.powerDrained = 0;
foreach( var cat in Rules.Categories.Keys )
ProductionInit( cat );
}
void UpdatePower()
@@ -127,10 +124,6 @@ namespace OpenRa.Game
{
UpdatePower();
foreach( var p in production )
if( p.Value != null )
p.Value.Tick( this );
if (this == Game.LocalPlayer)
{
var totalMoney = Cash + Ore;
@@ -149,37 +142,5 @@ namespace OpenRa.Game
}
}
}
// Key: Production category. Categories are: Building, Infantry, Vehicle, Ship, Plane (and one per super, if they're done in here)
readonly Dictionary<string, ProductionItem> production = new Dictionary<string, ProductionItem>();
public void ProductionInit( string category )
{
production.Add( category, null );
}
public ProductionItem Producing( string category )
{
return production[ category ];
}
public void CancelProduction( string category )
{
var item = production[ category ];
if( item == null ) return;
GiveCash( item.TotalCost - item.RemainingCost ); // refund what's been paid so far.
FinishProduction( category );
}
public void FinishProduction( string category )
{
production[ category ] = null;
}
public void BeginProduction( string group, ProductionItem item )
{
if( production[ group ] != null ) return;
production[ group ] = item;
}
}
}