mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-16 15:41:16 +01:00
Swedish dict has 0-count tiles that are available only for blanks.
Don't print these with counts/values.
This commit is contained in:
parent
14103984f3
commit
aaaf6489c8
1 changed files with 18 additions and 13 deletions
|
@ -2250,7 +2250,7 @@ server_formatPoolCounts( ServerCtxt* server, XWStreamCtxt* stream,
|
||||||
{
|
{
|
||||||
DictionaryCtxt* dict;
|
DictionaryCtxt* dict;
|
||||||
Tile tile;
|
Tile tile;
|
||||||
XP_U16 nChars;
|
XP_U16 nChars, nPrinted;
|
||||||
XP_Bool hasBlank;
|
XP_Bool hasBlank;
|
||||||
Tile blank = 0; /* shut compiler up */
|
Tile blank = 0; /* shut compiler up */
|
||||||
XP_U16 counts[MAX_UNIQUE_TILES+1]; /* 1 for the blank */
|
XP_U16 counts[MAX_UNIQUE_TILES+1]; /* 1 for the blank */
|
||||||
|
@ -2272,28 +2272,33 @@ server_formatPoolCounts( ServerCtxt* server, XWStreamCtxt* stream,
|
||||||
blank = dict_getBlankTile( dict );
|
blank = dict_getBlankTile( dict );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( tile = 0; ; ) {
|
for ( tile = 0, nPrinted = 0; ; ) {
|
||||||
XP_UCHAR buf[24];
|
XP_UCHAR buf[24];
|
||||||
XP_UCHAR face[4];
|
XP_UCHAR face[4];
|
||||||
XP_U16 count, value;
|
XP_U16 count, value;
|
||||||
XP_S16 nRemaining; /* signed so assertion will work */
|
XP_S16 nRemaining; /* signed so assertion will work */
|
||||||
|
|
||||||
dict_tilesToString( dict, &tile, 1, face );
|
|
||||||
count = dict_numTiles( dict, tile );
|
count = dict_numTiles( dict, tile );
|
||||||
nRemaining = pool_getNTilesLeftFor( pool, tile ) + counts[tile];
|
|
||||||
XP_ASSERT( nRemaining >= 0 );
|
|
||||||
value = dict_getTileValue( dict, tile );
|
|
||||||
|
|
||||||
XP_SNPRINTF( buf, sizeof(buf), (XP_UCHAR*)"%s: %d[%d] %d",
|
if ( count > 0 ) {
|
||||||
face, count, nRemaining, value );
|
dict_tilesToString( dict, &tile, 1, face );
|
||||||
stream_putBytes( stream, buf, (XP_U16)XP_STRLEN(buf) );
|
nRemaining = pool_getNTilesLeftFor( pool, tile ) + counts[tile];
|
||||||
|
XP_ASSERT( nRemaining >= 0 );
|
||||||
|
value = dict_getTileValue( dict, tile );
|
||||||
|
|
||||||
|
XP_SNPRINTF( buf, sizeof(buf), (XP_UCHAR*)"%s: %d[%d] %d",
|
||||||
|
face, count, nRemaining, value );
|
||||||
|
stream_putBytes( stream, buf, (XP_U16)XP_STRLEN(buf) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( ++tile >= nChars ) {
|
if ( ++tile >= nChars ) {
|
||||||
break;
|
break;
|
||||||
} else if ( tile % nCols == 0 ) {
|
} else if ( count > 0 ) {
|
||||||
stream_putBytes( stream, XP_CR, (XP_U16)XP_STRLEN(XP_CR) );
|
if ( ++nPrinted % nCols == 0 ) {
|
||||||
} else {
|
stream_putBytes( stream, XP_CR, (XP_U16)XP_STRLEN(XP_CR) );
|
||||||
stream_putBytes( stream, (void*)" ", 3 );
|
} else {
|
||||||
|
stream_putBytes( stream, (void*)" ", 3 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* server_formatPoolCounts */
|
} /* server_formatPoolCounts */
|
||||||
|
|
Loading…
Reference in a new issue