Indicate empty cell with CELL_ISEMPTY rather than an empty string; fix

palm to not draw star on top of placed tile.
This commit is contained in:
ehouse 2008-03-14 09:36:42 +00:00
parent 123923fd4b
commit d3ce87b057
3 changed files with 9 additions and 4 deletions

View file

@ -1743,7 +1743,7 @@ drawCell( BoardCtxt* board, XP_U16 col, XP_U16 row, XP_Bool skipBlanks )
XP_S16 owner = -1;
XP_Bool invert = XP_FALSE;
XP_Bitmap bitmap = NULL;
XP_UCHAR* textP = (XP_UCHAR*)ch;
XP_UCHAR* textP = NULL;
HintAtts hintAtts;
CellFlags flags = CELL_NONE;
XP_Bool isOrigin;
@ -1763,6 +1763,7 @@ drawCell( BoardCtxt* board, XP_U16 col, XP_U16 row, XP_Bool skipBlanks )
if ( isEmpty ) {
isBlank = XP_FALSE;
flags |= CELL_ISEMPTY;
} else if ( isBlank && skipBlanks ) {
break;
} else {
@ -1777,12 +1778,14 @@ drawCell( BoardCtxt* board, XP_U16 col, XP_U16 row, XP_Bool skipBlanks )
Tile valTile = isBlank? dict_getBlankTile( dict ) : tile;
XP_U16 val = dict_getTileValue( dict, valTile );
XP_SNPRINTF( ch, sizeof(ch), (XP_UCHAR*)"%d", val );
textP = ch;
} else if ( dict_faceIsBitmap( dict, tile ) ) {
bitmap = dict_getFaceBitmap( dict, tile, XP_FALSE );
XP_ASSERT( !!bitmap );
textP = (XP_UCHAR*)NULL;
} else {
(void)dict_tilesToString( dict, &tile, 1, ch, sizeof(ch) );
textP = ch;
}
}
bonus = util_getSquareBonus( board->util, model, col, row );

View file

@ -434,7 +434,7 @@ gtk_draw_drawCell( DrawCtx* p_dctx, const XP_Rect* rect, const XP_UCHAR* letter,
/* We draw just an empty, potentially colored, square IFF there's nothing
in the cell or if CELL_DRAGSRC is set */
if ( (flags & CELL_DRAGSRC) != 0 || ( !!letter && *letter == LETTER_NONE ) ) {
if ( (flags & (CELL_DRAGSRC|CELL_ISEMPTY)) != 0 ) {
if ( bonus != BONUS_NONE ) {
gdk_gc_set_foreground( dctx->drawGC, &dctx->bonusColors[bonus-1] );
gdk_draw_rectangle( DRAW_WHAT(dctx), dctx->drawGC, TRUE,

View file

@ -1,6 +1,6 @@
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; compile-command: "make ARCH=68K_ONLY MEMDEBUG=TRUE";-*- */
/*
* Copyright 1999 - 2007 by Eric House (xwords@eehouse.org). All rights
* Copyright 1999 - 2008 by Eric House (xwords@eehouse.org). All rights
* reserved.
*
* This program is free software; you can redistribute it and/or
@ -496,6 +496,7 @@ palm_common_draw_drawCell( DrawCtx* p_dctx, const XP_Rect* rect,
if ( !!letters ) {
len = XP_STRLEN( (const char*)letters );
XP_ASSERT( len > 0 );
if ( len > 0 ) {
XP_S16 strWidth = FntCharsWidth( (const char*)letters, len );
XP_U16 x, y;
@ -539,7 +540,8 @@ palm_common_draw_drawCell( DrawCtx* p_dctx, const XP_Rect* rect,
empty = XP_FALSE;
}
if ( (flags & CELL_ISSTAR) != 0 ) {
if ( ((flags & CELL_ISSTAR) != 0)
&& ((flags & (CELL_DRAGSRC | CELL_ISEMPTY)) != 0 ) ) {
bitmapInRect( dctx, STAR_BMP_RES_ID, rect );
} else if ( showBonus && (able == ONEBIT) ) {
/* this is my one refusal to totally factor bandw and color