diff --git a/src/java/com/threerings/puzzle/client/PlayerStatusView.java b/src/java/com/threerings/puzzle/client/PlayerStatusView.java index 4d75a4b0..43178570 100644 --- a/src/java/com/threerings/puzzle/client/PlayerStatusView.java +++ b/src/java/com/threerings/puzzle/client/PlayerStatusView.java @@ -100,8 +100,7 @@ public class PlayerStatusView extends JPanel @Override public String toString () { - return "[user=" + _username + ", pidx=" + _pidx + - ", status=" + _status + "]"; + return "[user=" + _username + ", pidx=" + _pidx + ", status=" + _status + "]"; } /** The game object associated with this view. */ diff --git a/src/java/com/threerings/puzzle/client/PuzzleBoardView.java b/src/java/com/threerings/puzzle/client/PuzzleBoardView.java index ca80a92f..d9df29e2 100644 --- a/src/java/com/threerings/puzzle/client/PuzzleBoardView.java +++ b/src/java/com/threerings/puzzle/client/PuzzleBoardView.java @@ -86,10 +86,9 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel } /** - * Provides the board view with a reference to its controller so that - * it may communicate directly rather than by posting actions up the - * interface hierarchy which sometimes fails if the puzzle board view - * is hidden before we get a chance to post our actions. + * Provides the board view with a reference to its controller so that it may communicate + * directly rather than by posting actions up the interface hierarchy which sometimes fails if + * the puzzle board view is hidden before we get a chance to post our actions. */ public void setController (PuzzleController pctrl) { @@ -105,9 +104,8 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel } /** - * Set whether this puzzle is paused or not. - * If paused, a label will be displayed with the component's font, - * which may be set with setFont(). + * Set whether this puzzle is paused or not. If paused, a label will be displayed with the + * component's font, which may be set with setFont(). */ @Override public void setPaused (boolean paused) @@ -118,8 +116,7 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel PuzzleCodes.PUZZLE_MESSAGE_BUNDLE).xlate(pmsg); // create a label using our component's standard font _pauseLabel = new Label(pmsg, Label.BOLD | Label.OUTLINE, - Color.WHITE, Color.BLACK, - getFont()); + Color.WHITE, Color.BLACK, getFont()); _pauseLabel.setTargetWidth(_bounds.width); _pauseLabel.layout(this); } else { @@ -129,11 +126,10 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel } /** - * Adds the given animation to the set of animations currently present - * on the board. The animation will be added to a list of action - * animations whose count can be queried with {@link - * #getActionAnimationCount}. The animation will automatically be - * removed from the action list when it completes. + * Adds the given animation to the set of animations currently present on the board. The + * animation will be added to a list of action animations whose count can be queried with + * {@link #getActionAnimationCount}. The animation will automatically be removed from the + * action list when it completes. */ public void addActionAnimation (Animation anim) { @@ -172,11 +168,10 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel } /** - * Adds the given sprite to the set of sprites currently present on - * the board. The sprite will be added to a list of action sprites - * whose count can be queried with {@link #getActionSpriteCount}. Callers - * should be sure to remove the sprite when their work with it is done - * via {@link #removeSprite}. + * Adds the given sprite to the set of sprites currently present on the board. The sprite will + * be added to a list of action sprites whose count can be queried with + * {@link #getActionSpriteCount}. Callers should be sure to remove the sprite when their work + * with it is done via {@link #removeSprite}. */ public void addActionSprite (Sprite sprite) { @@ -253,15 +248,16 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel return StringUtil.shortClassName(obj); } }; - log.info("Board contents [board=" + StringUtil.shortClassName(this) + - ", sprites=" + StringUtil.listToString(_actionSprites, fmt) + - ", anims=" + StringUtil.listToString(_actionAnims, fmt) + - "]."); + log.info("Board contents", + "board", StringUtil.shortClassName(this), + "sprites", StringUtil.listToString(_actionSprites, fmt), + "anims", StringUtil.listToString(_actionAnims, fmt)); + } /** - * Creates and returns an animation displaying the given string with - * the specified parameters, floating it a short distance up the view. + * Creates and returns an animation displaying the given string with the specified parameters, + * floating it a short distance up the view. * * @param score the score text to display. * @param color the color of the text. @@ -276,9 +272,8 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel } /** - * Creates a score animation, allowing derived classes to use custom - * animations that are customized following a call to - * {@link #createScoreAnimation(String,Color,Font,int,int)}. + * Creates a score animation, allowing derived classes to use custom animations that are + * customized following a call to {@link #createScoreAnimation(String,Color,Font,int,int)}. */ protected ScoreAnimation createScoreAnimation (Label label, int x, int y) { @@ -286,10 +281,9 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel } /** - * Positions the supplied animation so as to avoid any active - * animations previously registered with this method, and adds the - * animation to the list of animations to be avoided by any future - * avoid animations. + * Positions the supplied animation so as to avoid any active animations previously registered + * with this method, and adds the animation to the list of animations to be avoided by any + * future avoid animations. */ public void trackAvoidAnimation (Animation anim) { @@ -341,8 +335,8 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel } /** - * Fires a {@link #ACTION_CLEARED} command iff we have no remaining - * interesting sprites or animations. + * Fires a {@link #ACTION_CLEARED} command if we have no remaining interesting sprites or + * animations. */ protected void maybeFireCleared () { @@ -351,10 +345,9 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel getActionCount() + ":" + isShowing()); } if (getActionCount() == 0) { - // we're probably in the middle of a tick() in an - // animationDidFinish() call and we want everyone to finish - // processing their business before we go clearing the action, - // so we queue this up to be run after the tick is complete + // we're probably in the middle of a tick() in an animationDidFinish() call and we want + // everyone to finish processing their business before we go clearing the action, so we + // queue this up to be run after the tick is complete _ctx.getClient().getRunQueue().postRunnable(new Runnable() { public void run () { _pctrl.boardActionCleared(); @@ -364,9 +357,8 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel } /** - * Renders the board contents to the given graphics context. - * Sub-classes should implement this method to draw all of their - * game-specific business. + * Renders the board contents to the given graphics context. Sub-classes should implement this + * method to draw all of their game-specific business. */ protected abstract void renderBoard (Graphics2D gfx, Rectangle dirty); diff --git a/src/java/com/threerings/puzzle/client/PuzzleController.java b/src/java/com/threerings/puzzle/client/PuzzleController.java index e484dbb6..2d6962c4 100644 --- a/src/java/com/threerings/puzzle/client/PuzzleController.java +++ b/src/java/com/threerings/puzzle/client/PuzzleController.java @@ -130,16 +130,14 @@ public abstract class PuzzleController extends GameController { super.setGameOver(gameOver); - // clear the action if we're informed that the game is over early - // by the client + // clear the action if we're informed that the game is over early by the client if (gameOver) { clearAction(); } } /** - * Returns true if the puzzle has action, false if the action is - * cleared or it is suspended. + * Returns true if the puzzle has action, false if the action is cleared or it is suspended. */ public boolean hasAction () { @@ -209,9 +207,8 @@ public abstract class PuzzleController extends GameController } /** - * Derived classes should override this and return false if their - * action should not be paused when the user switches control to the - * chat area. + * Derived classes should override this and return false if their action should not be paused + * when the user switches control to the chat area. */ protected boolean supportsActionPause () { @@ -297,9 +294,9 @@ public abstract class PuzzleController extends GameController } /** - * Puzzles that do not have "action" that starts and stops (via {@link - * #startAction} and {@link #clearAction}) when the puzzle starts and - * stops can override this method and return false. + * Puzzles that do not have "action" that starts and stops (via {@link #startAction} and + * {@link #clearAction}) when the puzzle starts and stops can override this method and return + * false. */ protected boolean isActionPuzzle () { @@ -307,11 +304,10 @@ public abstract class PuzzleController extends GameController } /** - * Indicates whether the action should start immediately as a result - * of {@link GameController#gameDidStart} being called. If a puzzle wishes to do - * some beginning of the game fun stuff, like display a tutorial - * screen, they can veto the action start and then start it themselves - * later. + * Indicates whether the action should start immediately as a result of + * {@link GameController#gameDidStart} being called. If a puzzle wishes to do some beginning + * of the game fun stuff, like display a tutorial screen, they can veto the action start and + * then start it themselves later. */ protected boolean startActionImmediately () { @@ -327,28 +323,25 @@ public abstract class PuzzleController extends GameController if (name.equals(PuzzleObject.STATE)) { switch (event.getIntValue()) { case PuzzleObject.IN_PLAY: - // we have to postpone all game starting activity until the - // current action has ended; only after all the animations have - // been completed will everything be in a state fit for - // starting back up again + // we have to postpone all game starting activity until the current action has + // ended; only after all the animations have been completed will everything be in a + // state fit for starting back up again fireWhenActionCleared(new ClearPender() { public int actionCleared () { // do the standard game did start business gameDidStart(); // we don't always start the action immediately - return startActionImmediately() ? - RESTART_ACTION : CARE_NOT; + return startActionImmediately() ? RESTART_ACTION : CARE_NOT; } }); break; case PuzzleObject.GAME_OVER: - // similarly we haev to postpone game ending activity until - // the current action has ended - // clean up and clear out + // similarly we haev to postpone game ending activity until the current action has + // ended clean up and clear out clearAction(); - // wait until the action is cleared before we roll down to our - // delegates and do all that business + // wait until the action is cleared before we roll down to our delegates and do all + // that business fireWhenActionCleared(new ClearPender() { public int actionCleared () { gameDidEnd(); @@ -390,12 +383,10 @@ public abstract class PuzzleController extends GameController } /** - * Derived classes should override this method and do whatever is - * necessary to start up the action for their puzzle. This could be - * called when the user is already in the "room" and the game starts, - * or immediately upon entering the room if the game is already - * started (for example if they disconnected and reconnected to a game - * already in progress). + * Derived classes should override this method and do whatever is necessary to start up the + * action for their puzzle. This could be called when the user is already in the "room" and + * the game starts, or immediately upon entering the room if the game is already started (for + * example if they disconnected and reconnected to a game already in progress). */ protected void startAction () { @@ -413,23 +404,22 @@ public abstract class PuzzleController extends GameController // refuse to start the action if it's already going if (_astate != ACTION_CLEARED) { - log.warning("Action state inappropriate for startAction() " + - "[astate=" + _astate + "]."); + log.warning("Action state inappropriate for startAction()", "astate", _astate); Thread.dumpStack(); return; } if (isChatting() && supportsActionPause()) { - log.info("Not starting action, player is chatting in a puzzle " + - "that supports pausing the action."); + log.info( + "Not starting action, player is chatting in a puzzle that supports pausing the action."); return; } log.debug("Starting puzzle action."); - // register the game progress updater; it may already be updated - // because we can cycle through clearing the action and starting - // it again before the updater gets a chance to unregister itself + // register the game progress updater; it may already be updated because we can cycle + // through clearing the action and starting it again before the updater gets a chance to + // unregister itself if (!_pctx.getFrameManager().isRegisteredFrameParticipant(_updater)) { _pctx.getFrameManager().registerFrameParticipant(_updater); } @@ -440,8 +430,8 @@ public abstract class PuzzleController extends GameController // let our panel know what's up _panel.startAction(); - // and if we're not currently chatting, set the puzzle to grab - // keys and for the chatbox to look disabled + // and if we're not currently chatting, set the puzzle to grab keys and for the chatbox to + // look disabled if (!isChatting()) { _panel.setPuzzleGrabsKeys(true); } @@ -456,11 +446,10 @@ public abstract class PuzzleController extends GameController } /** - * If it is not known whether the puzzle board view has finished - * animating its final bits after a previous call to {@link - * #clearAction}, this method should be used instead of {@link - * #startAction} as it will wait until the action is confirmedly over - * before starting it anew. + * If it is not known whether the puzzle board view has finished animating its final bits + * after a previous call to {@link #clearAction}, this method should be used instead of + * {@link #startAction} as it will wait until the action is confirmedly over before starting + * it anew. */ protected void safeStartAction () { @@ -477,14 +466,12 @@ public abstract class PuzzleController extends GameController } /** - * Called when the game has ended or when it is going to reset and - * when the client leaves the game "room". This method does not always - * immediately clear the action, but may mark the clear as pending if - * the action cannot yet be cleared (as indicated by {@link - * #canClearAction}). The action will eventually be cleared which will - * result in a call to {@link #actuallyClearAction} which is what - * derived classes should override to do their action clearing - * business. + * Called when the game has ended or when it is going to reset and when the client leaves the + * game "room". This method does not always immediately clear the action, but may mark the + * clear as pending if the action cannot yet be cleared (as indicated by + * {@link #canClearAction}). The action will eventually be cleared which will result in a call + * to {@link #actuallyClearAction} which is what derived classes should override to do their + * action clearing business. */ protected void clearAction () { @@ -500,35 +487,31 @@ public abstract class PuzzleController extends GameController log.debug("Attempting to clear puzzle action."); - // put ourselves into a pending clear state and attempt to clear - // the action + // put ourselves into a pending clear state and attempt to clear the action _astate = CLEAR_PENDING; maybeClearAction(); } /** - * This method is called by the {@link PuzzleBoardView} when all - * action on the board has finished. + * This method is called by the {@link PuzzleBoardView} when all action on the board has + * finished. */ protected void boardActionCleared () { - // if we have a clear pending, this could be the trigger that - // allows us to clear our action + // if we have a clear pending, this could be the trigger that allows us to clear our action maybeClearAction(); } /** - * Queues up code to be invoked when the action is completely cleared - * (including all remaining interesting sprites and animations on the - * puzzle board). + * Queues up code to be invoked when the action is completely cleared (including all remaining + * interesting sprites and animations on the puzzle board). */ protected void fireWhenActionCleared (ClearPender pender) { // if the action is already ended, fire this pender immediately if (_astate == ACTION_CLEARED) { if (pender.actionCleared() == ClearPender.RESTART_ACTION) { - log.debug("Restarting action at behest of pender " + - pender + "."); + log.debug("Restarting action at behest of pender " + pender + "."); startAction(); } @@ -539,14 +522,12 @@ public abstract class PuzzleController extends GameController } /** - * Returns whether or not it is safe to clear the action. The default - * behavior is to not allow the action to be cleared until all - * interesting sprites and animations in the board view have finished. - * If derived classes or delegates wish to postpone the clearing of - * the action, they can return false from this method, but they must - * then be sure to call {@link #maybeClearAction} when whatever - * condition that caused them to desire to postpone action clearing - * has finally been satisfied. + * Returns whether or not it is safe to clear the action. The default behavior is to not allow + * the action to be cleared until all interesting sprites and animations in the board view + * have finished. If derived classes or delegates wish to postpone the clearing of the action, + * they can return false from this method, but they must then be sure to call + * {@link #maybeClearAction} when whatever condition that caused them to desire to postpone + * action clearing has finally been satisfied. */ protected boolean canClearAction () { @@ -561,8 +542,7 @@ public abstract class PuzzleController extends GameController applyToDelegates(new DelegateOp(PuzzleControllerDelegate.class) { @Override public void apply (PlaceControllerDelegate delegate) { - canClear[0] = canClear[0] && - ((PuzzleControllerDelegate)delegate).canClearAction(); + canClear[0] = canClear[0] && ((PuzzleControllerDelegate)delegate).canClearAction(); } }); @@ -570,27 +550,23 @@ public abstract class PuzzleController extends GameController } /** - * Called to effect the actual clearing of our action if we've - * received some asynchronous trigger that indicates that it may well - * be safe now to clear the action. + * Called to effect the actual clearing of our action if we've received some asynchronous + * trigger that indicates that it may well be safe now to clear the action. */ protected void maybeClearAction () { if (_astate == CLEAR_PENDING && canClearAction()) { actuallyClearAction(); -// } else { -// Log.info("Not clearing action [astate=" + _astate + -// ", canClear=" + canClearAction() + "]."); +// } else { +// log.info("Not clearing action", "astate", _astate, "canClear", canClearAction()); } } /** - * Performs the actual process of clearing the action for this puzzle. - * This is only called after it is known to be safe to clear the - * action. Derived classes can override this method and clear out - * anything that is not needed while the puzzle's "action" is not - * going (timers, etc.). Anything that is cleared out here should be - * recreated in {@link #startAction}. + * Performs the actual process of clearing the action for this puzzle. This is only called + * after it is known to be safe to clear the action. Derived classes can override this method + * and clear out anything that is not needed while the puzzle's "action" is not going (timers, + * etc.). Anything that is cleared out here should be recreated in {@link #startAction}. */ protected void actuallyClearAction () { @@ -635,16 +611,15 @@ public abstract class PuzzleController extends GameController }); _clearPenders.clear(); - // if there are no refusals and at least one restart request, go - // ahead and restart the action now + // if there are no refusals and at least one restart request, go ahead and restart the + // action now if (results[1] == 0 && results[0] > 0) { startAction(); } } /** - * Called when the action was actually cleared, but before the action - * obsevers are notified. + * Called when the action was actually cleared, but before the action observers are notified. */ protected void actionWasCleared () { @@ -665,10 +640,9 @@ public abstract class PuzzleController extends GameController } /** - * Returns the delay in milliseconds between sending each progress - * update event to the server. Derived classes may wish to override - * this to send their progress updates more or less frequently than - * the default. + * Returns the delay in milliseconds between sending each progress update event to the server. + * Derived classes may wish to override this to send their progress updates more or less + * frequently than the default. */ protected long getProgressInterval () { @@ -680,8 +654,8 @@ public abstract class PuzzleController extends GameController */ protected void generateNewBoard () { - // wait for any animations or sprites in the board to finish their - // business before setting the board into place + // wait for any animations or sprites in the board to finish their business before setting + // the board into place fireWhenActionCleared(new ClearPender() { public int actionCleared () { // update the player board @@ -709,8 +683,8 @@ public abstract class PuzzleController extends GameController } /** - * Returns the number of progress events currently queued up for - * sending to the server with the next progress update. + * Returns the number of progress events currently queued up for sending to the server with + * the next progress update. */ public int getEventCount () { @@ -718,8 +692,8 @@ public abstract class PuzzleController extends GameController } /** - * Are we syncing boards for this puzzle? - * By default, we defer to the PuzzlePanel and its runtime config. + * Are we syncing boards for this puzzle? By default, we defer to the PuzzlePanel and its + * runtime config. */ protected boolean isSyncingBoards () { @@ -727,17 +701,15 @@ public abstract class PuzzleController extends GameController } /** - * Adds the given progress event and a snapshot of the supplied board - * state to the set of progress events and associated board states for - * later transmission to the server. + * Adds the given progress event and a snapshot of the supplied board state to the set of + * progress events and associated board states for later transmission to the server. */ public void addProgressEvent (int event, Board board) { // make sure they don't queue things up at strange times if (_puzobj.state != PuzzleObject.IN_PLAY) { - log.warning("Rejecting progress event; game not in play " + - "[puzobj=" + _puzobj.which() + - ", event=" + event + "]."); + log.warning("Rejecting progress event; game not in play", + "puzobj", _puzobj.which(), "event", event); return; } @@ -745,16 +717,16 @@ public abstract class PuzzleController extends GameController if (isSyncingBoards()) { _states.add((board == null) ? null : (Board)board.clone()); if (board == null) { - log.warning("Added progress event with no associated board " + - "state, server will not be able to ensure " + - "board state synchronization."); + log.warning( + "Added progress event with no associated board state, " + + "server will not be able to ensure board state synchronization."); } } } /** - * Sends the server a game progress update with the list of events, as - * well as board states if {@link PuzzlePanel#isSyncingBoards} is true. + * Sends the server a game progress update with the list of events, as well as board states if + * {@link PuzzlePanel#isSyncingBoards} is true. */ public void sendProgressUpdate () { @@ -768,11 +740,11 @@ public abstract class PuzzleController extends GameController int[] events = CollectionUtil.toIntArray(_events); _events.clear(); -// Log.info("Sending progress [session=" + _puzobj.sessionId + -// ", events=" + StringUtil.toString(events) + "]."); +// log.info("Sending progress", "session", _puzobj.sessionId, +// "events", StringUtil.toString(events)); - // create an array of the board states that correspond with those - // events (if state syncing is enabled) + // create an array of the board states that correspond with those events (if state syncing + // is enabled) int numStates = _states.size(); if (numStates == size) { // ie, if we have a board to match every event Board[] states = new Board[numStates]; @@ -812,8 +784,7 @@ public abstract class PuzzleController extends GameController */ class Unpauser extends MouseHijacker { - public Unpauser (PuzzlePanel panel) - { + public Unpauser (PuzzlePanel panel) { super(panel.getBoardView()); _panel = panel; panel.addMouseListener(_clicker); @@ -821,8 +792,7 @@ public abstract class PuzzleController extends GameController } @Override - public Component release () - { + public Component release () { _panel.removeMouseListener(_clicker); _panel.getBoardView().removeMouseListener(_clicker); return super.release(); @@ -838,22 +808,21 @@ public abstract class PuzzleController extends GameController protected PuzzlePanel _panel; } - /** A special frame participant that handles the sending of puzzle - * progress updates. We can't just - * register an interval for this because sometimes the clock goes - * backwards in time in windows and our intervals don't get called for - * a long period of time which causes the server to think the client - * is disconnected or cheating and resign them from the puzzle. God - * bless you, Microsoft. */ + /** + * A special frame participant that handles the sending of puzzle progress updates. We can't + * just register an interval for this because sometimes the clock goes backwards in time in + * windows and our intervals don't get called for a long period of time which causes the + * server to think the client is disconnected or cheating and resign them from the puzzle. God + * bless you, Microsoft. + */ protected class Updater implements FrameParticipant { public void tick (long tickStamp) { if (_astate == ACTION_CLEARED) { - // remove ourselves as the action is now cleared; we can't - // do this in actuallyClearAction() because that might get - // called during the PuzzlePanel's frame tick and it's - // only safe to remove yourself during a tick(), not - // another frame participant + // remove ourselves as the action is now cleared; we can't do this in + // actuallyClearAction() because that might get called during the PuzzlePanel's + // frame tick and it's only safe to remove yourself during a tick(), not another + // frame participant _pctx.getFrameManager().removeFrameParticipant(_updater); } else if (tickStamp - _lastProgressTick > getProgressInterval()) { @@ -952,8 +921,7 @@ public abstract class PuzzleController extends GameController if (keycode == KeyEvent.VK_ESCAPE || keycode == KeyEvent.VK_PAUSE) { setChatting(!isChatting()); - // pressing P also to pause (but not unpause), - // and only if it has not been reassigned + // pressing P also to pause (but not unpause), and only if it has not been reassigned } else if (keycode == KeyEvent.VK_P && !isChatting() && !_panel._xlate.hasCommand(KeyEvent.VK_P)) { setChatting(true); diff --git a/src/java/com/threerings/puzzle/client/PuzzleControllerDelegate.java b/src/java/com/threerings/puzzle/client/PuzzleControllerDelegate.java index affe6b0e..34afd273 100644 --- a/src/java/com/threerings/puzzle/client/PuzzleControllerDelegate.java +++ b/src/java/com/threerings/puzzle/client/PuzzleControllerDelegate.java @@ -31,10 +31,9 @@ import com.threerings.puzzle.data.PuzzleGameCodes; import com.threerings.puzzle.data.PuzzleObject; /** - * A base class for puzzle controller delegates. Provides access to some - * delegated puzzle controller methods ({@link #startAction}, {@link - * #clearAction}, etc.) and provides a casted reference to the puzzle - * object. + * A base class for puzzle controller delegates. Provides access to some delegated puzzle + * controller methods ({@link #startAction}, {@link #clearAction}, etc.) and provides a casted + * reference to the puzzle object. */ public class PuzzleControllerDelegate extends GameControllerDelegate implements PuzzleCodes, PuzzleGameCodes @@ -90,23 +89,20 @@ public class PuzzleControllerDelegate extends GameControllerDelegate } /** - * Derived classes should override this method and do whatever is - * necessary to start up the action for their puzzle. This could be - * called when the user is already in the "room" and the game starts, - * or immediately upon entering the room if the game is already - * started (for example if they disconnected and reconnected to a game - * already in progress). + * Derived classes should override this method and do whatever is necessary to start up the + * action for their puzzle. This could be called when the user is already in the "room" and + * the game starts, or immediately upon entering the room if the game is already started (for + * example if they disconnected and reconnected to a game already in progress). */ protected void startAction () { } /** - * Delegates that wish to postpone action clearing can override this - * method to return false until such time as the action can be - * cleared. They must, however, call {@link #maybeClearAction} when - * conditions become such that they would once again allow action to - * be cleared. + * Delegates that wish to postpone action clearing can override this method to return false + * until such time as the action can be cleared. They must, however, call + * {@link #maybeClearAction} when conditions become such that they would once again allow + * action to be cleared. */ protected boolean canClearAction () { @@ -114,9 +110,8 @@ public class PuzzleControllerDelegate extends GameControllerDelegate } /** - * Calls {@link PuzzleController#maybeClearAction}, preserving its - * protected access but making the method available to all - * PuzzleControllerDelegate derivations. + * Calls {@link PuzzleController#maybeClearAction}, preserving its protected access but making + * the method available to all PuzzleControllerDelegate derivations. */ protected void maybeClearAction () { @@ -124,20 +119,17 @@ public class PuzzleControllerDelegate extends GameControllerDelegate } /** - * Puzzles should override this method and clear out any action on the - * board and generally clean up anything that was going on because the - * game was in play. This is called when the game has ended or when it - * is going to reset and when the client leaves the game "room". - * Anything that is cleared out here should be recreated in {@link - * #startAction}. + * Puzzles should override this method and clear out any action on the board and generally + * clean up anything that was going on because the game was in play. This is called when the + * game has ended or when it is going to reset and when the client leaves the game "room". + * Anything that is cleared out here should be recreated in {@link #startAction}. */ protected void clearAction () { } /** - * Called when the puzzle controller sets up a new board for the - * player. + * Called when the puzzle controller sets up a new board for the player. * * @param board the newly initialized and ready-to-go board. */ diff --git a/src/java/com/threerings/puzzle/client/PuzzlePanel.java b/src/java/com/threerings/puzzle/client/PuzzlePanel.java index 28c2c44e..86b1550c 100644 --- a/src/java/com/threerings/puzzle/client/PuzzlePanel.java +++ b/src/java/com/threerings/puzzle/client/PuzzlePanel.java @@ -45,10 +45,9 @@ import com.threerings.puzzle.util.PuzzleContext; import static com.threerings.puzzle.Log.log; /** - * The puzzle panel class should be extended by classes that provide a - * view for a puzzle game. The {@link PuzzleController} calls these - * methods as necessary to perform its duties in managing the logical - * actions of a puzzle game. + * The puzzle panel class should be extended by classes that provide a view for a puzzle game. The + * {@link PuzzleController} calls these methods as necessary to perform its duties in managing the + * logical actions of a puzzle game. */ public abstract class PuzzlePanel extends JPanel implements PlaceView, ControllerProvider, PuzzleCodes, PuzzleGameCodes @@ -83,8 +82,7 @@ public abstract class PuzzlePanel extends JPanel { super.addNotify(); - // leave the keyboard manager disabled to start, and set things up - // for chatting + // leave the keyboard manager disabled to start, and set things up for chatting setPuzzleGrabsKeys(false); } @@ -98,20 +96,18 @@ public abstract class PuzzlePanel extends JPanel } /** - * Temporarily replaces the puzzle board display with the supplied - * overlay panel. The panel can be removed and the board display - * restored by calling {@link #popOverlayPanel}. + * Temporarily replaces the puzzle board display with the supplied overlay panel. The panel + * can be removed and the board display restored by calling {@link #popOverlayPanel}. * - * @return true if the specified panel will be displayed, false if it - * was not able to be pushed because another overlay panel is already - * pushed onto the primary panel. + * @return true if the specified panel will be displayed, false if it was not able to be + * pushed because another overlay panel is already pushed onto the primary panel. */ public boolean pushOverlayPanel (JPanel opanel) { // bail if we've already got an overlay if (_opanel != null) { - log.info("Refusing to push overlay panel, we've already got one " + - "[opanel=" + _opanel + ", npanel=" + opanel + "]."); + log.info("Refusing to push overlay panel, we've already got one", + "opanel", _opanel, "npanel", opanel); return false; } @@ -150,8 +146,8 @@ public abstract class PuzzlePanel extends JPanel } /** - * Initializes the puzzle panel with the puzzle config of the puzzle - * whose user interface is being displayed by the panel + * Initializes the puzzle panel with the puzzle config of the puzzle whose user interface is + * being displayed by the panel */ public void init (GameConfig config) { @@ -160,8 +156,7 @@ public abstract class PuzzlePanel extends JPanel } /** - * Sets whether this panel receives events periodically from a robot - * player. + * Sets whether this panel receives events periodically from a robot player. */ public void setRobotPlayer (boolean isrobot) { @@ -175,8 +170,7 @@ public abstract class PuzzlePanel extends JPanel } /** - * Sets whether the puzzle grabs keys or if they should go to the chat - * window. + * Sets whether the puzzle grabs keys or if they should go to the chat window. */ public void setPuzzleGrabsKeys (boolean puzgrabs) { @@ -211,9 +205,8 @@ public abstract class PuzzlePanel extends JPanel } /** - * Creates a robot player using the default RobotPlayer. Derived - * classes can override to make use of more advanced robots adapted to - * specific puzzles. + * Creates a robot player using the default RobotPlayer. Derived classes can override to make + * use of more advanced robots adapted to specific puzzles. */ protected RobotPlayer createRobotPlayer () { @@ -221,25 +214,23 @@ public abstract class PuzzlePanel extends JPanel } /** - * Creates the puzzle board view that will be used to display the main - * puzzle interface. This is called when the puzzle panel is - * constructed. The derived panel will still be responsible for adding - * the board to the interface hierarchy. + * Creates the puzzle board view that will be used to display the main puzzle interface. This + * is called when the puzzle panel is constructed. The derived panel will still be responsible + * for adding the board to the interface hierarchy. */ protected abstract PuzzleBoardView createBoardView (PuzzleContext ctx); /** - * Creates the main panel used to display the puzzle and its various - * in-game accoutrements (next block views, player status displays, - * etc.) This is called when the puzzle panel is constructed. The - * derived panel is responsible for making sure that the board view is + * Creates the main panel used to display the puzzle and its various in-game accoutrements + * (next block views, player status displays, etc.) This is called when the puzzle panel is + * constructed. The derived panel is responsible for making sure that the board view is * present in the board panel. */ protected abstract JPanel createBoardPanel (PuzzleContext ctx); /** - * Returns a key translator with the desired key to controller command - * mappings desired for this puzzle. + * Returns a key translator with the desired key to controller command mappings desired for + * this puzzle. */ protected abstract KeyTranslator getKeyTranslator (); diff --git a/src/java/com/threerings/puzzle/data/Board.java b/src/java/com/threerings/puzzle/data/Board.java index cae1e7c1..201c5df1 100644 --- a/src/java/com/threerings/puzzle/data/Board.java +++ b/src/java/com/threerings/puzzle/data/Board.java @@ -37,8 +37,8 @@ public abstract class Board public abstract void dump (); /** - * Outputs a string representation of the board contents, interlaced - * with the supplied comparison board. + * Outputs a string representation of the board contents, interlaced with the supplied + * comparison board. */ public abstract void dumpAndCompare (Board other); @@ -60,8 +60,7 @@ public abstract class Board } /** - * Sets the seed in the board's random number generator and calls - * {@link #populate}. + * Sets the seed in the board's random number generator and calls {@link #populate}. */ public void initializeSeed (long seed) { @@ -70,8 +69,8 @@ public abstract class Board } /** - * Returns the random number generator used by the board to generate - * random numbers for our puzzles. + * Returns the random number generator used by the board to generate random numbers for our + * puzzles. */ public Random getRandom () { @@ -79,8 +78,8 @@ public abstract class Board } /** - * Called after the seed is set in the board to give derived classes a - * chance to do things like populating the board with random pieces. + * Called after the seed is set in the board to give derived classes a chance to do things + * like populating the board with random pieces. */ protected void populate () { @@ -90,29 +89,25 @@ public abstract class Board protected static class BoardRandom extends Random implements Cloneable { - public BoardRandom (long seed) - { + public BoardRandom (long seed) { super(0L); setSeed(seed); } @Override - public synchronized void setSeed (long seed) - { + public synchronized void setSeed (long seed) { _seed = (seed ^ multiplier) & mask; } @Override - synchronized protected int next (int bits) - { + synchronized protected int next (int bits) { long nextseed = (_seed * multiplier + addend) & mask; _seed = nextseed; return (int)(nextseed >>> (48 - bits)); } @Override - public void nextBytes (byte[] bytes) - { + public void nextBytes (byte[] bytes) { unimplemented(); } @@ -123,8 +118,7 @@ public abstract class Board // nextFloat() @Override - public int nextInt (int n) - { + public int nextInt (int n) { if (n <= 0) { throw new IllegalArgumentException("n must be positive"); } @@ -142,15 +136,13 @@ public abstract class Board } @Override - public double nextDouble () - { + public double nextDouble () { long l = ((long)(next(26)) << 27) + next(27); return l / (double)(1L << 53); } @Override - public synchronized double nextGaussian () - { + public synchronized double nextGaussian () { if (_haveNextNextGaussian) { _haveNextNextGaussian = false; return _nextNextGaussian; @@ -170,8 +162,7 @@ public abstract class Board } @Override - public Object clone () - { + public Object clone () { try { return super.clone(); } catch (CloneNotSupportedException cnse) { @@ -180,14 +171,12 @@ public abstract class Board } /** - * I suppose I could copy all the methods from Random, then we - * wouldn't need this.. + * I suppose I could copy all the methods from Random, then we wouldn't need this.. */ private final void unimplemented () { throw new RuntimeException( - "The Random method you attempted to call " + - "has not been implemented by BoardRandom."); + "The Random method you attempted to call has not been implemented by BoardRandom."); } /** The internal state related to generating random numbers. */ diff --git a/src/java/com/threerings/puzzle/data/BoardSummary.java b/src/java/com/threerings/puzzle/data/BoardSummary.java index 0d30ec9f..7cd793e6 100644 --- a/src/java/com/threerings/puzzle/data/BoardSummary.java +++ b/src/java/com/threerings/puzzle/data/BoardSummary.java @@ -24,15 +24,14 @@ package com.threerings.puzzle.data; import com.threerings.io.SimpleStreamableObject; /** - * Provides summarized data representing a player's board in a puzzle - * game. Board summaries are maintained by the puzzle server and are - * periodically sent to the clients to give them a view into how well - * their opponent(s) are doing. The data required to marshal a board - * summary object should be notably smaller in size than what would be - * required to marshal the entire associated {@link Board}. + * Provides summarized data representing a player's board in a puzzle game. Board summaries are + * maintained by the puzzle server and are periodically sent to the clients to give them a view + * into how well their opponent(s) are doing. The data required to marshal a board summary object + * should be notably smaller in size than what would be required to marshal the entire associated + * {@link Board}. * - *
Note all non-transient members of this and derived classes will - * automatically be serialized when the summary is sent over the wire. + *
Note all non-transient members of this and derived classes will automatically be serialized
+ * when the summary is sent over the wire.
*/
public abstract class BoardSummary extends SimpleStreamableObject
{
@@ -45,8 +44,8 @@ public abstract class BoardSummary extends SimpleStreamableObject
}
/**
- * Constructs a board summary that retrieves full board information
- * from the supplied board when summarizing.
+ * Constructs a board summary that retrieves full board information from the supplied board
+ * when summarizing.
*/
public BoardSummary (Board board)
{
@@ -54,8 +53,8 @@ public abstract class BoardSummary extends SimpleStreamableObject
}
/**
- * Sets the board associated with this board summary, causing
- * an immediate update to this summary.
+ * Sets the board associated with this board summary, causing an immediate update to this
+ * summary.
*/
public void setBoard (Board board)
{
@@ -64,14 +63,12 @@ public abstract class BoardSummary extends SimpleStreamableObject
}
/**
- * Called by the {@link
- * com.threerings.puzzle.server.PuzzleManager} to refresh the
- * board summary information by studying the associated board
- * contents.
+ * Called by the {@link com.threerings.puzzle.server.PuzzleManager} to refresh the board
+ * summary information by studying the associated board contents.
*/
public abstract void summarize ();
- /** The board that we're summarizing. This is only valid on the
- * server, and on the client only for the actual player's board. */
+ /** The board that we're summarizing. This is only valid on the server, and on the client only
+ * for the actual player's board. */
protected transient Board _board;
}
diff --git a/src/java/com/threerings/puzzle/data/PuzzleCodes.java b/src/java/com/threerings/puzzle/data/PuzzleCodes.java
index d5269546..8cddf451 100644
--- a/src/java/com/threerings/puzzle/data/PuzzleCodes.java
+++ b/src/java/com/threerings/puzzle/data/PuzzleCodes.java
@@ -34,10 +34,9 @@ public interface PuzzleCodes extends InvocationCodes
/** The default puzzle difficulty level. */
public static final int DEFAULT_DIFFICULTY = 2;
- /** Whether to enable debug logging and assertions for puzzles. Note
- * that enabling this may result in the server or client exiting
- * unexpectedly if certain error conditions arise in order to
- * facilitate debugging, and so this should never be enabled in any
- * environment even remotely resembling production. */
+ /** Whether to enable debug logging and assertions for puzzles. Note that enabling this may
+ * result in the server or client exiting unexpectedly if certain error conditions arise in
+ * order to facilitate debugging, and so this should never be enabled in any environment even
+ * remotely resembling production. */
public static final boolean DEBUG_PUZZLE = false;
}
diff --git a/src/java/com/threerings/puzzle/data/PuzzleGameCodes.java b/src/java/com/threerings/puzzle/data/PuzzleGameCodes.java
index 6dff03c1..9f30e9ac 100644
--- a/src/java/com/threerings/puzzle/data/PuzzleGameCodes.java
+++ b/src/java/com/threerings/puzzle/data/PuzzleGameCodes.java
@@ -22,9 +22,9 @@
package com.threerings.puzzle.data;
/**
- * Contains codes used by the puzzle game client implementations. This
- * differs from {@link PuzzleCodes} as that is related to the puzzle
- * services which span the client and the server.
+ * Contains codes used by the puzzle game client implementations. This differs from
+ * {@link PuzzleCodes} as that is related to the puzzle services which span the client and the
+ * server.
*/
public interface PuzzleGameCodes
{
diff --git a/src/java/com/threerings/puzzle/data/PuzzleObject.java b/src/java/com/threerings/puzzle/data/PuzzleObject.java
index 1bf9c5a6..bfcb60d2 100644
--- a/src/java/com/threerings/puzzle/data/PuzzleObject.java
+++ b/src/java/com/threerings/puzzle/data/PuzzleObject.java
@@ -24,10 +24,9 @@ package com.threerings.puzzle.data;
import com.threerings.parlor.game.data.GameObject;
/**
- * Extends the basic {@link GameObject} to add individual player
- * status. Puzzle games typically contain numerous players that may be
- * knocked out of the game while the overall game continues on, thereby
- * necessitating this second level of game status.
+ * Extends the basic {@link GameObject} to add individual player status. Puzzle games typically
+ * contain numerous players that may be knocked out of the game while the overall game continues
+ * on, thereby necessitating this second level of game status.
*/
public class PuzzleObject extends GameObject
implements PuzzleCodes
@@ -52,8 +51,8 @@ public class PuzzleObject extends GameObject
/** The puzzle difficulty level. */
public int difficulty;
- /** Summaries of the boards of all players in this puzzle (may be null
- * if the puzzle doesn't support individual player boards). */
+ /** Summaries of the boards of all players in this puzzle (may be null if the puzzle doesn't
+ * support individual player boards). */
public BoardSummary[] summaries;
/** The seed used to germinate the boards. */
diff --git a/src/java/com/threerings/puzzle/drop/client/DropBlockSprite.java b/src/java/com/threerings/puzzle/drop/client/DropBlockSprite.java
index b22bcfc6..0a65e477 100644
--- a/src/java/com/threerings/puzzle/drop/client/DropBlockSprite.java
+++ b/src/java/com/threerings/puzzle/drop/client/DropBlockSprite.java
@@ -24,11 +24,10 @@ package com.threerings.puzzle.drop.client;
import java.awt.Rectangle;
/**
- * The drop block sprite represents a block of multiple pieces that can be
- * rotated to any of the four cardinal compass directions. As such, it
- * may span multiple columns or rows depending on its orientation. The
- * block has a "central" piece around which it rotates, with the other
- * pieces referred to as "external" pieces.
+ * The drop block sprite represents a block of multiple pieces that can be rotated to any of the
+ * four cardinal compass directions. As such, it may span multiple columns or rows depending on
+ * its orientation. The block has a "central" piece around which it rotates, with the other pieces
+ * referred to as "external" pieces.
*/
public class DropBlockSprite extends DropSprite
{
@@ -41,8 +40,7 @@ public class DropBlockSprite extends DropSprite
* @param orient the orientation of the sprite.
* @param pieces the pieces displayed by the sprite.
*/
- public DropBlockSprite (
- DropBoardView view, int col, int row, int orient, int[] pieces)
+ public DropBlockSprite (DropBoardView view, int col, int row, int orient, int[] pieces)
{
super(view, col, row, pieces, 0);
@@ -60,8 +58,7 @@ public class DropBlockSprite extends DropSprite
* @param renderOrder the rendering order of the sprite.
*/
public DropBlockSprite (
- DropBoardView view, int col, int row, int orient, int[] pieces,
- int renderOrder)
+ DropBoardView view, int col, int row, int orient, int[] pieces, int renderOrder)
{
super(view, col, row, pieces, 0, renderOrder);
@@ -77,10 +74,9 @@ public class DropBlockSprite extends DropSprite
}
/**
- * Returns an array of the row numbers containing the block pieces.
- * The first index is the row of the central piece. The array is
- * cached and re-used internally and so the caller should make their
- * own copy if they care to modify it.
+ * Returns an array of the row numbers containing the block pieces. The first index is the row
+ * of the central piece. The array is cached and re-used internally and so the caller should
+ * make their own copy if they care to modify it.
*/
public int[] getRows ()
{
@@ -88,10 +84,9 @@ public class DropBlockSprite extends DropSprite
}
/**
- * Returns an array of the column numbers containing the block pieces.
- * The first index is the column of the central piece. The array is
- * cached and re-used internally and so the caller should make their
- * own copy if they care to modify it.
+ * Returns an array of the column numbers containing the block pieces. The first index is the
+ * column of the central piece. The array is cached and re-used internally and so the caller
+ * should make their own copy if they care to modify it.
*/
public int[] getColumns ()
{
@@ -99,9 +94,9 @@ public class DropBlockSprite extends DropSprite
}
/**
- * Returns the bounds of the block in board piece coordinates. The
- * bounds rectangle is cached and re-used internally and so the caller
- * should make their own copy if they care to modify it.
+ * Returns the bounds of the block in board piece coordinates. The bounds rectangle is cached
+ * and re-used internally and so the caller should make their own copy if they care to modify
+ * it.
*/
public Rectangle getBoardBounds ()
{
@@ -146,8 +141,8 @@ public class DropBlockSprite extends DropSprite
}
/**
- * Updates the sprite image offset to reflect the direction in which
- * the external piece is hanging.
+ * Updates the sprite image offset to reflect the direction in which the external piece is
+ * hanging.
*/
@Override
public void setOrientation (int orient)
@@ -194,8 +189,7 @@ public class DropBlockSprite extends DropSprite
}
/**
- * Re-calculates the external piece position and bounds of the drop
- * block.
+ * Re-calculates the external piece position and bounds of the drop block.
*/
protected void updateDropInfo ()
{
@@ -208,7 +202,7 @@ public class DropBlockSprite extends DropSprite
_rows[1] = _erow;
_cols[0] = _col;
_cols[1] = _ecol;
-
+
// calculate the drop block board bounds
int maxrow = Math.max(_row, _erow);
int mincol = Math.min(_col, _ecol);
@@ -227,8 +221,8 @@ public class DropBlockSprite extends DropSprite
}
/**
- * Returns the row the external piece is located in based on the
- * current central piece location and sprite orientation.
+ * Returns the row the external piece is located in based on the current central piece
+ * location and sprite orientation.
*/
protected int calculateExternalRow ()
{
@@ -242,8 +236,8 @@ public class DropBlockSprite extends DropSprite
}
/**
- * Returns the column the external piece is located in based on the
- * current central piece location and sprite orientation.
+ * Returns the column the external piece is located in based on the current central piece
+ * location and sprite orientation.
*/
protected int calculateExternalColumn ()
{
@@ -256,8 +250,7 @@ public class DropBlockSprite extends DropSprite
}
}
- /** How many times this sprite can be popped-up a row in a forgiving
- * rotation. */
+ /** How many times this sprite can be popped-up a row in a forgiving rotation. */
protected byte _popups = 2;
/** The drop block bounds in board coordinates. */
diff --git a/src/java/com/threerings/puzzle/drop/client/DropBoardView.java b/src/java/com/threerings/puzzle/drop/client/DropBoardView.java
index 748706f2..13494814 100644
--- a/src/java/com/threerings/puzzle/drop/client/DropBoardView.java
+++ b/src/java/com/threerings/puzzle/drop/client/DropBoardView.java
@@ -108,11 +108,9 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Called by the {@link DropSprite} to populate pos with
- * the screen coordinates in pixels at which a piece at (col,
- * row) in the board should be drawn. Derived classes may wish
- * to override this method to allow specialised positioning of
- * sprites.
+ * Called by the {@link DropSprite} to populate pos with the screen coordinates
+ * in pixels at which a piece at (col, row) in the board should be drawn. Derived
+ * classes may wish to override this method to allow specialised positioning of sprites.
*/
public void getPiecePosition (int col, int row, Point pos)
{
@@ -120,10 +118,9 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Called by the {@link DropSprite} to get the dimensions of the area
- * that will be occupied by rendering a piece segment of the given
- * orientation and length whose bottom-leftmost corner is at
- * (col, row).
+ * Called by the {@link DropSprite} to get the dimensions of the area that will be occupied by
+ * rendering a piece segment of the given orientation and length whose bottom-leftmost corner
+ * is at (col, row).
*/
public Dimension getPieceSegmentSize (int col, int row, int orient, int len)
{
@@ -141,8 +138,7 @@ public abstract class DropBoardView extends PuzzleBoardView
public void createPiece (int piece, int sx, int sy)
{
if (sx < 0 || sy < 0 || sx >= _bwid || sy >= _bhei) {
- log.warning("Requested to create piece in invalid location " +
- "[sx=" + sx + ", sy=" + sy + "].");
+ log.warning("Requested to create piece in invalid location", "sx", sx, "sy", sy);
Thread.dumpStack();
return;
}
@@ -150,11 +146,10 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Refreshes the piece sprite at the specified location, if no sprite
- * exists at the location, one will be created. Note: this
- * method assumes the default {@link ImageSprite} is being used to
- * display pieces. If {@link #createPieceSprite} is overridden to
- * return a non-ImageSprite, this method must also be customized.
+ * Refreshes the piece sprite at the specified location, if no sprite exists at the location,
+ * one will be created. Note: this method assumes the default {@link ImageSprite} is
+ * being used to display pieces. If {@link #createPieceSprite} is overridden to return a
+ * non-ImageSprite, this method must also be customized.
*/
public void updatePiece (int sx, int sy)
{
@@ -162,17 +157,15 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Updates the piece sprite at the specified location, if no sprite
- * exists at the location, one will be created. Note: this
- * method assumes the default {@link ImageSprite} is being used to
- * display pieces. If {@link #createPieceSprite} is overridden to
- * return a non-ImageSprite, this method must also be customized.
+ * Updates the piece sprite at the specified location, if no sprite exists at the location,
+ * one will be created. Note: this method assumes the default {@link ImageSprite} is
+ * being used to display pieces. If {@link #createPieceSprite} is overridden to return a
+ * non-ImageSprite, this method must also be customized.
*/
public void updatePiece (int piece, int sx, int sy)
{
if (sx < 0 || sy < 0 || sx >= _bwid || sy >= _bhei) {
- log.warning("Requested to update piece in invalid location " +
- "[sx=" + sx + ", sy=" + sy + "].");
+ log.warning("Requested to update piece in invalid location", "sx", sx, "sy", sy);
Thread.dumpStack();
return;
}
@@ -192,8 +185,8 @@ public abstract class DropBoardView extends PuzzleBoardView
long duration)
{
if (tx < 0 || ty < 0 || tx >= _bwid || ty >= _bhei) {
- log.warning("Requested to create and move piece to invalid " +
- "location [tx=" + tx + ", ty=" + ty + "].");
+ log.warning("Requested to create and move piece to invalid location",
+ "tx", tx, "ty", ty);
Thread.dumpStack();
return;
}
@@ -211,11 +204,10 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Instructs the view to move the piece at the specified starting
- * position to the specified destination position. There must be a
- * sprite at the starting position, if there is a sprite at the
- * destination position, it must also be moved immediately following
- * this call (as in the case of a swap) to avoid badness.
+ * Instructs the view to move the piece at the specified starting position to the specified
+ * destination position. There must be a sprite at the starting position, if there is a sprite
+ * at the destination position, it must also be moved immediately following this call (as in
+ * the case of a swap) to avoid badness.
*
* @return the piece sprite that is being moved.
*/
@@ -224,8 +216,7 @@ public abstract class DropBoardView extends PuzzleBoardView
int spos = sy * _bwid + sx;
Sprite piece = _pieces[spos];
if (piece == null) {
- log.warning("Missing source sprite for drop [sx=" + sx +
- ", sy=" + sy + ", tx=" + tx + ", ty=" + ty + "].");
+ log.warning("Missing source sprite for drop", "sx", sx, "sy", sy, "tx", tx, "ty", ty);
return null;
}
_pieces[spos] = null;
@@ -236,8 +227,8 @@ public abstract class DropBoardView extends PuzzleBoardView
/**
* A helper function for moving pieces into place.
*/
- protected void movePiece (Sprite piece, final int sx, final int sy,
- final int tx, final int ty, long duration)
+ protected void movePiece (
+ Sprite piece, final int sx, final int sy, final int tx, final int ty, long duration)
{
final Exception where = new Exception();
@@ -247,9 +238,8 @@ public abstract class DropBoardView extends PuzzleBoardView
if (sx == tx && sy == ty) {
int tpos = ty * _bwid + tx;
if (_pieces[tpos] != null) {
- log.warning("Zoiks! Asked to add a piece where we already " +
- "have one [sx=" + sx + ", sy=" + sy +
- ", tx=" + tx + ", ty=" + ty + "].", where);
+ log.warning("Zoiks! Asked to add a piece where we already have one",
+ "sx", sx, "sy", sy, "tx", tx, "ty", ty, where);
}
_pieces[tpos] = piece;
piece.setLocation(start.x, start.y);
@@ -268,9 +258,8 @@ public abstract class DropBoardView extends PuzzleBoardView
public void pathCompleted (Sprite sprite, Path path, long when) {
sprite.removeSpriteObserver(this);
if (_pieces[tpos] != null) {
- log.warning("Oh god, we're dropping onto another piece " +
- "[sx=" + sx + ", sy=" + sy +
- ", tx=" + tx + ", ty=" + ty + "].", where);
+ log.warning("Oh god, we're dropping onto another piece",
+ "sx", sx, "sy", sy, "tx", tx + "ty", ty, where);
return;
}
_pieces[tpos] = sprite;
@@ -285,9 +274,8 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Called when a piece is finished moving into its requested position.
- * Derived classes may wish to take this opportunity to play a sound
- * or whatnot.
+ * Called when a piece is finished moving into its requested position. Derived classes may
+ * wish to take this opportunity to play a sound or whatnot.
*/
protected void pieceArrived (long tickStamp, Sprite sprite, int px, int py)
{
@@ -295,9 +283,9 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Returns true if the piece that is supposed to be at the specified
- * coordinates is not yet there but is actually en route to that
- * location (due to a call to {@link #movePiece(Sprite,int,int,int,int,long)}).
+ * Returns true if the piece that is supposed to be at the specified coordinates is not yet
+ * there but is actually en route to that location (due to a call to
+ * {@link #movePiece(Sprite,int,int,int,int,long)}).
*/
protected boolean isMoving (int px, int py)
{
@@ -305,10 +293,9 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Returns the image used to display the given piece at coordinates
- * (0, 0) with an orientation of {@link #NORTH}. This
- * serves as a convenience routine for those puzzles that don't bother
- * rendering their pieces differently when placed at different board
+ * Returns the image used to display the given piece at coordinates (0, 0) with
+ * an orientation of {@link #NORTH}. This serves as a convenience routine for those puzzles
+ * that don't bother rendering their pieces differently when placed at different board
* coordinates or in different orientations.
*/
public Mirage getPieceImage (int piece)
@@ -317,11 +304,10 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Returns the image used to display the given piece at the specified
- * column and row with the given orientation.
+ * Returns the image used to display the given piece at the specified column and row with the
+ * given orientation.
*/
- public abstract Mirage getPieceImage (
- int piece, int col, int row, int orient);
+ public abstract Mirage getPieceImage (int piece, int col, int row, int orient);
@Override
public void setBoard (Board board)
@@ -356,8 +342,7 @@ public abstract class DropBoardView extends PuzzleBoardView
_pieces = new Sprite[width * height];
for (int yy = 0; yy < height; yy++) {
for (int xx = 0; xx < width; xx++) {
- Sprite piece = createPieceSprite(
- _dboard.getPiece(xx, yy), xx, yy);
+ Sprite piece = createPieceSprite(_dboard.getPiece(xx, yy), xx, yy);
if (piece != null) {
int ppos = yy * width + xx;
getPiecePosition(xx, yy, spos);
@@ -403,8 +388,7 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Creates a new drop sprite used to animate the given pieces falling
- * in the specified column.
+ * Creates a new drop sprite used to animate the given pieces falling in the specified column.
*/
public DropSprite createPieces (int col, int row, int[] pieces, int dist)
{
@@ -412,9 +396,8 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Dirties the rectangle encompassing the segment with the given
- * direction and length whose bottom-leftmost corner is at (col,
- * row).
+ * Dirties the rectangle encompassing the segment with the given direction and length whose
+ * bottom-leftmost corner is at (col, row).
*/
public void dirtySegment (int dir, int col, int row, int len)
{
@@ -425,9 +408,8 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Creates and returns an animation showing the specified score
- * floating up the view, with the label initially centered within the
- * view.
+ * Creates and returns an animation showing the specified score floating up the view, with the
+ * label initially centered within the view.
*
* @param score the score text to display.
* @param color the color of the text.
@@ -436,63 +418,57 @@ public abstract class DropBoardView extends PuzzleBoardView
public ScoreAnimation createScoreAnimation (
String score, Color color, Font font)
{
- return createScoreAnimation(
- score, color, font, 0, _bhei - 1, _bwid, _bhei);
+ return createScoreAnimation(score, color, font, 0, _bhei - 1, _bwid, _bhei);
}
/**
- * Creates and returns an animation showing the specified score
- * floating up the view.
+ * Creates and returns an animation showing the specified score floating up the view.
*
* @param score the score text to display.
* @param color the color of the text.
* @param font the font to use.
- * @param x the left coordinate in board coordinates of the rectangle
- * within which the score is to be centered.
- * @param y the bottom coordinate in board coordinates of the
- * rectangle within which the score is to be centered.
- * @param width the width in board coordinates of the rectangle within
- * which the score is to be centered.
- * @param height the height in board coordinates of the rectangle
- * within which the score is to be centered.
+ * @param x the left coordinate in board coordinates of the rectangle within which the score
+ * is to be centered.
+ * @param y the bottom coordinate in board coordinates of the rectangle within which the score
+ * is to be centered.
+ * @param width the width in board coordinates of the rectangle within which the score is to
+ * be centered.
+ * @param height the height in board coordinates of the rectangle within which the score is to
+ * be centered.
*/
- public ScoreAnimation createScoreAnimation (String score, Color color,
- Font font, int x, int y,
- int width, int height)
+ public ScoreAnimation createScoreAnimation (
+ String score, Color color, Font font, int x, int y, int width, int height)
{
// create the score animation
- ScoreAnimation anim =
- createScoreAnimation(score, color, font, x, y);
+ ScoreAnimation anim = createScoreAnimation(score, color, font, x, y);
// position the label within the specified rectangle
Dimension lsize = anim.getLabel().getSize();
Point pos = new Point();
- centerRectInBoardRect(
- x, y, width, height, lsize.width, lsize.height, pos);
+ centerRectInBoardRect(x, y, width, height, lsize.width, lsize.height, pos);
anim.setLocation(pos.x, pos.y);
return anim;
}
/**
- * Creates the sprite that is used to display the specified piece. If
- * the piece represents no piece, this method should return null.
+ * Creates the sprite that is used to display the specified piece. If the piece represents no
+ * piece, this method should return null.
*/
protected Sprite createPieceSprite (int piece, int px, int py)
{
if (piece == PIECE_NONE) {
return null;
}
- ImageSprite sprite = new ImageSprite(
- getPieceImage(piece, px, py, NORTH));
+ ImageSprite sprite = new ImageSprite(getPieceImage(piece, px, py, NORTH));
sprite.setRenderOrder(-1);
return sprite;
}
/**
- * Populates pos with the most appropriate screen
- * coordinates to center a rectangle of the given width and height (in
- * pixels) within the specified rectangle (in board coordinates).
+ * Populates pos with the most appropriate screen coordinates to center a
+ * rectangle of the given width and height (in pixels) within the specified rectangle (in
+ * board coordinates).
*
* @param bx the bounding rectangle's left board coordinate.
* @param by the bounding rectangle's bottom board coordinate.
@@ -500,8 +476,7 @@ public abstract class DropBoardView extends PuzzleBoardView
* @param bhei the bounding rectangle's height in board coordinates.
* @param rwid the width of the rectangle to position in pixels.
* @param rhei the height of the rectangle to position in pixels.
- * @param pos the point to populate with the rectangle's final
- * position.
+ * @param pos the point to populate with the rectangle's final position.
*/
protected void centerRectInBoardRect (
int bx, int by, int bwid, int bhei, int rwid, int rhei, Point pos)
@@ -515,10 +490,9 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Rotates the given drop block sprite to the specified orientation,
- * updating the image as necessary. Derived classes that make use of
- * block dropping functionality should override this method to do the
- * right thing.
+ * Rotates the given drop block sprite to the specified orientation, updating the image as
+ * necessary. Derived classes that make use of block dropping functionality should override
+ * this method to do the right thing.
*/
public void rotateDropBlock (DropBlockSprite sprite, int orient)
{
@@ -543,9 +517,8 @@ public abstract class DropBoardView extends PuzzleBoardView
}
/**
- * Renders the row of rising pieces to the given graphics context.
- * Sub-classes that make use of board rising functionality should
- * override this method to draw the rising piece row.
+ * Renders the row of rising pieces to the given graphics context. Sub-classes that make use
+ * of board rising functionality should override this method to draw the rising piece row.
*/
protected void renderRisingPieces (Graphics2D gfx, Rectangle dirtyRect)
{
diff --git a/src/java/com/threerings/puzzle/drop/client/DropControllerDelegate.java b/src/java/com/threerings/puzzle/drop/client/DropControllerDelegate.java
index 346a0049..06de7ef9 100644
--- a/src/java/com/threerings/puzzle/drop/client/DropControllerDelegate.java
+++ b/src/java/com/threerings/puzzle/drop/client/DropControllerDelegate.java
@@ -53,14 +53,13 @@ import com.threerings.puzzle.util.PuzzleContext;
import static com.threerings.puzzle.Log.log;
/**
- * Games that wish to make use of the drop puzzle services will need to
- * create an extension of this delegate class, customizing it for their
- * particular game and then adding it via {@link PlaceController#addDelegate}.
+ * Games that wish to make use of the drop puzzle services will need to create an extension of
+ * this delegate class, customizing it for their particular game and then adding it via
+ * {@link PlaceController#addDelegate}.
*
- *
It handles logical actions for a puzzle game that generally - * consists of a two-dimensional board containing pieces, with new pieces - * either falling into the board as a "drop block", or rising into the - * bottom of the board in new piece rows. + *
It handles logical actions for a puzzle game that generally consists of a two-dimensional + * board containing pieces, with new pieces either falling into the board as a "drop block", or + * rising into the bottom of the board in new piece rows. * *
Derived classes must implement {@link #getPieceVelocity} and {@link #evolveBoard}.
*
@@ -95,8 +94,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
public static final String RAISE_ROW = "raise_row";
/**
- * Creates a delegate with the specified drop game logic and
- * controller.
+ * Creates a delegate with the specified drop game logic and controller.
*/
public DropControllerDelegate (PuzzleController ctrl, DropLogic logic)
{
@@ -141,8 +139,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Returns the speed with which the next board row should rise into
- * place, in pixels per millisecond.
+ * Returns the speed with which the next board row should rise into place, in pixels per
+ * millisecond.
*/
protected float getRiseVelocity ()
{
@@ -166,7 +164,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
{
super.startAction();
-// Log.info("Starting drop action");
+// log.info("Starting drop action");
// add ourselves as a frame participant
_ctx.getFrameManager().registerFrameParticipant(this);
@@ -181,17 +179,15 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
// it on its merry way once more
if (_blocksprite != null) {
long delta = _dview.getTimeStamp() - _blockStamp;
- log.info("Restarting drop sprite [delta=" + delta + "].");
+ log.info("Restarting drop sprite", "delta", delta);
_blocksprite.fastForward(delta);
_blockStamp = 0L;
_dview.addSprite(_blocksprite);
- // if we cleared the action while the drop sprite was
- // bouncing, we need to land the block to get things going
- // again
+ // if we cleared the action while the drop sprite was bouncing, we need to land the
+ // block to get things going again
if (_blocksprite.isBouncing()) {
- log.info("Ended on a bounce, landing the block and " +
- "starting things up.");
+ log.info("Ended on a bounce, landing the block and starting things up.");
checkBlockLanded("bounced", true, true);
}
}
@@ -210,16 +206,15 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Clears out all of the action in the board; removes any drop block
- * sprites, any pieces rising in the board, and resets the animation
- * timestamps.
+ * Clears out all of the action in the board; removes any drop block sprites, any pieces
+ * rising in the board, and resets the animation timestamps.
*/
@Override
protected void clearAction ()
{
super.clearAction();
-// Log.info("Clearing drop action.");
+// log.info("Clearing drop action.");
// do away with the bounce interval
_bounceStamp = 0;
@@ -310,8 +305,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
if (handled && _blocksprite != null) {
- // land the block if it's been placed on something solid as a
- // result of one of the above actions
+ // land the block if it's been placed on something solid as a result of one of the
+ // above actions
String source = "fiddled [cmd=" + cmd + "]";
if (checkBlockLanded(source, false, false)) {
startBounceTimer(source);
@@ -335,19 +330,17 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
int row = _blocksprite.getRow(), col = _blocksprite.getColumn();
int dx = (dir == LEFT) ? -1 : 1;
- // if the sprite has made it to the bottom of the board then we
- // don't want to allow it to "virtually" fall any further because
- // of the bounce interval
+ // if the sprite has made it to the bottom of the board then we don't want to allow it to
+ // "virtually" fall any further because of the bounce interval
float pctdone = (row >= (_bhei - 1)) ? 0 :
_blocksprite.getPercentDone(_dview.getTimeStamp());
// get the drop block position resulting from the move
- Point pos = _dboard.getForgivingMove(
- bb.x, bb.y, bb.width, bb.height, dx, 0, pctdone);
+ Point pos = _dboard.getForgivingMove(bb.x, bb.y, bb.width, bb.height, dx, 0, pctdone);
if (pos != null) {
int frow = row + (pos.y - bb.y);
int fcol = col + (pos.x - bb.x);
- // Log.info("Valid move [row=" + frow + ", col=" + col + "].");
+ // log.info("Valid move", "row", frow, "col", col);
_blocksprite.setBoardLocation(frow, fcol);
}
}
@@ -364,9 +357,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
// gather information regarding the attempted rotation
int[] rows = _blocksprite.getRows();
int[] cols = _blocksprite.getColumns();
- // if the sprite has made it to the bottom of the board then we
- // don't want to allow it to "virtually" fall any further because
- // of the bounce interval
+ // if the sprite has made it to the bottom of the board then we don't want to allow it to
+ // "virtually" fall any further because of the bounce interval
float pctdone = (rows[0] >= (_bhei - 1)) ? 0 :
_blocksprite.getPercentDone(_dview.getTimeStamp());
@@ -375,10 +367,9 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
rows, cols, _blocksprite.getOrientation(), dir,
getRotationType(), pctdone, _blocksprite.canPopup());
if (info != null) {
-// Log.info("Found valid rotation " +
-// "[orient=" + DirectionUtil.toShortString(info[0]) +
-// ", col=" + info[1] + ", row=" + info[2] +
-// ", blocksprite=" + _blocksprite + "].");
+// log.info("Found valid rotation",
+// "orient", DirectionUtil.toShortString(info[0]), "col", info[1], "row", info[2],
+// "blocksprite", _blocksprite);
// update the piece image
_dview.rotateDropBlock(_blocksprite, info[0]);
@@ -396,16 +387,16 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Called when the drop block has rotated in the specified direction
- * to allow derived classes to engage in any game-specific antics.
+ * Called when the drop block has rotated in the specified direction to allow derived classes
+ * to engage in any game-specific antics.
*/
protected void blockDidRotate (int dir)
{
}
/**
- * Returns the rotation type used by this drop game. Either {@link
- * DropBoard#RADIAL_ROTATION} or {@link DropBoard#INPLACE_ROTATION}.
+ * Returns the rotation type used by this drop game. Either {@link DropBoard#RADIAL_ROTATION}
+ * or {@link DropBoard#INPLACE_ROTATION}.
*/
protected int getRotationType ()
{
@@ -421,7 +412,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
// only allow changing the piece velocity if we're not bouncing
if (_blocksprite != null && _bounceStamp == 0) {
- // Log.info("Updating drop block velocity [fast=" + fast + "].");
+ // log.info("Updating drop block velocity", "fast", fast);
_blocksprite.setVelocity(getPieceVelocity(fast));
}
}
@@ -437,13 +428,11 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
protected void dropNextBlock ()
{
if (_blocksprite != null || !_ctrl.hasAction()) {
- log.info("Not dropping block [bs=" + (_blocksprite != null) +
- ", action=" + _ctrl.hasAction() + "].");
+ log.info("Not dropping block", "bs", _blocksprite != null, "action", _ctrl.hasAction());
return;
}
- // determine whether or not the game should be ended because we
- // can't drop the next block
+ // determine whether or not the game should be ended because we can't drop the next block
if (checkDropEndsGame()) {
return;
}
@@ -476,12 +465,10 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Called by {@link #dropNextBlock} to determine whether the game
- * should be ended rather than dropping the next block because the
- * board is filled and a new block cannot enter. If true is returned,
- * the drop controller assumes that the derived class will have ended
- * or reset the game as appropriate and will simply abandon its
- * attempt to drop the next block.
+ * Called by {@link #dropNextBlock} to determine whether the game should be ended rather than
+ * dropping the next block because the board is filled and a new block cannot enter. If true
+ * is returned, the drop controller assumes that the derived class will have ended or reset
+ * the game as appropriate and will simply abandon its attempt to drop the next block.
*/
protected boolean checkDropEndsGame ()
{
@@ -489,9 +476,9 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Called only for block-dropping puzzles when it's time to create the
- * next drop block. Returns the drop block sprite if it was
- * successfully created, or null if it was not.
+ * Called only for block-dropping puzzles when it's time to create the next drop block.
+ * Returns the drop block sprite if it was successfully created, or null if it
+ * was not.
*/
protected DropBlockSprite createNextBlock ()
{
@@ -510,8 +497,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
/**
* Called when a drop sprite posts a piece moved event.
*/
- protected void handleDropSpriteMoved (
- DropSprite sprite, long when, int col, int row)
+ protected void handleDropSpriteMoved (DropSprite sprite, long when, int col, int row)
{
if (sprite instanceof DropBlockSprite) {
if (checkBlockLanded("piece-moved", false, true)) {
@@ -538,9 +524,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Applies the pieces in the given sprite to the specified column and
- * row in the board. Called when a drop sprite has finished
- * traversing its entire distance.
+ * Applies the pieces in the given sprite to the specified column and row in the board. Called
+ * when a drop sprite has finished traversing its entire distance.
*/
protected void applyDropSprite (DropSprite sprite, int col, int row)
{
@@ -551,17 +536,16 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
for (int dy = 0; dy < pieces.length; dy++) {
// pieces outside the board are discarded
if (row - dy >= 0) {
- // note: vertical segments are applied counting downwards
- // from the starting row toward row zero
+ // note: vertical segments are applied counting downwards from the starting row
+ // toward row zero
_dview.createPiece(pieces[dy], col, row - dy);
}
}
}
/**
- * Called to determine whether it is safe to evolve the board. The
- * default implementation does not allow board evolution if there are
- * sprites or animations active on the board.
+ * Called to determine whether it is safe to evolve the board. The default implementation does
+ * not allow board evolution if there are sprites or animations active on the board.
*/
protected boolean canEvolveBoard ()
{
@@ -569,24 +553,21 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Evolves the board to an unchanging state. If the board is in a
- * state where pieces should react with one another to cause changes
- * to the board state (such as piece dropping via {@link #dropPieces},
- * piece destruction, and/or piece joining), this is where that
- * process should be effected.
+ * Evolves the board to an unchanging state. If the board is in a state where pieces should
+ * react with one another to cause changes to the board state (such as piece dropping via
+ * {@link #dropPieces}, piece destruction, and/or piece joining), this is where that process
+ * should be effected.
*
- *
When no further evolution is possible and the board has - * stabilized this method should return false to indicate that such - * action should be taken. That will result in a follow-up call to - * {@link #boardDidStabilize} (assuming that the action was not - * cleared prior to the final stabilization of the board). + *
When no further evolution is possible and the board has stabilized this method should
+ * return false to indicate that such action should be taken. That will result in a follow-up
+ * call to {@link #boardDidStabilize} (assuming that the action was not cleared prior to the
+ * final stabilization of the board).
*/
protected abstract boolean evolveBoard ();
/**
- * Derived classes should call this method whenever they change some
- * board state that will require board evolution to restabilize the
- * board.
+ * Derived classes should call this method whenever they change some board state that will
+ * require board evolution to restabilize the board.
*/
protected void unstabilizeBoard ()
{
@@ -594,11 +575,10 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Called when the board has been fully evolved and is once again
- * stable. The default implementation updates the player's local board
- * summary and drops the next block into the board, but derived
- * classes may wish to perform custom actions if they don't use drop
- * blocks or have other requirements.
+ * Called when the board has been fully evolved and is once again stable. The default
+ * implementation updates the player's local board summary and drops the next block into the
+ * board, but derived classes may wish to perform custom actions if they don't use drop blocks
+ * or have other requirements.
*/
protected void boardDidStabilize ()
{
@@ -607,10 +587,9 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Updates the player's own local board summary to reflect the local
- * copy of the player's board which is likely to be more up to date
- * than the server-side board from which all other player board
- * summaries originate.
+ * Updates the player's own local board summary to reflect the local copy of the player's
+ * board which is likely to be more up to date than the server-side board from which all other
+ * player board summaries originate.
*/
public void updateSelfSummary ()
{
@@ -624,9 +603,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Called when an animation finishes doing its business. Derived
- * classes may wish to override this method but should be sure to call
- * super.animationDidFinish().
+ * Called when an animation finishes doing its business. Derived classes may wish to override
+ * this method but should be sure to call super.animationDidFinish().
*/
protected void animationDidFinish (Animation anim)
{
@@ -634,17 +612,16 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Checks whether the drop block can continue dropping and lands its
- * pieces if not. Returns whether at least one piece of the block has
- * landed; note that the other piece may need subsequent dropping.
+ * Checks whether the drop block can continue dropping and lands its pieces if not. Returns
+ * whether at least one piece of the block has landed; note that the other piece may need
+ * subsequent dropping.
*
- * @param commit if true, the block landing is committed, if false, it
- * is only checked, not committed.
- * @param atTop whether the block sprite is to be treated as being at
- * the top of its current row.
+ * @param commit if true, the block landing is committed, if false, it is only checked, not
+ * committed.
+ * @param atTop whether the block sprite is to be treated as being at the top of its current
+ * row.
*/
- protected boolean checkBlockLanded (
- String source, boolean commit, boolean atTop)
+ protected boolean checkBlockLanded (String source, boolean commit, boolean atTop)
{
if (_blocksprite == null) {
return true;
@@ -659,25 +636,20 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
float pctdone = (atTop) ? 0.0f :
_blocksprite.getPercentDone(_dview.getTimeStamp());
-// Log.info("Checking landed [source=" + source +
-// ", bounceRow=" + _bounceRow +
-// ", rows=" + StringUtil.toString(rows) +
-// ", cols=" + StringUtil.toString(cols) +
-// ", orient=" + DirectionUtil.toShortString(
-// _blocksprite.getOrientation()) +
-// ", commit=" + commit + ", pctdone=" + pctdone + "].");
+// log.info("Checking landed",
+// "source", source, "bounceRow", _bounceRow, "rows", rows, "cols", cols,
+// "orient", DirectionUtil.toShortString(_blocksprite.getOrientation()),
+// "commit", commit, "pctdone", pctdone);
if (_dboard.isValidDrop(rows, cols, pctdone)) {
if (commit) {
- log.info("Not valid drop [source=" + source +
- ", commit=" + commit + ", atTop=" + atTop +
- ", pctdone=" + pctdone + "].");
+ log.info("Not valid drop",
+ "source", source, "commit", commit, "atTop", atTop, "pctdone", pctdone);
}
return false;
}
- // if we're committing the landing, remove the sprite and update
- // the board and all that
+ // if we're committing the landing, remove the sprite and update the board and all that
if (commit) {
// give sub-classes a chance to do any pre-landing business
blockWillLand();
@@ -689,23 +661,18 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
if (rows[ii] >= 0) {
int col = cols[ii], row = rows[ii];
- // sanity-check the block to make sure it's located in
- // a valid position, and that we aren't somehow
- // overwriting an existing piece
+ // sanity-check the block to make sure it's located in a valid position, and
+ // that we aren't somehow overwriting an existing piece
if (col < 0 || col >= _bwid || row >= _bhei) {
- log.warning("Placing drop block piece outside board " +
- "bounds!? [x=" + col + ", y=" + row +
- ", pidx=" + ii +
- ", blocksprite=" + _blocksprite + "].");
+ log.warning("Placing drop block piece outside board bounds!?",
+ "x", col, "y", row, "pidx", ii, "blocksprite", _blocksprite);
error = true;
} else {
int cpiece = _dboard.getPiece(col, row);
if (cpiece != PIECE_NONE) {
- log.warning("Placing drop block piece onto " +
- "occupied board position!? [x=" + col +
- ", y=" + row + ", pidx=" + ii +
- ", blocksprite=" + _blocksprite + "].");
+ log.warning("Placing drop block piece onto occupied board position!?",
+ "x", col, "y", row, "pidx", ii, "blocksprite", _blocksprite);
error = true;
}
}
@@ -736,10 +703,9 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Called only for block-dropping puzzles when the drop block is about
- * to land on something. Derived classes may wish to override this
- * method to perform game-specific actions such as queueing up a
- * "block placed" progress event.
+ * Called only for block-dropping puzzles when the drop block is about to land on something.
+ * Derived classes may wish to override this method to perform game-specific actions such as
+ * queueing up a "block placed" progress event.
*/
protected void blockWillLand ()
{
@@ -747,9 +713,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Called only for block-dropping puzzles when the drop block lands on
- * something. Derived classes may wish to override this method to
- * perform any game-specific actions.
+ * Called only for block-dropping puzzles when the drop block lands on something. Derived
+ * classes may wish to override this method to perform any game-specific actions.
*/
protected void blockDidLand ()
{
@@ -757,19 +722,16 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Called when a block lands. We give the user a smidgen of time to
- * continue to fiddle with the block before we actually land it. If
- * the block is still landed when the bounce timer expires, we commit
- * the landing, otherwise we let the block keep falling.
+ * Called when a block lands. We give the user a smidgen of time to continue to fiddle with
+ * the block before we actually land it. If the block is still landed when the bounce timer
+ * expires, we commit the landing, otherwise we let the block keep falling.
*/
protected void startBounceTimer (String source)
{
int bounceRow = IntListUtil.getMaxValue(_blocksprite.getRows());
-// Log.info("startBounceTimer [source=" + source +
-// ", bounceStamp=" + _bounceStamp +
-// ", time=" + _dview.getTimeStamp() +
-// ", bounceRow=" + _bounceRow +
-// ", nbounceRow=" + bounceRow + "].");
+// log.info("startBounceTimer",
+// "source", source, "bounceStamp", _bounceStamp, "time", _dview.getTimeStamp(),
+// "bounceRow", _bounceRow, "nbounceRow", bounceRow);
// forcibly land the block if we bounce twice at the same row
if (_bounceStamp == 0 && _bounceRow == bounceRow) {
@@ -779,26 +741,23 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
return;
}
- // if the bounce "timer" is already started, the user probably did
- // something like rotate the piece while it was bouncing (which is
- // why we give them the bounce interval), so we don't reset
+ // if the bounce "timer" is already started, the user probably did something like rotate
+ // the piece while it was bouncing (which is why we give them the bounce interval), so we
+ // don't reset
if (_bounceStamp == 0) {
- // slow the piece down so that it doesn't fly past the
- // coordinates at which it's potentially landing; we have to
- // do this before we tell the sprite that it's bouncing
- // because changing the velocity fiddles with the rowstamp and
- // we're going to reset the rowstamp when we tell the sprite
- // that it's bouncing
+ // slow the piece down so that it doesn't fly past the coordinates at which it's
+ // potentially landing; we have to do this before we tell the sprite that it's bouncing
+ // because changing the velocity fiddles with the rowstamp and we're going to reset the
+ // rowstamp when we tell the sprite that it's bouncing
_blocksprite.setVelocity(getPieceVelocity(false));
- // set up our bounce interval (it depends on the current piece
- // velocity and so must be set at the time we bounce)
+ // set up our bounce interval (it depends on the current piece velocity and so must be
+ // set at the time we bounce)
_bounceInterval = (int)
((_dview.getPieceHeight() * BOUNCE_FRACTION) /
getPieceVelocity(false));
-// Log.info("bounceInterval=" + _bounceInterval +
-// ", phei=" + _dview.getPieceHeight() +
-// ", vel=" + getPieceVelocity(false));
+// log.info("bounce", "bounceInterval", _bounceInterval,
+// "phei", _dview.getPieceHeight(), "vel", getPieceVelocity(false));
// make a note of the time we started bouncing
_bounceStamp = _dview.getTimeStamp();
@@ -812,15 +771,13 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Called when the bounce timer expires. Herein we either commit the
- * landing of a block if it is still landed or let it keep falling if
- * it is no longer landed.
- */
+ * Called when the bounce timer expires. Herein we either commit the landing of a block if it
+ * is still landed or let it keep falling if it is no longer landed.
+ */
protected void bounceTimerExpired ()
{
-// Log.info("bounceTimerExpired [bounceStamp=" + _bounceStamp +
-// ", time=" + _dview.getTimeStamp() +
-// ", bounceRow=" + _bounceRow + "].");
+// log.info("bounceTimerExpired",
+// "bounceStamp", _bounceStamp, "time", _dview.getTimeStamp(), "bounceRow", _bounceRow);
// make sure we weren't cancelled for some reason
if (_bounceStamp != 0) {
@@ -836,11 +793,10 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Drops any pieces that need dropping and returns whether any pieces
- * were dropped. Derived classes that would like to drop their pieces
- * should include a call to this method in their {@link #evolveBoard}
- * implementation, and must also override {@link #getPieceDropLogic}
- * to provide their game-specific piece dropper implementation.
+ * Drops any pieces that need dropping and returns whether any pieces were dropped. Derived
+ * classes that would like to drop their pieces should include a call to this method in their
+ * {@link #evolveBoard} implementation, and must also override {@link #getPieceDropLogic} to
+ * provide their game-specific piece dropper implementation.
*/
protected boolean dropPieces ()
{
@@ -848,8 +804,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
public void pieceDropped (
int piece, int sx, int sy, int dx, int dy) {
float vel = getPieceVelocity(true) * 1.5f;
- long duration = (long)(_dview.getPieceHeight() *
- Math.abs(dy-sy) / vel);
+ long duration = (long)(_dview.getPieceHeight() * Math.abs(dy-sy) / vel);
if (sy < 0) {
_dview.createPiece(piece, sx, sy, dx, dy, duration);
} else {
@@ -861,10 +816,9 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Returns the piece drop logic used to drop any pieces that need
- * dropping in the board. Derived classes that intend to make use of
- * {@link #dropPieces} must implement this method and return a
- * reference to their game-specific piece dropper implementation.
+ * Returns the piece drop logic used to drop any pieces that need dropping in the board.
+ * Derived classes that intend to make use of {@link #dropPieces} must implement this method
+ * and return a reference to their game-specific piece dropper implementation.
*/
protected PieceDropLogic getPieceDropLogic ()
{
@@ -893,24 +847,24 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
bounceTimerExpired();
}
- // if we can't evolve the board because it doesn't need evolving
- // or things are going on, we stop here
+ // if we can't evolve the board because it doesn't need evolving or things are going on,
+ // we stop here
if (_stable || !canEvolveBoard()) {
return;
}
- // if we do not evolve the board in any way, let the derived class
- // know that the board stabilized so that they can drop in a new
- // piece if they like or take whatever other action is appropriate
+ // if we do not evolve the board in any way, let the derived class know that the board
+ // stabilized so that they can drop in a new piece if they like or take whatever other
+ // action is appropriate
boolean evolving = evolveBoard();
boolean debug = false;
if (debug) {
- log.info("Evolved board [evolving=" + evolving + "].");
+ log.info("Evolved board", "evolving", evolving);
}
- // if we're no longer evolving and the action has not ended, go
- // ahead and let our derived class know that the board has
- // stabilized so that it can drop in the next piece or somesuch
+ // if we're no longer evolving and the action has not ended, go ahead and let our derived
+ // class know that the board has stabilized so that it can drop in the next piece or
+ // somesuch
if (!evolving) {
// no evolving again until someone destabilizes the board
_stable = true;
@@ -921,8 +875,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
boardDidStabilize();
- // ensure that if we have been postponing action due to board
- // evolution, that it will now be cleared
+ // ensure that if we have been postponing action due to board evolution, that it will
+ // now be cleared
if (!_ctrl.hasAction()) {
if (debug) {
log.info("Maybe clearing action.");
@@ -971,8 +925,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
{
// don't overwrite an existing zip
if (_zipstamp == 0) {
- // if we're paused, inherit the pause time, otherwise use the
- // current time
+ // if we're paused, inherit the pause time, otherwise use the current time
if (_rpstamp != 0) {
_zipstamp = _rpstamp;
} else {
@@ -982,8 +935,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Called periodically on the frame tick. Raises the board row based
- * on the time since the current row traversal began.
+ * Called periodically on the frame tick. Raises the board row based on the time since the
+ * current row traversal began.
*/
/*
protected void raiseBoard (long tickStamp)
@@ -1040,10 +993,9 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
_dview.setRiseOffset(ypos);
if (rose) {
- // check to see if this means doom and defeat (even though the
- // game might be over, we still want to advance the piece
- // packet one last time and do the last rise so that the
- // server can tell that we kicked the proverbial bucket)
+ // check to see if this means doom and defeat (even though the game might be over, we
+ // still want to advance the piece packet one last time and do the last rise so that
+ // the server can tell that we kicked the proverbial bucket)
boolean canRise = checkCanRise();
// apply the rising row pieces to the board
@@ -1062,23 +1014,21 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
unstabilizeBoard();
} else {
- log.debug("Sticking fork in it [risers=" +
- StringUtil.toString(pieces) + ".");
+ log.debug("Sticking fork in it", "risers", pieces);
// let the controller know that we're done for
_ctrl.resetGame();
}
}
-// Log.info("Board rise [msecs=" + msecs + ", roff=" + ypos +
-// ", pctdone=" + pctdone + ", zipsecs=" + zipsecs + "].");
+// log.info("Board rise",
+// "msecs", msecs, "roff", ypos, "pctdone", pctdone, "zipsecs", zipsecs);
}
*/
/**
- * Called to determine whether or not rising a new row into the board
- * is legal. The default implementation will return false if the top
- * row of the board contains any pieces.
+ * Called to determine whether or not rising a new row into the board is legal. The default
+ * implementation will return false if the top row of the board contains any pieces.
*/
protected boolean checkCanRise ()
{
@@ -1086,10 +1036,9 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Called only for board-rising puzzles before effecting the rising of
- * the board by one row. Derived classes may wish to override this
- * method to add any desired behaviour, but should be sure to call
- * super.boardWillRise().
+ * Called only for board-rising puzzles before effecting the rising of the board by one row.
+ * Derived classes may wish to override this method to add any desired behaviour, but should
+ * be sure to call super.boardWillRise().
*/
protected void boardWillRise ()
{
@@ -1097,17 +1046,16 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
/**
- * Called only for board-rising puzzles when the board has finished
- * rising one row. Derived classes may wish to override this method
- * to add any desired behaviour, but should be sure to call
- * super.boardDidRise().
+ * Called only for board-rising puzzles when the board has finished rising one row. Derived
+ * classes may wish to override this method to add any desired behaviour, but should be sure
+ * to call super.boardDidRise().
*/
protected void boardDidRise ()
{
// nothing for now
}
- /** The yohoho context. */
+ /** The puzzle context. */
protected PuzzleContext _ctx;
/** Our puzzle controller. */
@@ -1143,8 +1091,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
/** The drop block sprite associated with the landing block, if any. */
protected DropBlockSprite _blocksprite;
- /** The piece dropper used to drop pieces in the board if the puzzle
- * chooses to make use of piece dropping functionality. */
+ /** The piece dropper used to drop pieces in the board if the puzzle chooses to make use of
+ * piece dropping functionality. */
protected PieceDropper _dropper;
/** The time at which the board rise was paused. */
@@ -1168,8 +1116,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
/** The row at which we last bounced, or {@link Integer#MIN_VALUE}. */
protected int _bounceRow;
- /** The timestamp used to keep track of when the drop block was
- * removed so that we can fast-forward it when restored. */
+ /** The timestamp used to keep track of when the drop block was removed so that we can
+ * fast-forward it when restored. */
protected long _blockStamp;
/** Whether the drop blocks are currently dropping quickly. */
@@ -1191,8 +1139,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
}
};
- /** A piece operation that will update piece sprites as board
- * positions are updated. */
+ /** A piece operation that will update piece sprites as board positions are updated. */
protected DropBoard.PieceOperation _updateBoardOp =
new DropBoard.PieceOperation() {
public boolean execute (DropBoard board, int col, int row) {
@@ -1210,7 +1157,6 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
/** The delay in milliseconds between board rising intervals. */
protected static final long RISE_INTERVAL = 50L;
- /** Defines the distance of a piece that we allow to bounce before we
- * land it. */
+ /** Defines the distance of a piece that we allow to bounce before we land it. */
protected static final float BOUNCE_FRACTION = 0.125f;
}
diff --git a/src/java/com/threerings/puzzle/drop/client/DropPanel.java b/src/java/com/threerings/puzzle/drop/client/DropPanel.java
index f66fba93..bbb5fb3a 100644
--- a/src/java/com/threerings/puzzle/drop/client/DropPanel.java
+++ b/src/java/com/threerings/puzzle/drop/client/DropPanel.java
@@ -24,8 +24,8 @@ package com.threerings.puzzle.drop.client;
import com.threerings.puzzle.data.BoardSummary;
/**
- * Puzzles using the drop services need implement this interface to
- * display drop puzzle related information.
+ * Puzzles using the drop services need implement this interface to display drop puzzle related
+ * information.
*/
public interface DropPanel
{
diff --git a/src/java/com/threerings/puzzle/drop/client/DropSprite.java b/src/java/com/threerings/puzzle/drop/client/DropSprite.java
index 9def6088..34e055d8 100644
--- a/src/java/com/threerings/puzzle/drop/client/DropSprite.java
+++ b/src/java/com/threerings/puzzle/drop/client/DropSprite.java
@@ -34,8 +34,8 @@ import com.threerings.media.image.Mirage;
import com.threerings.media.sprite.Sprite;
/**
- * The drop sprite is a sprite that displays one or more pieces falling
- * toward the bottom of the board.
+ * The drop sprite is a sprite that displays one or more pieces falling toward the bottom of the
+ * board.
*/
public class DropSprite extends Sprite
{
@@ -48,8 +48,7 @@ public class DropSprite extends Sprite
* @param pieces the pieces displayed by the sprite.
* @param dist the distance the sprite is to drop in rows.
*/
- public DropSprite (
- DropBoardView view, int col, int row, int[] pieces, int dist)
+ public DropSprite (DropBoardView view, int col, int row, int[] pieces, int dist)
{
this(view, col, row, pieces, dist, -1);
}
@@ -65,8 +64,7 @@ public class DropSprite extends Sprite
* @param renderOrder the render order.
*/
public DropSprite (
- DropBoardView view, int col, int row, int[] pieces, int dist,
- int renderOrder)
+ DropBoardView view, int col, int row, int[] pieces, int dist, int renderOrder)
{
_view = view;
_col = col;
@@ -188,11 +186,9 @@ public class DropSprite extends Sprite
}
/**
- * Sets the velocity of this sprite. The time at which the current
- * row was entered is modified so that the sprite position will remain
- * the same when calculated using the new velocity since the piece
- * sprite may have its velocity modified in the middle of a row
- * traversal.
+ * Sets the velocity of this sprite. The time at which the current row was entered is modified
+ * so that the sprite position will remain the same when calculated using the new velocity
+ * since the piece sprite may have its velocity modified in the middle of a row traversal.
*/
public void setVelocity (float velocity)
{
@@ -235,15 +231,14 @@ public class DropSprite extends Sprite
_stopstamp = 0;
} else {
- // we're continuing a previous drop, so make use of any
- // previously existing time
+ // we're continuing a previous drop, so make use of any previously existing time
_rowstamp = _endstamp;
}
}
/**
- * Returns true if this drop sprite is dropping, false if it has been
- * {@link #stop}ped or has not yet been {@link #drop}ped.
+ * Returns true if this drop sprite is dropping, false if it has been {@link #stop}ped or has
+ * not yet been {@link #drop}ped.
*/
public boolean isDropping ()
{
@@ -257,33 +252,29 @@ public class DropSprite extends Sprite
{
if (_stopstamp == 0) {
_stopstamp = _view.getTimeStamp();
- // Log.info("Stopped piece [piece=" + this + "].");
+ // log.info("Stopped piece", "piece", this);
}
}
/**
- * Puts the drop sprite into (or takes it out of) bouncing
- * mode. Bouncing mode is used to put the sprite into limbo after it
- * lands but before we commit the landing, giving the user a last
- * moment change move or rotate the piece. While the sprite is
- * "bouncing" it will be rendered one pixel below it's at rest state.
+ * Puts the drop sprite into (or takes it out of) bouncing mode. Bouncing mode is used to put
+ * the sprite into limbo after it lands but before we commit the landing, giving the user a
+ * last moment change move or rotate the piece. While the sprite is "bouncing" it will be
+ * rendered one pixel below it's at rest state.
*/
public void setBouncing (boolean bouncing)
{
_bouncing = bouncing;
if (_bouncing) {
- // if we've activated bouncing, shift the sprite slightly to
- // illustrate its new state
+ // if we've activated bouncing, shift the sprite slightly to illustrate its new state
shiftForBounce();
- // to prevent funny business in the event that we were a long
- // ways past the end of the row when we landed, we warp the
- // sprite back to the exact point of landing for the purposes
- // of the bounce and any subsequent antics
+ // to prevent funny business in the event that we were a long ways past the end of the
+ // row when we landed, we warp the sprite back to the exact point of landing for the
+ // purposes of the bounce and any subsequent antics
_endstamp = _rowstamp = _view.getTimeStamp();
-// Log.info("Adjusted rowstap due to bounce " +
-// "[time=" + _endstamp + "].");
+// log.info("Adjusted rowstap due to bounce", "time", _endstamp);
}
}
@@ -296,8 +287,7 @@ public class DropSprite extends Sprite
}
/**
- * Updates the sprite's location to illustrate that it is currently in
- * the "bouncing" state.
+ * Updates the sprite's location to illustrate that it is currently in the "bouncing" state.
*/
protected void shiftForBounce ()
{
@@ -311,15 +301,13 @@ public class DropSprite extends Sprite
}
/**
- * Returns a value between 0.0 and 1.0
- * representing how far the piece has moved toward the next row
- * as of the given time stamp.
+ * Returns a value between 0.0 and 1.0 representing how far the
+ * piece has moved toward the next row as of the given time stamp.
*/
public float getPercentDone (long timestamp)
{
- // if we've never been ticked and so haven't yet initialized our
- // row start timestamp, just let the caller know that we've not
- // traversed our row at all
+ // if we've never been ticked and so haven't yet initialized our row start timestamp, just
+ // let the caller know that we've not traversed our row at all
if (_rowstamp == 0) {
return 0.0f;
}
@@ -328,10 +316,9 @@ public class DropSprite extends Sprite
float travpix = msecs * _vel;
float pctdone = (travpix / _unit);
-// Log.info("getPercentDone [timestamp=" + timestamp +
-// ", rowstamp=" + _rowstamp + ", msecs=" + msecs +
-// ", travpix=" + travpix + ", pctdone=" + pctdone +
-// ", vel=" + _vel + "].");
+// log.info("getPercentDone",
+// "timestamp", timestamp, "rowstamp", _rowstamp, "msecs", msecs, "travpix", travpix,
+// "pctdone", pctdone, "vel", _vel);
return pctdone;
}
@@ -352,8 +339,7 @@ public class DropSprite extends Sprite
// ask the board for the render position of this piece
_view.getPiecePosition(pcol, prow, _renderPos);
// draw the piece image
- paintPieceImage(gfx, ii, pcol, prow, _orient,
- _renderPos.x + dx, _renderPos.y + dy);
+ paintPieceImage(gfx, ii, pcol, prow, _orient, _renderPos.x + dx, _renderPos.y + dy);
// increment the target column and row
pcol += incx;
prow += incy;
@@ -363,8 +349,8 @@ public class DropSprite extends Sprite
/**
* Paints the specified piece with the supplied parameters.
*/
- protected void paintPieceImage (Graphics2D gfx, int pieceidx,
- int col, int row, int orient, int x, int y)
+ protected void paintPieceImage (
+ Graphics2D gfx, int pieceidx, int col, int row, int orient, int x, int y)
{
Mirage image = _view.getPieceImage(_pieces[pieceidx], col, row, orient);
image.paint(gfx, x, y);
@@ -415,9 +401,8 @@ public class DropSprite extends Sprite
int nx = _srcPos.x + (int)((_destPos.x - _srcPos.x) * pctdone);
int ny = _srcPos.y + (int)((_destPos.y - _srcPos.y) * pctdone);
-// Log.info("Drop sprite tick [dist=" + _dist + ", pctdone=" + pctdone +
-// ", row=" + _row + ", col=" + _col +
-// ", nx=" + nx + ", ny=" + ny + "].");
+// log.info("Drop sprite tick",
+// "dist", _dist, "pctdone", pctdone, "row", _row, "col", _col, "nx", nx, "ny", ny);
// only update the sprite's location if it actually moved
if (_ox != nx || _oy != ny) {
@@ -431,8 +416,8 @@ public class DropSprite extends Sprite
}
/**
- * Called when the sprite has finished traversing its current row to
- * advance its board coordinates to the next row.
+ * Called when the sprite has finished traversing its current row to advance its board
+ * coordinates to the next row.
*/
protected void advancePosition ()
{
@@ -480,21 +465,18 @@ public class DropSprite extends Sprite
}
/**
- * Updates the bounds for this sprite based on the sprite display
- * dimensions in the view.
+ * Updates the bounds for this sprite based on the sprite display dimensions in the view.
*/
protected void updateBounds ()
{
- Dimension size = _view.getPieceSegmentSize(
- _col, _row, _orient, _pieces.length);
+ Dimension size = _view.getPieceSegmentSize(_col, _row, _orient, _pieces.length);
_bounds.width = size.width;
_bounds.height = size.height;
}
/**
- * Adjusts our render origin such that our location is not in the
- * upper left of the sprite's rendered image but is in fact offset by
- * some number of rows and columns.
+ * Adjusts our render origin such that our location is not in the upper left of the sprite's
+ * rendered image but is in fact offset by some number of rows and columns.
*/
protected void updateRenderOffset ()
{
@@ -505,19 +487,16 @@ public class DropSprite extends Sprite
/** Used to dispatch {@link DropSpriteObserver#pieceMoved}. */
protected static class PieceMovedOp implements ObserverList.ObserverOp