log gameSeed; generate on linux too

I'm seeing a rare case where a game connectes to relay specifying a room
and somehow gets both slots, having provided different gameSeeds the two
times. This means an opponent won't connect, the room being full in that
game. I can't reproduce, so am logging seed changes better and switching
linux client to leave seed generation to comms as Android does.
This commit is contained in:
Eric House 2019-01-08 08:16:50 -08:00
parent 454e3da578
commit db641c4664
2 changed files with 6 additions and 4 deletions

View file

@ -676,7 +676,7 @@ comms_makeFromStream( MPFORMAL XWStreamCtxt* stream, XW_UtilCtxt* util,
} else {
comms->channelSeed = stream_getU16( stream );
CNO_FMT( cbuf, comms->channelSeed );
XP_LOGF( "%s: loaded seed: %s", __func__, cbuf );
XP_LOGF( "%s: loaded seed: %s(%d)", __func__, cbuf, comms->channelSeed );
}
if ( STREAM_VERS_COMMSBACKOFF <= version ) {
comms->resendBackoff = stream_getU16( stream );
@ -890,7 +890,9 @@ comms_writeToStream( CommsCtxt* comms, XWStreamCtxt* stream,
stream_putU32( stream, comms->connID );
stream_putU16( stream, comms->nextChannelNo );
stream_putU16( stream, comms_getChannelSeed( comms ) ); /* force creation */
XP_U16 channelSeed = comms_getChannelSeed( comms ); /* force creation */
stream_putU16( stream, channelSeed );
XP_LOGF( "%s: stored seed: %x(%d)", __func__, channelSeed, channelSeed );
stream_putU16( stream, comms->resendBackoff );
stream_putU32( stream, comms->nextResend );
if ( addr_hasType( &comms->addr, COMMS_CONN_RELAY ) ) {
@ -1186,7 +1188,7 @@ comms_getChannelSeed( CommsCtxt* comms )
comms->channelSeed = XP_RANDOM() & ~CHANNEL_MASK;
comms->channelSeed |= comms->forceChannel;
CNO_FMT( cbuf, comms->channelSeed );
XP_LOGF( "%s: made seed: %s", __func__, cbuf );
XP_LOGF( "%s: made seed: %s(%d)", __func__, cbuf, comms->channelSeed );
}
return comms->channelSeed;
}

View file

@ -105,7 +105,7 @@ DEFINES += -DFEATURE_TRAY_EDIT
DEFINES += -DXWFEATURE_CROSSHAIRS
DEFINES += -DXWFEATURE_CHAT
DEFINES += -DDISABLE_TILE_SEL
DEFINES += -DSET_GAMESEED
# DEFINES += -DSET_GAMESEED
DEFINES += -DTEXT_MODEL
DEFINES += -DXWFEATURE_WALKDICT
DEFINES += -DXWFEATURE_WALKDICT_FILTER