Update Renderer.cs

Fix graphical error when adding mulitplayer spawn points in the map editor.
This commit is contained in:
Moritz Heller
2024-07-18 13:24:17 +02:00
committed by Gustas
parent 84f8c6a4c6
commit 62d1f002dd

View File

@@ -79,6 +79,7 @@ namespace OpenRA
Rectangle lastWorldViewport = Rectangle.Empty; Rectangle lastWorldViewport = Rectangle.Empty;
ITexture currentPaletteTexture; ITexture currentPaletteTexture;
int currentPaletteHeight = 0;
IBatchRenderer currentBatchRenderer; IBatchRenderer currentBatchRenderer;
RenderType renderType = RenderType.None; RenderType renderType = RenderType.None;
@@ -309,11 +310,13 @@ namespace OpenRA
{ {
// Note: palette.Texture and palette.ColorShifts are updated at the same time // Note: palette.Texture and palette.ColorShifts are updated at the same time
// so we only need to check one of the two to know whether we must update the textures // so we only need to check one of the two to know whether we must update the textures
if (palette.Texture == currentPaletteTexture) // also compare heights in case new palettes have been added
if (palette.Texture == currentPaletteTexture && palette.Height == currentPaletteHeight)
return; return;
Flush(); Flush();
currentPaletteTexture = palette.Texture; currentPaletteTexture = palette.Texture;
currentPaletteHeight = palette.Height;
SpriteRenderer.SetPalette(palette); SpriteRenderer.SetPalette(palette);
WorldSpriteRenderer.SetPalette(palette); WorldSpriteRenderer.SetPalette(palette);