mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
handle blanks as well in redo of undone pending tiles
This commit is contained in:
parent
592d99ba80
commit
57e246da3b
1 changed files with 11 additions and 4 deletions
|
@ -1014,15 +1014,22 @@ model_redoPendingTiles( ModelCtxt* model, XP_S16 turn )
|
|||
changed = nUndone > 0;
|
||||
if ( changed ) {
|
||||
PendingTile pendingTiles[nUndone];
|
||||
XP_U16 ii;
|
||||
PendingTile* pt = pendingTiles;
|
||||
|
||||
XP_MEMCPY( pendingTiles, &player->pendingTiles[player->nPending],
|
||||
nUndone * sizeof(pendingTiles[0]) );
|
||||
|
||||
/* Now we have info about each tile, but don't know where in the
|
||||
tray they are. So find 'em. */
|
||||
for ( ii = 0; ii < nUndone; ++ii ) {
|
||||
PendingTile* pt = &pendingTiles[ii];
|
||||
XP_S16 foundAt = model_trayContains( model, turn, pt->tile );
|
||||
for ( pt = pendingTiles; nUndone-- > 0; ++pt ) {
|
||||
Tile tile = pt->tile;
|
||||
XP_Bool isBlank = 0 != (tile & TILE_BLANK_BIT);
|
||||
XP_S16 foundAt;
|
||||
|
||||
if ( isBlank ) {
|
||||
tile = dict_getBlankTile( model->vol.dict );
|
||||
}
|
||||
foundAt = model_trayContains( model, turn, tile );
|
||||
XP_ASSERT( foundAt >= 0 );
|
||||
model_moveTrayToBoard( model, turn, pt->col, pt->row,
|
||||
foundAt, pt->tile & ~TILE_BLANK_BIT );
|
||||
|
|
Loading…
Reference in a new issue