diff --git a/Ship/Ship/AbstractMap.cs b/Ship/Ship/AbstractMap.cs index 5de5a27..fe8056a 100644 --- a/Ship/Ship/AbstractMap.cs +++ b/Ship/Ship/AbstractMap.cs @@ -56,17 +56,14 @@ namespace Ship private bool ObjectIntersects() { var location = _drawingObject.GetCurrentPosition(); - Debug.WriteLine(location.Left + " " + location.Right + " " + location.Top + " " + location.Bottom); for (int i = 0; i < _map.GetLength(0); i++) { for (int j = 0; j < _map.GetLength(1); j++) { if (_map[i, j] == _barrier) { - Debug.WriteLine("Barrier found " + i * _size_x + " " + (i + 1) * _size_x + " " + j * _size_y + " " + (j+1)*_size_y + " " + (i * _size_x >= location.Left) + " " + ((i + 1) * _size_x <= location.Right) + " " + (j * _size_y >= location.Top) + " " + ((j + 1) * _size_y <= location.Bottom)); if (i * _size_x >= location.Left && (i + 1) * _size_x <= location.Right && j * _size_y >= location.Top && (j + 1) * _size_y <= location.Bottom) { - Debug.WriteLine("True"); return true; } } diff --git a/Ship/Ship/FormMapWithSetShips.Designer.cs b/Ship/Ship/FormMapWithSetShips.Designer.cs index 39e0688..d9b2337 100644 --- a/Ship/Ship/FormMapWithSetShips.Designer.cs +++ b/Ship/Ship/FormMapWithSetShips.Designer.cs @@ -165,7 +165,8 @@ this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxSelectorMap.FormattingEnabled = true; this.comboBoxSelectorMap.Items.AddRange(new object[] { - "Простая карта"}); + "Простая карта", + "Водная карта"}); this.comboBoxSelectorMap.Location = new System.Drawing.Point(19, 22); this.comboBoxSelectorMap.Name = "comboBoxSelectorMap"; this.comboBoxSelectorMap.Size = new System.Drawing.Size(169, 23); diff --git a/Ship/Ship/FormMapWithSetShips.cs b/Ship/Ship/FormMapWithSetShips.cs index 8fa1a4a..fe0a3d8 100644 --- a/Ship/Ship/FormMapWithSetShips.cs +++ b/Ship/Ship/FormMapWithSetShips.cs @@ -37,6 +37,9 @@ namespace Ship case "Простая карта": map = new SimpleMap(); break; + case "Водная карта": + map = new WaterMap(); + break; } if (map != null) { diff --git a/Ship/Ship/WaterMap.cs b/Ship/Ship/WaterMap.cs index 59f21f6..e8627e8 100644 --- a/Ship/Ship/WaterMap.cs +++ b/Ship/Ship/WaterMap.cs @@ -33,8 +33,8 @@ namespace Ship } while (counter < 10) { - int x = _random.Next(2, 49); - int y = _random.Next(3, 50); + int x = _random.Next(2, 48); + int y = _random.Next(3, 48); var points = new int[] { _map[x, y], _map[x, y + 1], _map[x - 1, y + 1], _map[x + 1, y + 1] }; var forComparison = new int[] { _freeRoad, _freeRoad, _freeRoad, _freeRoad }; if (points.SequenceEqual(forComparison))