From fb027a56500c6dbb95da5e89a706527fa4527703 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 28 Jun 2011 22:05:10 +1200 Subject: [PATCH] fix broken palette handling in editor on linux/mac --- OpenRA.FileFormats/Palette.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OpenRA.FileFormats/Palette.cs b/OpenRA.FileFormats/Palette.cs index 8e1f1bc1cf..976decc629 100644 --- a/OpenRA.FileFormats/Palette.cs +++ b/OpenRA.FileFormats/Palette.cs @@ -11,6 +11,8 @@ using System.Drawing; using System.Drawing.Imaging; using System.IO; +using System; +using System.Reflection; namespace OpenRA.FileFormats { @@ -81,6 +83,12 @@ namespace OpenRA.FileFormats for (var i = 0; i < 256; i++) pal.Entries[i] = GetColor(i); + + // hack around a mono bug -- the palette flags get set wrong. + if (Platform.CurrentPlatform != PlatformType.Windows) + typeof(ColorPalette).GetField("flags", + BindingFlags.Instance | BindingFlags.NonPublic).SetValue(pal, 1); + return pal; } }