From e5de457819a52868d3986e1e6a12f672c0541852 Mon Sep 17 00:00:00 2001 From: dxiao Date: Mon, 24 Sep 2012 02:28:04 -0400 Subject: [PATCH] Updated javadoc for movePlayer, and adjusted other methods as well --- Mazebuilder/src/com/mazebuilder/gameplay/board/Board.java | 6 +++--- .../src/com/mazebuilder/gameplay/board/DefaultBoard.java | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Mazebuilder/src/com/mazebuilder/gameplay/board/Board.java b/Mazebuilder/src/com/mazebuilder/gameplay/board/Board.java index 8c388db..91f3596 100644 --- a/Mazebuilder/src/com/mazebuilder/gameplay/board/Board.java +++ b/Mazebuilder/src/com/mazebuilder/gameplay/board/Board.java @@ -20,16 +20,16 @@ public interface Board extends Renderable { Location getPlayerLocation(Player p); /** - * Returns the new location of the given player. Will return true if the move was completed. Does not jump walls. Uses identity (==) + * Will return true if the move was completed. Does not jump walls. Uses identity (==) * comparisons. **/ boolean movePlayer(Player p, Direction d); /** - * Returns the new location of the given player. Will return the same location if the move is impossible. Does not jump walls. Uses identity (==) + * Will return true if the move was completed. Does not jump walls. Uses identity (==) * comparisons. **/ - Location movePlayerWithBonus(Player p, Direction d); + boolean movePlayerWithBonus(Player p, Direction d); /** * Returns the new location of the given player. Will return the same location if the move is impossible (player cannot jump or no wall to jump). diff --git a/Mazebuilder/src/com/mazebuilder/gameplay/board/DefaultBoard.java b/Mazebuilder/src/com/mazebuilder/gameplay/board/DefaultBoard.java index 97a32cc..1e2dede 100644 --- a/Mazebuilder/src/com/mazebuilder/gameplay/board/DefaultBoard.java +++ b/Mazebuilder/src/com/mazebuilder/gameplay/board/DefaultBoard.java @@ -120,17 +120,17 @@ public boolean movePlayer(Player p, Direction d) { } @Override - public Location movePlayerWithBonus(Player p, Direction d) { + public boolean movePlayerWithBonus(Player p, Direction d) { Preconditions.checkArgument(p.canJump(), "Player " + Strings.nullToEmpty(p.getName()) + " cannot jump."); Location l = getPlayerLocation(p); if (!walls.isWall(l, d)) { Location moved = l.move(d); if (isBoardLocation(moved) && p.spendBonus(d)) { - l = moved; - players.put(p, l); + players.put(p, moved); + return true; } } - return l; + return false; } @Override