From caaf1bf16211fbc7ce61f5e906f9c319fd5b1471 Mon Sep 17 00:00:00 2001
From: KirillFirsof <117719052+KirillFirsof@users.noreply.github.com>
Date: Fri, 10 Nov 2023 08:32:07 +0400
Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BD=D0=B5=D1=86=20=D1=87=D0=B5?=
=?UTF-8?q?=D1=82=D0=B2=D0=B5=D1=80=D1=82=D0=BE=D0=B9=20=D0=BB=D0=B0=D0=B1?=
=?UTF-8?q?=D1=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../RPP_FirstLaba_Tractor/DrawningTractor.cs | 2 +-
.../RPP_FirstLaba_Tractor/SetGeneric.cs | 15 +++++----------
.../TractorsGenericCollection.cs | 8 ++++----
3 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/DrawningTractor.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/DrawningTractor.cs
index 578ec20..99015c2 100644
--- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/DrawningTractor.cs
+++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/DrawningTractor.cs
@@ -81,7 +81,7 @@ namespace ProjectTractor.DrawningObjects {
}
///
- /// Получение объекта IMoveableObject из объекта DrawningCar
+ /// Получение объекта IMoveableObject из объекта DrawningTractor
///
public IMoveableObject GetMoveableObject => new
DrawningObjectTractor(this);
diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs
index bf52cc5..37df499 100644
--- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs
+++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs
@@ -37,20 +37,15 @@ namespace ProjectTractor.Generics
///
public bool Insert(T tractor)
{
- if (_places[0] == null)
- {
- _places[0] = tractor;
- }
- else
- {
- return Insert(tractor, 0);
- }
+ if (_places.Count == _maxCount)
+ return false;
+ Insert(tractor, 0);
return true;
}
///
/// Добавление объекта в набор на конкретную позицию
///
- /// Добавляемый автомобиль
+ /// Добавляемый автомобиль
/// Позиция
///
public bool Insert(T tractor, int position)
@@ -96,7 +91,7 @@ namespace ProjectTractor.Generics
/// Проход по списку
///
///
- public IEnumerable GetCars(int? maxTractors = null)
+ public IEnumerable GetTractors(int? maxTractors = null)
{
for (int i = 0; i < _places.Count; ++i)
{
diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericCollection.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericCollection.cs
index 54f0f69..d978071 100644
--- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericCollection.cs
+++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericCollection.cs
@@ -9,7 +9,7 @@ using ProjectTractor.MovementStrategy;
namespace ProjectTractor.Generics
{
///
- /// Параметризованный класс для набора объектов DrawningCar
+ /// Параметризованный класс для набора объектов DrawningTractor
///
///
///
@@ -129,12 +129,12 @@ namespace ProjectTractor.Generics
private void DrawObjects(Graphics g)
{
int i = 0;
- foreach (var tractor in _collection.GetCars())
+ foreach (var tractor in _collection.GetTractors())
{
if (tractor != null)
{
- int inRow = _pictureWidth / _placeSizeWidth;
- tractor.SetPosition(_pictureWidth - _placeSizeWidth - (i % inRow * _placeSizeWidth) - _placeSizeHeight / 2 - 8, i / inRow * _placeSizeHeight + 20);
+ int countRows = _pictureWidth / _placeSizeWidth;
+ tractor.SetPosition(_pictureWidth - _placeSizeWidth * 2 - (i % countRows * _placeSizeWidth) + 20, _pictureHeight - i / countRows * _placeSizeHeight - 160);
tractor.DrawTransport(g);
}
i++;