From 4b2b4e4d2cffd34d0f87bffc361d9f65473c59bd Mon Sep 17 00:00:00 2001 From: ArtemEmelyanov Date: Wed, 14 Dec 2022 13:01:37 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Airbus/Airbus/DrawningObjectPlane.cs | 6 ++++++ Airbus/Airbus/SetPlanesGeneric.cs | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Airbus/Airbus/DrawningObjectPlane.cs b/Airbus/Airbus/DrawningObjectPlane.cs index ba3dab5..9552909 100644 --- a/Airbus/Airbus/DrawningObjectPlane.cs +++ b/Airbus/Airbus/DrawningObjectPlane.cs @@ -61,6 +61,12 @@ namespace Airbus return false; } + if ((plane is EntityAirbus) && !(otherPlanePlane is EntityAirbus) + || !(plane is EntityAirbus) && (otherPlanePlane is EntityAirbus)) + { + return false; + } + if (plane is EntityAirbus airbus && otherPlanePlane is EntityAirbus otherAirbus) { if (airbus.DopColor != otherAirbus.DopColor) diff --git a/Airbus/Airbus/SetPlanesGeneric.cs b/Airbus/Airbus/SetPlanesGeneric.cs index e3069c5..5af02f7 100644 --- a/Airbus/Airbus/SetPlanesGeneric.cs +++ b/Airbus/Airbus/SetPlanesGeneric.cs @@ -35,8 +35,7 @@ namespace Airbus public int Insert(T plane) { if (_places.Count == _maxCount) throw new StorageOverflowException(_maxCount); - _places.Insert(0, plane); - return 0; + return Insert(plane, 0); } /// /// Добавление объекта в набор на конкретную позицию