From 45944a053c71af229bc42c9a50de6a1b893f9732 Mon Sep 17 00:00:00 2001 From: Pavlos Touboulidis Date: Sun, 27 Apr 2014 00:01:33 +0300 Subject: [PATCH] Replace (and remove) custom Set with HashSet --- OpenRA.Game/OpenRA.Game.csproj | 1 - OpenRA.Game/Primitives/Set.cs | 56 ---------------------------------- OpenRA.Game/World.cs | 2 +- 3 files changed, 1 insertion(+), 58 deletions(-) delete mode 100755 OpenRA.Game/Primitives/Set.cs diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 2832ef2ba7..2271cc2038 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -289,7 +289,6 @@ - diff --git a/OpenRA.Game/Primitives/Set.cs b/OpenRA.Game/Primitives/Set.cs deleted file mode 100755 index 43c76648eb..0000000000 --- a/OpenRA.Game/Primitives/Set.cs +++ /dev/null @@ -1,56 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see COPYING. - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace OpenRA.Primitives -{ - public class Set : IEnumerable - { - Dictionary data = new Dictionary(); - - public void Add( T obj ) - { - data.Add( obj, false ); - if( OnAdd != null ) - OnAdd( obj ); - } - - public void Remove( T obj ) - { - data.Remove( obj ); - if( OnRemove != null ) - OnRemove( obj ); - } - - public event Action OnAdd; - public event Action OnRemove; - - public IEnumerator GetEnumerator() - { - return data.Keys.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public bool Contains( T obj ) { return data.ContainsKey(obj); } - - public Set( params T[] ts ) - { - foreach( var t in ts ) - Add(t); - } - } -} diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 1d1d12213a..09edb42db5 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -27,7 +27,7 @@ namespace OpenRA public class World { internal TraitDictionary traitDict = new TraitDictionary(); - Set actors = new Set(); + HashSet actors = new HashSet(); List effects = new List(); Queue> frameEndActions = new Queue>();