diff --git a/Stormtrooper/Stormtrooper/MapWithSetAirplaneGeneric.cs b/Stormtrooper/Stormtrooper/MapWithSetAirplaneGeneric.cs
index d3ed604..12424a2 100644
--- a/Stormtrooper/Stormtrooper/MapWithSetAirplaneGeneric.cs
+++ b/Stormtrooper/Stormtrooper/MapWithSetAirplaneGeneric.cs
@@ -88,7 +88,7 @@ namespace Stormtrooper
///
public Bitmap ShowOnMap()
{
- foreach (var air in _setAirs.GetBoats())
+ foreach (var air in _setAirs.GetAirs())
{
return _map.CreateMap(_pictureWidth, _pictureHeight, air);
}
@@ -168,15 +168,22 @@ namespace Stormtrooper
int currentHeight = 0;
int i = 0;
- foreach (var air in _setAirs.GetBoats())
+ foreach (var air in _setAirs.GetAirs())
{
- air.SetObject(currentWidth * _placeSizeWidth,
+ air?.SetObject(currentWidth * _placeSizeWidth,
currentHeight * _placeSizeHeight,
_pictureWidth, _pictureHeight);
- air.DrawningObject(g);
+ air?.DrawningObject(g);
- i++;
+ if (currentWidth > 0)
+ currentWidth--;
+ else
+ {
+ currentWidth = width - 1;
+ currentHeight++;
+ }
+ if (currentHeight > height) return;
}
}
}
diff --git a/Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs b/Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs
index 1ef7e87..bd13158 100644
--- a/Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs
+++ b/Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs
@@ -90,13 +90,13 @@ namespace Stormtrooper
}
}
- public IEnumerable GetBoats()
+ public IEnumerable GetAirs()
{
- foreach (var boat in _places)
+ foreach (var air in _places)
{
- if (boat != null)
+ if (air != null)
{
- yield return boat;
+ yield return air;
}
else
{