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; }