fixed waiting piece move bug
This commit is contained in:
@@ -85,7 +85,7 @@ public Game() {
|
|||||||
gameStatistics = new Statistic();
|
gameStatistics = new Statistic();
|
||||||
initializeDrawPile();
|
initializeDrawPile();
|
||||||
board = new Board();
|
board = new Board();
|
||||||
die = new Die(2,1,2,2,1,3);
|
die = new Die(2,5,6,3,6);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -348,4 +348,13 @@ public void setPieceInHome(int index, Piece piece) {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "Player: " + name + " Color: " + color;
|
return "Player: " + name + " Color: " + color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeWaitingPiece(Piece piece) {
|
||||||
|
for (int i = 0; i < Resources.MAX_PIECES; i++) {
|
||||||
|
if (piece.equals(this.waitingArea[i])) {
|
||||||
|
this.waitingArea[i] = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public void enter() {
|
|||||||
@Override
|
@Override
|
||||||
public void received(RequestMoveMessage msg, int from){
|
public void received(RequestMoveMessage msg, int from){
|
||||||
if (msg.getPiece().equals(this.piece)) {
|
if (msg.getPiece().equals(this.piece)) {
|
||||||
|
logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).removeWaitingPiece(this.piece);
|
||||||
piece.setState(PieceState.ACTIVE);
|
piece.setState(PieceState.ACTIVE);
|
||||||
Piece thrownOcc = logic.getGame().getBoard().getInfield()[logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getStartNodeIndex()].getOccupant();
|
Piece thrownOcc = logic.getGame().getBoard().getInfield()[logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getStartNodeIndex()].getOccupant();
|
||||||
if (thrownOcc != null) {
|
if (thrownOcc != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user