From 1210667283aa1efa2aecdc6de7345d9109791045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=20=D0=91=D0=BE=D0=BD=D0=B4=D0=B0?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Tue, 13 Dec 2022 19:20:57 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BD=D0=B5=D1=80=D0=B0=D0=B1=D0=BE=D1=87=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=BA=D0=B0=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarmlyShip/WarmlyShip/DrawningObjectShip.cs | 6 ++++++ WarmlyShip/WarmlyShip/EntityWarmlyShip.cs | 4 ++-- WarmlyShip/WarmlyShip/FormMapWithSetShip.cs | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/WarmlyShip/WarmlyShip/DrawningObjectShip.cs b/WarmlyShip/WarmlyShip/DrawningObjectShip.cs index e7c17d4..ea458d5 100644 --- a/WarmlyShip/WarmlyShip/DrawningObjectShip.cs +++ b/WarmlyShip/WarmlyShip/DrawningObjectShip.cs @@ -69,6 +69,12 @@ namespace WarmlyShip return false; } + if ((ship is EntityMotorShip) && !(otherShipShip is EntityMotorShip) + || !(ship is EntityMotorShip) && (otherShipShip is EntityMotorShip)) + { + return false; + } + if (ship is EntityMotorShip motorShip && otherShipShip is EntityMotorShip otherMotorShip) { if (motorShip.DopColor != otherMotorShip.DopColor) diff --git a/WarmlyShip/WarmlyShip/EntityWarmlyShip.cs b/WarmlyShip/WarmlyShip/EntityWarmlyShip.cs index 79878fb..40c6473 100644 --- a/WarmlyShip/WarmlyShip/EntityWarmlyShip.cs +++ b/WarmlyShip/WarmlyShip/EntityWarmlyShip.cs @@ -17,8 +17,8 @@ namespace WarmlyShip public EntityWarmlyShip(int speed, float weight, Color bodyColor) { Random random = new Random(); - Speed = speed <= 0 ? random.Next(100, 300) : speed; - Weight = weight <= 0 ? random.Next(1000, 2000) : weight; + Speed = speed <= 0 ? 100 : speed; + Weight = weight <= 0 ? 1000 : weight; BodyColor = bodyColor; } } diff --git a/WarmlyShip/WarmlyShip/FormMapWithSetShip.cs b/WarmlyShip/WarmlyShip/FormMapWithSetShip.cs index b4d69ce..ef6fed7 100644 --- a/WarmlyShip/WarmlyShip/FormMapWithSetShip.cs +++ b/WarmlyShip/WarmlyShip/FormMapWithSetShip.cs @@ -113,6 +113,7 @@ namespace WarmlyShip pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); _logger.LogInformation($"Добавлен объект: {ship} на карте: {listBoxMaps.SelectedItem}"); } + else MessageBox.Show("Объект не добавлен"); } catch (StorageOverflowException ex) {