mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-16 15:41:16 +01:00
fix memory leaks; get curses using new invite resp. code
This commit is contained in:
parent
766554d3f5
commit
7587653541
12 changed files with 68 additions and 67 deletions
|
@ -370,6 +370,8 @@ game_makeFromStream( MPFORMAL XWEnv xwe, XWStreamCtxt* stream,
|
||||||
XW_UtilCtxt* util, DrawCtx* draw, CommonPrefs* cp,
|
XW_UtilCtxt* util, DrawCtx* draw, CommonPrefs* cp,
|
||||||
const TransportProcs* procs )
|
const TransportProcs* procs )
|
||||||
{
|
{
|
||||||
|
LOG_FUNC();
|
||||||
|
XP_ASSERT( gi == util->gameInfo );
|
||||||
XP_Bool success = XP_FALSE;
|
XP_Bool success = XP_FALSE;
|
||||||
XP_U8 strVersion;
|
XP_U8 strVersion;
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||||
|
@ -655,10 +657,8 @@ game_dispose( XWGame* game, XWEnv xwe )
|
||||||
static void
|
static void
|
||||||
disposePlayerInfoInt( MPFORMAL CurGameInfo* gi )
|
disposePlayerInfoInt( MPFORMAL CurGameInfo* gi )
|
||||||
{
|
{
|
||||||
XP_U16 ii;
|
for ( int ii = 0; ii < gi->nPlayers; ++ii ) {
|
||||||
LocalPlayer* lp;
|
LocalPlayer* lp = &gi->players[ii];
|
||||||
|
|
||||||
for ( lp = gi->players, ii = 0; ii < MAX_NUM_PLAYERS; ++lp, ++ii ) {
|
|
||||||
XP_FREEP( mpool, &lp->name );
|
XP_FREEP( mpool, &lp->name );
|
||||||
XP_FREEP( mpool, &lp->password );
|
XP_FREEP( mpool, &lp->password );
|
||||||
XP_FREEP( mpool, &lp->dictName );
|
XP_FREEP( mpool, &lp->dictName );
|
||||||
|
@ -676,8 +676,6 @@ gi_disposePlayerInfo( MPFORMAL CurGameInfo* gi )
|
||||||
void
|
void
|
||||||
gi_copy( MPFORMAL CurGameInfo* destGI, const CurGameInfo* srcGI )
|
gi_copy( MPFORMAL CurGameInfo* destGI, const CurGameInfo* srcGI )
|
||||||
{
|
{
|
||||||
XP_MEMSET( destGI, 0, sizeof(*destGI) );
|
|
||||||
|
|
||||||
replaceStringIfDifferent( mpool, &destGI->dictName,
|
replaceStringIfDifferent( mpool, &destGI->dictName,
|
||||||
srcGI->dictName );
|
srcGI->dictName );
|
||||||
XP_STRNCPY( destGI->isoCodeStr, srcGI->isoCodeStr, VSIZE(destGI->isoCodeStr)-1 );
|
XP_STRNCPY( destGI->isoCodeStr, srcGI->isoCodeStr, VSIZE(destGI->isoCodeStr)-1 );
|
||||||
|
|
|
@ -159,7 +159,7 @@ mpool_destroy( MemPoolCtx* mpool )
|
||||||
MemPoolEntry* entry;
|
MemPoolEntry* entry;
|
||||||
for ( entry = mpool->usedList; !!entry; entry = entry->next ) {
|
for ( entry = mpool->usedList; !!entry; entry = entry->next ) {
|
||||||
#ifndef FOR_GREMLINS /* I don't want to hear about this right now */
|
#ifndef FOR_GREMLINS /* I don't want to hear about this right now */
|
||||||
XP_LOGF( "%s: " XP_P " index=%d, in %s, ln %d of %s\n", __func__,
|
XP_LOGFF( "ptr: " XP_P "; index=%d, allocated %s, ln %d of %s\n",
|
||||||
entry->ptr, entry->index,
|
entry->ptr, entry->index,
|
||||||
entry->func, entry->lineNo, entry->fileName );
|
entry->func, entry->lineNo, entry->fileName );
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -299,12 +299,11 @@ void
|
||||||
mpool_free( MemPoolCtx* mpool, void* ptr, const char* file,
|
mpool_free( MemPoolCtx* mpool, void* ptr, const char* file,
|
||||||
const char* func, XP_U32 lineNo )
|
const char* func, XP_U32 lineNo )
|
||||||
{
|
{
|
||||||
MemPoolEntry* entry;
|
|
||||||
MemPoolEntry* prev;
|
MemPoolEntry* prev;
|
||||||
|
|
||||||
MEMPOOL_SYNC_START(mpool);
|
MEMPOOL_SYNC_START(mpool);
|
||||||
|
|
||||||
entry = findEntryFor( mpool, ptr, &prev );
|
MemPoolEntry* entry = findEntryFor( mpool, ptr, &prev );
|
||||||
|
|
||||||
if ( !entry ) {
|
if ( !entry ) {
|
||||||
XP_LOGFF( "findEntryFor failed; pool %p, line %d in %s", mpool, lineNo, file );
|
XP_LOGFF( "findEntryFor failed; pool %p, line %d in %s", mpool, lineNo, file );
|
||||||
|
|
|
@ -1917,7 +1917,6 @@ client_readInitialMessage( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream )
|
||||||
if ( accepted ) {
|
if ( accepted ) {
|
||||||
ModelCtxt* model = server->vol.model;
|
ModelCtxt* model = server->vol.model;
|
||||||
CurGameInfo* gi = server->vol.gi;
|
CurGameInfo* gi = server->vol.gi;
|
||||||
CurGameInfo localGI;
|
|
||||||
XP_U32 gameID;
|
XP_U32 gameID;
|
||||||
PoolContext* pool;
|
PoolContext* pool;
|
||||||
#ifdef STREAM_VERS_BIGBOARD
|
#ifdef STREAM_VERS_BIGBOARD
|
||||||
|
@ -1940,10 +1939,11 @@ client_readInitialMessage( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream )
|
||||||
server->vol.gi->gameID = gameID;
|
server->vol.gi->gameID = gameID;
|
||||||
comms_setConnID( server->vol.comms, gameID );
|
comms_setConnID( server->vol.comms, gameID );
|
||||||
|
|
||||||
XP_MEMSET( &localGI, 0, sizeof(localGI) );
|
CurGameInfo localGI = {0};
|
||||||
gi_readFromStream( MPPARM(server->mpool) stream, &localGI );
|
gi_readFromStream( MPPARM(server->mpool) stream, &localGI );
|
||||||
localGI.serverRole = SERVER_ISCLIENT;
|
localGI.serverRole = SERVER_ISCLIENT;
|
||||||
|
|
||||||
|
XP_ASSERT( !localGI.dictName );
|
||||||
localGI.dictName = copyString( server->mpool, gi->dictName );
|
localGI.dictName = copyString( server->mpool, gi->dictName );
|
||||||
gi_copy( MPPARM(server->mpool) gi, &localGI );
|
gi_copy( MPPARM(server->mpool) gi, &localGI );
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,12 @@ static void relay_requestJoin_curses( void* closure, const XP_UCHAR* devID,
|
||||||
XP_U16 nPlayersTotal, XP_U16 seed, XP_U16 lang );
|
XP_U16 nPlayersTotal, XP_U16 seed, XP_U16 lang );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void disposeBoard( CursesBoardGlobals* bGlobals );
|
||||||
|
static void initCP( CommonGlobals* cGlobals );
|
||||||
|
static CursesBoardGlobals* commonInit( CursesBoardState* cbState,
|
||||||
|
sqlite3_int64 rowid,
|
||||||
|
const CurGameInfo* gip );
|
||||||
|
|
||||||
CursesBoardState*
|
CursesBoardState*
|
||||||
cb_init( CursesAppGlobals* aGlobals, LaunchParams* params,
|
cb_init( CursesAppGlobals* aGlobals, LaunchParams* params,
|
||||||
CursesMenuState* menuState, OnGameSaved onGameSaved )
|
CursesMenuState* menuState, OnGameSaved onGameSaved )
|
||||||
|
@ -204,29 +210,28 @@ cb_new( CursesBoardState* cbState, const cb_dims* dims )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cb_newFor( CursesBoardState* XP_UNUSED(cbState), const NetLaunchInfo* XP_UNUSED(nli),
|
cb_newFor( CursesBoardState* cbState, const NetLaunchInfo* nli,
|
||||||
const CommsAddrRec* XP_UNUSED(returnAddr),
|
|
||||||
const cb_dims* XP_UNUSED(dims) )
|
const cb_dims* XP_UNUSED(dims) )
|
||||||
{
|
{
|
||||||
/* FIX ME soon */
|
LaunchParams* params = cbState->params;
|
||||||
|
|
||||||
|
CommsAddrRec selfAddr;
|
||||||
|
makeSelfAddress( &selfAddr, params );
|
||||||
|
|
||||||
|
CursesBoardGlobals* bGlobals =
|
||||||
|
commonInit( cbState, -1, NULL );
|
||||||
|
CommonGlobals* cGlobals = &bGlobals->cGlobals;
|
||||||
|
initCP( cGlobals );
|
||||||
|
|
||||||
|
if ( game_makeFromInvite( &cGlobals->game, NULL_XWE, nli, &selfAddr,
|
||||||
|
cGlobals->util, (DrawCtx*)NULL,
|
||||||
|
&cGlobals->cp, (TransportProcs*)NULL ) ) {
|
||||||
|
linuxSaveGame( cGlobals );
|
||||||
|
} else {
|
||||||
XP_ASSERT( 0 );
|
XP_ASSERT( 0 );
|
||||||
/* LaunchParams* params = cbState->params; */
|
}
|
||||||
/* CurGameInfo gi = {0}; */
|
|
||||||
/* gi_copy( MPPARM(params->mpool) &gi, ¶ms->pgi ); */
|
|
||||||
/* gi_setNPlayers( &gi, nli->nPlayersT, nli->nPlayersH ); */
|
|
||||||
/* gi.gameID = nli->gameID; */
|
|
||||||
/* XP_STRNCPY( gi.isoCodeStr, nli->isoCodeStr, VSIZE(gi.isoCodeStr) ); */
|
|
||||||
/* gi.forceChannel = nli->forceChannel; */
|
|
||||||
/* gi.inDuplicateMode = nli->inDuplicateMode; */
|
|
||||||
/* gi.serverRole = SERVER_ISCLIENT; /\* recipient of invitation is client *\/ */
|
|
||||||
/* replaceStringIfDifferent( params->mpool, &gi.dictName, nli->dict ); */
|
|
||||||
|
|
||||||
/* CursesBoardGlobals* bGlobals = findOrOpen( cbState, -1, &gi, returnAddr ); */
|
disposeBoard( bGlobals );
|
||||||
|
|
||||||
/* gi_disposePlayerInfo( MPPARM(params->mpool) &gi ); */
|
|
||||||
|
|
||||||
/* enableDraw( bGlobals, dims ); */
|
|
||||||
/* setupBoard( bGlobals ); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const MenuList g_allMenuList[] = {
|
const MenuList g_allMenuList[] = {
|
||||||
|
@ -526,19 +531,10 @@ setupBoard( CursesBoardGlobals* bGlobals )
|
||||||
board_draw( board, NULL_XWE );
|
board_draw( board, NULL_XWE );
|
||||||
}
|
}
|
||||||
|
|
||||||
static CursesBoardGlobals*
|
static void
|
||||||
initNoDraw( CursesBoardState* cbState, sqlite3_int64 rowid,
|
initCP( CommonGlobals* cGlobals )
|
||||||
const CurGameInfo* gi, const CommsAddrRec* returnAddr )
|
|
||||||
{
|
{
|
||||||
LOG_FUNC();
|
const LaunchParams* params = cGlobals->params;
|
||||||
CursesBoardGlobals* result = commonInit( cbState, rowid, gi );
|
|
||||||
CommonGlobals* cGlobals = &result->cGlobals;
|
|
||||||
LaunchParams* params = cGlobals->params;
|
|
||||||
|
|
||||||
if ( !!returnAddr ) {
|
|
||||||
cGlobals->hostAddr = *returnAddr;
|
|
||||||
}
|
|
||||||
|
|
||||||
cGlobals->cp.showBoardArrow = XP_TRUE;
|
cGlobals->cp.showBoardArrow = XP_TRUE;
|
||||||
cGlobals->cp.showRobotScores = params->showRobotScores;
|
cGlobals->cp.showRobotScores = params->showRobotScores;
|
||||||
cGlobals->cp.hideTileValues = params->hideValues;
|
cGlobals->cp.hideTileValues = params->hideValues;
|
||||||
|
@ -555,6 +551,21 @@ initNoDraw( CursesBoardState* cbState, sqlite3_int64 rowid,
|
||||||
#ifdef XWFEATURE_ROBOTPHONIES
|
#ifdef XWFEATURE_ROBOTPHONIES
|
||||||
cGlobals->cp.makePhonyPct = params->makePhonyPct;
|
cGlobals->cp.makePhonyPct = params->makePhonyPct;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static CursesBoardGlobals*
|
||||||
|
initNoDraw( CursesBoardState* cbState, sqlite3_int64 rowid,
|
||||||
|
const CurGameInfo* gi, const CommsAddrRec* returnAddr )
|
||||||
|
{
|
||||||
|
LOG_FUNC();
|
||||||
|
CursesBoardGlobals* result = commonInit( cbState, rowid, gi );
|
||||||
|
CommonGlobals* cGlobals = &result->cGlobals;
|
||||||
|
|
||||||
|
if ( !!returnAddr ) {
|
||||||
|
cGlobals->hostAddr = *returnAddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
initCP( cGlobals );
|
||||||
|
|
||||||
if ( linuxOpenGame( cGlobals, &result->procs ) ) {
|
if ( linuxOpenGame( cGlobals, &result->procs ) ) {
|
||||||
result = ref( result );
|
result = ref( result );
|
||||||
|
|
|
@ -42,7 +42,7 @@ void cb_resized( CursesBoardState* cbState, const cb_dims* dims );
|
||||||
void cb_open( CursesBoardState* cbState, sqlite3_int64 rowid, const cb_dims* dims );
|
void cb_open( CursesBoardState* cbState, sqlite3_int64 rowid, const cb_dims* dims );
|
||||||
bool cb_new( CursesBoardState* cbState, const cb_dims* dims );
|
bool cb_new( CursesBoardState* cbState, const cb_dims* dims );
|
||||||
void cb_newFor( CursesBoardState* cbState, const NetLaunchInfo* nli,
|
void cb_newFor( CursesBoardState* cbState, const NetLaunchInfo* nli,
|
||||||
const CommsAddrRec* returnAddr, const cb_dims* dims );
|
const cb_dims* dims );
|
||||||
|
|
||||||
bool cb_feedRow( CursesBoardState* cbState, sqlite3_int64 rowid,
|
bool cb_feedRow( CursesBoardState* cbState, sqlite3_int64 rowid,
|
||||||
XP_U16 expectSeed, const XP_U8* buf, XP_U16 len,
|
XP_U16 expectSeed, const XP_U8* buf, XP_U16 len,
|
||||||
|
|
|
@ -1177,8 +1177,7 @@ onJoined( void* closure, const XP_UCHAR* connname, XWHostID hid )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
inviteReceivedCurses( void* closure, const NetLaunchInfo* invite,
|
inviteReceivedCurses( void* closure, const NetLaunchInfo* invite )
|
||||||
const CommsAddrRec* returnAddr )
|
|
||||||
{
|
{
|
||||||
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
||||||
sqlite3_int64 rowids[1];
|
sqlite3_int64 rowids[1];
|
||||||
|
@ -1193,7 +1192,7 @@ inviteReceivedCurses( void* closure, const NetLaunchInfo* invite,
|
||||||
if ( doIt ) {
|
if ( doIt ) {
|
||||||
cb_dims dims;
|
cb_dims dims;
|
||||||
figureDims( aGlobals, &dims );
|
figureDims( aGlobals, &dims );
|
||||||
cb_newFor( aGlobals->cbState, invite, returnAddr, &dims );
|
cb_newFor( aGlobals->cbState, invite, &dims );
|
||||||
} else {
|
} else {
|
||||||
XP_LOGFF( "Not accepting duplicate invitation (nRowIDs(gameID=%d) was %d",
|
XP_LOGFF( "Not accepting duplicate invitation (nRowIDs(gameID=%d) was %d",
|
||||||
invite->gameID, nRowIDs );
|
invite->gameID, nRowIDs );
|
||||||
|
@ -1205,9 +1204,7 @@ static void
|
||||||
relayInviteReceivedCurses( void* closure, const NetLaunchInfo* invite )
|
relayInviteReceivedCurses( void* closure, const NetLaunchInfo* invite )
|
||||||
{
|
{
|
||||||
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
||||||
CommsAddrRec addr = {0};
|
inviteReceivedCurses( aGlobals, invite );
|
||||||
nli_makeAddrRec( invite, &addr );
|
|
||||||
inviteReceivedCurses( aGlobals, invite, &addr );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1240,11 +1237,10 @@ cursesGotBuf( void* closure, const CommsAddrRec* addr,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
smsInviteReceivedCurses( void* closure, const NetLaunchInfo* nli,
|
smsInviteReceivedCurses( void* closure, const NetLaunchInfo* nli )
|
||||||
const CommsAddrRec* returnAddr )
|
|
||||||
{
|
{
|
||||||
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
||||||
inviteReceivedCurses( aGlobals, nli, returnAddr );
|
inviteReceivedCurses( aGlobals, nli );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -75,8 +75,7 @@ void cursesDrawCtxtFree( DrawCtx* dctx );
|
||||||
|
|
||||||
void cursesmain( XP_Bool isServer, LaunchParams* params );
|
void cursesmain( XP_Bool isServer, LaunchParams* params );
|
||||||
bool handleQuit( void* closure, int unused_key );
|
bool handleQuit( void* closure, int unused_key );
|
||||||
void inviteReceivedCurses( void* aGlobals, const NetLaunchInfo* invite,
|
void inviteReceivedCurses( void* aGlobals, const NetLaunchInfo* invite );
|
||||||
const CommsAddrRec* returnAddr );
|
|
||||||
void mqttMsgReceivedCurses( void* closure, const CommsAddrRec* from,
|
void mqttMsgReceivedCurses( void* closure, const CommsAddrRec* from,
|
||||||
XP_U32 gameID, const XP_U8* buf, XP_U16 len );
|
XP_U32 gameID, const XP_U8* buf, XP_U16 len );
|
||||||
void gameGoneCurses( void* closure, const CommsAddrRec* from, XP_U32 gameID );
|
void gameGoneCurses( void* closure, const CommsAddrRec* from, XP_U32 gameID );
|
||||||
|
|
|
@ -359,7 +359,7 @@ make_rematch( GtkAppGlobals* apg, const CommonGlobals* cGlobals )
|
||||||
{
|
{
|
||||||
LaunchParams* params = apg->cag.params;
|
LaunchParams* params = apg->cag.params;
|
||||||
GtkGameGlobals* newGlobals = calloc( 1, sizeof(*newGlobals) );
|
GtkGameGlobals* newGlobals = calloc( 1, sizeof(*newGlobals) );
|
||||||
initBoardGlobalsGtk( newGlobals, params, cGlobals->util->gameInfo );
|
initBoardGlobalsGtk( newGlobals, params, NULL );
|
||||||
|
|
||||||
XW_UtilCtxt* util = newGlobals->cGlobals.util;
|
XW_UtilCtxt* util = newGlobals->cGlobals.util;
|
||||||
const CommonPrefs* cp = &newGlobals->cGlobals.cp;
|
const CommonPrefs* cp = &newGlobals->cGlobals.cp;
|
||||||
|
@ -705,8 +705,7 @@ feedBufferGTK( GtkAppGlobals* apg, sqlite3_int64 rowid,
|
||||||
|
|
||||||
/* Stuff common to receiving invitations */
|
/* Stuff common to receiving invitations */
|
||||||
static void
|
static void
|
||||||
gameFromInvite( GtkAppGlobals* apg, const NetLaunchInfo* nli,
|
gameFromInvite( GtkAppGlobals* apg, const NetLaunchInfo* nli )
|
||||||
const CommsAddrRec* XP_UNUSED(returnAddr) )
|
|
||||||
{
|
{
|
||||||
LOG_FUNC();
|
LOG_FUNC();
|
||||||
|
|
||||||
|
@ -751,7 +750,7 @@ inviteReceivedGTK( void* closure, const NetLaunchInfo* invite )
|
||||||
GTK_BUTTONS_YES_NO, NULL );
|
GTK_BUTTONS_YES_NO, NULL );
|
||||||
}
|
}
|
||||||
if ( doIt ) {
|
if ( doIt ) {
|
||||||
gameFromInvite( apg, invite, NULL );
|
gameFromInvite( apg, invite );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -812,8 +811,7 @@ gtkNoticeRcvd( void* closure )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
smsInviteReceived( void* closure, const NetLaunchInfo* nli,
|
smsInviteReceived( void* closure, const NetLaunchInfo* nli )
|
||||||
const CommsAddrRec* returnAddr )
|
|
||||||
{
|
{
|
||||||
GtkAppGlobals* apg = (GtkAppGlobals*)closure;
|
GtkAppGlobals* apg = (GtkAppGlobals*)closure;
|
||||||
XP_LOGF( "%s(gameName=%s, gameID=%d, dictName=%s, nPlayers=%d, "
|
XP_LOGF( "%s(gameName=%s, gameID=%d, dictName=%s, nPlayers=%d, "
|
||||||
|
@ -821,7 +819,7 @@ smsInviteReceived( void* closure, const NetLaunchInfo* nli,
|
||||||
nli->gameID, nli->dict, nli->nPlayersT,
|
nli->gameID, nli->dict, nli->nPlayersT,
|
||||||
nli->nPlayersH, nli->forceChannel );
|
nli->nPlayersH, nli->forceChannel );
|
||||||
|
|
||||||
gameFromInvite( apg, nli, returnAddr );
|
gameFromInvite( apg, nli );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -91,9 +91,7 @@ linux_dutil_onInviteReceived( XW_DUtilCtxt* duc, XWEnv XP_UNUSED(xwe),
|
||||||
LaunchParams* params = (LaunchParams*)duc->closure;
|
LaunchParams* params = (LaunchParams*)duc->closure;
|
||||||
|
|
||||||
if ( params->useCurses ) {
|
if ( params->useCurses ) {
|
||||||
CommsAddrRec addr = {0};
|
inviteReceivedCurses( params->appGlobals, nli );
|
||||||
nli_makeAddrRec( nli, &addr );
|
|
||||||
inviteReceivedCurses( params->appGlobals, nli, &addr );
|
|
||||||
} else {
|
} else {
|
||||||
inviteReceivedGTK( params->appGlobals, nli );
|
inviteReceivedGTK( params->appGlobals, nli );
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,6 +141,7 @@ ensureLocalPlayerNames( LaunchParams* XP_UNUSED_DBG(params), CurGameInfo* gi )
|
||||||
for ( int ii = 0; ii < gi->nPlayers; ++ii ) {
|
for ( int ii = 0; ii < gi->nPlayers; ++ii ) {
|
||||||
LocalPlayer* lp = &gi->players[ii];
|
LocalPlayer* lp = &gi->players[ii];
|
||||||
if ( lp->isLocal && !lp->name ) {
|
if ( lp->isLocal && !lp->name ) {
|
||||||
|
XP_ASSERT(0);
|
||||||
replaceStringIfDifferent( params->mpool,
|
replaceStringIfDifferent( params->mpool,
|
||||||
&lp->name, "LPlayer" );
|
&lp->name, "LPlayer" );
|
||||||
}
|
}
|
||||||
|
@ -189,7 +190,7 @@ linuxOpenGame( CommonGlobals* cGlobals, const TransportProcs* procs )
|
||||||
cGlobals->gi,
|
cGlobals->gi,
|
||||||
cGlobals->util, cGlobals->draw,
|
cGlobals->util, cGlobals->draw,
|
||||||
&cGlobals->cp, procs );
|
&cGlobals->cp, procs );
|
||||||
XP_LOGF( "%s: loaded gi at %p", __func__, &cGlobals->gi );
|
XP_LOGFF( "loaded gi at %p", &cGlobals->gi );
|
||||||
stream_destroy( stream, NULL_XWE );
|
stream_destroy( stream, NULL_XWE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2945,6 +2946,7 @@ main( int argc, char** argv )
|
||||||
++mainParams.nLocalPlayers;
|
++mainParams.nLocalPlayers;
|
||||||
mainParams.pgi.players[index].robotIQ = 0; /* means human */
|
mainParams.pgi.players[index].robotIQ = 0; /* means human */
|
||||||
mainParams.pgi.players[index].isLocal = XP_TRUE;
|
mainParams.pgi.players[index].isLocal = XP_TRUE;
|
||||||
|
XP_ASSERT( !mainParams.pgi.players[index].name );
|
||||||
mainParams.pgi.players[index].name =
|
mainParams.pgi.players[index].name =
|
||||||
copyString( mainParams.mpool, (XP_UCHAR*)optarg);
|
copyString( mainParams.mpool, (XP_UCHAR*)optarg);
|
||||||
break;
|
break;
|
||||||
|
@ -2967,6 +2969,7 @@ main( int argc, char** argv )
|
||||||
++mainParams.nLocalPlayers;
|
++mainParams.nLocalPlayers;
|
||||||
mainParams.pgi.players[index].robotIQ = 1; /* real smart by default */
|
mainParams.pgi.players[index].robotIQ = 1; /* real smart by default */
|
||||||
mainParams.pgi.players[index].isLocal = XP_TRUE;
|
mainParams.pgi.players[index].isLocal = XP_TRUE;
|
||||||
|
XP_ASSERT( !mainParams.pgi.players[index].name );
|
||||||
mainParams.pgi.players[index].name =
|
mainParams.pgi.players[index].name =
|
||||||
copyString( mainParams.mpool, (XP_UCHAR*)optarg);
|
copyString( mainParams.mpool, (XP_UCHAR*)optarg);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -263,7 +263,7 @@ parseAndDispatch( LaunchParams* params, uint8_t* buf, int len,
|
||||||
NetLaunchInfo nli = {0};
|
NetLaunchInfo nli = {0};
|
||||||
nliFromData( params, msg, &nli );
|
nliFromData( params, msg, &nli );
|
||||||
(*storage->procs->inviteReceived)( storage->procClosure,
|
(*storage->procs->inviteReceived)( storage->procClosure,
|
||||||
&nli, addr );
|
&nli );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
#include "nli.h"
|
#include "nli.h"
|
||||||
|
|
||||||
typedef struct _SMSProcs {
|
typedef struct _SMSProcs {
|
||||||
void (*inviteReceived)( void* closure, const NetLaunchInfo* nli,
|
void (*inviteReceived)( void* closure, const NetLaunchInfo* nli );
|
||||||
const CommsAddrRec* returnAddr );
|
|
||||||
void (*msgReceived)( void* closure, const CommsAddrRec* from, XP_U32 gameID,
|
void (*msgReceived)( void* closure, const CommsAddrRec* from, XP_U32 gameID,
|
||||||
const XP_U8* buf, XP_U16 len );
|
const XP_U8* buf, XP_U16 len );
|
||||||
void (*msgNoticeReceived)( void* closure );
|
void (*msgNoticeReceived)( void* closure );
|
||||||
|
|
Loading…
Reference in a new issue