From c15b56199c7c2c136a8b2dd6287c42b38272942f Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 22 Apr 2012 17:55:53 -0700 Subject: [PATCH] use marker enum to test for size. no code change --- xwords4/common/server.c | 4 ++-- xwords4/common/states.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/xwords4/common/server.c b/xwords4/common/server.c index 1315f22c6..9d3713533 100644 --- a/xwords4/common/server.c +++ b/xwords4/common/server.c @@ -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 ); diff --git a/xwords4/common/states.h b/xwords4/common/states.h index 058d267f3..d7ddb13ad 100644 --- a/xwords4/common/states.h +++ b/xwords4/common/states.h @@ -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