From 94a05eba867852d5291d2f5fe940dbbbc17687f5 Mon Sep 17 00:00:00 2001 From: Danil Kargin Date: Sun, 16 Oct 2022 17:13:19 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirFighter/AirFighter/AbstractMap.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/AirFighter/AirFighter/AbstractMap.cs b/AirFighter/AirFighter/AbstractMap.cs index 2c61fba..21a9d6c 100644 --- a/AirFighter/AirFighter/AbstractMap.cs +++ b/AirFighter/AirFighter/AbstractMap.cs @@ -78,9 +78,9 @@ namespace AirFighter { return 2; } - for (int i = (int)(Top / _size_y); i <= (int)(Bottom / _size_y) + 1; i++) + for (int i = (int)(Top / _size_y); i <= (int)(Bottom / _size_y); i++) { - for (int j = (int)(Left / _size_x); j <= (int)(Right / _size_x) + 1; j++) + for (int j = (int)(Left / _size_x); j <= (int)(Right / _size_x); j++) { if (_map[i, j] == _barrier) return 0; @@ -106,22 +106,23 @@ namespace AirFighter int flag = 0; while (flag == 0) { - flag = CheckBarrier((int)Right, (int)Left, (int)Top, (int)Bottom); + y += (int)_size_y; - Top += _size_y; - Bottom += _size_y; + Top += (int)_size_y; + Bottom += (int)_size_y; _drawningObject.SetObject(x, y, _width, _height); + flag = CheckBarrier((int)Right, (int)Left, (int)Top, (int)Bottom); } if (flag == 1) { return true; } x += (int)_size_x; - Left += _size_x; - Right += _size_x; + Left += (int)_size_x; + Right += (int)_size_x; y = (int)tempTop; - Top = tempTop; - Bottom = tempBottom; + Top = (int)tempTop; + Bottom = (int)tempBottom; } return false; }