diff --git a/Tank/Tank/TankCompareByColor.cs b/Tank/Tank/TankCompareByColor.cs index 9515d36..895cf85 100644 --- a/Tank/Tank/TankCompareByColor.cs +++ b/Tank/Tank/TankCompareByColor.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tank.DrawningObjects; +using Tank.Entities; namespace Tank { @@ -23,6 +24,10 @@ namespace Tank { return x.Tank.BodyColor.Name.CompareTo(y.Tank.BodyColor.Name); } + if (x.GetType() == y.GetType() && x is DrawTank) + { + return (x.Tank as EntityTank).AdditionalColor.Name.CompareTo((y.Tank as EntityTank).AdditionalColor.Name); + } var speedCompare = x.Tank.Speed.CompareTo(y.Tank.Speed); if (speedCompare != 0) { diff --git a/Tank/Tank/TanksCollectionInfo.cs b/Tank/Tank/TanksCollectionInfo.cs index feb68e7..529d7d5 100644 --- a/Tank/Tank/TanksCollectionInfo.cs +++ b/Tank/Tank/TanksCollectionInfo.cs @@ -20,7 +20,7 @@ namespace Tank public bool Equals(TankCollectionInfo? other) { if (other == null || Name == null || other.Name == null) return false; - if (Name == other.Name) return true; + if (Name == other?.Name) return true; throw new NotImplementedException(); }