Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next: Support Display Only Last Move Number #367

Merged
merged 3 commits into from
Oct 1, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/featurecat/lizzie/gui/BoardRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,20 @@ private void drawMoveNumbers(Graphics2D g) {

int[] moveNumberList = branch == null ? Lizzie.board.getMoveNumberList() : branch.data.moveNumberList;

// Allow to display only last move number
int lastMoveNumber = Lizzie.board.getData().moveNumber;
int onlyLastMoveNumber = (!Lizzie.config.uiConfig.isNull("only-last-move-number")) ? Lizzie.config.uiConfig.getInt("only-last-move-number") : 9999;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about uiConfig.optInt("only-last-move-number", 9999) instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better method. I have changed and committed.


for (int i = 0; i < Board.BOARD_SIZE; i++) {
for (int j = 0; j < Board.BOARD_SIZE; j++) {
int stoneX = x + scaledMargin + squareLength * i;
int stoneY = y + scaledMargin + squareLength * j;

// Allow to display only last move number
if (lastMoveNumber - moveNumberList[Board.getIndex(i, j)] >= onlyLastMoveNumber) {
continue;
}

Stone stoneAtThisPoint = branch == null ? Lizzie.board.getStones()[Board.getIndex(i, j)] :
branch.data.stones[Board.getIndex(i, j)];

Expand Down