Example #1
0
  protected void loadSavedGame(SaveSelectionPanel ssp, Window windowToClose) {
    ShortSaveInfo ssi = ssp.getSelectedSaveGame();
    if (ssi == null) {
      JOptionPane.showMessageDialog(
          windowToClose, "Select a non-empty slot.", "Error", JOptionPane.ERROR_MESSAGE);
      return;
    }

    try {
      System.out.println("Loading game with slot " + ssi.slot + "...");
      SavedGame sg = SavedGame.loadSavedGame(EditorResourceManager.getUFODirectory(), ssi.slot);
      System.out.println("Successfully loaded saved game.");
      windowToClose.dispose();
      MainMenuFrame mainMenu = new MainMenuFrame(sg);
      mainMenu.setVisible(true);
    } catch (IOException ioe) {
      System.out.println("Error loading saved game: " + ioe.getMessage());
      ioe.printStackTrace(System.out);
    }
  }