Skip to content

Commit

Permalink
fix marker generation when clicking pieces
Browse files Browse the repository at this point in the history
  • Loading branch information
BlazingTwist committed Jan 29, 2024
1 parent f5b6ce8 commit 4052f8c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/java/jchess/common/BaseChessGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ protected void onBoardClicked(int x, int y) {
return;
}

if (clickedEntity.tile != null) {
// show which pieces can move to the selected tile
for (Entity attacker : clickedEntity.tile.attackingPieces) {
createMoveFromMarker(attacker);
}
createSelectionMarker(clickedEntity);
}

if (clickedEntity.piece != null) {
long startTime = System.currentTimeMillis();

Expand All @@ -110,14 +118,6 @@ protected void onBoardClicked(int x, int y) {
logger.info("Computing valid moves with kingCheck took {} ms", endTime - startTime);
}

if (clickedEntity.tile != null) {
// show which pieces can move to the selected tile
for (Entity attacker : clickedEntity.tile.attackingPieces) {
createMoveFromMarker(attacker);
}
createSelectionMarker(clickedEntity);
}

eventManager.getEvent(RenderEvent.class).fire(null);
}

Expand Down

0 comments on commit 4052f8c

Please sign in to comment.