use marker enum to test for size. no code change

This commit is contained in:
Eric House 2012-04-22 17:55:53 -07:00
parent a72dbdd8dd
commit c15b56199c
2 changed files with 6 additions and 4 deletions

View file

@ -285,7 +285,7 @@ getNV( XWStreamCtxt* stream, ServerNonvolatiles* nv, XP_U16 nPlayers )
++nv->nDevices;
}
XP_ASSERT( XWSTATE_GAMEOVER < 1<<4 );
XP_ASSERT( XWSTATE_LAST <= 1<<4 );
nv->gameState = (XW_State)stream_getBits( stream, XWSTATE_NBITS );
if ( version >= STREAM_VERS_SERVER_SAVES_TOSHOW ) {
nv->stateAfterShow = (XW_State)stream_getBits( stream, XWSTATE_NBITS );
@ -318,7 +318,7 @@ putNV( XWStreamCtxt* stream, const ServerNonvolatiles* nv, XP_U16 nPlayers )
/* number of players is upper limit on device count */
stream_putBits( stream, NDEVICES_NBITS, nv->nDevices-1 );
XP_ASSERT( XWSTATE_GAMEOVER < 1<<4 );
XP_ASSERT( XWSTATE_LAST <= 1<<4 );
stream_putBits( stream, XWSTATE_NBITS, nv->gameState );
stream_putBits( stream, XWSTATE_NBITS, nv->stateAfterShow );

View file

@ -29,10 +29,12 @@ enum {
XWSTATE_RECEIVED_ALL_REG, /* includes waiting for dict from server */
XWSTATE_NEEDSEND_BADWORD_INFO,
XWSTATE_MOVE_CONFIRM_WAIT, /* client's waiting to hear back */
XWSTATE_MOVE_CONFIRM_MUSTSEND, /* server should tell client asap */
XWSTATE_MOVE_CONFIRM_MUSTSEND,/* server should tell client asap */
XWSTATE_NEEDSEND_ENDGAME,
XWSTATE_INTURN,
XWSTATE_GAMEOVER
XWSTATE_GAMEOVER,
XWSTATE_LAST /* for asserts only :-) */
};
typedef XP_U8 XW_State;
#define XWSTATE_NBITS 4