save/restore new dictLang field; up stream version

This commit is contained in:
Andy2 2010-09-01 06:51:44 -07:00
parent c6c1a93de5
commit 0b91e9634e
2 changed files with 8 additions and 1 deletions

View file

@ -361,6 +361,7 @@ gi_copy( MPFORMAL CurGameInfo* destGI, const CurGameInfo* srcGI )
replaceStringIfDifferent( mpool, &destGI->dictName,
srcGI->dictName );
destGI->dictLang = srcGI->dictLang;
destGI->gameID = srcGI->gameID;
destGI->gameSeconds = srcGI->gameSeconds;
destGI->nPlayers = (XP_U8)srcGI->nPlayers;
@ -438,6 +439,9 @@ gi_readFromStream( MPFORMAL XWStreamCtxt* stream, CurGameInfo* gi )
}
gi->gameID = stream_getU16( stream );
if ( strVersion >= STREAM_VERS_DICTLANG ) {
gi->dictLang = stream_getU8( stream );
}
if ( gi->timerEnabled || strVersion >= STREAM_VERS_GAMESECONDS ) {
gi->gameSeconds = stream_getU16( stream );
}
@ -481,6 +485,7 @@ gi_writeToStream( XWStreamCtxt* stream, const CurGameInfo* gi )
stream_putBits( stream, 1, gi->confirmBTConnect );
stream_putU16( stream, gi->gameID );
stream_putU8( stream, gi->dictLang );
stream_putU16( stream, gi->gameSeconds );
for ( pl = gi->players, i = 0; i < gi->nPlayers; ++pl, ++i ) {

View file

@ -31,6 +31,7 @@
extern "C" {
#endif
#define STREAM_VERS_DICTLANG 0x0D /* save dict lang code in CurGameInfo */
#define STREAM_VERS_NUNDONE 0x0C /* save undone tile in model */
#define STREAM_VERS_GAMESECONDS 0x0B /* save gameSeconds whether or not
timer's enabled */
@ -47,7 +48,7 @@ extern "C" {
#define STREAM_VERS_41B4 0x02
#define STREAM_VERS_405 0x01
#define CUR_STREAM_VERS STREAM_VERS_NUNDONE
#define CUR_STREAM_VERS STREAM_VERS_DICTLANG
typedef struct LocalPlayer {
XP_UCHAR* name;
@ -65,6 +66,7 @@ typedef struct CurGameInfo {
LocalPlayer players[MAX_NUM_PLAYERS];
XP_U16 gameID; /* uniquely identifies game */
XP_U16 gameSeconds; /* for timer */
XP_LangCode dictLang;
XP_U8 nPlayers;
XP_U8 boardSize;
DeviceRole serverRole;