Fix CA1822
This commit is contained in:
committed by
Pavel Penev
parent
e4cac1fffc
commit
277699cbd5
@@ -312,7 +312,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
path = null;
|
||||
}
|
||||
|
||||
bool CellIsEvacuating(Actor self, CPos cell)
|
||||
static bool CellIsEvacuating(Actor self, CPos cell)
|
||||
{
|
||||
foreach (var actor in self.World.ActorMap.GetActorsAt(cell))
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.AudioLoaders
|
||||
{
|
||||
public class Mp3Loader : ISoundLoader
|
||||
{
|
||||
bool IsMp3(Stream s)
|
||||
static bool IsMp3(Stream s)
|
||||
{
|
||||
var start = s.Position;
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.AudioLoaders
|
||||
}
|
||||
}
|
||||
|
||||
Stream Clone(Mp3Format cloneFrom)
|
||||
static Stream Clone(Mp3Format cloneFrom)
|
||||
{
|
||||
return SegmentStream.CreateWithoutOwningStream(cloneFrom.stream, 0, (int)cloneFrom.stream.Length);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.AudioLoaders
|
||||
{
|
||||
public class WavLoader : ISoundLoader
|
||||
{
|
||||
bool IsWave(Stream s)
|
||||
static bool IsWave(Stream s)
|
||||
{
|
||||
var start = s.Position;
|
||||
var type = s.ReadASCII(4);
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
return ++currentBlock >= numBlocks;
|
||||
}
|
||||
|
||||
short WriteSample(short t, Queue<byte> data)
|
||||
static short WriteSample(short t, Queue<byte> data)
|
||||
{
|
||||
data.Enqueue((byte)t);
|
||||
data.Enqueue((byte)(t >> 8));
|
||||
@@ -266,7 +266,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
}
|
||||
|
||||
// This code contains elements from libsndfile
|
||||
short DecodeNibble(short nibble, byte bpred, ref short idelta, ref short s1, ref short s2)
|
||||
static short DecodeNibble(short nibble, byte bpred, ref short idelta, ref short s1, ref short s2)
|
||||
{
|
||||
var predict = (s1 * AdaptCoeff1[bpred] + s2 * AdaptCoeff2[bpred]) >> 8;
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSelectionBar(float2 start, float2 end, float value, Color barColor)
|
||||
static void DrawSelectionBar(float2 start, float2 end, float value, Color barColor)
|
||||
{
|
||||
var c = Color.FromArgb(128, 30, 30, 30);
|
||||
var c2 = Color.FromArgb(128, 10, 10, 10);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
CheckTrait(emitError, actorInfo.Value, traitInfo, mapRules);
|
||||
}
|
||||
|
||||
void CheckTrait(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo, Ruleset rules)
|
||||
static void CheckTrait(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo, Ruleset rules)
|
||||
{
|
||||
var actualType = traitInfo.GetType();
|
||||
foreach (var field in Utility.GetFields(actualType))
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckActorReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
static void CheckActorReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
FieldInfo fieldInfo, IReadOnlyDictionary<string, ActorInfo> dict, ActorReferenceAttribute attribute)
|
||||
{
|
||||
var values = LintExts.GetFieldValues(traitInfo, fieldInfo, attribute.DictionaryReference);
|
||||
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckWeaponReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
static void CheckWeaponReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
FieldInfo fieldInfo, IReadOnlyDictionary<string, WeaponInfo> dict)
|
||||
{
|
||||
var values = LintExts.GetFieldValues(traitInfo, fieldInfo);
|
||||
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckVoiceReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
static void CheckVoiceReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
FieldInfo fieldInfo, IReadOnlyDictionary<string, SoundInfo> dict)
|
||||
{
|
||||
var values = LintExts.GetFieldValues(traitInfo, fieldInfo);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var weaponInfo in rules.Weapons)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, emitWarning, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, modData, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, ModData modData, Ruleset rules)
|
||||
static void Run(Action<string> emitError, ModData modData, Ruleset rules)
|
||||
{
|
||||
var fileSystem = modData.DefaultFileSystem;
|
||||
var sequenceYaml = MiniYaml.Merge(modData.Manifest.Cursors.Select(s => MiniYaml.FromStream(fileSystem.Open(s), s)));
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules, modData);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules, ModData modData)
|
||||
static void Run(Action<string> emitError, Ruleset rules, ModData modData)
|
||||
{
|
||||
// As the map has not been created we need to get MapGrid info directly from manifest.
|
||||
var grid = modData.Manifest.Get<MapGrid>();
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
var worldActor = rules.Actors[SystemActors.World];
|
||||
var locomotorInfos = worldActor.TraitInfos<LocomotorInfo>().ToArray();
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckLocomotors(ActorInfo actorInfo, Action<string> emitError, LocomotorInfo[] locomotorInfos, string locomotor)
|
||||
static void CheckLocomotors(ActorInfo actorInfo, Action<string> emitError, LocomotorInfo[] locomotorInfos, string locomotor)
|
||||
{
|
||||
if (!locomotorInfos.Any(l => l.Name == locomotor))
|
||||
emitError($"Actor `{actorInfo.Name}` defines Locomotor `{locomotor}` not found on World actor.");
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, map.MapFormat, map.Author, map.Title, map.Categories);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, int mapFormat, string author, string title, string[] categories)
|
||||
static void Run(Action<string> emitError, int mapFormat, string author, string title, string[] categories)
|
||||
{
|
||||
if (mapFormat < Map.SupportedMapFormat)
|
||||
emitError($"Map format `{mapFormat}` does not match the supported version `{Map.CurrentMapFormat}`.");
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
var palettes = new List<string>();
|
||||
var playerPalettes = new List<string>();
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void GetPalettes(Ruleset rules, List<string> palettes, List<string> playerPalettes, Action<string> emitError)
|
||||
static void GetPalettes(Ruleset rules, List<string> palettes, List<string> playerPalettes, Action<string> emitError)
|
||||
{
|
||||
// Palettes are only defined on the world actor.
|
||||
var worldActorInfo = rules.Actors[SystemActors.World];
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, emitWarning, map.Players, map.Visibility, map.WorldActorInfo, map.SpawnPoints);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Action<string> emitWarning, MapPlayers players, MapVisibility visibility, ActorInfo worldActorInfo, CPos[] spawnPoints)
|
||||
static void Run(Action<string> emitError, Action<string> emitWarning, MapPlayers players, MapVisibility visibility, ActorInfo worldActorInfo, CPos[] spawnPoints)
|
||||
{
|
||||
if (players.Players.Count > 64)
|
||||
emitError("Defining more than 64 players is not allowed.");
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var weaponInfo in rules.Weapons)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, emitWarning, rules, sequences);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules, SequenceSet sequences)
|
||||
static void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules, SequenceSet sequences)
|
||||
{
|
||||
var factions = rules.Actors[SystemActors.World].TraitInfos<FactionInfo>().Select(f => f.InternalName).ToArray();
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, emitWarning, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
CheckMapYaml(emitError, modData, map, map.RuleDefinitions);
|
||||
}
|
||||
|
||||
string NormalizeName(string key)
|
||||
static string NormalizeName(string key)
|
||||
{
|
||||
var name = key.Split('@')[0];
|
||||
if (name.StartsWith("-", StringComparison.Ordinal))
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
return name;
|
||||
}
|
||||
|
||||
void CheckActors(IEnumerable<MiniYamlNode> actors, Action<string> emitError, ModData modData)
|
||||
static void CheckActors(IEnumerable<MiniYamlNode> actors, Action<string> emitError, ModData modData)
|
||||
{
|
||||
foreach (var actor in actors)
|
||||
{
|
||||
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckMapYaml(Action<string> emitError, ModData modData, IReadOnlyFileSystem fileSystem, MiniYaml ruleDefinitions)
|
||||
static void CheckMapYaml(Action<string> emitError, ModData modData, IReadOnlyFileSystem fileSystem, MiniYaml ruleDefinitions)
|
||||
{
|
||||
if (ruleDefinitions == null)
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
CheckMapYaml(emitError, emitWarning, modData, map, map.WeaponDefinitions);
|
||||
}
|
||||
|
||||
string NormalizeName(string key)
|
||||
static string NormalizeName(string key)
|
||||
{
|
||||
var name = key.Split('@')[0];
|
||||
if (name.StartsWith("-", StringComparison.Ordinal))
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
return name;
|
||||
}
|
||||
|
||||
void CheckWeapons(IEnumerable<MiniYamlNode> weapons, Action<string> emitError, Action<string> emitWarning, ModData modData)
|
||||
static void CheckWeapons(IEnumerable<MiniYamlNode> weapons, Action<string> emitError, Action<string> emitWarning, ModData modData)
|
||||
{
|
||||
var weaponInfo = typeof(WeaponInfo);
|
||||
foreach (var weapon in weapons)
|
||||
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckMapYaml(Action<string> emitError, Action<string> emitWarning, ModData modData, IReadOnlyFileSystem fileSystem, MiniYaml weaponDefinitions)
|
||||
static void CheckMapYaml(Action<string> emitError, Action<string> emitWarning, ModData modData, IReadOnlyFileSystem fileSystem, MiniYaml weaponDefinitions)
|
||||
{
|
||||
if (weaponDefinitions == null)
|
||||
return;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckVoices(ActorInfo actorInfo, Action<string> emitError, Ruleset rules, string voiceSet)
|
||||
static void CheckVoices(ActorInfo actorInfo, Action<string> emitError, Ruleset rules, string voiceSet)
|
||||
{
|
||||
var soundInfo = rules.Voices[voiceSet.ToLowerInvariant()];
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
CheckMapYaml(emitError, modData, map, map.RuleDefinitions);
|
||||
}
|
||||
|
||||
void CheckMapYaml(Action<string> emitError, ModData modData, IReadOnlyFileSystem fileSystem, MiniYaml ruleDefinitions)
|
||||
static void CheckMapYaml(Action<string> emitError, ModData modData, IReadOnlyFileSystem fileSystem, MiniYaml ruleDefinitions)
|
||||
{
|
||||
if (ruleDefinitions == null)
|
||||
return;
|
||||
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, nodes);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, List<MiniYamlNode> nodes)
|
||||
static void Run(Action<string> emitError, List<MiniYamlNode> nodes)
|
||||
{
|
||||
// Build a list of all inheritance relationships.
|
||||
var inheritsMap = new Dictionary<string, List<string>>();
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
CheckInheritance(emitError, "Player", inheritsMap);
|
||||
}
|
||||
|
||||
void CheckInheritance(Action<string> emitError, string actor, Dictionary<string, List<string>> inheritsMap)
|
||||
static void CheckInheritance(Action<string> emitError, string actor, Dictionary<string, List<string>> inheritsMap)
|
||||
{
|
||||
var toResolve = new Queue<string>(inheritsMap.Keys.Where(k => string.Equals(k, actor, StringComparison.InvariantCultureIgnoreCase)));
|
||||
while (toResolve.TryDequeue(out var key))
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
var providedPrereqs = rules.Actors.SelectMany(a => a.Value.TraitInfos<ITechTreePrerequisiteInfo>().SelectMany(p => p.Prerequisites(a.Value)));
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
||||
}
|
||||
}
|
||||
|
||||
bool IsModInstalled(ModContent content)
|
||||
static bool IsModInstalled(ModContent content)
|
||||
{
|
||||
return content.Packages
|
||||
.Where(p => p.Value.Required)
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Orders
|
||||
this.variants = variants.ToArray();
|
||||
}
|
||||
|
||||
PlaceBuildingCellType MakeCellType(bool valid, bool lineBuild = false)
|
||||
static PlaceBuildingCellType MakeCellType(bool valid, bool lineBuild = false)
|
||||
{
|
||||
var cell = valid ? PlaceBuildingCellType.Valid : PlaceBuildingCellType.Invalid;
|
||||
if (lineBuild)
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public ActorGlobal(ScriptContext context)
|
||||
: base(context) { }
|
||||
|
||||
ActorInit CreateInit(string initName, LuaValue value)
|
||||
static ActorInit CreateInit(string initName, LuaValue value)
|
||||
{
|
||||
// Find the requested type
|
||||
var initInstance = initName.Split(ActorInfo.TraitInstanceSeparator);
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
return a;
|
||||
}
|
||||
|
||||
void Move(Actor actor, CPos dest)
|
||||
static void Move(Actor actor, CPos dest)
|
||||
{
|
||||
var move = actor.TraitOrDefault<IMove>();
|
||||
if (move == null)
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders
|
||||
return true;
|
||||
}
|
||||
|
||||
void RegionsFromFrames(Png png, out List<Rectangle> regions, out List<float2> offsets)
|
||||
static void RegionsFromFrames(Png png, out List<Rectangle> regions, out List<float2> offsets)
|
||||
{
|
||||
regions = new List<Rectangle>();
|
||||
offsets = new List<float2>();
|
||||
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders
|
||||
}
|
||||
}
|
||||
|
||||
void RegionsFromSlices(Png png, out List<Rectangle> regions, out List<float2> offsets)
|
||||
static void RegionsFromSlices(Png png, out List<Rectangle> regions, out List<float2> offsets)
|
||||
{
|
||||
// Default: whole image is 1 frame.
|
||||
var frameSize = new Size(png.Width, png.Height);
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders
|
||||
}
|
||||
}
|
||||
|
||||
bool IsShpTS(Stream s)
|
||||
static bool IsShpTS(Stream s)
|
||||
{
|
||||
var start = s.Position;
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders
|
||||
return f == imageCount || type < 4;
|
||||
}
|
||||
|
||||
ShpTSFrame[] ParseFrames(Stream s)
|
||||
static ShpTSFrame[] ParseFrames(Stream s)
|
||||
{
|
||||
var start = s.Position;
|
||||
|
||||
|
||||
@@ -444,7 +444,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return chosenTarget;
|
||||
}
|
||||
|
||||
bool PreventsAutoTarget(Actor attacker, Actor target)
|
||||
static bool PreventsAutoTarget(Actor attacker, Actor target)
|
||||
{
|
||||
foreach (var deat in target.TraitsImplementing<IDisableEnemyAutoTarget>())
|
||||
if (deat.DisableEnemyAutoTarget(target, attacker))
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
return ShouldFlee(owner, enemies => !AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemies));
|
||||
}
|
||||
|
||||
protected Actor FindClosestEnemy(Squad owner)
|
||||
protected static Actor FindClosestEnemy(Squad owner)
|
||||
{
|
||||
return owner.SquadManager.FindClosestEnemy(owner.Units.First().CenterPosition);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
return ShouldFlee(owner, enemies => !AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemies));
|
||||
}
|
||||
|
||||
protected Actor FindClosestEnemy(Squad owner)
|
||||
protected static Actor FindClosestEnemy(Squad owner)
|
||||
{
|
||||
var first = owner.Units.First();
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
bool TargetChanged(in Target lastTarget, in Target target)
|
||||
static bool TargetChanged(in Target lastTarget, in Target target)
|
||||
{
|
||||
// Invalidate reveal changing the target.
|
||||
if (lastTarget.Type == TargetType.FrozenActor && target.Type == TargetType.Actor)
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return RenderAboveShroud(self, wr);
|
||||
}
|
||||
|
||||
IEnumerable<IRenderable> RenderAboveShroud(Actor self, WorldRenderer wr)
|
||||
static IEnumerable<IRenderable> RenderAboveShroud(Actor self, WorldRenderer wr)
|
||||
{
|
||||
var pal = wr.Palette(TileSet.TerrainPaletteInternalName);
|
||||
var a = self.CurrentActivity;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
decorations = selectedDecorations.Where(d => !d.RequiresSelection).ToArray();
|
||||
}
|
||||
|
||||
IEnumerable<WPos> ActivityTargetPath(Actor self)
|
||||
static IEnumerable<WPos> ActivityTargetPath(Actor self)
|
||||
{
|
||||
if (!self.IsInWorld || self.IsDead)
|
||||
yield break;
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
Player GetTargetPlayer(in Target target)
|
||||
static Player GetTargetPlayer(in Target target)
|
||||
{
|
||||
if (target.Type == TargetType.Actor)
|
||||
return target.Actor.Owner;
|
||||
|
||||
@@ -345,7 +345,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
// NOTE: pos required to be in map bounds
|
||||
bool AnyActorsAt(InfluenceNode influenceNode, CPos a, SubCell sub, bool checkTransient)
|
||||
static bool AnyActorsAt(InfluenceNode influenceNode, CPos a, SubCell sub, bool checkTransient)
|
||||
{
|
||||
var always = sub == SubCell.FullCell || sub == SubCell.Any;
|
||||
for (var i = influenceNode; i != null; i = i.Next)
|
||||
@@ -376,7 +376,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
// NOTE: can not check aircraft
|
||||
bool AnyActorsAt(InfluenceNode influenceNode, SubCell sub, Func<Actor, bool> withCondition)
|
||||
static bool AnyActorsAt(InfluenceNode influenceNode, SubCell sub, Func<Actor, bool> withCondition)
|
||||
{
|
||||
var always = sub == SubCell.FullCell || sub == SubCell.Any;
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
&& world.Map.Rules.Music[song].Exists;
|
||||
}
|
||||
|
||||
bool SongExists(MusicInfo song)
|
||||
static bool SongExists(MusicInfo song)
|
||||
{
|
||||
return song != null && song.Exists;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
bool PreventMapSpawn(World world, ActorReference actorReference, IEnumerable<IPreventMapSpawn> preventMapSpawns)
|
||||
static bool PreventMapSpawn(World world, ActorReference actorReference, IEnumerable<IPreventMapSpawn> preventMapSpawns)
|
||||
{
|
||||
foreach (var pms in preventMapSpawns)
|
||||
if (pms.PreventMapSpawn(world, actorReference))
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
info.BinSize * tileScale);
|
||||
}
|
||||
|
||||
Rectangle Bounds(LightSource source)
|
||||
static Rectangle Bounds(LightSource source)
|
||||
{
|
||||
var c = source.Pos;
|
||||
var r = source.Range.Length;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
string IUtilityCommand.Name => "--map-rules";
|
||||
bool IUtilityCommand.ValidateArguments(string[] args) { return args.Length == 2; }
|
||||
|
||||
void MergeAndPrint(Map map, string key, MiniYaml value)
|
||||
static void MergeAndPrint(Map map, string key, MiniYaml value)
|
||||
{
|
||||
var nodes = new List<MiniYamlNode>();
|
||||
var includes = new List<string>();
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
return !invalid || PrintUsage();
|
||||
}
|
||||
|
||||
bool PrintUsage()
|
||||
static bool PrintUsage()
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Usage:");
|
||||
@@ -137,7 +137,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
return !invalid || PrintUsage();
|
||||
}
|
||||
|
||||
bool PrintUsage()
|
||||
static bool PrintUsage()
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Usage:");
|
||||
|
||||
@@ -481,7 +481,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
return world.OrderGenerator.HandleKeyPress(e);
|
||||
}
|
||||
|
||||
ScrollDirection CheckForDirections()
|
||||
static ScrollDirection CheckForDirections()
|
||||
{
|
||||
var margin = Game.Settings.Game.ViewportEdgeScrollMargin;
|
||||
var directions = ScrollDirection.None;
|
||||
|
||||
Reference in New Issue
Block a user