diff --git a/ArmoredVehicle/src/FormMapWithSetMachine.java b/ArmoredVehicle/src/FormMapWithSetMachine.java index 4409512..7852673 100644 --- a/ArmoredVehicle/src/FormMapWithSetMachine.java +++ b/ArmoredVehicle/src/FormMapWithSetMachine.java @@ -586,7 +586,7 @@ private void ReloadMaps() { int result = fs.showSaveDialog(null); if (result == JFileChooser.APPROVE_OPTION) { File selectedFile = fs.getSelectedFile(); - if (_mapCollection.SaveData(selectedFile.getPath())) + if (_mapCollection.SaveData(selectedFile.getPath()+".txt")) { JOptionPane.showMessageDialog(null, "Сохранение прошло успешно", "Результат",JOptionPane.INFORMATION_MESSAGE); } diff --git a/ArmoredVehicle/src/MapsCollection.java b/ArmoredVehicle/src/MapsCollection.java index e695427..4ea43d6 100644 --- a/ArmoredVehicle/src/MapsCollection.java +++ b/ArmoredVehicle/src/MapsCollection.java @@ -217,10 +217,11 @@ public class MapsCollection { map = new HorizontalMap(); break; } - _mapStorages.put(elem[0], new MapWithSetMachineGeneric(_pictureWidth, _pictureHeight, map)); if(_mapStorages.containsKey(elem[0])){ _mapStorages.get(elem[0]).Clear(); } + else _mapStorages.put(elem[0], new MapWithSetMachineGeneric(_pictureWidth, _pictureHeight, map)); + while((str = br.readLine()) != null) { _mapStorages.get(elem[0]).LoadData(str.split(separatorData + "\n?")); }