final
This commit is contained in:
parent
b1f9c38b44
commit
f49703596b
@ -51,6 +51,8 @@ namespace AirBomber
|
||||
if (obj is null)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
if (obj + (Renderer) != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
@ -65,6 +67,12 @@ namespace AirBomber
|
||||
_logger.LogWarning("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
catch (StorageOverflowException ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
_logger.LogWarning(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void ButtonRemoveEntity_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -97,6 +105,7 @@ namespace AirBomber
|
||||
catch (EntityNotFoundException ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
_logger.LogWarning(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AirBomber.MovementStrategy;
|
||||
using AirBomber.Exceptions;
|
||||
using AirBomber.MovementStrategy;
|
||||
using AirBomber.Rendering;
|
||||
|
||||
namespace AirBomber.Generics
|
||||
@ -36,12 +37,7 @@ namespace AirBomber.Generics
|
||||
|
||||
public static bool operator -(EntitiesGenericCollection<T, U> collect, int pos)
|
||||
{
|
||||
T? obj = collect._collection[pos];
|
||||
|
||||
if (obj != null)
|
||||
return collect._collection.Remove(pos);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public U? GetU(int pos)
|
||||
|
@ -29,13 +29,13 @@ namespace AirBomber.Generics
|
||||
return i;
|
||||
}
|
||||
|
||||
throw new StorageOverflowException();
|
||||
throw new StorageOverflowException(_maxCount);
|
||||
}
|
||||
|
||||
public int Insert(T Entity, int Position)
|
||||
{
|
||||
if (Position >= _maxCount)
|
||||
throw new StorageOverflowException();
|
||||
throw new StorageOverflowException(_maxCount);
|
||||
|
||||
if (_objects[Position] is null)
|
||||
{
|
||||
@ -43,16 +43,16 @@ namespace AirBomber.Generics
|
||||
return Position;
|
||||
}
|
||||
|
||||
throw new StorageOverflowException();
|
||||
throw new StorageOverflowException(_maxCount);
|
||||
}
|
||||
|
||||
public bool Remove(int Position)
|
||||
{
|
||||
if (Position >= _maxCount)
|
||||
throw new EntityNotFoundException();
|
||||
throw new EntityNotFoundException(Position);
|
||||
|
||||
if (_objects[Position] is null)
|
||||
throw new EntityNotFoundException();
|
||||
throw new EntityNotFoundException(Position);
|
||||
|
||||
_objects[Position] = default(T);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user