fixed crashbug wrt FACT not being Buildable

This commit is contained in:
Bob
2010-01-12 23:34:05 +13:00
parent cecc163e52
commit 7c2baa75bb

View File

@@ -38,9 +38,8 @@ namespace OpenRa.Game.GameRules
return false;
foreach( var p in bi.Prerequisites )
if (Rules.NewUnitInfo[p.ToLowerInvariant()].Traits.Get<BuildableInfo>().Owner.Any(x => x == player.Race))
if( playerBuildings[ p ].Count == 0 )
return false;
if( playerBuildings[ p ].Count == 0 )
return false;
if( producesIndex[ Rules.UnitCategory[ info.Name ] ].All( x => playerBuildings[ x.Name ].Count == 0 ) )
return false;
@@ -58,8 +57,7 @@ namespace OpenRa.Game.GameRules
public IEnumerable<string> AllItems(Player player, params string[] categories)
{
return categories.SelectMany(x => Rules.Categories[x]).Select(x => Rules.NewUnitInfo[x].Name)
.Where(x => Rules.NewUnitInfo[x].Traits.Get<BuildableInfo>().Owner.Contains(player.Race)); /* todo: fix for dual-race scenarios (captured buildings) */
return categories.SelectMany(x => Rules.Categories[x]).Select(x => Rules.NewUnitInfo[x].Name);
}
public IEnumerable<NewUnitInfo> UnitBuiltAt( NewUnitInfo info )