/** * Apply the current Hex to the Board at the specified location. */ void paintHex(Coords c) { board.resetStoredElevation(); board.setHex(c, curHex.duplicate()); }
/** * Sets the current hex * * @param hex hex to set. */ void setCurrentHex(IHex hex) { curHex = hex.duplicate(); texElev.setText(Integer.toString(curHex.getLevel())); refreshTerrainList(); if (lisTerrain.getModel().getSize() > 0) { lisTerrain.setSelectedIndex(0); refreshTerrainFromList(); } texTheme.setText(curHex.getTheme()); repaint(); repaintWorkingHex(); }
/** * 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); } }
/** * This assigns images to a hex based on the best matches it can find. * <p/> * First it assigns any images to be superimposed on a hex. These images must * have a match value of 1.0 to be added, and any time a match of this level is * achieved, any terrain involved in the match is removed from further * consideration. * <p/> * Any terrain left is used to match a base image for the hex. This time, a * match can be any value, and the first, best image is used. */ public synchronized Object[] assignMatch(IHex hex, Component comp) { IHex hexCopy = hex.duplicate(); List<Image> ortho = orthoFor(hexCopy, comp); List<Image> supers = supersFor(hexCopy, comp); Image base = baseFor(hexCopy, comp); Object[] pair = new Object[] { base, supers, ortho }; basesCache.put(hex, base); supersCache.put(hex, supers); orthosCache.put(hex, ortho); return pair; }
/** * 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); } }