mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
tap on pending blank tile brings up picker
It's been annoying to have to move a placed blank to change its value. No more.
This commit is contained in:
parent
832b3adfd2
commit
9e66d294a2
3 changed files with 22 additions and 5 deletions
|
@ -2861,6 +2861,21 @@ tryMoveArrow( BoardCtxt* board, XP_U16 col, XP_U16 row )
|
|||
return result;
|
||||
} /* tryMoveArrow */
|
||||
|
||||
static XP_Bool
|
||||
tryChangeBlank( const BoardCtxt* board, XP_U16 col, XP_U16 row )
|
||||
{
|
||||
XP_Bool handled = XP_FALSE;
|
||||
XP_Bool isBlank, isPending;
|
||||
model_getTile( board->model, col, row, XP_TRUE, board->selPlayer, NULL,
|
||||
&isBlank, &isPending, NULL );
|
||||
handled = isBlank && isPending;
|
||||
if ( handled ) {
|
||||
(void)model_askBlankTile( board->model, board->selPlayer, col, row );
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
XP_Bool
|
||||
holdsPendingTile( BoardCtxt* board, XP_U16 pencol, XP_U16 penrow )
|
||||
{
|
||||
|
@ -2905,6 +2920,7 @@ handleActionInCell( BoardCtxt* board, XP_U16 col, XP_U16 row, XP_Bool isPen )
|
|||
|| moveSelTileToBoardXY( board, col, row )
|
||||
#endif
|
||||
|| tryMoveArrow( board, col, row )
|
||||
|| tryChangeBlank( board, col, row )
|
||||
|| (!isPen && tryReplaceTile( board, col, row ))
|
||||
;
|
||||
} /* handleActionInCell */
|
||||
|
|
|
@ -1332,8 +1332,8 @@ model_packTilesUtil( ModelCtxt* model, PoolContext* pool,
|
|||
|
||||
/* setup async query for blank value, but while at it return a reasonable
|
||||
default. */
|
||||
static Tile
|
||||
askBlankTile( ModelCtxt* model, XP_U16 turn, XP_U16 col, XP_U16 row)
|
||||
Tile
|
||||
model_askBlankTile( ModelCtxt* model, XP_U16 turn, XP_U16 col, XP_U16 row)
|
||||
{
|
||||
XP_U16 nUsed = MAX_UNIQUE_TILES;
|
||||
const XP_UCHAR* tfaces[MAX_UNIQUE_TILES];
|
||||
|
@ -1345,7 +1345,7 @@ askBlankTile( ModelCtxt* model, XP_U16 turn, XP_U16 col, XP_U16 row)
|
|||
util_notifyPickTileBlank( model->vol.util, turn, col, row,
|
||||
tfaces, nUsed );
|
||||
return tiles[0];
|
||||
} /* askBlankTile */
|
||||
} /* model_askBlankTile */
|
||||
|
||||
void
|
||||
model_moveTrayToBoard( ModelCtxt* model, XP_S16 turn, XP_U16 col, XP_U16 row,
|
||||
|
@ -1361,7 +1361,7 @@ model_moveTrayToBoard( ModelCtxt* model, XP_S16 turn, XP_U16 col, XP_U16 row,
|
|||
tile = blankFace;
|
||||
} else {
|
||||
XP_ASSERT( turn >= 0 );
|
||||
tile = TILE_BLANK_BIT | askBlankTile( model, (XP_U16)turn, col, row );
|
||||
tile = TILE_BLANK_BIT | model_askBlankTile( model, (XP_U16)turn, col, row );
|
||||
}
|
||||
tile |= TILE_BLANK_BIT;
|
||||
}
|
||||
|
@ -1530,7 +1530,7 @@ model_moveTileOnBoard( ModelCtxt* model, XP_S16 turn, XP_U16 colCur,
|
|||
pt->col = colNew;
|
||||
pt->row = rowNew;
|
||||
if ( isBlank ) {
|
||||
(void)askBlankTile( model, turn, colNew, rowNew );
|
||||
(void)model_askBlankTile( model, turn, colNew, rowNew );
|
||||
}
|
||||
|
||||
decrPendingTileCountAt( model, colCur, rowCur );
|
||||
|
|
|
@ -323,6 +323,7 @@ void model_packTilesUtil( ModelCtxt* model, PoolContext* pool,
|
|||
XP_U16* nUsed, const XP_UCHAR** texts,
|
||||
Tile* tiles );
|
||||
|
||||
Tile model_askBlankTile( ModelCtxt* model, XP_U16 turn, XP_U16 col, XP_U16 row);
|
||||
|
||||
#ifdef CPLUS
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue