removed Ijw.DirectX, Ijw.Framework deps

This commit is contained in:
Chris Forbes
2010-02-16 18:52:26 +13:00
parent 95ae493dc4
commit 4258e78049
38 changed files with 250 additions and 54 deletions

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "Ijw.DirectX"]
path = Ijw.DirectX
url = git://github.com/chrisforbes/Ijw.DirectX.git

Submodule Ijw.DirectX deleted from 57bf1241a4

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Collections;
namespace OpenRa.FileFormats
{
public class Cache<T, U> : IEnumerable<KeyValuePair<T, U>>
{
Dictionary<T, U> hax = new Dictionary<T, U>();
Func<T,U> loader;
public Cache(Func<T,U> loader)
{
if (loader == null)
throw new ArgumentNullException();
this.loader = loader;
}
public U this[T key]
{
get
{
U result;
if (!hax.TryGetValue(key, out result))
hax.Add(key, result = loader(key));
return result;
}
}
public IEnumerator<KeyValuePair<T, U>> GetEnumerator() { return hax.GetEnumerator(); }
IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); }
public IEnumerable<T> Keys { get { return hax.Keys; } }
public IEnumerable<U> Values { get { return hax.Values; } }
}
}

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IjwFramework.Types;
using System.Collections;
namespace OpenRa.Collections

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using IjwFramework.Collections;
using System;
namespace OpenRa.FileFormats

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenRa.FileFormats
{
public class Lazy<T>
{
Func<T> p;
T value;
public Lazy(Func<T> p)
{
if (p == null)
throw new ArgumentNullException();
this.p = p;
}
public T Value
{
get
{
if (p == null)
return value;
value = p();
p = null;
return value;
}
}
}
public static class Lazy
{
public static Lazy<T> New<T>(Func<T> p) { return new Lazy<T>(p); }
}
}

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using IjwFramework.Types;
namespace OpenRa.FileFormats
{

View File

@@ -35,10 +35,6 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="IjwFramework, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Ijw.DirectX\Ijw.Framework\IjwFramework\bin\Release\IjwFramework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -51,6 +47,7 @@
<Compile Include="AudLoader.cs" />
<Compile Include="Blowfish.cs" />
<Compile Include="BlowfishKeyProvider.cs" />
<Compile Include="Cache.cs" />
<Compile Include="Collections\Set.cs" />
<Compile Include="DisposableAction.cs" />
<Compile Include="Dune2ShpReader.cs" />
@@ -66,12 +63,15 @@
<Compile Include="IniWriter.cs" />
<Compile Include="int2.cs" />
<Compile Include="IPaletteRemap.cs" />
<Compile Include="Lazy.cs" />
<Compile Include="Map.cs" />
<Compile Include="MiniYaml.cs" />
<Compile Include="PackageEntry.cs" />
<Compile Include="Package.cs" />
<Compile Include="Pair.cs" />
<Compile Include="Palette.cs" />
<Compile Include="PlayerColorRemap.cs" />
<Compile Include="PriorityQueue.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProtocolVersion.cs" />
<Compile Include="Session.cs" />

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenRa.FileFormats
{
public struct Pair<T, U>
{
public T First;
public U Second;
public Pair(T first, U second)
{
First = first;
Second = second;
}
static IEqualityComparer<T> tc = EqualityComparer<T>.Default;
static IEqualityComparer<U> uc = EqualityComparer<U>.Default;
public static bool operator ==(Pair<T, U> a, Pair<T, U> b)
{
return tc.Equals(a.First, b.First) && uc.Equals(a.Second, b.Second);
}
public static bool operator !=(Pair<T, U> a, Pair<T, U> b)
{
return !(a == b);
}
public override bool Equals(object obj)
{
if (!(obj is Pair<T, U>))
return false;
return (Pair<T, U>)obj == this;
}
public override int GetHashCode()
{
return First.GetHashCode() ^ Second.GetHashCode();
}
public Pair<T, U> WithFirst(T t) { return new Pair<T, U>(t, Second); }
public Pair<T, U> WithSecond(U u) { return new Pair<T, U>(First, u); }
public static T AsFirst(Pair<T, U> p) { return p.First; }
public static U AsSecond(Pair<T, U> p) { return p.Second; }
public Pair<U, T> Swap() { return Pair.New(Second, First); }
}
public static class Pair
{
public static Pair<T, U> New<T, U>(T t, U u) { return new Pair<T, U>(t, u); }
}
}

View File

@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenRa.FileFormats
{
public class PriorityQueue<T>
where T : IComparable<T>
{
List<T[]> items = new List<T[]>();
int level, 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;
if (++index >= (1 << level))
{
index = 0;
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;
if (--lastIndex < 0)
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());
if (--index < 0)
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 &&
At(downLevel, downIndex).CompareTo(At(downLevel, downIndex + 1)) >= 0)
++downIndex;
if (val.CompareTo(At(downLevel, downIndex)) <= 0)
{
items[intoLevel][intoIndex] = val;
return;
}
items[intoLevel][intoIndex] = At(downLevel, downIndex);
BubbleInto(downLevel, downIndex, val);
}
int RowLength(int i)
{
if (i == level)
return index;
return (1 << i);
}
}
}

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using IjwFramework.Collections;
namespace OpenRa.FileFormats
{

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using IjwFramework.Types;
using OpenRa.FileFormats;
using OpenRa.Graphics;
using OpenRa.Orders;

View File

@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using IjwFramework.Collections;
using IjwFramework.Types;
using OpenRa.GameRules;
using OpenRa.Graphics;
using OpenRa.Orders;
using OpenRa.Traits;
using OpenRa.FileFormats;
namespace OpenRa
{

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using IjwFramework.Types;
using OpenRa.FileFormats;
using OpenRa.GameRules;
using OpenRa.Graphics;

View File

@@ -4,7 +4,6 @@ using System.Linq;
using OpenRa.FileFormats;
using OpenRa.Traits;
using System.Reflection;
using IjwFramework.Types;
using System.IO;
namespace OpenRa.GameRules

View File

@@ -4,7 +4,6 @@ using System.Linq;
using System.Text;
using OpenRa.FileFormats;
using OpenRa.Graphics;
using IjwFramework.Types;
using System.Collections;
namespace OpenRa.GameRules

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using IjwFramework.Types;
using OpenRa.FileFormats;
using OpenRa.GameRules;

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using IjwFramework.Collections;
using OpenRa.Traits;
using OpenRa.FileFormats;
namespace OpenRa.GameRules
{

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using IjwFramework.Types;
using OpenRa.FileFormats;
namespace OpenRa.GameRules
{

View File

@@ -1,6 +1,5 @@
using System;
using System.Linq;
using IjwFramework.Collections;
using OpenRa.FileFormats;
namespace OpenRa.Graphics

View File

@@ -4,9 +4,7 @@ using System.Linq;
using OpenRa.Traits;
using OpenRa.FileFormats;
using System.Drawing.Imaging;
using IjwFramework.Collections;
using System.Collections.Generic;
using IjwFramework.Types;
namespace OpenRa.Graphics
{

View File

@@ -1,5 +1,4 @@
using System.Linq;
using IjwFramework.Collections;
using OpenRa.FileFormats;
namespace OpenRa.Graphics

View File

@@ -1,6 +1,5 @@
using System.Drawing;
using OpenRa.GlRenderer;
using IjwFramework.Collections;
using OpenRa.FileFormats;
namespace OpenRa.Graphics

View File

@@ -2,8 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using IjwFramework.Types;
using OpenRa.FileFormats;
namespace OpenRa.Network
{

View File

@@ -55,10 +55,6 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="IjwFramework, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Ijw.DirectX\Ijw.Framework\IjwFramework\bin\Debug\IjwFramework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using IjwFramework.Collections;
using OpenRa.Graphics;
using OpenRa.Traits;
using OpenRa.FileFormats;
namespace OpenRa
{

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRa.Traits;
using IjwFramework.Collections;
using OpenRa.FileFormats;
namespace OpenRa
{

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IjwFramework.Types;
using OpenRa.Graphics;
using OpenRa.Traits;
using OpenRa.FileFormats;

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using IjwFramework.Collections;
using OpenRa.FileFormats;
using OpenRa.Support;
using OpenRa.Traits;

View File

@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using IjwFramework.Collections;
using OpenRa.Graphics;
using OpenRa.FileFormats;
namespace OpenRa.Support
{

View File

@@ -2,7 +2,6 @@
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using IjwFramework.Collections;
using OpenRa.FileFormats;
namespace OpenRa

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using IjwFramework.Types;
using OpenRa.Effects;
using System.Drawing;
using OpenRa.FileFormats;
namespace OpenRa.Traits
{

View File

@@ -4,7 +4,6 @@ using System.Linq;
using System.Text;
using OpenRa.Graphics;
using OpenRa.FileFormats;
using IjwFramework.Collections;
using System.Drawing;
namespace OpenRa.Traits

View File

@@ -2,7 +2,7 @@
using System.Linq;
using OpenRa.Effects;
using OpenRa.Traits;
using IjwFramework.Types;
using OpenRa.FileFormats;
/*
* Crates left to implement:

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IjwFramework.Collections;
using OpenRa.FileFormats;
namespace OpenRa.Traits
{

View File

@@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.Drawing;
using IjwFramework.Types;
using OpenRa.GameRules;
using OpenRa.Graphics;
using OpenRa.Traits.Activities;
using OpenRa.FileFormats;
namespace OpenRa.Traits
{

View File

@@ -48,9 +48,6 @@
<Reference Include="Tao.Cg, Version=2.0.0.0, Culture=neutral, PublicKeyToken=52fa5aba625fe731, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Tao.Glfw, Version=2.6.0.0, Culture=neutral, PublicKeyToken=2bb092b6587e4402, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Tao.OpenGl, Version=2.1.0.12, Culture=neutral, PublicKeyToken=1ca010269a4501ef, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>

View File

@@ -31,14 +31,6 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="Ijw.DirectX, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Ijw.DirectX\bin\Ijw.DirectX.dll</HintPath>
</Reference>
<Reference Include="Ijw.Math, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Ijw.DirectX\bin\Ijw.Math.dll</HintPath>
</Reference>
<Reference Include="IjwFramework, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Ijw.DirectX\bin\IjwFramework.dll</HintPath>