diff --git a/Ship/Ship/AbstractMap.cs b/Ship/Ship/AbstractMap.cs index fe8056a..5de5a27 100644 --- a/Ship/Ship/AbstractMap.cs +++ b/Ship/Ship/AbstractMap.cs @@ -56,14 +56,17 @@ 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 d9b2337..39e0688 100644 --- a/Ship/Ship/FormMapWithSetShips.Designer.cs +++ b/Ship/Ship/FormMapWithSetShips.Designer.cs @@ -165,8 +165,7 @@ 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 fe0a3d8..8fa1a4a 100644 --- a/Ship/Ship/FormMapWithSetShips.cs +++ b/Ship/Ship/FormMapWithSetShips.cs @@ -37,9 +37,6 @@ 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 e8627e8..59f21f6 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, 48); - int y = _random.Next(3, 48); + int x = _random.Next(2, 49); + int y = _random.Next(3, 50); 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))