add compile-time option to have tap on empty tray space return one

tile instead of all of them.
This commit is contained in:
Eric House 2012-06-29 06:50:46 -07:00
parent 69b0a0d4a3
commit c272491db6
3 changed files with 15 additions and 3 deletions

View file

@ -1689,10 +1689,10 @@ board_toggle_showValues( BoardCtxt* board )
} /* board_toggle_showValues */
XP_Bool
board_replaceTiles( BoardCtxt* board )
board_replaceNTiles( BoardCtxt* board, XP_U16 nTiles )
{
XP_Bool result = XP_FALSE;
while ( replaceLastTile( board ) ) {
while ( 0 < nTiles-- && replaceLastTile( board ) ) {
result = XP_TRUE;
}
@ -1701,6 +1701,12 @@ board_replaceTiles( BoardCtxt* board )
}
return result;
}
XP_Bool
board_replaceTiles( BoardCtxt* board )
{
return board_replaceNTiles( board, MAX_TRAY_TILES );
} /* board_replaceTiles */
XP_Bool

View file

@ -268,6 +268,7 @@ XP_Bool holdsPendingTile( BoardCtxt* board, XP_U16 pencol, XP_U16 penrow );
XP_Bool moveTileToBoard( BoardCtxt* board, XP_U16 col, XP_U16 row,
XP_U16 tileIndex, Tile blankFace );
XP_Bool board_replaceNTiles( BoardCtxt* board, XP_U16 nTiles );
void invalTilesUnderRect( BoardCtxt* board, const XP_Rect* rect );
void invalCellRegion( BoardCtxt* board, XP_U16 colA, XP_U16 rowA, XP_U16 colB,

View file

@ -442,11 +442,16 @@ handleActionInTray( BoardCtxt* board, XP_S16 index, XP_Bool onDivider )
#endif
} else if ( index == -(MAX_TRAY_TILES) ) { /* pending score tile */
result = board_commitTurn( board );
#ifndef DISABLE_EMPTYTRAY_UNDO
#if defined XWFEATURE_TRAYUNDO_ALL
} else if ( index < 0 ) { /* other empty area */
/* it better be true */
(void)board_replaceTiles( board );
result = XP_TRUE;
#elif defined XWFEATURE_TRAYUNDO_ONE
} else if ( index < 0 ) { /* other empty area */
/* it better be true */
(void)board_replaceNTiles( board, 1 );
result = XP_TRUE;
#endif
}
return result;