From c67d41e1ab0feb80428ea84972e5d98487f8aa17 Mon Sep 17 00:00:00 2001 From: Pavel_Sorokin Date: Fri, 2 Dec 2022 11:11:24 +0400 Subject: [PATCH 1/9] =?UTF-8?q?=D0=A1=D1=80=D0=B0=D0=B2=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BE=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=D0=BE=D0=B2?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Liner/Liner/DrawingObjectShip.cs | 42 +++++++++++++++++++++++++++ Liner/Liner/IDrawingObject.cs | 2 +- Liner/Liner/MapWithSetShipsGeneric.cs | 2 +- Liner/Liner/SetShipsGeneric.cs | 6 +++- 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/Liner/Liner/DrawingObjectShip.cs b/Liner/Liner/DrawingObjectShip.cs index 8a66da9..afc03ab 100644 --- a/Liner/Liner/DrawingObjectShip.cs +++ b/Liner/Liner/DrawingObjectShip.cs @@ -32,5 +32,47 @@ namespace Liner } public string GetInfo() => _ship?.GetDataForSave(); public static IDrawingObject Create(string data) => new DrawingObjectShip(data.CreateDrawingShip()); + + public bool Equals(IDrawingObject? other) + { + if (other is not DrawingObjectShip otherShip) + { + return false; + } + var ship = _ship.Ship; + var otherShipShip = otherShip._ship.Ship; + if (ship.GetType() != otherShipShip.GetType()) + { + return false; + } + if (ship.Speed != otherShipShip.Speed) + { + return false; + } + if (ship.Weight != otherShipShip.Weight) + { + return false; + } + if (ship.BodyColor != otherShipShip.BodyColor) + { + return false; + } + if (ship is EntityLiner liner && otherShipShip is EntityLiner otherLiner) + { + if (liner.DopColor != otherLiner.DopColor) + { + return false; + } + if (liner.Pool != otherLiner.Pool) + { + return false; + } + if (liner.DopDeck != otherLiner.DopDeck) + { + return false; + } + } + return true; + } } } diff --git a/Liner/Liner/IDrawingObject.cs b/Liner/Liner/IDrawingObject.cs index 7422b43..5525b33 100644 --- a/Liner/Liner/IDrawingObject.cs +++ b/Liner/Liner/IDrawingObject.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Liner { - internal interface IDrawingObject + internal interface IDrawingObject : IEquatable { public float Step { get; } void SetObject(int x, int y, int width, int height); diff --git a/Liner/Liner/MapWithSetShipsGeneric.cs b/Liner/Liner/MapWithSetShipsGeneric.cs index a17ce92..7e338bb 100644 --- a/Liner/Liner/MapWithSetShipsGeneric.cs +++ b/Liner/Liner/MapWithSetShipsGeneric.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Liner { internal class MapWithSetShipsGeneric - where T : class, IDrawingObject + where T : class, IDrawingObject, IEquatable where U : AbstractMap { private readonly int _pictureWidth; diff --git a/Liner/Liner/SetShipsGeneric.cs b/Liner/Liner/SetShipsGeneric.cs index 13a1be7..e3904d2 100644 --- a/Liner/Liner/SetShipsGeneric.cs +++ b/Liner/Liner/SetShipsGeneric.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Liner { internal class SetShipsGeneric - where T : class + where T : class, IEquatable { private readonly List _places; public int Count => _places.Count; @@ -23,6 +23,10 @@ namespace Liner } public int Insert(T ship, int position) { + if (_places.Contains(ship)) + { + return -1; + } if (Count == _maxCount) { throw new StorageOverflowException(_maxCount); -- 2.25.1 From 27cbe93ededa64387883becdb9f0e610abcc5751 Mon Sep 17 00:00:00 2001 From: Pavel_Sorokin Date: Fri, 2 Dec 2022 11:37:42 +0400 Subject: [PATCH 2/9] =?UTF-8?q?=D0=A1=D0=BE=D1=80=D1=82=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Liner/Liner/DrawingObjectShip.cs | 1 + Liner/Liner/FormMapWithSetShips.Designer.cs | 50 ++++++++++++---- Liner/Liner/FormMapWithSetShips.cs | 18 ++++++ Liner/Liner/MapWithSetShipsGeneric.cs | 4 ++ Liner/Liner/SetShipsGeneric.cs | 8 +++ Liner/Liner/ShipCompareByColor.cs | 63 +++++++++++++++++++++ Liner/Liner/ShipCompareByType.cs | 55 ++++++++++++++++++ 7 files changed, 187 insertions(+), 12 deletions(-) create mode 100644 Liner/Liner/ShipCompareByColor.cs create mode 100644 Liner/Liner/ShipCompareByType.cs diff --git a/Liner/Liner/DrawingObjectShip.cs b/Liner/Liner/DrawingObjectShip.cs index afc03ab..55f54e5 100644 --- a/Liner/Liner/DrawingObjectShip.cs +++ b/Liner/Liner/DrawingObjectShip.cs @@ -18,6 +18,7 @@ namespace Liner { return _ship?.GetCurrentPosition() ?? default; } + public DrawingShip GetShip => _ship; public void MoveObject(Direction direction) { _ship?.MoveTransport(direction); diff --git a/Liner/Liner/FormMapWithSetShips.Designer.cs b/Liner/Liner/FormMapWithSetShips.Designer.cs index 12a5ba7..c9ad1d8 100644 --- a/Liner/Liner/FormMapWithSetShips.Designer.cs +++ b/Liner/Liner/FormMapWithSetShips.Designer.cs @@ -51,6 +51,8 @@ this.LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); + this.buttonSortType = new System.Windows.Forms.Button(); + this.buttonSortColor = new System.Windows.Forms.Button(); this.groupBox.SuspendLayout(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); @@ -59,6 +61,8 @@ // // groupBox // + this.groupBox.Controls.Add(this.buttonSortColor); + this.groupBox.Controls.Add(this.buttonSortType); this.groupBox.Controls.Add(this.groupBox1); this.groupBox.Controls.Add(this.buttonRight); this.groupBox.Controls.Add(this.buttonDown); @@ -72,7 +76,7 @@ this.groupBox.Dock = System.Windows.Forms.DockStyle.Right; this.groupBox.Location = new System.Drawing.Point(696, 28); this.groupBox.Name = "groupBox"; - this.groupBox.Size = new System.Drawing.Size(279, 640); + this.groupBox.Size = new System.Drawing.Size(279, 746); this.groupBox.TabIndex = 0; this.groupBox.TabStop = false; this.groupBox.Text = "Инструменты"; @@ -146,7 +150,7 @@ this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonRight.BackgroundImage = global::Liner.Properties.Resources._3; this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonRight.Location = new System.Drawing.Point(233, 598); + this.buttonRight.Location = new System.Drawing.Point(233, 704); this.buttonRight.Name = "buttonRight"; this.buttonRight.Size = new System.Drawing.Size(30, 30); this.buttonRight.TabIndex = 17; @@ -158,7 +162,7 @@ this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonDown.BackgroundImage = global::Liner.Properties.Resources._2; this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonDown.Location = new System.Drawing.Point(197, 598); + this.buttonDown.Location = new System.Drawing.Point(197, 704); this.buttonDown.Name = "buttonDown"; this.buttonDown.Size = new System.Drawing.Size(30, 30); this.buttonDown.TabIndex = 16; @@ -170,7 +174,7 @@ this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonUp.BackgroundImage = global::Liner.Properties.Resources._4; this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonUp.Location = new System.Drawing.Point(197, 562); + this.buttonUp.Location = new System.Drawing.Point(197, 668); this.buttonUp.Name = "buttonUp"; this.buttonUp.Size = new System.Drawing.Size(30, 30); this.buttonUp.TabIndex = 15; @@ -182,7 +186,7 @@ this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonLeft.BackgroundImage = global::Liner.Properties.Resources._1; this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonLeft.Location = new System.Drawing.Point(161, 598); + this.buttonLeft.Location = new System.Drawing.Point(161, 704); this.buttonLeft.Name = "buttonLeft"; this.buttonLeft.Size = new System.Drawing.Size(30, 30); this.buttonLeft.TabIndex = 14; @@ -191,7 +195,7 @@ // // ButtonShowOnMap // - this.ButtonShowOnMap.Location = new System.Drawing.Point(16, 527); + this.ButtonShowOnMap.Location = new System.Drawing.Point(16, 633); this.ButtonShowOnMap.Name = "ButtonShowOnMap"; this.ButtonShowOnMap.Size = new System.Drawing.Size(222, 29); this.ButtonShowOnMap.TabIndex = 13; @@ -201,7 +205,7 @@ // // ButtonShowStorage // - this.ButtonShowStorage.Location = new System.Drawing.Point(16, 472); + this.ButtonShowStorage.Location = new System.Drawing.Point(16, 578); this.ButtonShowStorage.Name = "ButtonShowStorage"; this.ButtonShowStorage.Size = new System.Drawing.Size(222, 29); this.ButtonShowStorage.TabIndex = 12; @@ -211,7 +215,7 @@ // // ButtonRemoveShip // - this.ButtonRemoveShip.Location = new System.Drawing.Point(16, 437); + this.ButtonRemoveShip.Location = new System.Drawing.Point(16, 543); this.ButtonRemoveShip.Name = "ButtonRemoveShip"; this.ButtonRemoveShip.Size = new System.Drawing.Size(222, 29); this.ButtonRemoveShip.TabIndex = 11; @@ -221,7 +225,7 @@ // // maskedTextBoxPosition // - this.maskedTextBoxPosition.Location = new System.Drawing.Point(16, 404); + this.maskedTextBoxPosition.Location = new System.Drawing.Point(16, 510); this.maskedTextBoxPosition.Mask = "00"; this.maskedTextBoxPosition.Name = "maskedTextBoxPosition"; this.maskedTextBoxPosition.Size = new System.Drawing.Size(222, 27); @@ -229,7 +233,7 @@ // // ButtonAddShip // - this.ButtonAddShip.Location = new System.Drawing.Point(16, 356); + this.ButtonAddShip.Location = new System.Drawing.Point(16, 462); this.ButtonAddShip.Name = "ButtonAddShip"; this.ButtonAddShip.Size = new System.Drawing.Size(222, 29); this.ButtonAddShip.TabIndex = 2; @@ -242,7 +246,7 @@ this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBox.Location = new System.Drawing.Point(0, 28); this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(696, 640); + this.pictureBox.Size = new System.Drawing.Size(696, 746); this.pictureBox.TabIndex = 1; this.pictureBox.TabStop = false; // @@ -283,11 +287,31 @@ // this.saveFileDialog.Filter = "txt file | *.txt"; // + // buttonSortType + // + this.buttonSortType.Location = new System.Drawing.Point(16, 355); + this.buttonSortType.Name = "buttonSortType"; + this.buttonSortType.Size = new System.Drawing.Size(222, 29); + this.buttonSortType.TabIndex = 19; + this.buttonSortType.Text = "Сортировать по типу"; + this.buttonSortType.UseVisualStyleBackColor = true; + this.buttonSortType.Click += new System.EventHandler(this.ButtonSortType_Click); + // + // buttonSortColor + // + this.buttonSortColor.Location = new System.Drawing.Point(16, 390); + this.buttonSortColor.Name = "buttonSortColor"; + this.buttonSortColor.Size = new System.Drawing.Size(222, 29); + this.buttonSortColor.TabIndex = 20; + this.buttonSortColor.Text = "Сортировать по цвету"; + this.buttonSortColor.UseVisualStyleBackColor = true; + this.buttonSortColor.Click += new System.EventHandler(this.ButtonSortColor_Click); + // // FormMapWithSetShips // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(975, 668); + this.ClientSize = new System.Drawing.Size(975, 774); this.Controls.Add(this.pictureBox); this.Controls.Add(this.groupBox); this.Controls.Add(this.menuStrip); @@ -331,5 +355,7 @@ private ToolStripMenuItem LoadToolStripMenuItem; private OpenFileDialog openFileDialog; private SaveFileDialog saveFileDialog; + private Button buttonSortColor; + private Button buttonSortType; } } \ No newline at end of file diff --git a/Liner/Liner/FormMapWithSetShips.cs b/Liner/Liner/FormMapWithSetShips.cs index bc0b972..c72d936 100644 --- a/Liner/Liner/FormMapWithSetShips.cs +++ b/Liner/Liner/FormMapWithSetShips.cs @@ -242,5 +242,23 @@ namespace Liner } } } + private void ButtonSortType_Click(object sender, EventArgs e) + { + if (ListBoxMaps.SelectedIndex == -1) + { + return; + } + _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty].Sort(new ShipCompareByType()); + pictureBox.Image = _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); + } + private void ButtonSortColor_Click(object sender, EventArgs e) + { + if (ListBoxMaps.SelectedIndex == -1) + { + return; + } + _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty].Sort(new ShipCompareByColor()); + pictureBox.Image = _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); + } } } diff --git a/Liner/Liner/MapWithSetShipsGeneric.cs b/Liner/Liner/MapWithSetShipsGeneric.cs index 7e338bb..775c0d3 100644 --- a/Liner/Liner/MapWithSetShipsGeneric.cs +++ b/Liner/Liner/MapWithSetShipsGeneric.cs @@ -74,6 +74,10 @@ namespace Liner _setShips.Insert(DrawingObjectShip.Create(rec) as T); } } + public void Sort(IComparer comparer) + { + _setShips.SortSet(comparer); + } private void Shaking() { int j = _setShips.Count - 1; diff --git a/Liner/Liner/SetShipsGeneric.cs b/Liner/Liner/SetShipsGeneric.cs index e3904d2..761a84b 100644 --- a/Liner/Liner/SetShipsGeneric.cs +++ b/Liner/Liner/SetShipsGeneric.cs @@ -79,5 +79,13 @@ namespace Liner } } } + public void SortSet(IComparer comparer) + { + if (comparer == null) + { + return; + } + _places.Sort(comparer); + } } } \ No newline at end of file diff --git a/Liner/Liner/ShipCompareByColor.cs b/Liner/Liner/ShipCompareByColor.cs new file mode 100644 index 0000000..5df0f57 --- /dev/null +++ b/Liner/Liner/ShipCompareByColor.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Liner +{ + internal class ShipCompareByColor : IComparer + { + public int Compare(IDrawingObject? x, IDrawingObject? y) + { + if (x == null && y == null) + { + return 0; + } + if (x == null && y != null) + { + return 1; + } + if (x != null && y == null) + { + return -1; + } + var xShip= x as DrawingObjectShip; + var yShip = y as DrawingObjectShip; + if (xShip == null && yShip == null) + { + return 0; + } + if (xShip == null && yShip != null) + { + return 1; + } + if (xShip != null && yShip == null) + { + return -1; + } + string xShipColor = xShip.GetShip.Ship.BodyColor.Name; + string yShipColor = yShip.GetShip.Ship.BodyColor.Name; + if (xShipColor != yShipColor) + { + return xShipColor.CompareTo(yShipColor); + } + if (xShip.GetShip.Ship is EntityLiner xLiner && yShip.GetShip.Ship is EntityLiner yLiner) + { + string xLocomotiveDopColor = xLiner.DopColor.Name; + string yLocomotiveDopColor = yLiner.DopColor.Name; + var dopColorCompare = xShipColor.CompareTo(yShipColor); + if (dopColorCompare != 0) + { + return dopColorCompare; + } + } + var speedCompare = xShip.GetShip.Ship.Speed.CompareTo(yShip.GetShip.Ship.Speed); + if (speedCompare != 0) + { + return speedCompare; + } + return xShip.GetShip.Ship.Weight.CompareTo(yShip.GetShip.Ship.Weight); + } + } +} diff --git a/Liner/Liner/ShipCompareByType.cs b/Liner/Liner/ShipCompareByType.cs new file mode 100644 index 0000000..cc25b69 --- /dev/null +++ b/Liner/Liner/ShipCompareByType.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Liner +{ + internal class ShipCompareByType : IComparer + { + public int Compare(IDrawingObject? x, IDrawingObject? y) + { + if (x == null && y == null) + { + return 0; + } + if (x == null && y != null) + { + return 1; + } + if (x != null && y == null) + { + return -1; + } + var xShip = x as DrawingObjectShip; + var yShip = y as DrawingObjectShip; + if (xShip == null && yShip == null) + { + return 0; + } + if (xShip == null && yShip != null) + { + return 1; + } + if (xShip != null && yShip == null) + { + return -1; + } + if (xShip.GetShip.GetType().Name != yShip.GetShip.GetType().Name) + { + if (xShip.GetShip.GetType().Name == "DrawingShip") + { + return -1; + } + return 1; + } + var speedCompare = xShip.GetShip.Ship.Speed.CompareTo(yShip.GetShip.Ship.Speed); + if (speedCompare != 0) + { + return speedCompare; + } + return xShip.GetShip.Ship.Weight.CompareTo(yShip.GetShip.Ship.Weight); + } + } +} -- 2.25.1 From 619e8623ae136c0f118c81d6f08f077f3bdf9c9c Mon Sep 17 00:00:00 2001 From: Pavel_Sorokin Date: Fri, 2 Dec 2022 11:50:08 +0400 Subject: [PATCH 3/9] =?UTF-8?q?Equals=20=D0=B2=20AbstractMap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Liner/Liner/AbstractMap.cs | 42 +++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/Liner/Liner/AbstractMap.cs b/Liner/Liner/AbstractMap.cs index faa99df..21ceac2 100644 --- a/Liner/Liner/AbstractMap.cs +++ b/Liner/Liner/AbstractMap.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Liner { - internal abstract class AbstractMap + internal abstract class AbstractMap : IEquatable { private IDrawingObject _drawningObject = null; protected int[,] _map = null; @@ -139,5 +139,45 @@ namespace Liner protected abstract void GenerateMap(); protected abstract void DrawRoadPart(Graphics g, int i, int j); protected abstract void DrawBarrierPart(Graphics g, int i, int j); + + public bool Equals(AbstractMap? other) + { + if(other == null) + { + return false; + } + var otherMap = other as AbstractMap; + if(otherMap == null) + { + return false; + } + if(_width != otherMap._width) + { + return false; + } + if(_height != otherMap._height) + { + return false; + } + if (_size_x != otherMap._size_x) + { + return false; + } + if (_size_y != otherMap._size_y) + { + return false; + } + for(int i = 0; i < _map.GetLength(0); i++) + { + for (int j = 0; j < _map.GetLength(1); j++) + { + if (_map[i, j] != otherMap._map[i, j]) + { + return false; + } + } + } + return true; + } } } -- 2.25.1 From a7aa4f92d6936efa27ef3401a790449bca227c2d Mon Sep 17 00:00:00 2001 From: Pavel_Sorokin Date: Fri, 2 Dec 2022 12:05:08 +0400 Subject: [PATCH 4/9] fix --- Liner/Liner/ShipCompareByColor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Liner/Liner/ShipCompareByColor.cs b/Liner/Liner/ShipCompareByColor.cs index 5df0f57..c97e27c 100644 --- a/Liner/Liner/ShipCompareByColor.cs +++ b/Liner/Liner/ShipCompareByColor.cs @@ -44,9 +44,9 @@ namespace Liner } if (xShip.GetShip.Ship is EntityLiner xLiner && yShip.GetShip.Ship is EntityLiner yLiner) { - string xLocomotiveDopColor = xLiner.DopColor.Name; - string yLocomotiveDopColor = yLiner.DopColor.Name; - var dopColorCompare = xShipColor.CompareTo(yShipColor); + string xShipDopColor = xLiner.DopColor.Name; + string yShipDopColor = yLiner.DopColor.Name; + var dopColorCompare = xShipDopColor.CompareTo(yShipDopColor); if (dopColorCompare != 0) { return dopColorCompare; -- 2.25.1 From 3c14b35930dc32cb3b4330bf24cfa4fdf3bf6a8d Mon Sep 17 00:00:00 2001 From: Pavel_Sorokin Date: Fri, 2 Dec 2022 12:12:35 +0400 Subject: [PATCH 5/9] fix(2) --- Liner/Liner/DrawingObjectShip.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Liner/Liner/DrawingObjectShip.cs b/Liner/Liner/DrawingObjectShip.cs index 55f54e5..758177d 100644 --- a/Liner/Liner/DrawingObjectShip.cs +++ b/Liner/Liner/DrawingObjectShip.cs @@ -36,13 +36,18 @@ namespace Liner public bool Equals(IDrawingObject? other) { - if (other is not DrawingObjectShip otherShip) + if (other == null) + { + return false; + } + var otherShip = other as DrawingObjectShip; + if (otherShip == null) { return false; } var ship = _ship.Ship; var otherShipShip = otherShip._ship.Ship; - if (ship.GetType() != otherShipShip.GetType()) + if (ship.GetType().Name != otherShipShip.GetType().Name) { return false; } @@ -76,4 +81,6 @@ namespace Liner return true; } } + + } } -- 2.25.1 From dfce1d08e13ca0a6023610a1837e223d4797bf81 Mon Sep 17 00:00:00 2001 From: Pavel_Sorokin Date: Fri, 2 Dec 2022 12:14:13 +0400 Subject: [PATCH 6/9] =?UTF-8?q?=D1=81=D0=BA=D0=BE=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BB=D0=B8=D1=88=D0=BD=D1=8F=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Liner/Liner/DrawingObjectShip.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Liner/Liner/DrawingObjectShip.cs b/Liner/Liner/DrawingObjectShip.cs index 758177d..ecf33b0 100644 --- a/Liner/Liner/DrawingObjectShip.cs +++ b/Liner/Liner/DrawingObjectShip.cs @@ -82,5 +82,5 @@ namespace Liner } } - } } + -- 2.25.1 From a56ec182e5d596999637fa00059fe683c9bbd786 Mon Sep 17 00:00:00 2001 From: Pavel_Sorokin Date: Fri, 2 Dec 2022 12:36:48 +0400 Subject: [PATCH 7/9] fix(2) --- Liner/Liner/AbstractMap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Liner/Liner/AbstractMap.cs b/Liner/Liner/AbstractMap.cs index 21ceac2..24284e4 100644 --- a/Liner/Liner/AbstractMap.cs +++ b/Liner/Liner/AbstractMap.cs @@ -146,7 +146,7 @@ namespace Liner { return false; } - var otherMap = other as AbstractMap; + var otherMap = other; if(otherMap == null) { return false; -- 2.25.1 From 811bba9e54b50e49895bbd0f44b5ef7045bfe3f2 Mon Sep 17 00:00:00 2001 From: Pavel_Sorokin Date: Fri, 2 Dec 2022 12:46:55 +0400 Subject: [PATCH 8/9] new fix --- Liner/Liner/AbstractMap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Liner/Liner/AbstractMap.cs b/Liner/Liner/AbstractMap.cs index 24284e4..21ceac2 100644 --- a/Liner/Liner/AbstractMap.cs +++ b/Liner/Liner/AbstractMap.cs @@ -146,7 +146,7 @@ namespace Liner { return false; } - var otherMap = other; + var otherMap = other as AbstractMap; if(otherMap == null) { return false; -- 2.25.1 From e227e7f26ee1ddbb28b95f67f688750e41e34042 Mon Sep 17 00:00:00 2001 From: Pavel_Sorokin Date: Mon, 5 Dec 2022 22:35:54 +0400 Subject: [PATCH 9/9] =?UTF-8?q?=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Liner/Liner/ShipCompareByColor.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Liner/Liner/ShipCompareByColor.cs b/Liner/Liner/ShipCompareByColor.cs index c97e27c..b522de5 100644 --- a/Liner/Liner/ShipCompareByColor.cs +++ b/Liner/Liner/ShipCompareByColor.cs @@ -42,6 +42,14 @@ namespace Liner { return xShipColor.CompareTo(yShipColor); } + if (xShip.GetShip.GetType().Name != yShip.GetShip.GetType().Name) + { + if (xShip.GetShip.GetType().Name == "DrawingShip") + { + return -1; + } + return 1; + } if (xShip.GetShip.Ship is EntityLiner xLiner && yShip.GetShip.Ship is EntityLiner yLiner) { string xShipDopColor = xLiner.DopColor.Name; -- 2.25.1