diff --git a/OpenRA.FileFormats/Primitives/Pair.cs b/OpenRA.FileFormats/Primitives/Pair.cs index 60f67df522..7603795801 100644 --- a/OpenRA.FileFormats/Primitives/Pair.cs +++ b/OpenRA.FileFormats/Primitives/Pair.cs @@ -60,7 +60,15 @@ namespace OpenRA.FileFormats public override string ToString() { return "({0},{1})".F(First, Second); - } + } + + class PairEqualityComparer : IEqualityComparer> + { + public bool Equals(Pair x, Pair y) { return x == y; } + public int GetHashCode(Pair obj) { return obj.GetHashCode(); } + } + + public static IEqualityComparer> EqualityComparer { get { return new PairEqualityComparer(); } } } public static class Pair diff --git a/OpenRA.Game/Graphics/SpriteFont.cs b/OpenRA.Game/Graphics/SpriteFont.cs index 8ba3cd9d24..4dbaf0b01c 100644 --- a/OpenRA.Game/Graphics/SpriteFont.cs +++ b/OpenRA.Game/Graphics/SpriteFont.cs @@ -29,7 +29,8 @@ namespace OpenRA.Graphics throw new InvalidOperationException("FT_New_Face failed"); FT.FT_Set_Pixel_Sizes(face, 0, (uint)size); - glyphs = new Cache, GlyphInfo>(CreateGlyph); + glyphs = new Cache, GlyphInfo>(CreateGlyph, + Pair.EqualityComparer); // setup a 1-channel SheetBuilder for our private use if (builder == null) builder = new SheetBuilder(TextureChannel.Alpha);