beef up OpenRA.FileFormats.Set a little; use it in CncMenuPaletteEffect rather than making new List<string> every frame
This commit is contained in:
@@ -12,7 +12,7 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace OpenRA.Collections
|
namespace OpenRA.FileFormats
|
||||||
{
|
{
|
||||||
public class Set<T> : IEnumerable<T>
|
public class Set<T> : IEnumerable<T>
|
||||||
{
|
{
|
||||||
@@ -44,5 +44,13 @@ namespace OpenRA.Collections
|
|||||||
{
|
{
|
||||||
return GetEnumerator();
|
return GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Contains( T obj ) { return data.ContainsKey(obj); }
|
||||||
|
|
||||||
|
public Set( params T[] ts )
|
||||||
|
{
|
||||||
|
foreach( var t in ts )
|
||||||
|
Add(t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Collections;
|
|
||||||
using OpenRA.Effects;
|
using OpenRA.Effects;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Network;
|
using OpenRA.Network;
|
||||||
|
|||||||
@@ -61,12 +61,13 @@ namespace OpenRA.Mods.Cnc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Set<string> excludePalettes = new Set<string>("cursor", "chrome", "colorpicker", "shroud", "fog");
|
||||||
|
|
||||||
public void AdjustPalette(Dictionary<string,Palette> palettes)
|
public void AdjustPalette(Dictionary<string,Palette> palettes)
|
||||||
{
|
{
|
||||||
if (to == EffectType.None && remainingFrames == 0)
|
if (to == EffectType.None && remainingFrames == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var excludePalettes = new List<string>(){"cursor", "chrome", "colorpicker", "shroud", "fog"};
|
|
||||||
foreach (var pal in palettes)
|
foreach (var pal in palettes)
|
||||||
{
|
{
|
||||||
if (excludePalettes.Contains(pal.Key))
|
if (excludePalettes.Contains(pal.Key))
|
||||||
|
|||||||
Reference in New Issue
Block a user