add pref controlling whether can switch to look at tray of user whose

turn it isn't
This commit is contained in:
Andy2 2010-07-17 06:21:24 -07:00
parent 8da9a1e8fa
commit 5b8cf716b3
4 changed files with 12 additions and 7 deletions

View file

@ -421,7 +421,9 @@ board_prefsChanged( BoardCtxt* board, CommonPrefs* cp )
board->disableArrow = !cp->showBoardArrow;
board->hideValsInTray = cp->hideTileValues;
board->skipCommitConfirm = cp->skipCommitConfirm;
board->allowPeek = cp->allowPeek;
board->showColors = cp->showColors;
board->allowPeek = cp->allowPeek;
if ( showArrowChanged ) {
showArrowChanged = setArrowVisible( board, XP_FALSE );
@ -814,7 +816,8 @@ board_commitTurn( BoardCtxt* board )
* singletons that may have to be hidden or shown.
*/
static void
selectPlayerImpl( BoardCtxt* board, XP_U16 newPlayer, XP_Bool reveal )
selectPlayerImpl( BoardCtxt* board, XP_U16 newPlayer, XP_Bool reveal,
XP_Bool canPeek )
{
if ( !board->gameOver && server_getCurrentTurn(board->server) < 0 ) {
/* game not started yet; do nothing */
@ -822,7 +825,7 @@ selectPlayerImpl( BoardCtxt* board, XP_U16 newPlayer, XP_Bool reveal )
if ( reveal ) {
checkRevealTray( board );
}
} else {
} else if ( canPeek ) {
PerTurnInfo* newInfo = &board->pti[newPlayer];
XP_U16 oldPlayer = board->selPlayer;
model_foreachPendingCell( board->model, newPlayer,
@ -872,9 +875,9 @@ selectPlayerImpl( BoardCtxt* board, XP_U16 newPlayer, XP_Bool reveal )
} /* selectPlayerImpl */
void
board_selectPlayer( BoardCtxt* board, XP_U16 newPlayer )
board_selectPlayer( BoardCtxt* board, XP_U16 newPlayer, XP_Bool canSwitch )
{
selectPlayerImpl( board, newPlayer, XP_TRUE );
selectPlayerImpl( board, newPlayer, XP_TRUE, canSwitch );
} /* board_selectPlayer */
void
@ -3308,7 +3311,7 @@ boardTurnChanged( void* p_board )
nextPlayer = chooseBestSelPlayer( board );
if ( nextPlayer >= 0 ) {
XP_U16 nHumans = gi_countLocalHumans( board->gi );
selectPlayerImpl( board, nextPlayer, nHumans <= 1 );
selectPlayerImpl( board, nextPlayer, nHumans <= 1, XP_TRUE );
}
setTimerIf( board );

View file

@ -173,6 +173,7 @@ struct BoardCtxt {
XP_Bool disableArrow;
XP_Bool hideValsInTray;
XP_Bool skipCommitConfirm;
XP_Bool allowPeek; /* Can look at non-turn player's rack */
XP_Bool eraseTray;
XP_Bool boardObscuresTray;
@ -246,7 +247,7 @@ void figureTrayTileRect( BoardCtxt* board, XP_U16 index, XP_Rect* rect );
XP_Bool rectsIntersect( const XP_Rect* rect1, const XP_Rect* rect2 );
XP_S16 pointToTileIndex( BoardCtxt* board, XP_U16 x, XP_U16 y,
XP_Bool* onDividerP );
void board_selectPlayer( BoardCtxt* board, XP_U16 newPlayer );
void board_selectPlayer( BoardCtxt* board, XP_U16 newPlayer, XP_Bool canPeek );
void flipIf( const BoardCtxt* board, XP_U16 col, XP_U16 row,
XP_U16* fCol, XP_U16* fRow );
XP_Bool pointOnSomething( BoardCtxt* board, XP_U16 x, XP_U16 y,

View file

@ -135,6 +135,7 @@ typedef struct CommonPrefs {
XP_U16 robotThinkMin, robotThinkMax;
#endif
XP_Bool showColors; /* applies to all games */
XP_Bool allowPeek; /* applies to all games */
} CommonPrefs;
#ifdef XWFEATURE_BLUETOOTH

View file

@ -324,7 +324,7 @@ handlePenUpScore( BoardCtxt* board, XP_U16 xx, XP_U16 yy )
if ( rectNum == CURSOR_LOC_REM ) {
util_remSelected( board->util );
} else if ( --rectNum >= 0 ) {
board_selectPlayer( board, rectNum );
board_selectPlayer( board, rectNum, board->allowPeek );
} else {
result = XP_FALSE;
}