Permalink
Browse files

refactor canMove + isPlacing into canPlace

  • Loading branch information...
1 parent 4355a43 commit e51449275d61b7e5b3cc1e12b644959b6f04ada1 @eregon committed May 21, 2011
Showing with 5 additions and 1 deletion.
  1. +4 −0 src/pylos/model/Player.java
  2. +1 −1 src/pylos/view/appstate/ActionManager.java
@@ -209,6 +209,10 @@ public boolean canMakeMove() {
return action != Action.WAIT && (Config.CAN_MOVE_OTHER || type == Type.LOCAL);
}
+ public boolean canPlace() {
+ return (action == Action.PLACE || action == Action.MOUNT) && (Config.CAN_MOVE_OTHER || type == Type.LOCAL);
+ }
+
// Location methods
public void isLocal() {
type = Type.LOCAL;
@@ -70,7 +70,7 @@ public boolean getCollisions() {
@Override
public void update(float tpf) {
- if (Model.currentPlayer.canMove() && Model.currentPlayer.isPlacing() && getCollisions()) {
+ if (Model.currentPlayer.canPlace() && getCollisions()) {
highlightBall.setMaterial(Model.currentPlayer.graphics.ballMaterial);
view.board.place(highlightBall, collisions.getPosition());
highlightBallNode.attachChild(highlightBall);

0 comments on commit e514492

Please sign in to comment.