From: Geoffrey Allott Date: Wed, 14 Jun 2023 10:54:27 +0000 (+0100) Subject: fix player_after bugs X-Git-Url: https://git.pointlesshacks.com/?a=commitdiff_plain;h=d794b6f5117a765d47716d19c1db2e2075f483ce;p=pokerwave.git fix player_after bugs --- diff --git a/site/modules/cribbage.js b/site/modules/cribbage.js index 8cf3087..ac71cda 100644 --- a/site/modules/cribbage.js +++ b/site/modules/cribbage.js @@ -266,7 +266,7 @@ export class Cribbage extends GameWithChat { if (this.count === 31) { this.clear_pegging(); } - this.active = this.player_after(user_action.username, username => !this.passed.has(username) || this.hands.has(username) && this.hands.get(username).length > 0); + this.active = this.player_after(user_action.username, username => !this.passed.has(username) && this.hands.has(username) && this.hands.get(username).length > 0); this.redraw_cards(); this.redraw_players(); break; @@ -275,7 +275,7 @@ export class Cribbage extends GameWithChat { if (this.passed.size === this.hands.size) { this.clear_pegging(); } - this.active = this.player_after(user_action.username, username => !this.passed.has(username) || this.hands.has(username) && this.hands.get(username).length > 0); + this.active = this.player_after(user_action.username, username => !this.passed.has(username) && this.hands.has(username) && this.hands.get(username).length > 0); this.redraw_cards(); this.redraw_players(); break; diff --git a/site/modules/game.js b/site/modules/game.js index 33564d0..c000498 100644 --- a/site/modules/game.js +++ b/site/modules/game.js @@ -45,7 +45,7 @@ export class Game { } } if (player_after_seat === null) for (const [username, seat] of this.seats) { - if (is_playing(username) && player_after_seat === null || seat < player_after_seat) { + if (is_playing(username) && (player_after_seat === null || seat < player_after_seat)) { player_after = username; player_after_seat = seat; }