Enforce use of 'var' instead of explicit type.

This commit is contained in:
Matthias Mailänder
2022-12-26 15:28:53 +01:00
committed by Matthias Mailänder
parent 982c97dc6c
commit 19ecddcd86
16 changed files with 31 additions and 28 deletions

View File

@@ -108,7 +108,7 @@ namespace OpenRA.Graphics
public ImmutablePalette(IPalette p)
{
for (int i = 0; i < Palette.Size; i++)
for (var i = 0; i < Palette.Size; i++)
colors[i] = p[i];
}

View File

@@ -344,7 +344,7 @@ namespace OpenRA
if (yaml.TryGetValue("Visibility", out temp))
newData.Visibility = FieldLoader.GetValue<MapVisibility>("Visibility", temp.Value);
string requiresMod = string.Empty;
var requiresMod = string.Empty;
if (yaml.TryGetValue("RequiresMod", out temp))
requiresMod = temp.Value;

View File

@@ -131,7 +131,7 @@ namespace OpenRA.Network
Log.Write("sync", $"\t {a.ActorID} {a.Type} {a.Owner} {a.Trait} ({a.Hash})");
var nvp = a.NamesValues;
for (int i = 0; i < nvp.Names.Length; i++)
for (var i = 0; i < nvp.Names.Length; i++)
if (nvp.Values[i] != null)
Log.Write("sync", $"\t\t {nvp.Names[i]}: {nvp.Values[i]}");
}
@@ -142,7 +142,7 @@ namespace OpenRA.Network
Log.Write("sync", "\t {0} ({1})", e.Name, e.Hash);
var nvp = e.NamesValues;
for (int i = 0; i < nvp.Names.Length; i++)
for (var i = 0; i < nvp.Names.Length; i++)
if (nvp.Values[i] != null)
Log.Write("sync", $"\t\t {nvp.Names[i]}: {nvp.Values[i]}");
}

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Scripting
public static bool TryGetClrValue<T>(this LuaValue value, out T clrObject)
{
var ret = value.TryGetClrValue(typeof(T), out object temp);
var ret = value.TryGetClrValue(typeof(T), out var temp);
clrObject = ret ? (T)temp : default;
return ret;
}