Replace terniary null checks with coalescing.
This commit is contained in:
@@ -153,7 +153,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var ios = actor.TraitInfoOrDefault<IOccupySpaceInfo>();
|
||||
var buildingInfo = ios as BuildingInfo;
|
||||
actorCenterOffset = buildingInfo != null ? buildingInfo.CenterOffset(world) : WVec.Zero;
|
||||
actorCenterOffset = buildingInfo?.CenterOffset(world) ?? WVec.Zero;
|
||||
actorSharesCell = ios != null && ios.SharesCell;
|
||||
actorSubCell = SubCell.Invalid;
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void WorldOnRenderPlayerChanged(Player player)
|
||||
{
|
||||
var newShroud = player != null ? player.Shroud : null;
|
||||
var newShroud = player?.Shroud;
|
||||
|
||||
if (shroud != newShroud)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user