Regenerate cached texture indices when the palette size changes.

This commit is contained in:
Paul Chote
2015-05-10 00:58:10 +01:00
parent 7eae157ad8
commit 889360d4c6
3 changed files with 37 additions and 12 deletions

View File

@@ -25,6 +25,8 @@ namespace OpenRA.Graphics
public readonly Theater Theater;
public Viewport Viewport { get; private set; }
public event Action PaletteInvalidated = null;
readonly HardwarePalette palette = new HardwarePalette();
readonly Dictionary<string, PaletteReference> palettes = new Dictionary<string, PaletteReference>();
readonly TerrainRenderer terrainRenderer;
@@ -70,7 +72,13 @@ namespace OpenRA.Graphics
if (allowOverwrite && palette.Contains(name))
ReplacePalette(name, pal);
else
{
var oldHeight = palette.Height;
palette.AddPalette(name, pal, allowModifiers);
if (oldHeight != palette.Height && PaletteInvalidated != null)
PaletteInvalidated();
}
}
public void ReplacePalette(string name, IPalette pal)