PlayerColorPalette now using the full palette if no RemapIndex is set.

This commit is contained in:
Andre Mohren
2022-05-26 10:58:26 +02:00
committed by Gustas
parent df72d303b8
commit 0e5f33ef93
7 changed files with 18 additions and 13 deletions

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Primitives;
using OpenRA.Traits;
@@ -42,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{
foreach (var p in PlayerIndex)
if (p.Value.Length != RemapIndex.Length)
if (p.Value.Length != (RemapIndex.Length == 0 ? 256 : RemapIndex.Length))
throw new YamlException($"PlayerIndex for player `{p.Key}` length does not match RemapIndex!");
}
}
@@ -62,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits
ImmutablePalette pal;
if (info.PlayerIndex.TryGetValue(playerName, out var remap))
pal = new ImmutablePalette(basePalette, new IndexedColorRemap(basePalette, info.RemapIndex, remap));
pal = new ImmutablePalette(basePalette, new IndexedColorRemap(basePalette, info.RemapIndex.Length == 0 ? Enumerable.Range(0, 256).ToArray() : info.RemapIndex, remap));
else
pal = new ImmutablePalette(basePalette);