Use out var syntax

This commit is contained in:
teinarss
2020-08-16 10:49:33 +02:00
committed by Paul Chote
parent d52e4793fe
commit 27f1a7ab27
193 changed files with 395 additions and 826 deletions

View File

@@ -183,8 +183,7 @@ namespace OpenRA.Mods.Common.Scripting
if (autotarget == null)
return;
UnitStance stance;
if (!Enum<UnitStance>.TryParse(value, true, out stance))
if (!Enum<UnitStance>.TryParse(value, true, out var stance))
throw new LuaException("Unknown stance type '{0}'".F(value));
autotarget.PredictedStance = stance;

View File

@@ -77,8 +77,7 @@ namespace OpenRA.Mods.Common.Scripting
{
var result = new List<Actor>();
ActorInfo ai;
if (!Context.World.Map.Rules.Actors.TryGetValue(type, out ai))
if (!Context.World.Map.Rules.Actors.TryGetValue(type, out var ai))
throw new LuaException("Unknown actor type '{0}'".F(type));
result.AddRange(Player.World.Actors

View File

@@ -38,8 +38,7 @@ namespace OpenRA.Mods.Common.Scripting
"If 'Buildable.BuildAtProductionType' is not set either, a random exit will be selected.")]
public void Produce(string actorType, string factionVariant = null, string productionType = null)
{
ActorInfo actorInfo;
if (!Self.World.Map.Rules.Actors.TryGetValue(actorType, out actorInfo))
if (!Self.World.Map.Rules.Actors.TryGetValue(actorType, out var actorInfo))
throw new LuaException("Unknown actor type '{0}'".F(actorType));
var bi = actorInfo.TraitInfo<BuildableInfo>();