4 лаба Кувшинов ПИбд-21 Простая #7

Closed
TImourka wants to merge 4 commits from laba4 into laba3
2 changed files with 8 additions and 8 deletions
Showing only changes of commit 986512d2fc - Show all commits

View File

@ -113,12 +113,12 @@ namespace Laba1Loco
/// Проход по списку
/// </summary>
/// <returns></returns>
public IEnumerable<T> GetTrains(int? maxCars = null)
public IEnumerable<T> 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;
}

View File

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