mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
flesh out interaction with comms. Now able to play a complete game vs
linux version over GPRS.
This commit is contained in:
parent
eb0e79041e
commit
05e9bd2d12
1 changed files with 25 additions and 4 deletions
|
@ -139,7 +139,8 @@ static void RECTtoXPR( XP_Rect* dest, RECT* src );
|
||||||
static XP_Bool doNewGame( CEAppGlobals* globals, XP_Bool silent );
|
static XP_Bool doNewGame( CEAppGlobals* globals, XP_Bool silent );
|
||||||
static XP_Bool ceSaveCurGame( CEAppGlobals* globals, XP_Bool autoSave );
|
static XP_Bool ceSaveCurGame( CEAppGlobals* globals, XP_Bool autoSave );
|
||||||
static void updateForColors( CEAppGlobals* globals );
|
static void updateForColors( CEAppGlobals* globals );
|
||||||
|
static XWStreamCtxt* make_generic_stream( CEAppGlobals* globals );
|
||||||
|
static void ce_send_on_close( XWStreamCtxt* stream, void* closure );
|
||||||
|
|
||||||
// Forward declarations of functions included in this code module:
|
// Forward declarations of functions included in this code module:
|
||||||
ATOM MyRegisterClass (HINSTANCE, LPTSTR);
|
ATOM MyRegisterClass (HINSTANCE, LPTSTR);
|
||||||
|
@ -266,6 +267,7 @@ ceInitUtilFuncs( CEAppGlobals* globals )
|
||||||
vtable->m_util_warnIllegalWord = ce_util_warnIllegalWord;
|
vtable->m_util_warnIllegalWord = ce_util_warnIllegalWord;
|
||||||
#ifdef BEYOND_IR
|
#ifdef BEYOND_IR
|
||||||
vtable->m_util_addrChange = ce_util_addrChange;
|
vtable->m_util_addrChange = ce_util_addrChange;
|
||||||
|
vtable->m_util_makeStreamFromAddr = ce_util_makeStreamFromAddr;
|
||||||
#endif
|
#endif
|
||||||
#ifdef XWFEATURE_SEARCHLIMIT
|
#ifdef XWFEATURE_SEARCHLIMIT
|
||||||
vtable->m_util_getTraySearchLimits = ce_util_getTraySearchLimits;
|
vtable->m_util_getTraySearchLimits = ce_util_getTraySearchLimits;
|
||||||
|
@ -565,6 +567,16 @@ ceInitAndStartBoard( CEAppGlobals* globals, XP_Bool newGame, CeGamePrefs* gp,
|
||||||
board_invalAll( globals->game.board );
|
board_invalAll( globals->game.board );
|
||||||
InvalidateRect( globals->hWnd, NULL, TRUE /* erase */ );
|
InvalidateRect( globals->hWnd, NULL, TRUE /* erase */ );
|
||||||
|
|
||||||
|
#ifdef BEYOND_IR
|
||||||
|
if ( newGame && globals->gameInfo.serverRole == SERVER_ISCLIENT ) {
|
||||||
|
XWStreamCtxt* stream;
|
||||||
|
XP_ASSERT( !!globals->game.comms );
|
||||||
|
stream = make_generic_stream( globals );
|
||||||
|
stream_setOnCloseProc( stream, ce_send_on_close );
|
||||||
|
server_initClientConnection( globals->game.server, stream );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
server_do( globals->game.server );
|
server_do( globals->game.server );
|
||||||
|
|
||||||
globals->isNewGame = FALSE;
|
globals->isNewGame = FALSE;
|
||||||
|
@ -1955,11 +1967,9 @@ wince_debugf(XP_UCHAR* format, ...)
|
||||||
|
|
||||||
nBytes = strlen( timeStamp );
|
nBytes = strlen( timeStamp );
|
||||||
WriteFile( fileH, timeStamp, nBytes, &nWritten, NULL );
|
WriteFile( fileH, timeStamp, nBytes, &nWritten, NULL );
|
||||||
XP_ASSERT( nWritten == nBytes );
|
|
||||||
|
|
||||||
nBytes = strlen( buf );
|
nBytes = strlen( buf );
|
||||||
WriteFile( fileH, buf, nBytes, &nWritten, NULL );
|
WriteFile( fileH, buf, nBytes, &nWritten, NULL );
|
||||||
XP_ASSERT( nWritten == nBytes );
|
|
||||||
CloseHandle( fileH );
|
CloseHandle( fileH );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2018,6 +2028,16 @@ ce_send_proc( XP_U8* buf, XP_U16 len, const CommsAddrRec* addr, void* closure )
|
||||||
|
|
||||||
return ce_sockwrap_send( globals->socketWrap, buf, len, addr );
|
return ce_sockwrap_send( globals->socketWrap, buf, len, addr );
|
||||||
} /* ce_send_proc */
|
} /* ce_send_proc */
|
||||||
|
|
||||||
|
static void
|
||||||
|
ce_send_on_close( XWStreamCtxt* stream, void* closure )
|
||||||
|
{
|
||||||
|
CEAppGlobals* globals = (CEAppGlobals*)closure;
|
||||||
|
|
||||||
|
XP_ASSERT( !!globals->game.comms );
|
||||||
|
comms_send( globals->game.comms, stream );
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* I can't believe the stupid compiler's making me implement this */
|
/* I can't believe the stupid compiler's making me implement this */
|
||||||
|
@ -2293,7 +2313,7 @@ ce_util_makeEmptyDict( XW_UtilCtxt* uc )
|
||||||
#endif
|
#endif
|
||||||
} /* ce_util_makeEmptyDict */
|
} /* ce_util_makeEmptyDict */
|
||||||
|
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#ifdef BEYOND_IR
|
||||||
static XWStreamCtxt*
|
static XWStreamCtxt*
|
||||||
ce_util_makeStreamFromAddr( XW_UtilCtxt* uc, XP_U16 channelNo )
|
ce_util_makeStreamFromAddr( XW_UtilCtxt* uc, XP_U16 channelNo )
|
||||||
{
|
{
|
||||||
|
@ -2301,6 +2321,7 @@ ce_util_makeStreamFromAddr( XW_UtilCtxt* uc, XP_U16 channelNo )
|
||||||
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
||||||
|
|
||||||
stream = make_generic_stream( globals );
|
stream = make_generic_stream( globals );
|
||||||
|
stream_setOnCloseProc( stream, ce_send_on_close );
|
||||||
stream_setAddress( stream, channelNo );
|
stream_setAddress( stream, channelNo );
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
|
|
Loading…
Reference in a new issue