mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-31 19:57:06 +01:00
use variable length ints to store msgID and len
This commit is contained in:
parent
b96c7a21aa
commit
a8963c952e
2 changed files with 12 additions and 16 deletions
|
@ -1304,14 +1304,6 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void refreshNames()
|
|
||||||
// {
|
|
||||||
// if ( !m_isLocked ) {
|
|
||||||
// new RefreshNamesTask( m_activity, this, m_gi.dictLang,
|
|
||||||
// m_gi.nPlayers, m_roomChoose ).execute();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setTitle()
|
protected void setTitle()
|
||||||
{
|
{
|
||||||
|
|
|
@ -737,10 +737,13 @@ comms_makeFromStream( MPFORMAL XWEnv xwe, XWStreamCtxt* stream,
|
||||||
addrFromStream( &rec->addr, stream );
|
addrFromStream( &rec->addr, stream );
|
||||||
logAddr( comms, xwe, &rec->addr, __func__ );
|
logAddr( comms, xwe, &rec->addr, __func__ );
|
||||||
|
|
||||||
rec->nextMsgID = stream_getU16( stream );
|
|
||||||
rec->lastMsgSaved = rec->lastMsgRcd = stream_getU16( stream );
|
|
||||||
if ( STREAM_VERS_SMALLCOMMS <= version ) {
|
if ( STREAM_VERS_SMALLCOMMS <= version ) {
|
||||||
|
rec->nextMsgID = stream_getU32VL( stream );
|
||||||
|
rec->lastMsgSaved = rec->lastMsgRcd = stream_getU32VL( stream );
|
||||||
rec->flags = stream_getU16( stream );
|
rec->flags = stream_getU16( stream );
|
||||||
|
} else {
|
||||||
|
rec->nextMsgID = stream_getU16( stream );
|
||||||
|
rec->lastMsgSaved = rec->lastMsgRcd = stream_getU16( stream );
|
||||||
}
|
}
|
||||||
#ifdef LOG_COMMS_MSGNOS
|
#ifdef LOG_COMMS_MSGNOS
|
||||||
XP_LOGF( "%s(): read lastMsgRcd of %d for addr %d", __func__, rec->lastMsgRcd, ii );
|
XP_LOGF( "%s(): read lastMsgRcd of %d for addr %d", __func__, rec->lastMsgRcd, ii );
|
||||||
|
@ -763,14 +766,15 @@ comms_makeFromStream( MPFORMAL XWEnv xwe, XWStreamCtxt* stream,
|
||||||
|
|
||||||
msg->channelNo = stream_getU16( stream );
|
msg->channelNo = stream_getU16( stream );
|
||||||
if ( version >= STREAM_VERS_SMALLCOMMS ) {
|
if ( version >= STREAM_VERS_SMALLCOMMS ) {
|
||||||
msg->msgID = stream_getU16( stream );
|
msg->msgID = stream_getU32VL( stream );
|
||||||
|
msg->len = stream_getU32VL( stream );
|
||||||
} else {
|
} else {
|
||||||
msg->msgID = stream_getU32( stream );
|
msg->msgID = stream_getU32( stream );
|
||||||
|
msg->len = stream_getU16( stream );
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
msg->sendCount = 0;
|
msg->sendCount = 0;
|
||||||
#endif
|
#endif
|
||||||
msg->len = stream_getU16( stream );
|
|
||||||
msg->msg = (XP_U8*)XP_MALLOC( mpool, msg->len );
|
msg->msg = (XP_U8*)XP_MALLOC( mpool, msg->len );
|
||||||
stream_getBytes( stream, msg->msg, msg->len );
|
stream_getBytes( stream, msg->msg, msg->len );
|
||||||
#ifdef COMMS_CHECKSUM
|
#ifdef COMMS_CHECKSUM
|
||||||
|
@ -973,8 +977,8 @@ comms_writeToStream( CommsCtxt* comms, XWEnv XP_UNUSED_DBG(xwe),
|
||||||
addrToStream( stream, addr );
|
addrToStream( stream, addr );
|
||||||
logAddr( comms, xwe, addr, __func__ );
|
logAddr( comms, xwe, addr, __func__ );
|
||||||
|
|
||||||
stream_putU16( stream, (XP_U16)rec->nextMsgID );
|
stream_putU32VL( stream, rec->nextMsgID );
|
||||||
stream_putU16( stream, (XP_U16)rec->lastMsgRcd );
|
stream_putU32VL( stream, rec->lastMsgRcd );
|
||||||
stream_putU16( stream, rec->flags );
|
stream_putU16( stream, rec->flags );
|
||||||
#ifdef LOG_COMMS_MSGNOS
|
#ifdef LOG_COMMS_MSGNOS
|
||||||
XP_LOGFF( "wrote lastMsgRcd of %d for addr %d", rec->lastMsgRcd, ii++ );
|
XP_LOGFF( "wrote lastMsgRcd of %d for addr %d", rec->lastMsgRcd, ii++ );
|
||||||
|
@ -988,9 +992,9 @@ comms_writeToStream( CommsCtxt* comms, XWEnv XP_UNUSED_DBG(xwe),
|
||||||
|
|
||||||
for ( msg = comms->msgQueueHead; !!msg; msg = msg->next ) {
|
for ( msg = comms->msgQueueHead; !!msg; msg = msg->next ) {
|
||||||
stream_putU16( stream, msg->channelNo );
|
stream_putU16( stream, msg->channelNo );
|
||||||
stream_putU16( stream, msg->msgID );
|
stream_putU32VL( stream, msg->msgID );
|
||||||
|
|
||||||
stream_putU16( stream, msg->len );
|
stream_putU32VL( stream, msg->len );
|
||||||
stream_putBytes( stream, msg->msg, msg->len );
|
stream_putBytes( stream, msg->msg, msg->len );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue