Replace terniary null checks with coalescing.

This commit is contained in:
Paul Chote
2021-03-07 21:22:00 +00:00
committed by teinarss
parent 2473b8763b
commit d52ba83f96
43 changed files with 72 additions and 73 deletions

View File

@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var moi = world.Map.Rules.Actors["player"].TraitInfoOrDefault<MissionObjectivesInfo>();
if (moi != null)
{
var faction = world.LocalPlayer == null ? null : world.LocalPlayer.Faction.InternalName;
var faction = world.LocalPlayer?.Faction.InternalName;
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", moi.LeaveNotification, faction);
}
}
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
leaving = true;
var iop = world.WorldActor.TraitsImplementing<IObjectivesPanel>().FirstOrDefault();
var exitDelay = iop != null ? iop.ExitDelay : 0;
var exitDelay = iop?.ExitDelay ?? 0;
if (mpe != null)
{
Game.RunAfterDelay(exitDelay, () =>
@@ -208,7 +208,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return;
var iop = world.WorldActor.TraitsImplementing<IObjectivesPanel>().FirstOrDefault();
var exitDelay = iop != null ? iop.ExitDelay : 0;
var exitDelay = iop?.ExitDelay ?? 0;
Action onRestart = () =>
{