This commit is contained in:
Saanechkaa 2022-12-13 17:24:29 +04:00
parent cebb91a24c
commit 5f39e71615
3 changed files with 8 additions and 3 deletions

View File

@ -49,7 +49,7 @@
{ {
int width = picWidth / _placeSizeWidth; int width = picWidth / _placeSizeWidth;
int height = picHeight / _placeSizeHeight; int height = picHeight / _placeSizeHeight;
_setRoadTrains = new SetRoadTrainsGeneric<T>(width * height - 2); _setRoadTrains = new SetRoadTrainsGeneric<T>(width * height - 1);
_pictureWidth = picWidth; _pictureWidth = picWidth;
_pictureHeight = picHeight; _pictureHeight = picHeight;
_map = map; _map = map;

View File

@ -27,6 +27,7 @@
<PackageReference Include="Serilog" Version="2.12.0" /> <PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" /> <PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" /> <PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -72,9 +72,13 @@
public T Remove(int position) public T Remove(int position)
{ {
// проверка позиции // проверка позиции
if (position < 0 || position >= _maxCount) if (position < 0 || position >= _maxCount - 1)
return null; return null;
T delObj = _places[position]; if (position >= _places.Count)
{
throw new RoadTrainNotFoundException(position);
}
var delObj = _places[position];
if (delObj == null) if (delObj == null)
{ {
throw new RoadTrainNotFoundException(position); throw new RoadTrainNotFoundException(position);