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 OreCapacity = Game.world.Actors
.Where(a => a.Owner == this && a.traits.Contains<StoresOre>()) .Where(a => a.Owner == this && a.traits.Contains<StoresOre>())
.Select(a => a.LegacyInfo as LegacyBuildingInfo) .Select(a => a.Info.Traits.Get<StoresOreInfo>())
.Where(b => b != null) .Sum(b => b.Capacity);
.Sum(b => b.Storage);
} }
void GiveAdvice(string advice) void GiveAdvice(string advice)

View File

@@ -48,7 +48,7 @@ namespace OpenRa.Game.Traits
public bool IsFull(Actor self) 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) public bool IsEmpty(Actor self)
@@ -65,7 +65,8 @@ namespace OpenRa.Game.Traits
public IEnumerable<PipType> GetPips( Actor self ) 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) if (i >= cargo.Count)
yield return PipType.Transparent; yield return PipType.Transparent;
else else

View File

@@ -86,12 +86,12 @@ namespace OpenRa.Game.Traits
} }
// Cancel existing primaries // 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>() foreach (var b in Game.world.Actors.Where(x => x.traits.Contains<Production>()
&& x.Owner == self.Owner && x.Owner == self.Owner
&& x.traits.Get<Production>().IsPrimary == true && 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); b.traits.Get<Production>().SetPrimaryProducer(b, false);
} }

View File

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