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