always include slots that are only used in conditional builds to

simplify converting between saved versions.
This commit is contained in:
ehouse 2004-10-08 23:57:24 +00:00
parent 8991604df6
commit 722b0095ca
2 changed files with 5 additions and 21 deletions

View file

@ -334,20 +334,18 @@ gi_readFromStream( MPFORMAL XWStreamCtxt* stream, CurGameInfo* gi )
gi->robotSmartness = (XP_U8)stream_getBits( stream, 2 ); gi->robotSmartness = (XP_U8)stream_getBits( stream, 2 );
gi->phoniesAction = (XWPhoniesChoice)stream_getBits( stream, 2 ); gi->phoniesAction = (XWPhoniesChoice)stream_getBits( stream, 2 );
gi->timerEnabled = stream_getBits( stream, 1 ); gi->timerEnabled = stream_getBits( stream, 1 );
#ifdef FEATURE_TRAY_EDIT
if ( strVersion >= CUR_STREAM_VERS ) { if ( strVersion >= CUR_STREAM_VERS ) {
gi->allowPickTiles = stream_getBits( stream, 1 ); gi->allowPickTiles = stream_getBits( stream, 1 );
} else { } else {
gi->allowPickTiles = XP_FALSE; gi->allowPickTiles = XP_FALSE;
} }
#endif
#ifdef XWFEATURE_SEARCHLIMIT
if ( strVersion >= CUR_STREAM_VERS ) { if ( strVersion >= CUR_STREAM_VERS ) {
gi->allowHintRect = stream_getBits( stream, 1 ); gi->allowHintRect = stream_getBits( stream, 1 );
} else { } else {
gi->allowHintRect = XP_FALSE; gi->allowHintRect = XP_FALSE;
} }
#endif
gi->gameID = stream_getU16( stream ); gi->gameID = stream_getU16( stream );
@ -389,12 +387,8 @@ gi_writeToStream( XWStreamCtxt* stream, CurGameInfo* gi )
stream_putBits( stream, 2, gi->robotSmartness ); stream_putBits( stream, 2, gi->robotSmartness );
stream_putBits( stream, 2, gi->phoniesAction ); stream_putBits( stream, 2, gi->phoniesAction );
stream_putBits( stream, 1, gi->timerEnabled ); stream_putBits( stream, 1, gi->timerEnabled );
#ifdef FEATURE_TRAY_EDIT
stream_putBits( stream, 1, gi->allowPickTiles ); stream_putBits( stream, 1, gi->allowPickTiles );
#endif
#ifdef XWFEATURE_SEARCHLIMIT
stream_putBits( stream, 1, gi->allowHintRect ); stream_putBits( stream, 1, gi->allowHintRect );
#endif
stream_putU16( stream, gi->gameID ); stream_putU16( stream, gi->gameID );
if ( gi->timerEnabled) { if ( gi->timerEnabled) {

View file

@ -30,15 +30,9 @@
extern "C" { extern "C" {
#endif #endif
/* WARNING: the following assumes that FEATURE_TRAY_EDIT is defined if #define CUR_STREAM_VERS 0x02
XWFEATURE_SEARCHLIMIT is*/
#if defined XWFEATURE_SEARCHLIMIT #define STREAM_VERS_405 0x01
# define CUR_STREAM_VERS 0x03
#elif defined FEATURE_TRAY_EDIT
# define CUR_STREAM_VERS 0x02
#else
# define CUR_STREAM_VERS 0x01
#endif
typedef struct LocalPlayer { typedef struct LocalPlayer {
XP_UCHAR* name; XP_UCHAR* name;
@ -62,12 +56,8 @@ typedef struct CurGameInfo {
XP_Bool hintsNotAllowed; XP_Bool hintsNotAllowed;
XP_Bool timerEnabled; XP_Bool timerEnabled;
#ifdef FEATURE_TRAY_EDIT
XP_Bool allowPickTiles; XP_Bool allowPickTiles;
#endif
#ifdef XWFEATURE_SEARCHLIMIT
XP_Bool allowHintRect; XP_Bool allowHintRect;
#endif
XP_U8 robotSmartness; XP_U8 robotSmartness;
XWPhoniesChoice phoniesAction; XWPhoniesChoice phoniesAction;