PlayerColorPalette now using the full palette if no RemapIndex is set.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user