remove most of the crap from queries

This commit is contained in:
Chris Forbes
2011-03-17 21:48:50 +13:00
parent eba7641125
commit 149324ea92
21 changed files with 113 additions and 129 deletions

View File

@@ -58,16 +58,18 @@ namespace OpenRA.Mods.RA.Buildings
{
var ret = new Cache<string, List<Actor>>( x => new List<Actor>() );
if (player == null)
return ret;
return ret;
foreach (var b in player.World.Queries.WithTrait<BuildingInfo>()
.Where(a => a.Actor.Owner == player).Select(a => a.Actor))
{
ret[b.Info.Name].Add(b);
var tt = b.Info.Traits.GetOrDefault<TooltipInfo>();
if (tt != null)
foreach (var alt in tt.AlternateName)
ret[alt].Add(b);
}
foreach( var b in player.World.Queries.OwnedBy[player].Where( x=>x.Info.Traits.Contains<BuildingInfo>() ) )
{
ret[ b.Info.Name ].Add( b );
var tt = b.Info.Traits.GetOrDefault<TooltipInfo>();
if( tt != null )
foreach( var alt in tt.AlternateName )
ret[ alt ].Add( b );
}
return ret;
}