исправил ошибки

This commit is contained in:
antoc0der 2023-10-27 22:39:53 +03:00
parent 9406327348
commit 7bfa7b0938
3 changed files with 6 additions and 7 deletions

View File

@ -67,13 +67,13 @@ namespace ProjectAirplaneWithRadar.Generics
private void DrawObjects(Graphics g) private void DrawObjects(Graphics g)
{ {
int i = 0; int i = 0;
foreach (var monorail in _collection.GetAirplanes()) foreach (var airplane in _collection.GetAirplanes())
{ {
if (monorail != null) if (airplane != null)
{ {
int inRow = _pictureWidth / _placeSizeWidth; int inRow = _pictureWidth / _placeSizeWidth;
monorail.SetPosition(i % inRow * _placeSizeWidth, _pictureHeight - _pictureHeight % _placeSizeHeight - (i / inRow + 1) * _placeSizeHeight); airplane.SetPosition(i % inRow * _placeSizeWidth, _pictureHeight - _pictureHeight % _placeSizeHeight - (i / inRow + 1) * _placeSizeHeight);
monorail.DrawTransport(g); airplane.DrawTransport(g);
} }
i++; i++;
} }

View File

@ -40,6 +40,5 @@ namespace ProjectAirplaneWithRadar.Generics
return null; return null;
} }
} }
} }
} }

View File

@ -53,12 +53,12 @@ namespace ProjectAirplaneWithRadar.Generics
return; return;
} }
} }
public IEnumerable<T?> GetAirplanes(int? maxMonorails = null) public IEnumerable<T?> GetAirplanes(int? maxAirplanes = null)
{ {
for (int i = 0; i < _places.Count; ++i) for (int i = 0; i < _places.Count; ++i)
{ {
yield return _places[i]; yield return _places[i];
if (maxMonorails.HasValue && i == maxMonorails.Value) if (maxAirplanes.HasValue && i == maxAirplanes.Value)
{ {
yield break; yield break;
} }