Борьба с конфликтами

This commit is contained in:
sqdselo 2024-06-06 10:44:54 +04:00
commit 6a1f539b10

View File

@ -56,7 +56,7 @@ namespace HoistingCrane.CollectionGenericObjects
public DrawningTrackedVehicle? GetRandomObject() public DrawningTrackedVehicle? GetRandomObject()
{ {
Random rnd = new(); Random rnd = new();
return _collection?.Get(rnd.Next(GetMaxCount)); return arr?.Get(rnd.Next(GetMaxCount));
} }
/// <summary> /// <summary>
@ -65,15 +65,15 @@ namespace HoistingCrane.CollectionGenericObjects
/// <returns></returns> /// <returns></returns>
public Bitmap? Show() public Bitmap? Show()
{ {
Bitmap bitmap = new(_pictureWidth, _pictureHeight); Bitmap bitmap = new(pictureWidth, pictureHeight);
Graphics graphics = Graphics.FromImage(bitmap); Graphics graphics = Graphics.FromImage(bitmap);
DrawBackgound(graphics); DrawBackgound(graphics);
SetObjectsPosition(); SetObjectsPosition();
for (int i = 0; i < (_collection?.Count ?? 0); ++i) for (int i = 0; i < (arr?.Count ?? 0); ++i)
{ {
try try
{ {
DrawningTrackedVehicle? obj = _collection?.Get(i); DrawningTrackedVehicle? obj = arr?.Get(i);
obj?.DrawTransport(graphics); obj?.DrawTransport(graphics);
} }
catch (Exception) { } catch (Exception) { }