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++; } }