fixed bug with Remove
This commit is contained in:
parent
62a9296290
commit
3a6d87df27
@ -91,7 +91,6 @@ namespace Boats
|
|||||||
Bitmap bmp = new(_pictureWidth, _pictureHeight);
|
Bitmap bmp = new(_pictureWidth, _pictureHeight);
|
||||||
Graphics g = Graphics.FromImage(bmp);
|
Graphics g = Graphics.FromImage(bmp);
|
||||||
DrawBackground(g);
|
DrawBackground(g);
|
||||||
Shaking();
|
|
||||||
DrawBoats(g);
|
DrawBoats(g);
|
||||||
return bmp;
|
return bmp;
|
||||||
}
|
}
|
||||||
@ -136,8 +135,8 @@ namespace Boats
|
|||||||
var boat = _setBoats[j];
|
var boat = _setBoats[j];
|
||||||
if (boat != null)
|
if (boat != null)
|
||||||
{
|
{
|
||||||
boat = _setBoats.Remove(j);
|
|
||||||
_setBoats.Insert(boat, i);
|
_setBoats.Insert(boat, i);
|
||||||
|
_setBoats.Remove(j);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,8 +74,7 @@ namespace Boats
|
|||||||
if (Count == 0 || position < 0 || position >= _maxCount || _places[position] == null)
|
if (Count == 0 || position < 0 || position >= _maxCount || _places[position] == null)
|
||||||
throw new BoatNotFoundException(position);
|
throw new BoatNotFoundException(position);
|
||||||
T boat = _places[position];
|
T boat = _places[position];
|
||||||
|
_places.RemoveAt(position);
|
||||||
_places[position] = null;
|
|
||||||
return boat;
|
return boat;
|
||||||
}
|
}
|
||||||
public T this[int position]
|
public T this[int position]
|
||||||
|
Loading…
Reference in New Issue
Block a user