Skip to content

Commit

Permalink
Invert boolean parameter in tryStroke
Browse files Browse the repository at this point in the history
This is easier to understand than a double negative. No functional
changes.
  • Loading branch information
StenAL committed May 18, 2024
1 parent 641457b commit 74fec6e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/src/main/java/agolf/game/GameCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ public synchronized void mousePressed(MouseEvent event) {
this.removeMouseListener(this);
this.removeKeyListener(this);
this.setCursor(cursorDefault);
if (super.gameContainer.gamePanel.tryStroke(true)) {
if (super.gameContainer.gamePanel.tryStroke(false)) {
super.gameContainer.gamePanel.setBeginStroke(this.currentPlayerID, x, y, this.shootingMode);
//this.doHackedStroke(this.currentPlayerID, true, x, y, this.keyCountMod4);
this.doStroke(this.currentPlayerID, true, x, y, this.shootingMode);
Expand Down
8 changes: 4 additions & 4 deletions client/src/main/java/agolf/game/GamePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ public void broadcastMessage(String message) {
this.gameChatPanel.addBroadcastMessage(message);
}

protected boolean tryStroke(boolean didNotTimeout) {
protected boolean tryStroke(boolean didTimeout) {
synchronized (canStrokeLock) {
if (this.isWaitingForTurnStart) {
return false;
Expand All @@ -510,10 +510,10 @@ protected boolean tryStroke(boolean didNotTimeout) {
this.isWaitingForTurnStart = true;
}

if (didNotTimeout) {
this.gamePlayerInfoPanel.stopTimer();
} else {
if (didTimeout) {
this.gameCanvas.doZeroLengthStroke();
} else {
this.gamePlayerInfoPanel.stopTimer();
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion client/src/main/java/agolf/game/GamePlayerInfoPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ protected boolean run() {
--this.currentTimeForShot;
this.repaint();
if (this.currentTimeForShot <= 0) {
this.gameContainer.gamePanel.tryStroke(false);
this.gameContainer.gamePanel.tryStroke(true);
this.stopTimer();
return false;
} else {
Expand Down

0 comments on commit 74fec6e

Please sign in to comment.