diff --git a/WarPlanes/WarPlanes/DrawningWarplane.cs b/WarPlanes/WarPlanes/DrawningWarplane.cs index e1c0ce4..5fe61ec 100644 --- a/WarPlanes/WarPlanes/DrawningWarplane.cs +++ b/WarPlanes/WarPlanes/DrawningWarplane.cs @@ -53,16 +53,16 @@ /// Высота картинки public void SetPosition(int x, int y, int width, int height) { - _startPosX = x; - _startPosY = y; - _pictureWidth = width; - _pictureHeight = height; - - if (width <= _warplaneWidth || height <= _warplaneHeight || x < 0 || y < 0 || x > width - _warplaneWidth || y > height - _warplaneHeight) + if (width <= _warplaneWidth || height <= _warplaneHeight || x < 0 || y < 0 || x > width - _warplaneWidth || y > height - _warplaneHeight) { _pictureWidth = null; _pictureHeight = null; - } + return; + } + _startPosX = x; + _startPosY = y; + _pictureWidth = width; + _pictureHeight = height; } /// /// Изменение направления пермещения