more fixes

This commit is contained in:
Chris Forbes
2010-01-12 16:33:03 +13:00
parent 4ddf03fc64
commit 09517acf18
4 changed files with 8 additions and 8 deletions

View File

@@ -84,9 +84,8 @@ namespace OpenRa.Game
{
OreCapacity = Game.world.Actors
.Where(a => a.Owner == this && a.traits.Contains<StoresOre>())
.Select(a => a.LegacyInfo as LegacyBuildingInfo)
.Where(b => b != null)
.Sum(b => b.Storage);
.Select(a => a.Info.Traits.Get<StoresOreInfo>())
.Sum(b => b.Capacity);
}
void GiveAdvice(string advice)

View File

@@ -48,7 +48,7 @@ namespace OpenRa.Game.Traits
public bool IsFull(Actor self)
{
return cargo.Count == self.LegacyInfo.Passengers;
return cargo.Count == self.Info.Traits.Get<CargoInfo>().Passengers;
}
public bool IsEmpty(Actor self)
@@ -65,7 +65,8 @@ namespace OpenRa.Game.Traits
public IEnumerable<PipType> GetPips( Actor self )
{
for (var i = 0; i < self.Info.Traits.Get<CargoInfo>().Passengers; i++)
var numPips = self.Info.Traits.Get<CargoInfo>().Passengers;
for (var i = 0; i < numPips; i++)
if (i >= cargo.Count)
yield return PipType.Transparent;
else

View File

@@ -86,12 +86,12 @@ namespace OpenRa.Game.Traits
}
// Cancel existing primaries
foreach (var p in (self.LegacyInfo as LegacyBuildingInfo).Produces)
foreach (var p in self.Info.Traits.Get<ProductionInfo>().Produces)
{
foreach (var b in Game.world.Actors.Where(x => x.traits.Contains<Production>()
&& x.Owner == self.Owner
&& x.traits.Get<Production>().IsPrimary == true
&& (x.LegacyInfo as LegacyBuildingInfo).Produces.Contains(p)))
&& (x.Info.Traits.Get<ProductionInfo>().Produces.Contains(p))))
{
b.traits.Get<Production>().SetPrimaryProducer(b, false);
}

View File

@@ -33,7 +33,7 @@ namespace OpenRa.Game.Traits
void DoBib(Actor self, bool isRemove)
{
var buildingInfo = self.traits.Get<Building>().unitInfo;
var buildingInfo = self.Info.Traits.Get<BuildingInfo>();
if (buildingInfo.Bib)
{
var size = buildingInfo.Dimensions.X;