Fix IDE0019
This commit is contained in:
committed by
Pavel Penev
parent
80bb828fe5
commit
6d7c73d498
@@ -144,6 +144,9 @@ dotnet_diagnostic.IDE0017.severity = warning
|
|||||||
# Inline variable declaration.
|
# Inline variable declaration.
|
||||||
dotnet_diagnostic.IDE0018.severity = warning
|
dotnet_diagnostic.IDE0018.severity = warning
|
||||||
|
|
||||||
|
# Use pattern matching to avoid 'as' followed by a 'null' check.
|
||||||
|
dotnet_diagnostic.IDE0019.severity = warning
|
||||||
|
|
||||||
# Collection initialization can be simplified
|
# Collection initialization can be simplified
|
||||||
dotnet_diagnostic.IDE0028.severity = warning
|
dotnet_diagnostic.IDE0028.severity = warning
|
||||||
|
|
||||||
|
|||||||
@@ -146,11 +146,10 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
minefieldStart = order.ExtraLocation;
|
minefieldStart = order.ExtraLocation;
|
||||||
|
|
||||||
var movement = self.Trait<IPositionable>();
|
var movement = self.Trait<IPositionable>();
|
||||||
var mobile = movement as Mobile;
|
|
||||||
|
|
||||||
var minefield = GetMinefieldCells(minefieldStart, cell, Info.MinefieldDepth)
|
var minefield = GetMinefieldCells(minefieldStart, cell, Info.MinefieldDepth)
|
||||||
.Where(c => IsCellAcceptable(self, c) && self.Owner.Shroud.IsExplored(c)
|
.Where(c => IsCellAcceptable(self, c) && self.Owner.Shroud.IsExplored(c)
|
||||||
&& movement.CanEnterCell(c, null, BlockedByActor.Immovable) && (mobile != null && mobile.CanStayInCell(c)))
|
&& movement.CanEnterCell(c, null, BlockedByActor.Immovable) && (movement is Mobile mobile && mobile.CanStayInCell(c)))
|
||||||
.OrderBy(c => (c - minefieldStart).LengthSquared).ToList();
|
.OrderBy(c => (c - minefieldStart).LengthSquared).ToList();
|
||||||
|
|
||||||
self.QueueActivity(order.Queued, new LayMines(self, minefield));
|
self.QueueActivity(order.Queued, new LayMines(self, minefield));
|
||||||
|
|||||||
@@ -34,12 +34,8 @@ namespace OpenRA.Mods.Common.Installer
|
|||||||
var prefixes = new[] { "HKEY_LOCAL_MACHINE\\Software\\", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\" };
|
var prefixes = new[] { "HKEY_LOCAL_MACHINE\\Software\\", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\" };
|
||||||
|
|
||||||
foreach (var prefix in prefixes)
|
foreach (var prefix in prefixes)
|
||||||
{
|
if (Registry.GetValue($"{prefix}GOG.com\\Games\\{appId.Value}", "path", null) is string installDir)
|
||||||
var installDir = Registry.GetValue($"{prefix}GOG.com\\Games\\{appId.Value}", "path", null) as string;
|
|
||||||
|
|
||||||
if (installDir != null)
|
|
||||||
return installDir;
|
return installDir;
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -646,8 +646,7 @@ namespace OpenRA.Mods.Common.Pathfinder
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
bool ActorIsBlocking(Actor actor)
|
bool ActorIsBlocking(Actor actor)
|
||||||
{
|
{
|
||||||
var mobile = actor.OccupiesSpace as Mobile;
|
var isMovable = actor.OccupiesSpace is Mobile mobile && !mobile.IsTraitDisabled && !mobile.IsTraitPaused && !mobile.IsImmovable;
|
||||||
var isMovable = mobile != null && !mobile.IsTraitDisabled && !mobile.IsTraitPaused && !mobile.IsImmovable;
|
|
||||||
if (isMovable)
|
if (isMovable)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user