From 517cfe6fdaa5a6b9c44493e2e87387ef181af883 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 10 Aug 2015 06:24:40 -0700 Subject: [PATCH] bring over saved file format change from relay_conn branch so builds from each will be able to open each other's files. --- xwords4/common/comms.c | 11 +++++------ xwords4/common/comtypes.h | 3 ++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xwords4/common/comms.c b/xwords4/common/comms.c index 3151305ab..a3c2de639 100644 --- a/xwords4/common/comms.c +++ b/xwords4/common/comms.c @@ -632,7 +632,8 @@ comms_makeFromStream( MPFORMAL XWStreamCtxt* stream, XW_UtilCtxt* util, isServer = stream_getU8( stream ); addrFromStream( &addr, stream ); - if ( addr_hasType( &addr, COMMS_CONN_RELAY ) ) { + if ( version >= STREAM_VERS_DEVIDS + || addr_hasType( &addr, COMMS_CONN_RELAY ) ) { nPlayersHere = (XP_U16)stream_getBits( stream, 4 ); nPlayersTotal = (XP_U16)stream_getBits( stream, 4 ); } else { @@ -846,10 +847,8 @@ comms_writeToStream( CommsCtxt* comms, XWStreamCtxt* stream, stream_putU8( stream, (XP_U8)comms->isServer ); logAddr( comms, &comms->addr, __func__ ); addrToStream( stream, &comms->addr ); - if ( addr_hasType( &comms->addr, COMMS_CONN_RELAY ) ) { - stream_putBits( stream, 4, comms->rr.nPlayersHere ); - stream_putBits( stream, 4, comms->rr.nPlayersTotal ); - } + stream_putBits( stream, 4, comms->rr.nPlayersHere ); + stream_putBits( stream, 4, comms->rr.nPlayersTotal ); stream_putU32( stream, comms->connID ); stream_putU16( stream, comms->nextChannelNo ); @@ -1051,7 +1050,7 @@ comms_getConTypes( const CommsCtxt* comms ) XP_LOGF( "%s: returning COMMS_CONN_NONE for null comms", __func__ ); } return typ; -} /* comms_getConType */ +} /* comms_getConTypes */ XP_Bool comms_getIsServer( const CommsCtxt* comms ) diff --git a/xwords4/common/comtypes.h b/xwords4/common/comtypes.h index 094ddcbab..cca8f4476 100644 --- a/xwords4/common/comtypes.h +++ b/xwords4/common/comtypes.h @@ -47,6 +47,7 @@ #endif #define MAX_COLS MAX_ROWS +#define STREAM_VERS_DEVIDS 0x19 #define STREAM_VERS_MULTIADDR 0x18 #define STREAM_VERS_MODELDIVIDER 0x17 #define STREAM_VERS_COMMSBACKOFF 0x16 @@ -86,7 +87,7 @@ #define STREAM_VERS_405 0x01 /* search for FIX_NEXT_VERSION_CHANGE next time this is changed */ -#define CUR_STREAM_VERS STREAM_VERS_MULTIADDR +#define CUR_STREAM_VERS STREAM_VERS_DEVIDS typedef struct XP_Rect { XP_S16 left;