Change to use pattern matching

This commit is contained in:
teinarss
2021-02-28 19:00:32 +01:00
committed by reaperrr
parent 7c0e4b25ae
commit d60c05eff3
35 changed files with 63 additions and 122 deletions

View File

@@ -209,12 +209,10 @@ namespace OpenRA.Mods.Common.Traits
{
Func<object, bool> saveInit = init =>
{
var factionInit = init as FactionInit;
if (factionInit != null && factionInit.Value == Owner.Faction)
if (init is FactionInit factionInit && factionInit.Value == Owner.Faction)
return false;
var healthInit = init as HealthInit;
if (healthInit != null && healthInit.Value == 100)
if (init is HealthInit healthInit && healthInit.Value == 100)
return false;
// TODO: Other default values will need to be filtered