Bugfix: Closes old map editor dialogs that depends on the old map when creating a new map or loading a map.

This commit is contained in:
Stian Grenborgen 2024-01-14 14:06:23 +01:00
parent ab4b40c2db
commit 16b98ecf42
2 changed files with 5 additions and 6 deletions

View File

@ -366,6 +366,7 @@ public final class MapEditorController extends FreeColClientHolder {
final GUI gui = getGUI();
fcc.setMapEditor(true);
getGUI().removeInGameComponents();
gui.showStatusPanel(Messages.message("status.loadingGame"));
final File theFile = file;
@ -382,10 +383,8 @@ public final class MapEditorController extends FreeColClientHolder {
requireNativeNations(game);
SwingUtilities.invokeLater(() -> {
gui.closeStatusPanel();
getGUI().startMapEditorGUI();
gui.setFocus(game.getMap().getTile(1,1));
gui.enableEditorTransformPanel(true);
gui.enableMapControls(getClientOptions().getBoolean(ClientOptions.DISPLAY_MAP_CONTROLS));
gui.updateMenuBar();
gui.refresh();
});
} catch (FileNotFoundException fnfe) {

View File

@ -70,10 +70,10 @@ public class NewEmptyMapAction extends MapboardAction {
Map map = getFreeColClient().getFreeColServer()
.generateEmptyMap(size.width, size.height);
Tile tile = map.getTile(size.width/2, size.height/2);
getGUI().enableEditorTransformPanel(true);
getGUI().enableMapControls(getClientOptions().getBoolean(ClientOptions.DISPLAY_MAP_CONTROLS));
getGUI().removeInGameComponents();
getGUI().startMapEditorGUI();
getGUI().refresh();
getGUI().setFocus(tile);
getGUI().updateMenuBar();
getGUI().refresh();
}
}