23.03 магия

This commit is contained in:
UndertakerDM 2024-03-23 17:56:46 +04:00
parent 00df3818cf
commit 8790849a68
3 changed files with 3 additions and 2 deletions

View File

@ -77,7 +77,7 @@ public abstract class AbstractCompany
public DrawningWarmlyShip? GetRandomObject()
{
Random rnd = new();
return _collection.Get(rnd.Next(GetMaxCount));
return _collection?.Get(rnd.Next(GetMaxCount));
}
/// <summary>

View File

@ -57,7 +57,7 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
public bool Insert(T obj, int position)
{
// TODO проверка позиции
if(position != null ||position < 0|| position > _collection.Length)
if(position < 0|| position > _collection.Length)
{
return false;
}

View File

@ -11,6 +11,7 @@ public class WarmlyShip2SharingService : AbstractCompany
{
public WarmlyShip2SharingService(int picWidth, int picHeight, ICollectionGenericObjects<DrawningWarmlyShip> collection) : base(picWidth, picHeight, collection)
{
}
protected override void DrawBackgound(Graphics g)