Apply patch from trunk rev. 2442: Draw arrow only if inval bit set and

cell is otherwise unoccupied.  Fixes wince bug where tile dragged onto
arrow disappears.
This commit is contained in:
ehouse 2009-03-02 01:32:07 +00:00
parent 75242023f6
commit 521b26b8c1

View file

@ -1,6 +1,6 @@
/* -*-mode: C; fill-column: 78; compile-command: "cd ../linux && make MEMDEBUG=TRUE"; -*- */ /* -*-mode: C; fill-column: 78; compile-command: "cd ../linux && make MEMDEBUG=TRUE"; -*- */
/* /*
* Copyright 1997 - 2008 by Eric House (xwords@eehouse.org). All rights * Copyright 1997 - 2009 by Eric House (xwords@eehouse.org). All rights
* reserved. * reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -240,8 +240,8 @@ drawBoard( BoardCtxt* board )
XP_S16 lastCol, i; XP_S16 lastCol, i;
XP_S16 row; XP_S16 row;
ModelCtxt* model = board->model; ModelCtxt* model = board->model;
BoardArrow const* arrow = NULL;
BlankQueue bq; BlankQueue bq;
XP_Rect arrowRect;
scrollIfCan( board ); /* this must happen before we count blanks scrollIfCan( board ); /* this must happen before we count blanks
since it invalidates squares */ since it invalidates squares */
@ -253,6 +253,20 @@ drawBoard( BoardCtxt* board )
board->trayVisState == TRAY_REVEALED, &bq ); board->trayVisState == TRAY_REVEALED, &bq );
invalBlanksWithNeighbors( board, &bq ); invalBlanksWithNeighbors( board, &bq );
/* figure out now, before clearing inval bits, if we'll need to draw
the arrow later */
if ( board->trayVisState == TRAY_REVEALED ) {
BoardArrow const* tmpArrow = &board->selInfo->boardArrow;
if ( tmpArrow->visible ) {
XP_U16 col = tmpArrow->col;
XP_U16 row = tmpArrow->row;
if ( INVAL_BIT_SET( board, col, row )
&& !cellOccupied( board, col, row, XP_TRUE ) ) {
arrow = tmpArrow;
}
}
}
for ( row = board->yOffset; row <= board->lastVisibleRow; ++row ) { for ( row = board->yOffset; row <= board->lastVisibleRow; ++row ) {
XP_U16 rowFlags = board->redrawFlags[row]; XP_U16 rowFlags = board->redrawFlags[row];
if ( rowFlags != 0 ) { if ( rowFlags != 0 ) {
@ -278,27 +292,23 @@ drawBoard( BoardCtxt* board )
} }
} }
if ( board->trayVisState == TRAY_REVEALED ) { if ( !!arrow ) {
BoardArrow* arrow = &board->selInfo->boardArrow; XP_U16 col = arrow->col;
XP_U16 row = arrow->row;
if ( arrow->visible ) { XP_Rect arrowRect;
XP_U16 col = arrow->col; if ( getCellRect( board, col, row, &arrowRect ) ) {
XP_U16 row = arrow->row; XWBonusType bonus;
if ( getCellRect( board, col, row, &arrowRect ) ) { HintAtts hintAtts;
XWBonusType bonus; CellFlags flags = CELL_NONE;
HintAtts hintAtts; bonus = util_getSquareBonus( board->util, model, col, row );
CellFlags flags = CELL_NONE; hintAtts = figureHintAtts( board, col, row );
bonus = util_getSquareBonus( board->util, model,
col, row );
hintAtts = figureHintAtts( board, col, row );
#ifdef KEYBOARD_NAV #ifdef KEYBOARD_NAV
if ( cellFocused( board, col, row ) ) { if ( cellFocused( board, col, row ) ) {
flags |= CELL_ISCURSOR; flags |= CELL_ISCURSOR;
}
#endif
draw_drawBoardArrow( board->draw, &arrowRect, bonus,
arrow->vert, hintAtts, flags );
} }
#endif
draw_drawBoardArrow( board->draw, &arrowRect, bonus,
arrow->vert, hintAtts, flags );
} }
} }