Use Null-Propagation Operator

This commit is contained in:
teinarss
2020-08-16 11:38:14 +02:00
committed by Paul Chote
parent 8d27d22100
commit 9c4fd0e3d3
113 changed files with 219 additions and 464 deletions

View File

@@ -158,8 +158,7 @@ namespace OpenRA.Mods.Common.Traits
cell.Density = Math.Min(cell.Type.Info.MaxDensity, cell.Density + n);
Content[p] = cell;
if (CellChanged != null)
CellChanged(p, cell.Type);
CellChanged?.Invoke(p, cell.Type);
}
public bool IsFull(CPos cell)
@@ -183,8 +182,7 @@ namespace OpenRA.Mods.Common.Traits
else
Content[cell] = c;
if (CellChanged != null)
CellChanged(cell, c.Type);
CellChanged?.Invoke(cell, c.Type);
return c.Type;
}
@@ -202,8 +200,7 @@ namespace OpenRA.Mods.Common.Traits
Content[cell] = ResourceLayerContents.Empty;
world.Map.CustomTerrain[cell] = byte.MaxValue;
if (CellChanged != null)
CellChanged(cell, c.Type);
CellChanged?.Invoke(cell, c.Type);
}
public ResourceType GetResourceType(CPos cell) { return Content[cell].Type; }