diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index 4e758acf64..182f8e9d16 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -344,9 +344,9 @@ namespace OpenRa AddButton(r, _ => { }); } - bool PaletteAvailable(int index) { return Game.LobbyInfo.Clients.All(c => c.PaletteIndex != index); } + bool PaletteAvailable(int index) { return Game.LobbyInfo.Clients.All(c => c.PaletteIndex != index); } bool SpawnPointAvailable(int index) { return (index == 0) || Game.LobbyInfo.Clients.All(c => c.SpawnPoint != index); } - + void CyclePalette(bool left) { var d = left ? +1 : Player.PlayerColors.Count() - 1; diff --git a/OpenRa.Game/World.cs b/OpenRa.Game/World.cs index 584131b246..9762d32dbf 100644 --- a/OpenRa.Game/World.cs +++ b/OpenRa.Game/World.cs @@ -171,16 +171,16 @@ namespace OpenRa public CachedView> WithTrait() { - return WithTraitInner( world, hasTrait ); + return WithTraitInner( world.actors, hasTrait ); } - static CachedView> WithTraitInner( World world, TypeDictionary hasTrait ) + static CachedView> WithTraitInner( Set set, TypeDictionary hasTrait ) { var ret = hasTrait.GetOrDefault>>(); if( ret != null ) return ret; ret = new CachedView>( - world.actors, + set, x => x.traits.Contains(), x => new TraitPair { Actor = x, Trait = x.traits.Get() } ); hasTrait.Add( ret ); @@ -208,18 +208,16 @@ namespace OpenRa public class OwnedByCachedView : CachedView { - readonly World world; readonly TypeDictionary hasTrait = new TypeDictionary(); public OwnedByCachedView( World world, Set set, Func include ) : base( set, include, a => a ) { - this.world = world; } public CachedView> WithTrait() { - return WithTraitInner( world, hasTrait ); + return WithTraitInner( this, hasTrait ); } } }