fixed waiting piece move bug

This commit is contained in:
Fleischer Hanno
2024-12-08 21:14:20 +01:00
parent 2d7fddf09a
commit 992efd403d
3 changed files with 11 additions and 1 deletions

View File

@@ -85,7 +85,7 @@ public Game() {
gameStatistics = new Statistic();
initializeDrawPile();
board = new Board();
die = new Die(2,1,2,2,1,3);
die = new Die(2,5,6,3,6);
}
/**

View File

@@ -348,4 +348,13 @@ public void setPieceInHome(int index, Piece piece) {
public String toString() {
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;
}
}
}
}

View File

@@ -40,6 +40,7 @@ public void enter() {
@Override
public void received(RequestMoveMessage msg, int from){
if (msg.getPiece().equals(this.piece)) {
logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).removeWaitingPiece(this.piece);
piece.setState(PieceState.ACTIVE);
Piece thrownOcc = logic.getGame().getBoard().getInfield()[logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getStartNodeIndex()].getOccupant();
if (thrownOcc != null) {