Polevoy S.V Lab_work4 #4
@ -49,13 +49,9 @@ namespace Artilleries
|
||||
public Bitmap ShowOnMap()
|
||||
{
|
||||
Shaking();
|
||||
for (int i = 0; i < _setArtilleries.Count; i++)
|
||||
foreach (var artillery in _setArtilleries.GetArtilleries())
|
||||
{
|
||||
var car = _setArtilleries.Get(i);
|
||||
if (car != null)
|
||||
{
|
||||
return _map.CreateMap(_pictureWidth, _pictureHeight, car);
|
||||
}
|
||||
return _map.CreateMap(_pictureWidth, _pictureHeight, artillery);
|
||||
}
|
||||
return new(_pictureWidth, _pictureHeight);
|
||||
}
|
||||
@ -74,11 +70,11 @@ namespace Artilleries
|
||||
int j = _setArtilleries.Count - 1;
|
||||
for (int i = 0; i < _setArtilleries.Count; i++)
|
||||
{
|
||||
if (_setArtilleries.Get(i) == null)
|
||||
if (_setArtilleries[i] == null)
|
||||
{
|
||||
for (; j > i; j--)
|
||||
{
|
||||
var car = _setArtilleries.Get(j);
|
||||
var car = _setArtilleries[j];
|
||||
if (car != null)
|
||||
{
|
||||
_setArtilleries.Insert(car, i);
|
||||
@ -120,14 +116,12 @@ namespace Artilleries
|
||||
int width = _pictureWidth / _placeSizeWidth;
|
||||
int height = _pictureHeight / _placeSizeHeight;
|
||||
|
||||
for (int i = 0; i < _setArtilleries.Count; i++)
|
||||
int index = 0;
|
||||
foreach (var artillery in _setArtilleries.GetArtilleries())
|
||||
{
|
||||
var artillery = _setArtilleries.Get(i);
|
||||
if (artillery != null)
|
||||
{
|
||||
artillery.SetObject(i % width * _placeSizeWidth + 10, (height - 1 - i / width) * _placeSizeHeight + 10, _pictureWidth, _pictureHeight);
|
||||
artillery.DrawingObject(g);
|
||||
}
|
||||
artillery.SetObject(index % width * _placeSizeWidth + 10, (height - 1 - index / width) * _placeSizeHeight + 10, _pictureWidth, _pictureHeight);
|
||||
artillery.DrawingObject(g);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user