/** * Apply the current Hex to the Board at the specified location. */ void paintHex(Coords c) { board.resetStoredElevation(); board.setHex(c, curHex.duplicate()); }
/** * 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); } }
/** * 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; }