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,18 +292,15 @@ drawBoard( BoardCtxt* board )
} }
} }
if ( board->trayVisState == TRAY_REVEALED ) { if ( !!arrow ) {
BoardArrow* arrow = &board->selInfo->boardArrow;
if ( arrow->visible ) {
XP_U16 col = arrow->col; XP_U16 col = arrow->col;
XP_U16 row = arrow->row; XP_U16 row = arrow->row;
XP_Rect arrowRect;
if ( getCellRect( board, col, row, &arrowRect ) ) { if ( getCellRect( board, col, row, &arrowRect ) ) {
XWBonusType bonus; XWBonusType bonus;
HintAtts hintAtts; HintAtts hintAtts;
CellFlags flags = CELL_NONE; CellFlags flags = CELL_NONE;
bonus = util_getSquareBonus( board->util, model, bonus = util_getSquareBonus( board->util, model, col, row );
col, row );
hintAtts = figureHintAtts( board, col, row ); hintAtts = figureHintAtts( board, col, row );
#ifdef KEYBOARD_NAV #ifdef KEYBOARD_NAV
if ( cellFocused( board, col, row ) ) { if ( cellFocused( board, col, row ) ) {
@ -300,7 +311,6 @@ drawBoard( BoardCtxt* board )
arrow->vert, hintAtts, flags ); arrow->vert, hintAtts, flags );
} }
} }
}
/* I doubt the two of these can happen at the same time */ /* I doubt the two of these can happen at the same time */
drawTradeWindowIf( board ); drawTradeWindowIf( board );