diff --git a/SelfPropelledArtilleryUnit/FormArtilleryConfig.cs b/SelfPropelledArtilleryUnit/FormArtilleryConfig.cs index 50d7e15..51cfc96 100644 --- a/SelfPropelledArtilleryUnit/FormArtilleryConfig.cs +++ b/SelfPropelledArtilleryUnit/FormArtilleryConfig.cs @@ -118,6 +118,5 @@ namespace Artilleries EventAddArtillery?.Invoke(_artillery); Close(); } - } } diff --git a/SelfPropelledArtilleryUnit/FormMapWithSetArtilleries.cs b/SelfPropelledArtilleryUnit/FormMapWithSetArtilleries.cs index 46ee05e..f5bdf3a 100644 --- a/SelfPropelledArtilleryUnit/FormMapWithSetArtilleries.cs +++ b/SelfPropelledArtilleryUnit/FormMapWithSetArtilleries.cs @@ -89,7 +89,12 @@ namespace Artilleries private void buttonAddArtillery_Click(object sender, EventArgs e) { var formArtilleryConfig = new FormArtilleryConfig(); - formArtilleryConfig.AddEvent((artillery) => { + formArtilleryConfig.AddEvent((artillery) => { + if (listBoxMaps.SelectedIndex == -1) + { + return; + } + if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] + new DrawingObjectArtillery(artillery) != -1) { MessageBox.Show("Объект добавлен");