From 32a64dc5d127fcec56f269a290c3740f2a31da51 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 23 Feb 2010 13:52:51 +0100 Subject: [PATCH] Fix display of uninitialized boards in background observe A variable partnerBoardValid is cleared on starting our own game, and set when a board from the background game comes in during it. At the end of our own game, a valid partner board now is put in the display. --- backend.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/backend.c b/backend.c index 56049a8..7a3c731 100644 --- a/backend.c +++ b/backend.c @@ -243,6 +243,7 @@ static int exiting = 0; /* [HGM] moved to top */ static int setboardSpoiledMachineBlack = 0 /*, errorExitFlag = 0*/; int startedFromPositionFile = FALSE; Board filePosition; /* [HGM] loadPos */ Board partnerBoard; /* [HGM] bughouse: for peeking at partner game */ +Boolean partnerBoardValid = 0; char partnerStatus[MSG_SIZ]; Boolean partnerUp; Boolean originalFlip; @@ -3464,6 +3465,7 @@ read_from_ics(isr, closure, data, count, error) ZippyGameStart(whitename, blackname); } #endif /*ZIPPY*/ + partnerBoardValid = FALSE; // [HGM] bughouse continue; } @@ -3504,6 +3506,7 @@ read_from_ics(isr, closure, data, count, error) Reset(TRUE, TRUE); } #endif /*ZIPPY*/ + if(appData.bgObserve && partnerBoardValid) DrawPosition(TRUE, partnerBoard); continue; } @@ -3833,6 +3836,7 @@ ParseBoard12(string) sprintf(partnerStatus, "W: %d:%d B: %d:%d (%d-%d) %c", white_time/60000, (white_time%60000)/1000, (black_time/60000), (black_time%60000)/1000, white_stren, black_stren, to_play); DisplayMessage(partnerStatus, ""); + partnerBoardValid = TRUE; return; } @@ -6443,6 +6447,8 @@ int RightClick(ClickType action, int x, int y, int *fromX, int *fromY) if((gameMode == IcsPlayingWhite || gameMode == IcsPlayingBlack) && !appData.zippyPlay && appData.bgObserve) { // [HGM] bughouse: show background game + if(!partnerBoardValid) return -2; // suppress display of uninitialized boards + if( appData.dualBoard) return -2; // [HGM] dual: is already displayed if(action == Press) { originalFlip = flipView; flipView = !flipView; // temporarily flip board to see game from partners perspective -- 1.7.0.4