/** * Apply the current Hex to the Board at the specified location. */ void paintHex(Coords c) { board.resetStoredElevation(); board.setHex(c, curHex.duplicate()); }
break; case Packet.COMMAND_CHANGE_HEX: game.getBoard().setHex((Coords) c.getObject(0), (IHex) c.getObject(1)); break; case Packet.COMMAND_CHANGE_HEXES:
break; case Packet.COMMAND_CHANGE_HEX: getGame().getBoard().setHex((Coords) c.getObject(0), (IHex) c.getObject(1)); break;
/** * Apply the current Hex to the Board at the specified location. */ public void resurfaceHex(Coords c) { if (board.contains(c)) { IHex newHex = curHex.duplicate(); newHex.setLevel(board.getHex(c).getLevel()); board.resetStoredElevation(); board.setHex(c, newHex); } }
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(); }
/** * Apply the current Hex to the Board at the specified location. */ public void addToHex(Coords c) { if (board.contains(c)) { IHex newHex = curHex.duplicate(); IHex oldHex = board.getHex(c); newHex.setLevel(oldHex.getLevel()); int terrainTypes[] = oldHex.getTerrainTypes(); for (int i = 0; i < terrainTypes.length; i++) { int terrainID = terrainTypes[i]; if (!newHex.containsTerrain(terrainID) && oldHex.containsTerrain(terrainID)) { newHex.addTerrain(oldHex.getTerrain(terrainID)); } } board.resetStoredElevation(); board.setHex(c, newHex); } }
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; }