/** * * @param args */ public static void main(String[] args) { try { File boardDir = Configuration.boardsDir(); BoardsValidator validator = new BoardsValidator(); validator.scanForBoards(boardDir); System.out.println("Found " + validator.numBoardErrors + " boards with errors!"); }catch (IOException e){ System.out.println("IOException!"); e.printStackTrace(); } } }
/** * {@inheritDoc} */ @Override @Deprecated public void load(final String filename) { load(new MegaMekFile(Configuration.boardsDir(), filename).getFile()); }
&& !MapSettings.BOARD_RANDOM.equals(boardSelected) && !MapSettings.BOARD_SURPRISE.equals(boardSelected)) { b.load(new File(Configuration.boardsDir(), boardSelected + ".board")); if (b.isValid()) { nonFound = false;
public void previewMapsheet() { String boardName = lisBoardsAvailable.getSelectedValue(); if (lisBoardsAvailable.getSelectedIndex() > 2) { IBoard board = new Board(16, 17); board.load(new MegaMekFile(Configuration.boardsDir(), boardName + ".board").getFile()); if (chkRotateBoard.isSelected()) { BoardUtilities.flip(board, true, true); } if (board.isValid()) miniMap.setBoard(board); } }
/** * Test method for {@link megamek.common.Configuration#boardsDir()}. */ @Test public final void testBoardsDir() { assertEquals(new File("data", "boards").toString(), Configuration .boardsDir().toString()); }
/** * Changes all selected boards to be the specified board */ private void changeMap(String board) { int[] selected = lisBoardsSelected.getSelectedIndices(); for (final int newVar : selected) { String name = board; if (!MapSettings.BOARD_RANDOM.equals(name) && !MapSettings.BOARD_SURPRISE.equals(name) && chkRotateBoard.isSelected()) { name = Board.BOARD_REQUEST_ROTATION + name; } // Validate the map IBoard b = new Board(16, 17); if (!MapSettings.BOARD_GENERATED.equals(board) && !MapSettings.BOARD_RANDOM.equals(board) && !MapSettings.BOARD_SURPRISE.equals(board)) { b.load(new MegaMekFile(Configuration.boardsDir(), board + ".board").getFile()); if (!b.isValid()) { JOptionPane.showMessageDialog(this, "The Selected board is invalid, please select another."); return; } } ((DefaultListModel<String>) lisBoardsSelected.getModel()).setElementAt(newVar + ": " + name, newVar); //$NON-NLS-1$ mapSettings.getBoardsSelectedVector().set(newVar, name); } lisBoardsSelected.setSelectedIndices(selected); clientgui.getClient().sendMapSettings(mapSettings); }
/** * Test method for * {@link megamek.common.Configuration#setBoardsDir(java.io.File)}. */ @Test public final void testSetBoardsDir() { Configuration.setBoardsDir(new File("my_boards")); assertEquals("my_boards", Configuration.boardsDir().toString()); // Should reset to default. Configuration.setBoardsDir(null); assertEquals(new File("data", "boards").toString(), Configuration .boardsDir().toString()); }
File curDir = new File(Configuration.boardsDir(), dir); if (curDir.exists()) { for(String file : curDir.list()) { sBoardFile = board + FILE_SUFFIX_BOARD; File fBoard = new MegaMekFile(Configuration.boardsDir(), sBoardFile).getFile(); if (!fBoard.exists()) { throw new ScenarioLoaderException("nonexistantBoard", board); //$NON-NLS-1$ ba[n].load(new MegaMekFile(Configuration.boardsDir(), sBoardFile).getFile()); if(cf > 0) { ba[n].setBridgeCF(cf);
sheetBoards[i] = BoardUtilities.generateRandom(temp); } else { sheetBoards[i].load(new MegaMekFile(Configuration.boardsDir(), name + ".board").getFile()); BoardUtilities.flip(sheetBoards[i], isRotated, isRotated);