diff --git a/AircraftCarrier/AircraftCarrier/DrawingWarship.cs b/AircraftCarrier/AircraftCarrier/DrawingWarship.cs
index e5fdddb..d1ba1a3 100644
--- a/AircraftCarrier/AircraftCarrier/DrawingWarship.cs
+++ b/AircraftCarrier/AircraftCarrier/DrawingWarship.cs
@@ -59,27 +59,14 @@ namespace AircraftCarrier
///
public void SetPosition(int x, int y, int width, int height)
{
- _startPosX = x;
- _startPosY = y;
- _pictureWidth = width;
- _pictureHeight = height;
-
- if (width < _warshipWidth)
+ if (width >= x + _warshipWidth && height >= y + _warshipHeight && x >= 0 && y >= 0)
{
- width = _warshipWidth;
- }
- if (height < _warshipHeight)
- {
- height = _warshipHeight;
- }
- if(x + _warshipWidth > width)
- {
- _startPosX -= x + _warshipWidth - width;
- }
- if (y + _warshipHeight > height)
- {
- _pictureHeight -= y + _warshipHeight - height;
+ _startPosX = x;
+ _startPosY = y;
+ _pictureWidth = width;
+ _pictureHeight = height;
}
+ else return;
}
///
/// Изменение направления пермещения