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()