Skip to content

Commit 43cf46a

Browse files
committed
Avoid GameBug.board shim in bughouse paths
1 parent 7ea2408 commit 43cf46a

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

server/bug/game_bug.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,9 @@ def get_board(self, full=False, persp_color=None):
604604

605605
@property
606606
def turn_player(self):
607-
return self.wplayer.username if self.board.color == WHITE else self.bplayer.username
607+
# Bughouse has two boards; keep the existing compatibility behavior here
608+
# by deriving turn info from board A directly without touching game.board.
609+
return self.wplayer.username if self.boards["a"].color == WHITE else self.bplayer.username
608610

609611
def game_json(self, player):
610612
color = "w" if self.wplayerA == player or self.wplayerB == player else "b"

server/bug/wsr_bug.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ async def handle_reconnect_bughouse(
6767

6868

6969
async def handle_resign_bughouse(data: AbortResignMessage, game: GameBug, user: User) -> None:
70-
if data["type"] == "abort" and (game is not None) and game.board.ply > 2:
70+
# Keep prior behavior tied to board A ply, but avoid calling GameBug.board
71+
# (a compatibility shim that logs when accidentally used).
72+
if data["type"] == "abort" and (game is not None) and game.boards["a"].ply > 2:
7173
return
7274

7375
if game.status > STARTED:

0 commit comments

Comments
 (0)