diff --git a/AirBomber/AirBomber/PlanesGenericCollection.cs b/AirBomber/AirBomber/PlanesGenericCollection.cs
index 5d4cbf8..80ca3bb 100644
--- a/AirBomber/AirBomber/PlanesGenericCollection.cs
+++ b/AirBomber/AirBomber/PlanesGenericCollection.cs
@@ -65,7 +65,7 @@ namespace AirBomber
///
public static bool operator -(PlanesGenericCollection collect, int pos)
{
- T? obj = collect._collection.Get(pos);
+ T? obj = collect._collection[pos];
if (obj != null)
{
collect._collection.Remove(pos);
@@ -80,7 +80,7 @@ namespace AirBomber
///
public U? GetU(int pos)
{
- return (U?)_collection.Get(pos)?.GetMoveableObject;
+ return (U?)_collection[pos]?.GetMoveableObject;
}
///
/// Вывод всего набора объектов
@@ -121,16 +121,18 @@ namespace AirBomber
private void DrawObjects(Graphics g)
{
int widthObjCount = _pictureWidth / _placeSizeWidth;
- for (int i = 0; i < _collection.Count; i++)
+ int i = 0;
+ foreach (var plane in _collection.GetPlanes())
{
- T? type = _collection.Get(i);
- if (type != null)
{
- int row = i / widthObjCount;
- int col = widthObjCount - 1 - (i % widthObjCount);
+ if (plane != null)
+ {
+ int row = i / widthObjCount;
+ int col = widthObjCount - 1 - (i % widthObjCount);
- type.SetPosition(col * _placeSizeWidth, row * _placeSizeHeight);
- type?.DrawPlane(g);
+ plane.SetPosition(col * _placeSizeWidth, row * _placeSizeHeight);
+ plane?.DrawPlane(g);
+ }
}
}
}
diff --git a/AirBomber/AirBomber/SetGeneric.cs b/AirBomber/AirBomber/SetGeneric.cs
index 1188285..e899acd 100644
--- a/AirBomber/AirBomber/SetGeneric.cs
+++ b/AirBomber/AirBomber/SetGeneric.cs
@@ -123,12 +123,12 @@ namespace AirBomber
/// Проход по списку
///
///
- public IEnumerable GetCars(int? maxCars = null)
+ public IEnumerable GetPlanes(int? maxPlanes = null)
{
for (int i = 0; i < _places.Count; ++i)
{
yield return _places[i];
- if (maxCars.HasValue && i == maxCars.Value)
+ if (maxPlanes.HasValue && i == maxPlanes.Value)
{
yield break;
}