mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-27 07:58:49 +01:00
add pool_containsTiles()
This commit is contained in:
parent
4ffdeefe3b
commit
89ca45357a
2 changed files with 18 additions and 0 deletions
|
@ -208,6 +208,22 @@ pool_removeTiles( PoolContext* pool, const TrayTileSet* tiles )
|
|||
XP_LOGF( "%s: %d tiles left in pool", __func__, pool->numTilesLeft );
|
||||
} /* pool_removeTiles */
|
||||
|
||||
XP_Bool
|
||||
pool_containsTiles( const PoolContext* pool, const TrayTileSet* tiles )
|
||||
{
|
||||
XP_Bool allThere = XP_TRUE;
|
||||
XP_U16 ii;
|
||||
XP_U8 counts[pool->numFaces];
|
||||
XP_MEMCPY( counts, pool->lettersLeft, sizeof(counts) );
|
||||
|
||||
/* In case we have duplicates, make count of each type */
|
||||
for ( ii = 0; allThere && ii < tiles->nTiles; ++ii ) {
|
||||
allThere = 0 <= --counts[tiles->tiles[ii]];
|
||||
}
|
||||
|
||||
return allThere;
|
||||
}
|
||||
|
||||
XP_U16
|
||||
pool_getNTilesLeft( PoolContext* pool )
|
||||
{
|
||||
|
|
|
@ -28,6 +28,8 @@ void pool_requestTiles( PoolContext* pool, Tile* tiles,
|
|||
/*in out*/ XP_U8* maxNum );
|
||||
void pool_replaceTiles( PoolContext* pool, const TrayTileSet* tiles );
|
||||
void pool_removeTiles( PoolContext* pool, const TrayTileSet* tiles );
|
||||
XP_Bool pool_containsTiles( const PoolContext* pool,
|
||||
const TrayTileSet* tiles );
|
||||
|
||||
XP_U16 pool_getNTilesLeft( PoolContext* pool );
|
||||
XP_U16 pool_getNTilesLeftFor( PoolContext* pool, Tile tile );
|
||||
|
|
Loading…
Add table
Reference in a new issue