mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-26 09:58:20 +01:00
Merge branch 'android_branch' into android_bt
This commit is contained in:
commit
3b3439371f
4 changed files with 34 additions and 32 deletions
|
@ -72,8 +72,6 @@ static void buildModelFromStack( ModelCtxt* model, StackCtxt* stack,
|
||||||
MovePrintFuncPost mpfpo, void* closure );
|
MovePrintFuncPost mpfpo, void* closure );
|
||||||
static void setPendingCounts( ModelCtxt* model, XP_S16 turn );
|
static void setPendingCounts( ModelCtxt* model, XP_S16 turn );
|
||||||
static XP_S16 setContains( const TrayTileSet* tiles, Tile tile );
|
static XP_S16 setContains( const TrayTileSet* tiles, Tile tile );
|
||||||
static void sortTiles( TrayTileSet* dest, const TrayTileSet* src );
|
|
||||||
static void removeTile( TrayTileSet* tiles, XP_U16 index );
|
|
||||||
static void loadPlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream,
|
static void loadPlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream,
|
||||||
XP_U16 version, PlayerCtxt* pc );
|
XP_U16 version, PlayerCtxt* pc );
|
||||||
static void writePlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream,
|
static void writePlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream,
|
||||||
|
@ -2413,16 +2411,6 @@ writePlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream,
|
||||||
}
|
}
|
||||||
} /* writePlayerCtxt */
|
} /* writePlayerCtxt */
|
||||||
|
|
||||||
static void
|
|
||||||
removeTile( TrayTileSet* tiles, XP_U16 index )
|
|
||||||
{
|
|
||||||
XP_U16 ii;
|
|
||||||
--tiles->nTiles;
|
|
||||||
for ( ii = index; ii < tiles->nTiles; ++ii ) {
|
|
||||||
tiles->tiles[ii] = tiles->tiles[ii+1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static XP_S16
|
static XP_S16
|
||||||
setContains( const TrayTileSet* tiles, Tile tile )
|
setContains( const TrayTileSet* tiles, Tile tile )
|
||||||
{
|
{
|
||||||
|
@ -2439,23 +2427,6 @@ setContains( const TrayTileSet* tiles, Tile tile )
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
sortTiles( TrayTileSet* dest, const TrayTileSet* src )
|
|
||||||
{
|
|
||||||
TrayTileSet tmp = *src;
|
|
||||||
dest->nTiles = 0;
|
|
||||||
while ( 0 < tmp.nTiles ) {
|
|
||||||
XP_U16 ii, smallest;
|
|
||||||
for ( smallest = ii = 0; ii < tmp.nTiles; ++ii ) {
|
|
||||||
if ( tmp.tiles[ii] < tmp.tiles[smallest] ) {
|
|
||||||
smallest = ii;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dest->tiles[dest->nTiles++] = tmp.tiles[smallest];
|
|
||||||
removeTile( &tmp, smallest );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CPLUS
|
#ifdef CPLUS
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -104,9 +104,11 @@ static XP_U32
|
||||||
augmentFor( XP_U32 hash, const StackEntry* entry )
|
augmentFor( XP_U32 hash, const StackEntry* entry )
|
||||||
{
|
{
|
||||||
switch( entry->moveType ) {
|
switch( entry->moveType ) {
|
||||||
case ASSIGN_TYPE:
|
case ASSIGN_TYPE: {
|
||||||
hash = augmentHash( hash, (XP_U8*)&entry->u.assign,
|
TrayTileSet tiles;
|
||||||
sizeof(entry->u.assign) );
|
sortTiles( &tiles, &entry->u.assign.tiles );
|
||||||
|
hash = augmentHash( hash, (XP_U8*)&tiles, sizeof(tiles) );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MOVE_TYPE:
|
case MOVE_TYPE:
|
||||||
hash = augmentHash( hash, (XP_U8*)&entry->u.move,
|
hash = augmentHash( hash, (XP_U8*)&entry->u.move,
|
||||||
|
|
|
@ -73,6 +73,33 @@ traySetFromStream( XWStreamCtxt* stream, TrayTileSet* ts )
|
||||||
ts->nTiles = (XP_U8)nTiles;
|
ts->nTiles = (XP_U8)nTiles;
|
||||||
} /* traySetFromStream */
|
} /* traySetFromStream */
|
||||||
|
|
||||||
|
void
|
||||||
|
removeTile( TrayTileSet* tiles, XP_U16 index )
|
||||||
|
{
|
||||||
|
XP_U16 ii;
|
||||||
|
--tiles->nTiles;
|
||||||
|
for ( ii = index; ii < tiles->nTiles; ++ii ) {
|
||||||
|
tiles->tiles[ii] = tiles->tiles[ii+1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sortTiles( TrayTileSet* dest, const TrayTileSet* src )
|
||||||
|
{
|
||||||
|
TrayTileSet tmp = *src;
|
||||||
|
dest->nTiles = 0;
|
||||||
|
while ( 0 < tmp.nTiles ) {
|
||||||
|
XP_U16 ii, smallest;
|
||||||
|
for ( smallest = ii = 0; ii < tmp.nTiles; ++ii ) {
|
||||||
|
if ( tmp.tiles[ii] < tmp.tiles[smallest] ) {
|
||||||
|
smallest = ii;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dest->tiles[dest->nTiles++] = tmp.tiles[smallest];
|
||||||
|
removeTile( &tmp, smallest );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static void
|
static void
|
||||||
signedToStream( XWStreamCtxt* stream, XP_U16 nBits, XP_S32 num )
|
signedToStream( XWStreamCtxt* stream, XP_U16 nBits, XP_S32 num )
|
||||||
|
|
|
@ -34,6 +34,8 @@ XP_U16 bitsForMax( XP_U32 n );
|
||||||
|
|
||||||
void traySetToStream( XWStreamCtxt* stream, const TrayTileSet* ts );
|
void traySetToStream( XWStreamCtxt* stream, const TrayTileSet* ts );
|
||||||
void traySetFromStream( XWStreamCtxt* stream, TrayTileSet* ts );
|
void traySetFromStream( XWStreamCtxt* stream, TrayTileSet* ts );
|
||||||
|
void sortTiles( TrayTileSet* dest, const TrayTileSet* src );
|
||||||
|
void removeTile( TrayTileSet* tiles, XP_U16 index );
|
||||||
|
|
||||||
XP_S32 signedFromStream( XWStreamCtxt* stream, XP_U16 nBits );
|
XP_S32 signedFromStream( XWStreamCtxt* stream, XP_U16 nBits );
|
||||||
void signedToStream( XWStreamCtxt* stream, XP_U16 nBits, XP_S32 num );
|
void signedToStream( XWStreamCtxt* stream, XP_U16 nBits, XP_S32 num );
|
||||||
|
|
Loading…
Reference in a new issue