mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-14 08:01:38 +01:00
write and read dummy values to/from stream when KEYBOARD_NAV isn't
defined so that the versions are compatible. This will let existing saved games be read if I turn this off on Android.
This commit is contained in:
parent
de32e514ab
commit
0957c95c8e
1 changed files with 18 additions and 6 deletions
|
@ -219,14 +219,18 @@ board_makeFromStream( MPFORMAL XWStreamCtxt* stream, ModelCtxt* model,
|
||||||
board->gameOver = (XP_Bool)stream_getBits( stream, 1 );
|
board->gameOver = (XP_Bool)stream_getBits( stream, 1 );
|
||||||
board->showColors = (XP_Bool)stream_getBits( stream, 1 );
|
board->showColors = (XP_Bool)stream_getBits( stream, 1 );
|
||||||
board->showCellValues = (XP_Bool)stream_getBits( stream, 1 );
|
board->showCellValues = (XP_Bool)stream_getBits( stream, 1 );
|
||||||
#ifdef KEYBOARD_NAV
|
|
||||||
if ( version >= STREAM_VERS_KEYNAV ) {
|
if ( version >= STREAM_VERS_KEYNAV ) {
|
||||||
board->focussed = (BoardObjectType)stream_getBits( stream, 2 );
|
board->focussed = (BoardObjectType)stream_getBits( stream, 2 );
|
||||||
|
#ifdef KEYBOARD_NAV
|
||||||
board->focusHasDived = (BoardObjectType)stream_getBits( stream, 1 );
|
board->focusHasDived = (BoardObjectType)stream_getBits( stream, 1 );
|
||||||
board->scoreCursorLoc = (XP_U8)
|
board->scoreCursorLoc = (XP_U8)
|
||||||
stream_getBits( stream, (version < STREAM_VERS_MODEL_NO_DICT? 2:3));
|
stream_getBits( stream, (version < STREAM_VERS_MODEL_NO_DICT? 2:3));
|
||||||
}
|
#else
|
||||||
|
(void)stream_getBits( stream,
|
||||||
|
version < STREAM_VERS_MODEL_NO_DICT? 3:4 );
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
XP_ASSERT( !!server );
|
XP_ASSERT( !!server );
|
||||||
|
|
||||||
|
@ -242,13 +246,16 @@ board_makeFromStream( MPFORMAL XWStreamCtxt* stream, ModelCtxt* model,
|
||||||
pti->traySelBits = (TileBit)stream_getBits( stream,
|
pti->traySelBits = (TileBit)stream_getBits( stream,
|
||||||
MAX_TRAY_TILES );
|
MAX_TRAY_TILES );
|
||||||
pti->tradeInProgress = (XP_Bool)stream_getBits( stream, 1 );
|
pti->tradeInProgress = (XP_Bool)stream_getBits( stream, 1 );
|
||||||
#ifdef KEYBOARD_NAV
|
|
||||||
if ( version >= STREAM_VERS_KEYNAV ) {
|
if ( version >= STREAM_VERS_KEYNAV ) {
|
||||||
|
#ifdef KEYBOARD_NAV
|
||||||
pti->bdCursor.col = stream_getBits( stream, 4 );
|
pti->bdCursor.col = stream_getBits( stream, 4 );
|
||||||
pti->bdCursor.row = stream_getBits( stream, 4 );
|
pti->bdCursor.row = stream_getBits( stream, 4 );
|
||||||
pti->trayCursorLoc = stream_getBits( stream, 3 );
|
pti->trayCursorLoc = stream_getBits( stream, 3 );
|
||||||
}
|
#else
|
||||||
|
(void)stream_getBits( stream, 4+4+3 );
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef XWFEATURE_SEARCHLIMIT
|
#ifdef XWFEATURE_SEARCHLIMIT
|
||||||
if ( version >= STREAM_VERS_41B4 ) {
|
if ( version >= STREAM_VERS_41B4 ) {
|
||||||
|
@ -286,10 +293,12 @@ board_writeToStream( BoardCtxt* board, XWStreamCtxt* stream )
|
||||||
stream_putBits( stream, 1, board->gameOver );
|
stream_putBits( stream, 1, board->gameOver );
|
||||||
stream_putBits( stream, 1, board->showColors );
|
stream_putBits( stream, 1, board->showColors );
|
||||||
stream_putBits( stream, 1, board->showCellValues );
|
stream_putBits( stream, 1, board->showCellValues );
|
||||||
#ifdef KEYBOARD_NAV
|
|
||||||
stream_putBits( stream, 2, board->focussed );
|
stream_putBits( stream, 2, board->focussed );
|
||||||
|
#ifdef KEYBOARD_NAV
|
||||||
stream_putBits( stream, 1, board->focusHasDived );
|
stream_putBits( stream, 1, board->focusHasDived );
|
||||||
stream_putBits( stream, 3, board->scoreCursorLoc );
|
stream_putBits( stream, 3, board->scoreCursorLoc );
|
||||||
|
#else
|
||||||
|
stream_putBits( stream, 4, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XP_ASSERT( !!board->server );
|
XP_ASSERT( !!board->server );
|
||||||
|
@ -306,10 +315,13 @@ board_writeToStream( BoardCtxt* board, XWStreamCtxt* stream )
|
||||||
stream_putBits( stream, NTILES_NBITS, pti->dividerLoc );
|
stream_putBits( stream, NTILES_NBITS, pti->dividerLoc );
|
||||||
stream_putBits( stream, MAX_TRAY_TILES, pti->traySelBits );
|
stream_putBits( stream, MAX_TRAY_TILES, pti->traySelBits );
|
||||||
stream_putBits( stream, 1, pti->tradeInProgress );
|
stream_putBits( stream, 1, pti->tradeInProgress );
|
||||||
#ifdef KEYBOARD_NAV
|
|
||||||
|
#ifdef KEYBOARD_NAV
|
||||||
stream_putBits( stream, 4, pti->bdCursor.col );
|
stream_putBits( stream, 4, pti->bdCursor.col );
|
||||||
stream_putBits( stream, 4, pti->bdCursor.row );
|
stream_putBits( stream, 4, pti->bdCursor.row );
|
||||||
stream_putBits( stream, 3, pti->trayCursorLoc );
|
stream_putBits( stream, 3, pti->trayCursorLoc );
|
||||||
|
#else
|
||||||
|
stream_putBits( stream, 4+4+3, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XWFEATURE_SEARCHLIMIT
|
#ifdef XWFEATURE_SEARCHLIMIT
|
||||||
|
|
Loading…
Reference in a new issue