From 3c0124841ec9e6837e6af165340865c4cd78049e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D1=88=D0=B8=D0=BD=20=D0=9C=D0=B0=D0=BA=D1=81?= =?UTF-8?q?=D0=B8=D0=BC?= Date: Thu, 20 Oct 2022 11:28:49 +0400 Subject: [PATCH] fix --- .../GasolineTanker/FormMapWithSetGasolineTanker.cs | 2 ++ .../GasolineTanker/MapWithSetGasolienTankerGeneric.cs | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/GasolineTanker/GasolineTanker/FormMapWithSetGasolineTanker.cs b/GasolineTanker/GasolineTanker/FormMapWithSetGasolineTanker.cs index 8ecaafc..6df5df9 100644 --- a/GasolineTanker/GasolineTanker/FormMapWithSetGasolineTanker.cs +++ b/GasolineTanker/GasolineTanker/FormMapWithSetGasolineTanker.cs @@ -33,10 +33,12 @@ namespace GasolineTanker { int index = listBoxMaps.SelectedIndex; listBoxMaps.Items.Clear(); + for (int i = 0; i < _mapsCollection.Keys.Count; i++) { listBoxMaps.Items.Add(_mapsCollection.Keys[i]); } + if (listBoxMaps.Items.Count > 0 && (index == -1 || index >= listBoxMaps.Items.Count)) { listBoxMaps.SelectedIndex = 0; diff --git a/GasolineTanker/GasolineTanker/MapWithSetGasolienTankerGeneric.cs b/GasolineTanker/GasolineTanker/MapWithSetGasolienTankerGeneric.cs index 4a437cc..cd44080 100644 --- a/GasolineTanker/GasolineTanker/MapWithSetGasolienTankerGeneric.cs +++ b/GasolineTanker/GasolineTanker/MapWithSetGasolienTankerGeneric.cs @@ -112,10 +112,10 @@ namespace GasolineTanker int height = _pictureHeight / _placeSizeHeight; int i = 0; - foreach (var warship in _setGasolineTanker.GetGasolineTanker()) + foreach (var gasolineTanker in _setGasolineTanker.GetGasolineTanker()) { - warship.SetObject(i % width * _placeSizeWidth+10, (height - 1 - i / width) * _placeSizeHeight + 10, _pictureWidth, _pictureHeight); - warship.DrawningObject(g); + gasolineTanker.SetObject(i % width * _placeSizeWidth+10, (height - 1 - i / width) * _placeSizeHeight + 10, _pictureWidth, _pictureHeight); + gasolineTanker.DrawningObject(g); i++; } }