public void changedUpdate(DocumentEvent te) { if (te.getDocument().equals(texElev.getDocument())) { int value; try { value = Integer.parseInt(texElev.getText()); } catch (NumberFormatException ex) { return; } if (value != curHex.getLevel()) { curHex.setLevel(value); repaintWorkingHex(); } } else if (te.getDocument().equals(texTheme.getDocument())) { curHex.setTheme(texTheme.getText()); repaintWorkingHex(); } }
for (Coords c: allBoardHexes()) { IHex hex = board.getHex(c); hex.setTheme(selectedTheme.equals("(No Theme)")? "":selectedTheme); board.setHex(c, hex);
public synchronized void boardChangedHex(BoardEvent b) { hexImageCache.remove(b.getCoords()); IHex hex = game.getBoard().getHex(b.getCoords()); tileManager.clearHex(hex); tileManager.waitForHex(hex); clearShadowMap(); // Maybe have to set the hexes' theme. Null clientgui implies board editor - don't mess with theme if ((selectedTheme != null) && !selectedTheme.equals("(Original Theme)") && (clientgui != null)) { if (selectedTheme.equals("(No Theme)") && (hex.getTheme() != null) && !hex.getTheme().equals("")) { hex.setTheme(""); game.getBoard().setHex(b.getCoords(), hex); } else if (!selectedTheme.equals(hex.getTheme())) { hex.setTheme(selectedTheme); game.getBoard().setHex(b.getCoords(), hex); } } repaint(); }
switch (capStyle) { case MapSettings.MOUNTAIN_SNOWCAPPED: hex.setTheme("snow"); break; case MapSettings.MOUNTAIN_VOLCANO_ACTIVE: case MapSettings.MOUNTAIN_VOLCANO_DORMANT: hex.setTheme("lunar"); break; case MapSettings.MOUNTAIN_LAKE: break; case MapSettings.MOUNTAIN_VOLCANO_EXTINCT: hex.setTheme("lunar"); elev -= 2; break;
public IBoard implantOldBoard(IGame game, int west, int north, int east, int south) { IBoard oldBoard = game.getBoard(); for (int x = 0; x < oldBoard.getWidth(); x++) { for (int y = 0; y < oldBoard.getHeight(); y++) { int newX = x+west; int newY = y+north; if (oldBoard.contains(x, y) && board.contains(newX, newY)) { IHex oldHex = oldBoard.getHex(x, y); IHex hex = board.getHex(newX, newY); hex.removeAllTerrains(); hex.setLevel(oldHex.getLevel()); int terrainTypes[] = oldHex.getTerrainTypes(); for (int i = 0; i < terrainTypes.length; i++) { int terrainID = terrainTypes[i]; if (!hex.containsTerrain(terrainID) && oldHex.containsTerrain(terrainID)) { hex.addTerrain(oldHex.getTerrain(terrainID)); } } hex.setTheme(oldHex.getTheme()); board.setHex(newX, newY, hex); board.resetStoredElevation(); } } } return board; }