Only render units our race can build. That FACT prerequisite was unnecessary.

This commit is contained in:
Bob
2010-01-13 00:20:55 +13:00
parent f1bbbac39d
commit ac9e58cf73
5 changed files with 3 additions and 5 deletions

View File

@@ -532,6 +532,7 @@ namespace OpenRa.Game
var allItems = Rules.TechTree.AllItems(Game.LocalPlayer, queueName) var allItems = Rules.TechTree.AllItems(Game.LocalPlayer, queueName)
.Where(a => Rules.NewUnitInfo[a].Traits.Contains<BuildableInfo>()) .Where(a => Rules.NewUnitInfo[a].Traits.Contains<BuildableInfo>())
.Where(a => Rules.NewUnitInfo[a].Traits.Get<BuildableInfo>().Owner.Contains(Game.LocalPlayer.Race))
.OrderBy(a => Rules.NewUnitInfo[a].Traits.Get<BuildableInfo>().TechLevel); .OrderBy(a => Rules.NewUnitInfo[a].Traits.Get<BuildableInfo>().TechLevel);
var queue = Game.LocalPlayer.PlayerActor.traits.Get<Traits.ProductionQueue>(); var queue = Game.LocalPlayer.PlayerActor.traits.Get<Traits.ProductionQueue>();

View File

@@ -40,7 +40,7 @@ namespace OpenRa.Game.GameRules
var bi = info.Traits.GetOrDefault<BuildableInfo>(); var bi = info.Traits.GetOrDefault<BuildableInfo>();
if( bi == null ) return false; if( bi == null ) return false;
if( !bi.Owner.Any( x => x == player.Race ) ) if( !bi.Owner.Contains( player.Race ) )
return false; return false;
foreach( var p in bi.Prerequisites ) foreach( var p in bi.Prerequisites )

View File

@@ -50,8 +50,7 @@ namespace OpenRa.Game
var buildings = Rules.TechTree.GatherBuildings(Owner); var buildings = Rules.TechTree.GatherBuildings(Owner);
var effectivePrereq = Info.Prerequisite var effectivePrereq = Info.Prerequisite
.Select( a => a.ToLowerInvariant() ) .Select( a => a.ToLowerInvariant() )
.Where( a => Rules.NewUnitInfo[a].Traits.Get<BuildableInfo>().Owner .Where( a => Rules.NewUnitInfo[a].Traits.Get<BuildableInfo>().Owner.Contains( Owner.Race ));
.Any( r => r == Owner.Race ));
IsAvailable = Info.TechLevel > -1 IsAvailable = Info.TechLevel > -1
&& effectivePrereq.Any() && effectivePrereq.Any()

View File

@@ -1172,7 +1172,6 @@ POWR:
Buildable: Buildable:
TechLevel: 1 TechLevel: 1
Tab: Building Tab: Building
Prerequisites: fact
Owner: allies,soviet Owner: allies,soviet
Cost: 300 Cost: 300
Description: Power Plant Description: Power Plant

View File

@@ -1256,7 +1256,6 @@ Crewed=yes
; normal power plant ; normal power plant
[POWR] [POWR]
Prerequisite=fact
Strength=400 Strength=400
Armor=wood Armor=wood
TechLevel=1 TechLevel=1