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

@@ -282,13 +282,13 @@ namespace OpenRA.Mods.Common.Orders
footprint.Add(t, MakeCellType(isCloseEnough && world.IsCellBuildable(t, actorInfo, buildingInfo) && (resourceLayer == null || resourceLayer.GetResourceType(t) == null)));
}
return preview != null ? preview.Render(wr, topLeft, footprint) : Enumerable.Empty<IRenderable>();
return preview?.Render(wr, topLeft, footprint) ?? Enumerable.Empty<IRenderable>();
}
IEnumerable<IRenderable> IOrderGenerator.RenderAnnotations(WorldRenderer wr, World world)
{
var preview = variants[variant].Preview;
return preview != null ? preview.RenderAnnotations(wr, TopLeft) : Enumerable.Empty<IRenderable>();
return preview?.RenderAnnotations(wr, TopLeft) ?? Enumerable.Empty<IRenderable>();
}
string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi)