diff --git a/DoubleDeckerBus/DoubleDeckerBus/DrawingObjectBus.cs b/DoubleDeckerBus/DoubleDeckerBus/DrawingObjectBus.cs index b845317..77e7525 100644 --- a/DoubleDeckerBus/DoubleDeckerBus/DrawingObjectBus.cs +++ b/DoubleDeckerBus/DoubleDeckerBus/DrawingObjectBus.cs @@ -74,24 +74,26 @@ namespace DoubleDeckerBus return false; } var bus = _bus.Bus; - var otherCarCar = otherBus._bus.Bus; - if (bus.Speed != otherCarCar.Speed) + var otherBusBus = otherBus._bus.Bus; + if (bus.GetType().Name != otherBusBus.GetType().Name) { return false; } - if (bus.Weight != otherCarCar.Weight) + if (bus.Speed != otherBusBus.Speed) { return false; } - if (bus.BodyColor != otherCarCar.BodyColor) + if (bus.Weight != otherBusBus.Weight) + { + return false; + } + if (bus.BodyColor != otherBusBus.BodyColor) { return false; } - if (bus is EntityDDB DDB) { - if (other is not EntityDDB otherDDB) { - return false; - } + if (bus is EntityDDB DDB && otherBusBus is EntityDDB otherDDB) + { if (DDB.Ledder != otherDDB.Ledder) { return false; @@ -105,6 +107,7 @@ namespace DoubleDeckerBus { return false; } + } return true;