From 986512d2fc165fe095ef651006f2f9df16be65a4 Mon Sep 17 00:00:00 2001 From: Timourka Date: Mon, 23 Oct 2023 23:51:58 +0400 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=BD=D0=BE=D0=B2=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Laba1Loco/Laba1Loco/SetGeneric.cs | 4 ++-- Laba1Loco/Laba1Loco/TrainsGenericCollection.cs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Laba1Loco/Laba1Loco/SetGeneric.cs b/Laba1Loco/Laba1Loco/SetGeneric.cs index a63353d..5483060 100644 --- a/Laba1Loco/Laba1Loco/SetGeneric.cs +++ b/Laba1Loco/Laba1Loco/SetGeneric.cs @@ -113,12 +113,12 @@ namespace Laba1Loco /// Проход по списку /// /// - public IEnumerable GetTrains(int? maxCars = null) + public IEnumerable GetTrains(int? maxTrains = null) { for (int i = 0; i < _places.Count; ++i) { yield return _places[i]; - if (maxCars.HasValue && i == maxCars.Value) + if (maxTrains.HasValue && i == maxTrains.Value) { yield break; } diff --git a/Laba1Loco/Laba1Loco/TrainsGenericCollection.cs b/Laba1Loco/Laba1Loco/TrainsGenericCollection.cs index 83c66a1..3ad62b6 100644 --- a/Laba1Loco/Laba1Loco/TrainsGenericCollection.cs +++ b/Laba1Loco/Laba1Loco/TrainsGenericCollection.cs @@ -120,15 +120,15 @@ where U : IMoveableObject private void DrawObjects(Graphics g) { int i = 0; - foreach (var car in _collection.GetTrains()) + foreach (var train in _collection.GetTrains()) { - if (car != null) + if (train != null) { - car.SetPosition((i % (_pictureWidth / _placeSizeWidth)) * _placeSizeWidth, (i / (_pictureWidth / _placeSizeWidth)) * _placeSizeHeight); - if (car is DrawingLoco) - (car as DrawingLoco).DrawTransport(g); + train.SetPosition((i % (_pictureWidth / _placeSizeWidth)) * _placeSizeWidth, (i / (_pictureWidth / _placeSizeWidth)) * _placeSizeHeight); + if (train is DrawingLoco) + (train as DrawingLoco).DrawTransport(g); else - car.DrawTransport(g); + train.DrawTransport(g); } i++; }