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

@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits.Render
if (facings == -1)
{
var qbo = init.Actor.TraitInfoOrDefault<IQuantizeBodyOrientationInfo>();
facings = qbo != null ? qbo.QuantizedBodyFacings(init.Actor, sequenceProvider, faction) : 1;
facings = qbo?.QuantizedBodyFacings(init.Actor, sequenceProvider, faction) ?? 1;
}
}
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Traits.Render
// Return to the caller whether the renderable position or size has changed
var visible = IsVisible;
var offset = Animation.OffsetFunc != null ? Animation.OffsetFunc() : WVec.Zero;
var offset = Animation.OffsetFunc?.Invoke() ?? WVec.Zero;
var sequence = Animation.Animation.CurrentSequence;
var updated = visible != cachedVisible || offset != cachedOffset || sequence != cachedSequence;