Fix IDE0030

This commit is contained in:
RoosterDragon
2023-02-19 10:24:48 +00:00
committed by Pavel Penev
parent 8223161959
commit 99c1a4448b
4 changed files with 7 additions and 4 deletions

View File

@@ -156,6 +156,9 @@ dotnet_diagnostic.IDE0028.severity = warning
# Use coalesce expression (non-nullable types).
dotnet_diagnostic.IDE0029.severity = warning
# Use coalesce expression (nullable types).
dotnet_diagnostic.IDE0030.severity = warning
# Simplify 'default' expression
dotnet_diagnostic.IDE0034.severity = warning

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Scripting.Global
var luaLabel = Ui.Root.Get("INGAME_ROOT").Get<LabelWidget>("MISSION_TEXT");
luaLabel.GetText = () => text;
var c = color.HasValue ? color.Value : Color.White;
var c = color ?? Color.White;
luaLabel.GetColor = () => c;
}

View File

@@ -172,7 +172,7 @@ namespace OpenRA.Mods.Common.Terrain
if (r.Index >= template.Stride)
return missingTile;
var start = template.Variants > 1 ? variant.HasValue ? variant.Value : random.Next(template.Variants) : 0;
var start = template.Variants > 1 ? variant ?? random.Next(template.Variants) : 0;
return template.Sprites[start * template.Stride + r.Index];
}

View File

@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits
if (unitGroup.BaseActor != null)
{
var facing = unitGroup.BaseActorFacing.HasValue ? unitGroup.BaseActorFacing.Value : new WAngle(w.SharedRandom.Next(1024));
var facing = unitGroup.BaseActorFacing ?? new WAngle(w.SharedRandom.Next(1024));
w.CreateActor(unitGroup.BaseActor.ToLowerInvariant(), new TypeDictionary
{
new LocationInit(p.HomeLocation + unitGroup.BaseActorOffset),
@@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Traits
}
var subCell = ip.SharesCell ? w.ActorMap.FreeSubCell(validCell) : 0;
var facing = unitGroup.SupportActorsFacing.HasValue ? unitGroup.SupportActorsFacing.Value : new WAngle(w.SharedRandom.Next(1024));
var facing = unitGroup.SupportActorsFacing ?? new WAngle(w.SharedRandom.Next(1024));
w.CreateActor(s.ToLowerInvariant(), new TypeDictionary
{