diff --git a/OpenRa.DataStructures/Delegates.cs b/OpenRa.DataStructures/Delegates.cs deleted file mode 100644 index 29d63224f4..0000000000 --- a/OpenRa.DataStructures/Delegates.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenRa -{ - // Put globally-useful delegate types here, particularly if - // they are generic. - - public delegate T Provider(); - public delegate T Provider( U u ); - public delegate T Provider( U u, V v ); - public delegate void Action(); -} diff --git a/OpenRa.DataStructures/OpenRa.DataStructures.csproj b/OpenRa.DataStructures/OpenRa.DataStructures.csproj index e04b5174f2..2a624350ee 100644 --- a/OpenRa.DataStructures/OpenRa.DataStructures.csproj +++ b/OpenRa.DataStructures/OpenRa.DataStructures.csproj @@ -34,10 +34,8 @@ - - diff --git a/OpenRa.DataStructures/PriorityQueue.cs b/OpenRa.DataStructures/PriorityQueue.cs deleted file mode 100644 index 10266e3b9c..0000000000 --- a/OpenRa.DataStructures/PriorityQueue.cs +++ /dev/null @@ -1,139 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; - -namespace OpenRa -{ - public class PriorityQueue - where T : IComparable - { - List items = new List(); - int level; - int index; - - public PriorityQueue() - { - items.Add( new T[ 1 ] ); - } - - public void Add( T item ) - { - int addLevel = level; - int addIndex = index; - - while( addLevel >= 1 && Above( addLevel, addIndex ).CompareTo( item ) > 0 ) - { - items[ addLevel ][ addIndex ] = Above( addLevel, addIndex ); - --addLevel; - addIndex >>= 1; - } - - items[ addLevel ][ addIndex ] = item; - - ++index; - if( index >= ( 1 << level ) ) - { - index = 0; - ++level; - if( items.Count <= level ) - items.Add( new T[ 1 << level ] ); - } - } - - public bool Empty - { - get { return ( level == 0 ); } - } - - T At( int level, int index ) - { - return items[ level ][ index ]; - } - - T Above( int level, int index ) - { - return items[ level - 1 ][ index >> 1 ]; - } - - T Last() - { - int lastLevel = level; - int lastIndex = index; - --lastIndex; - if( lastIndex < 0 ) - { - --lastLevel; - lastIndex = ( 1 << lastLevel ) - 1; - } - return At( lastLevel, lastIndex ); - } - - public T Pop() - { - if( level == 0 && index == 0 ) - throw new InvalidOperationException( "Attempting to pop empty PriorityQueue" ); - - T ret = At( 0, 0 ); - BubbleInto( 0, 0, Last() ); - --index; - if( index < 0 ) - { - --level; - index = ( 1 << level ) - 1; - } - - return ret; - } - - void BubbleInto( int intoLevel, int intoIndex, T val ) - { - int downLevel = intoLevel + 1; - int downIndex = intoIndex << 1; - - if( downLevel > level || ( downLevel == level && downIndex >= index )) - { - items[ intoLevel ][ intoIndex ] = val; - return; - } - - if( downLevel == level && downIndex == index - 1 ) - { - //Log.Write( "one-option bubble" ); - } - else if( At( downLevel, downIndex ).CompareTo( At( downLevel, downIndex + 1 ) ) < 0 ) - { - //Log.Write( "left bubble" ); - } - else - { - //Log.Write( "right bubble" ); - ++downIndex; - } - - if( val.CompareTo( At( downLevel, downIndex ) ) <= 0 ) - { - items[ intoLevel ][ intoIndex ] = val; - return; - } - - items[ intoLevel ][ intoIndex ] = At( downLevel, downIndex ); - BubbleInto( downLevel, downIndex, val ); - } - - //void Invariant() - //{ - // for( int i = 1 ; i < level ; i++ ) - // for( int j = 0 ; j < RowLength( i ) ; j++ ) - // if( At( i, j ).CompareTo( Above( i, j ) ) < 0 ) - // System.Diagnostics.Debug.Assert( At( i, j ).CompareTo( Above( i, j ) ) < 0, "At( i, j ) > Above( i, j )" ); - //} - - int RowLength( int i ) - { - if( i == level ) - return index; - return ( 1 << i ); - } - } -} diff --git a/OpenRa.Game/Animation.cs b/OpenRa.Game/Animation.cs index a2b425baef..b414f7829a 100644 --- a/OpenRa.Game/Animation.cs +++ b/OpenRa.Game/Animation.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; +using IjwFramework.Delegates; namespace OpenRa.Game { diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index 7aa09c2e23..9ab2a46750 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -4,6 +4,7 @@ using System.Text; using OpenRa.FileFormats; using BluntDirectX.Direct3D; using System.Drawing; +using IjwFramework.Delegates; namespace OpenRa.Game { diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 17fef9f087..375f65951f 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -33,6 +33,10 @@ False ..\release\BluntDx.dll + + False + ..\..\IjwFramework\IjwFramework\bin\Debug\IjwFramework.dll + diff --git a/OpenRa.Game/PathFinder.cs b/OpenRa.Game/PathFinder.cs index e4672d857e..ce87825dce 100644 --- a/OpenRa.Game/PathFinder.cs +++ b/OpenRa.Game/PathFinder.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text; using OpenRa.FileFormats; using System.Windows.Forms; +using IjwFramework.Collections; namespace OpenRa.Game { diff --git a/OpenRa.Game/Region.cs b/OpenRa.Game/Region.cs index 9f787b8ff7..8846c01c4a 100644 --- a/OpenRa.Game/Region.cs +++ b/OpenRa.Game/Region.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text; using System.Drawing; using System.Windows.Forms; +using IjwFramework.Delegates; namespace OpenRa.Game { diff --git a/OpenRa.Game/Sidebar.cs b/OpenRa.Game/Sidebar.cs index dee2316649..63e331992e 100644 --- a/OpenRa.Game/Sidebar.cs +++ b/OpenRa.Game/Sidebar.cs @@ -7,6 +7,7 @@ using OpenRa.FileFormats; using System.Drawing; using System.IO; using System.Windows.Forms; +using IjwFramework.Delegates; namespace OpenRa.Game {