mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
fix gtk games connecting to relay/each other
I broke gtk back in February making curses changes
This commit is contained in:
parent
055eceffba
commit
5a28a7fc27
4 changed files with 35 additions and 21 deletions
|
@ -549,13 +549,22 @@ gi_setNPlayers( CurGameInfo* gi, XP_U16 nTotal, XP_U16 nHere )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( nHere != curLocal ) {
|
if ( nHere != curLocal ) {
|
||||||
/* This will happen when a device has more than on player. Not sure I
|
/* This will happen when a device has more than one player. Not sure I
|
||||||
handle that correctly, but don't assert for now. */
|
handle that correctly, but don't assert for now. */
|
||||||
XP_LOGFF( "nHere: %d; curLocal: %d; a problem?", nHere, curLocal );
|
XP_LOGFF( "nHere: %d; curLocal: %d; a problem?", nHere, curLocal );
|
||||||
/* for ( XP_U16 ii = 0; ii < nTotal; ++ii ) { */
|
for ( XP_U16 ii = 0; ii < nTotal; ++ii ) {
|
||||||
/* gi->players[ii].isLocal = ii < nHere; */
|
if ( !gi->players[ii].isLocal ) {
|
||||||
/* } */
|
gi->players[ii].isLocal = XP_TRUE;
|
||||||
|
XP_LOGFF( "making player #%d local when wasn't before", ii );
|
||||||
|
++curLocal;
|
||||||
|
XP_ASSERT( curLocal <= nHere );
|
||||||
|
if ( curLocal == nHere ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
LOGGI( gi, __func__ );
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_U16
|
XP_U16
|
||||||
|
@ -762,20 +771,21 @@ player_timePenalty( CurGameInfo* gi, XP_U16 playerNum )
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void
|
void
|
||||||
game_logGI( const CurGameInfo* gi, const char* msg )
|
game_logGI( const CurGameInfo* gi, const char* msg, const char* func, int line )
|
||||||
{
|
{
|
||||||
XP_LOGFF( "msg: %s", msg );
|
XP_LOGFF( "msg: %s from %s() line %d; addr: %p", msg, func, line, gi );
|
||||||
|
if ( !!gi ) {
|
||||||
XP_LOGF( " nPlayers: %d", gi->nPlayers );
|
XP_LOGF( " nPlayers: %d", gi->nPlayers );
|
||||||
for ( XP_U16 ii = 0; ii < gi->nPlayers; ++ii ) {
|
for ( XP_U16 ii = 0; ii < gi->nPlayers; ++ii ) {
|
||||||
const LocalPlayer* lp = &gi->players[ii];
|
const LocalPlayer* lp = &gi->players[ii];
|
||||||
XP_LOGF( " player[%d]: local: %d; robotIQ: %d; name: %s", ii,
|
XP_LOGF( " player[%d]: local: %d; robotIQ: %d; name: %s", ii,
|
||||||
lp->isLocal, lp->robotIQ, lp->name );
|
lp->isLocal, lp->robotIQ, lp->name );
|
||||||
|
}
|
||||||
|
XP_LOGF( " forceChannel: %d", gi->forceChannel );
|
||||||
|
XP_LOGF( " serverRole: %d", gi->serverRole );
|
||||||
|
XP_LOGF( " gameID: %d", gi->gameID );
|
||||||
|
XP_LOGF( " dictName: %s", gi->dictName );
|
||||||
}
|
}
|
||||||
XP_LOGF( " forceChannel: %d", gi->forceChannel );
|
|
||||||
XP_LOGF( " serverRole: %d", gi->serverRole );
|
|
||||||
XP_LOGF( " gameID: %d", gi->gameID );
|
|
||||||
XP_LOGF( " dictName: %s", gi->dictName );
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,11 @@ typedef struct CurGameInfo {
|
||||||
} CurGameInfo;
|
} CurGameInfo;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void game_logGI( const CurGameInfo* gi, const char* msg );
|
# define LOGGI( gip, msg ) game_logGI( (gip), (msg), __func__, __LINE__ )
|
||||||
|
void game_logGI( const CurGameInfo* gi, const char* msg,
|
||||||
|
const char* func, int line );
|
||||||
#else
|
#else
|
||||||
# define game_logGI(gi, msg)
|
# define LOGGI(gi, msg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CPLUS
|
#ifdef CPLUS
|
||||||
|
|
|
@ -672,8 +672,9 @@ server_initClientConnection( ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
|
|
||||||
nPlayers = gi->nPlayers;
|
nPlayers = gi->nPlayers;
|
||||||
XP_ASSERT( nPlayers > 0 );
|
XP_ASSERT( nPlayers > 0 );
|
||||||
stream_putBits( stream, NPLAYERS_NBITS,
|
XP_U16 localPlayers = gi_countLocalPlayers( gi, XP_FALSE);
|
||||||
gi_countLocalPlayers( gi, XP_FALSE) );
|
XP_ASSERT( 0 < localPlayers );
|
||||||
|
stream_putBits( stream, NPLAYERS_NBITS, localPlayers );
|
||||||
|
|
||||||
for ( lp = gi->players; nPlayers-- > 0; ++lp ) {
|
for ( lp = gi->players; nPlayers-- > 0; ++lp ) {
|
||||||
XP_UCHAR* name;
|
XP_UCHAR* name;
|
||||||
|
|
|
@ -583,7 +583,8 @@ createOrLoadObjects( GtkGameGlobals* globals )
|
||||||
|
|
||||||
TransportProcs procs;
|
TransportProcs procs;
|
||||||
setTransportProcs( &procs, globals );
|
setTransportProcs( &procs, globals );
|
||||||
if ( linuxOpenGame( cGlobals, &procs, NULL ) ) {
|
|
||||||
|
if ( linuxOpenGame( cGlobals, &procs, &cGlobals->addr ) ) {
|
||||||
|
|
||||||
if ( !params->fileName && !!params->dbName ) {
|
if ( !params->fileName && !!params->dbName ) {
|
||||||
XP_UCHAR buf[64];
|
XP_UCHAR buf[64];
|
||||||
|
|
Loading…
Reference in a new issue