|
Up
Design
About
Screen shots
/** * Chooses a random/default Piece-level scale. * This is overridden at Player level, if the player has * a personal ScaleMenu of his own. */ public void newScale() { // choose a new scale (pitch menu) if (!scales.isEmpty()) { int scaleIndex = dice.roll(scales); Vector items = scales.getItems(); PitchMenu chosenScale = (PitchMenu)items.elementAt(scaleIndex); // if required, make sure we haven't just repeated the last scale if (scales.getAvoidRepeats() && currentScale != null) { if (scales.getCount() > 1) // prevent infinite loop! while (chosenScale == currentScale) { // reroll scaleIndex = dice.roll(scales); items = scales.getItems(); chosenScale = (PitchMenu)items.elementAt(scaleIndex); } } currentScale = chosenScale; } else { // use a default scale currentScale = (PitchMenu)Defaults.scales.getValueAt(0, 0); currentScale = (PitchMenu)currentScale.deepCopy(); currentScale.setHideNameFromPiece(true); currentScale.expand(); } if (getVisualFeedback()) fireTableCellUpdated(0, 2); Debug.println("TM", "new piece scale = " + currentScale.toString()); Debug.println(); // give every player a chance to override the Piece-level scale band.newScale(currentScale); }