PIbd-21 Belianin N.N. LabWork08 #8

Closed
Belnik wants to merge 3 commits from LabWork08 into LabWork07
2 changed files with 6 additions and 1 deletions
Showing only changes of commit 17895a1d63 - Show all commits

View File

@ -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)
{

View File

@ -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();
}