Фикс ObjNotFndEx в компании
This commit is contained in:
parent
3cac227c53
commit
7baa0393e0
@ -1,4 +1,5 @@
|
|||||||
using Battleship.Drawnings;
|
using Battleship.Drawnings;
|
||||||
|
using Battleship.Exceptions;
|
||||||
|
|
||||||
namespace Battleship.CollectionGenericObjects;
|
namespace Battleship.CollectionGenericObjects;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -93,10 +94,14 @@ public abstract class AbstractCompany
|
|||||||
|
|
||||||
SetObjectsPosition();
|
SetObjectsPosition();
|
||||||
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
|
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
DrawningShip? obj = _collection?.Get(i);
|
DrawningShip? obj = _collection?.Get(i);
|
||||||
obj?.DrawTransport(graphics);
|
obj?.DrawTransport(graphics);
|
||||||
}
|
}
|
||||||
|
catch (ObjectNotFoundException) { };
|
||||||
|
}
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Battleship.Drawnings;
|
using Battleship.Drawnings;
|
||||||
|
using Battleship.Exceptions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -49,10 +50,14 @@ public class ShipDocks : AbstractCompany
|
|||||||
for(int ix = 5; ix + _placeSizeWidth <= _pictureWidth; ix += _placeSizeWidth)
|
for(int ix = 5; ix + _placeSizeWidth <= _pictureWidth; ix += _placeSizeWidth)
|
||||||
{
|
{
|
||||||
if (count < _collection.Count)
|
if (count < _collection.Count)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
_collection?.Get(count)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
_collection?.Get(count)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
||||||
_collection?.Get(count)?.SetPosition(ix, iy);
|
_collection?.Get(count)?.SetPosition(ix, iy);
|
||||||
}
|
}
|
||||||
|
catch (ObjectNotFoundException){}
|
||||||
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user