removed UnitCategory. removed the last unit-based use of Categories (Categories is still used for weapons)

This commit is contained in:
Bob
2010-01-14 14:30:51 +13:00
parent 73f6d5c71c
commit 8aae1ff7d5
7 changed files with 21 additions and 32 deletions

View File

@@ -33,7 +33,7 @@ namespace OpenRa.Game.Traits
{
case "StartProduction":
{
string group = Rules.UnitCategory[ order.TargetString ];
string group = Rules.NewUnitInfo[ order.TargetString ].Category;
var ui = Rules.NewUnitInfo[ order.TargetString ].Traits.Get<BuildableInfo>();
var time = ui.Cost
* Rules.General.BuildSpeed /* todo: country-specific build speed bonus */
@@ -65,7 +65,7 @@ namespace OpenRa.Game.Traits
}
case "PauseProduction":
{
var producing = CurrentItem( Rules.UnitCategory[ order.TargetString ] );
var producing = CurrentItem( Rules.NewUnitInfo[ order.TargetString ].Category );
if( producing != null && producing.Item == order.TargetString )
producing.Paused = ( order.TargetLocation.X != 0 );
break;
@@ -95,7 +95,7 @@ namespace OpenRa.Game.Traits
public void CancelProduction( string itemName )
{
var category = Rules.UnitCategory[itemName];
var category = Rules.NewUnitInfo[itemName].Category;
var queue = production[ category ];
if (queue.Count == 0) return;
@@ -160,12 +160,12 @@ namespace OpenRa.Game.Traits
// Something went wrong somewhere...
if( producer == null )
{
CancelProduction( Rules.UnitCategory[ name ] );
CancelProduction( newUnitType.Category );
return;
}
if( producer.traits.WithInterface<IProducer>().Any( p => p.Produce( producer, newUnitType ) ) )
FinishProduction( Rules.UnitCategory[ name ] );
FinishProduction( newUnitType.Category );
}
}
}