From 0f3e5659da3bff466ae3520c5ab7e30a3c4ef459 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 13 Apr 2010 18:26:10 +1200 Subject: [PATCH] make world.Queries not quite so order-sensitive --- OpenRA.Game/World.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 89380b6373..a1e52373a1 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -198,17 +198,13 @@ namespace OpenRA { readonly World world; - public readonly Dictionary OwnedBy = new Dictionary(); + public readonly Cache OwnedBy; readonly TypeDictionary hasTrait = new TypeDictionary(); public AllQueries( World world ) { this.world = world; - foreach( var p in world.players.Values ) - { - var player = p; - OwnedBy.Add( player, new OwnedByCachedView( world, world.actors, x => x.Owner == player ) ); - } + OwnedBy = new Cache(p => new OwnedByCachedView(world, world.actors, x => x.Owner == p)); } public CachedView> WithTrait()