mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
don't include indices for prefixes that don't exist.
This commit is contained in:
parent
412a58f6b9
commit
42d1a48a1d
1 changed files with 4 additions and 7 deletions
|
@ -862,9 +862,7 @@ indexOne( const DictionaryCtxt* dict, XP_U16 depth, Tile* tiles,
|
||||||
XWStreamCtxt* stream, EdgeArray* prevEdges, DictIndex* prevIndex )
|
XWStreamCtxt* stream, EdgeArray* prevEdges, DictIndex* prevIndex )
|
||||||
{
|
{
|
||||||
EdgeArray curEdges = { .nEdges = 0 };
|
EdgeArray curEdges = { .nEdges = 0 };
|
||||||
if ( !findStartsWith( dict, tiles, depth, &curEdges ) ) {
|
if ( findStartsWith( dict, tiles, depth, &curEdges ) ) {
|
||||||
indices[(*nextIndex)++] = NO_INDEX;
|
|
||||||
} else {
|
|
||||||
XP_ASSERT( curEdges.nEdges == depth );
|
XP_ASSERT( curEdges.nEdges == depth );
|
||||||
if ( ! ISACCEPTING( dict, curEdges.edges[curEdges.nEdges-1] ) ) {
|
if ( ! ISACCEPTING( dict, curEdges.edges[curEdges.nEdges-1] ) ) {
|
||||||
if ( !nextWord( dict, &curEdges ) ) {
|
if ( !nextWord( dict, &curEdges ) ) {
|
||||||
|
@ -883,15 +881,14 @@ indexOne( const DictionaryCtxt* dict, XP_U16 depth, Tile* tiles,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
indices[(*nextIndex)++] = *prevIndex;
|
indices[(*nextIndex)++] = *prevIndex;
|
||||||
|
|
||||||
if ( NULL != stream ) {
|
if ( NULL != stream ) {
|
||||||
XP_UCHAR prefix[8];
|
XP_UCHAR prefix[8];
|
||||||
(void)dict_tilesToString( dict, tiles, depth, prefix, VSIZE(prefix) );
|
(void)dict_tilesToString( dict, tiles, depth, prefix, VSIZE(prefix) );
|
||||||
stream_catString( stream, prefix );
|
stream_catString( stream, prefix );
|
||||||
|
stream_catString( stream, "\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( NULL != stream ) {
|
|
||||||
stream_catString( stream, "\n" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -906,7 +903,7 @@ doOneDepth( const DictionaryCtxt* dict,
|
||||||
prefix[curDepth] = allTiles[ii];
|
prefix[curDepth] = allTiles[ii];
|
||||||
if ( curDepth + 1 == maxDepth ) {
|
if ( curDepth + 1 == maxDepth ) {
|
||||||
indexOne( dict, maxDepth, prefix, indices, nextEntry,
|
indexOne( dict, maxDepth, prefix, indices, nextEntry,
|
||||||
stream, prevEdges, prevIndex);
|
stream, prevEdges, prevIndex );
|
||||||
} else {
|
} else {
|
||||||
doOneDepth( dict, allTiles, nTiles, prefix, curDepth+1, maxDepth,
|
doOneDepth( dict, allTiles, nTiles, prefix, curDepth+1, maxDepth,
|
||||||
indices, nextEntry, stream, prevEdges, prevIndex );
|
indices, nextEntry, stream, prevEdges, prevIndex );
|
||||||
|
|
Loading…
Add table
Reference in a new issue