mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
fix streaming so four devices can be in game.
This commit is contained in:
parent
4e38b864d2
commit
73170b1254
1 changed files with 10 additions and 8 deletions
|
@ -131,7 +131,7 @@ static void registerRemotePlayer( ServerCtxt* server, XWStreamCtxt* stream );
|
||||||
static void server_sendInitialMessage( ServerCtxt* server );
|
static void server_sendInitialMessage( ServerCtxt* server );
|
||||||
static void sendBadWordMsgs( ServerCtxt* server );
|
static void sendBadWordMsgs( ServerCtxt* server );
|
||||||
static XP_Bool handleIllegalWord( ServerCtxt* server,
|
static XP_Bool handleIllegalWord( ServerCtxt* server,
|
||||||
XWStreamCtxt* incomming );
|
XWStreamCtxt* incoming );
|
||||||
static void tellMoveWasLegal( ServerCtxt* server );
|
static void tellMoveWasLegal( ServerCtxt* server );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -235,8 +235,10 @@ getNV( XWStreamCtxt* stream, ServerNonvolatiles* nv, XP_U16 nPlayers )
|
||||||
/* This should go away when stream format changes */
|
/* This should go away when stream format changes */
|
||||||
(void)stream_getBits( stream, 3 ); /* was npassesinrow */
|
(void)stream_getBits( stream, 3 ); /* was npassesinrow */
|
||||||
|
|
||||||
/* number of players is upper limit on device count */
|
nv->nDevices = (XP_U8)stream_getBits( stream, NDEVICES_NBITS );
|
||||||
nv->nDevices = (XP_U8)stream_getBits( stream, PLAYERNUM_NBITS );
|
if ( stream_getVersion( stream ) > STREAM_VERS_41 ) {
|
||||||
|
++nv->nDevices;
|
||||||
|
}
|
||||||
|
|
||||||
XP_ASSERT( XWSTATE_GAMEOVER < 1<<4 );
|
XP_ASSERT( XWSTATE_GAMEOVER < 1<<4 );
|
||||||
nv->gameState = (XW_State)stream_getBits( stream, 4 );
|
nv->gameState = (XW_State)stream_getBits( stream, 4 );
|
||||||
|
@ -256,7 +258,7 @@ putNV( XWStreamCtxt* stream, ServerNonvolatiles* nv, XP_U16 nPlayers )
|
||||||
|
|
||||||
stream_putBits( stream, 3, 0 ); /* was nPassesInRow */
|
stream_putBits( stream, 3, 0 ); /* was nPassesInRow */
|
||||||
/* number of players is upper limit on device count */
|
/* number of players is upper limit on device count */
|
||||||
stream_putBits( stream, PLAYERNUM_NBITS, nv->nDevices );
|
stream_putBits( stream, NDEVICES_NBITS, nv->nDevices-1 );
|
||||||
|
|
||||||
XP_ASSERT( XWSTATE_GAMEOVER < 1<<4 );
|
XP_ASSERT( XWSTATE_GAMEOVER < 1<<4 );
|
||||||
stream_putBits( stream, 4, nv->gameState );
|
stream_putBits( stream, 4, nv->gameState );
|
||||||
|
@ -2087,13 +2089,13 @@ tellMoveWasLegal( ServerCtxt* server )
|
||||||
} /* tellMoveWasLegal */
|
} /* tellMoveWasLegal */
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
handleIllegalWord( ServerCtxt* server, XWStreamCtxt* incomming )
|
handleIllegalWord( ServerCtxt* server, XWStreamCtxt* incoming )
|
||||||
{
|
{
|
||||||
BadWordInfo bwi;
|
BadWordInfo bwi;
|
||||||
XP_U16 whichPlayer;
|
XP_U16 whichPlayer;
|
||||||
|
|
||||||
whichPlayer = stream_getBits( incomming, PLAYERNUM_NBITS );
|
whichPlayer = stream_getBits( incoming, PLAYERNUM_NBITS );
|
||||||
bwiFromStream( MPPARM(server->mpool) incomming, &bwi );
|
bwiFromStream( MPPARM(server->mpool) incoming, &bwi );
|
||||||
|
|
||||||
badWordMoveUndoAndTellUser( server, &bwi );
|
badWordMoveUndoAndTellUser( server, &bwi );
|
||||||
|
|
||||||
|
@ -2103,7 +2105,7 @@ handleIllegalWord( ServerCtxt* server, XWStreamCtxt* incomming )
|
||||||
} /* handleIllegalWord */
|
} /* handleIllegalWord */
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
handleMoveOk( ServerCtxt* server, XWStreamCtxt* incomming /* unused */ )
|
handleMoveOk( ServerCtxt* server, XWStreamCtxt* incoming /* unused */ )
|
||||||
{
|
{
|
||||||
XP_Bool accepted = XP_TRUE;
|
XP_Bool accepted = XP_TRUE;
|
||||||
XP_ASSERT( server->vol.gi->serverRole == SERVER_ISCLIENT );
|
XP_ASSERT( server->vol.gi->serverRole == SERVER_ISCLIENT );
|
||||||
|
|
Loading…
Reference in a new issue