From c7d237696243ab3960baacd7b233d710d6cef938 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, 29 Nov 2022 22:32:20 +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=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D1=89=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AbstractMap.java | 2 +- DrawingShip.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AbstractMap.java b/AbstractMap.java index 4d2ba50..c5ccc9c 100644 --- a/AbstractMap.java +++ b/AbstractMap.java @@ -33,7 +33,7 @@ public abstract class AbstractMap { { for (int j = (int)(position[0] / _size_x); j <= (int)(position[1] / _size_x); ++j) { - if (_map[i][j] == _barrier) return false; + if (i >= 0 && j >= 0 && i < _map.length && j < _map[0].length && _map[i][j] == _barrier) return false; } } return true; diff --git a/DrawingShip.java b/DrawingShip.java index 442df41..8e3766c 100644 --- a/DrawingShip.java +++ b/DrawingShip.java @@ -125,6 +125,6 @@ public class DrawingShip extends JPanel { } public float[] GetCurrentPosition() { - return new float[]{_startPosX, _startPosY, _startPosX + _warmlyShipWidth, _startPosY + _warmlyShipHeight}; + return new float[]{_startPosX, _startPosX + _warmlyShipWidth, _startPosY, _startPosY + _warmlyShipHeight}; } }