make world.Queries not quite so order-sensitive
This commit is contained in:
@@ -198,17 +198,13 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
readonly World world;
|
readonly World world;
|
||||||
|
|
||||||
public readonly Dictionary<Player, OwnedByCachedView> OwnedBy = new Dictionary<Player, OwnedByCachedView>();
|
public readonly Cache<Player, OwnedByCachedView> OwnedBy;
|
||||||
readonly TypeDictionary hasTrait = new TypeDictionary();
|
readonly TypeDictionary hasTrait = new TypeDictionary();
|
||||||
|
|
||||||
public AllQueries( World world )
|
public AllQueries( World world )
|
||||||
{
|
{
|
||||||
this.world = world;
|
this.world = world;
|
||||||
foreach( var p in world.players.Values )
|
OwnedBy = new Cache<Player, OwnedByCachedView>(p => new OwnedByCachedView(world, world.actors, x => x.Owner == p));
|
||||||
{
|
|
||||||
var player = p;
|
|
||||||
OwnedBy.Add( player, new OwnedByCachedView( world, world.actors, x => x.Owner == player ) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CachedView<Actor, TraitPair<T>> WithTrait<T>()
|
public CachedView<Actor, TraitPair<T>> WithTrait<T>()
|
||||||
|
|||||||
Reference in New Issue
Block a user