mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
fix crash opening older games
I'd forgotten that merely adding a new type changed the game's binary format.
This commit is contained in:
parent
496ef73da2
commit
ee9f3c36f8
2 changed files with 17 additions and 6 deletions
|
@ -737,10 +737,15 @@ comms_makeFromStream( MPFORMAL XWStreamCtxt* stream, XW_UtilCtxt* util,
|
|||
prevsQueueNext = &msg->next;
|
||||
}
|
||||
|
||||
/* FIX_NEXT_VERSION_CHANGE: Fix this next time CUR_STREAM_VERS is
|
||||
changed!! Don't write the 0th enum's case as it means NOTHING, and only
|
||||
write those for which the address type is set. I think. */
|
||||
if ( STREAM_VERS_DISABLEDS <= version ) {
|
||||
for ( int typ = 0; typ < VSIZE(comms->disableds); ++typ ) {
|
||||
for ( int ii = 0; ii < VSIZE(comms->disableds[0]); ++ii ) {
|
||||
comms->disableds[typ][ii] = 0 != stream_getBits( stream, 1 );
|
||||
for ( CommsConnType typ = (CommsConnType)0; typ < VSIZE(comms->disableds); ++typ ) {
|
||||
if ( typ < COMMS_CONN_NFC || addr_hasType( &comms->addr, typ ) ) {
|
||||
for ( int ii = 0; ii < VSIZE(comms->disableds[0]); ++ii ) {
|
||||
comms->disableds[typ][ii] = 0 != stream_getBits( stream, 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -940,9 +945,12 @@ comms_writeToStream( CommsCtxt* comms, XWStreamCtxt* stream,
|
|||
stream_putBytes( stream, msg->msg, msg->len );
|
||||
}
|
||||
|
||||
for ( int typ = 0; typ < VSIZE(comms->disableds); ++typ ) {
|
||||
for ( int ii = 0; ii < VSIZE(comms->disableds[0]); ++ii ) {
|
||||
stream_putBits( stream, 1, comms->disableds[typ][ii] ? 1 : 0 );
|
||||
/* FIX_NEXT_VERSION_CHANGE: Fix this next time CUR_STREAM_VERS is changed!! */
|
||||
for ( CommsConnType typ = (CommsConnType)0; typ < VSIZE(comms->disableds); ++typ ) {
|
||||
if ( typ < COMMS_CONN_NFC || addr_hasType( &comms->addr, typ ) ) {
|
||||
for ( int ii = 0; ii < VSIZE(comms->disableds[0]); ++ii ) {
|
||||
stream_putBits( stream, 1, comms->disableds[typ][ii] ? 1 : 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2893,6 +2901,7 @@ XP_Bool
|
|||
types_iter( XP_U32 conTypes, CommsConnType* typp, XP_U32* state )
|
||||
{
|
||||
CommsConnType typ = *state;
|
||||
XP_ASSERT( (conTypes & 0xFF) == conTypes );
|
||||
XP_ASSERT( typ < COMMS_CONN_NTYPES );
|
||||
while ( ++typ < COMMS_CONN_NTYPES ) {
|
||||
*state = typ;
|
||||
|
|
|
@ -310,6 +310,8 @@ typedef struct _PlayerDicts {
|
|||
#define LOG_RETURNF(fmt, ...) XP_LOGF( "%s => " fmt, __func__, __VA_ARGS__ )
|
||||
#define LOG_RETURN_VOID() LOG_RETURNF("%s","void")
|
||||
#define XP_LOGLOC() XP_LOGF( "%s(), line %d", __func__, __LINE__ )
|
||||
#define LOG_POS(strm) XP_LOGF( "%s(); line %d; read_pos: %X", __func__, __LINE__, \
|
||||
stream_getPos((strm), POS_READ) )
|
||||
|
||||
#ifndef XP_USE
|
||||
# define XP_USE(v) v=v
|
||||
|
|
Loading…
Reference in a new issue