fix wince to compile with new APIs

This commit is contained in:
ehouse 2009-09-12 23:31:48 +00:00
parent f83f6d64ed
commit 5c95c7b603

View file

@ -81,17 +81,9 @@ typedef struct FileWriteState {
static XP_S16 ce_send_proc( const XP_U8* buf, XP_U16 len, static XP_S16 ce_send_proc( const XP_U8* buf, XP_U16 len,
const CommsAddrRec* addr, const CommsAddrRec* addr,
void* closure ); void* closure );
# ifdef COMMS_HEARTBEAT
#define CE_SEND_PROC ce_send_proc
#else
#define CE_SEND_PROC NULL
#endif
#ifdef COMMS_HEARTBEAT
static void ce_reset_proc( void* closure ); static void ce_reset_proc( void* closure );
# define CE_RESET_PROC ce_reset_proc, # endif
#else
# define CE_RESET_PROC
#endif #endif
static VTableMgr* ce_util_getVTManager( XW_UtilCtxt* uc ); static VTableMgr* ce_util_getVTManager( XW_UtilCtxt* uc );
@ -825,6 +817,17 @@ ceSetTitleFromName( CEAppGlobals* globals )
SendMessage( globals->hWnd, WM_SETTEXT, 0, (long)widebuf ); SendMessage( globals->hWnd, WM_SETTEXT, 0, (long)widebuf );
} /* ceSetTitleFromName */ } /* ceSetTitleFromName */
static void
ceInitTProcs( CEAppGlobals* globals, TransportProcs* procs )
{
XP_MEMSET( procs, 0, sizeof(*procs) );
procs->send = ce_send_proc;
#ifdef COMMS_HEARTBEAT
procs->reset = ce_reset_proc;
#endif
procs->closure = globals;
}
static void static void
ceInitAndStartBoard( CEAppGlobals* globals, XP_Bool newGame, ceInitAndStartBoard( CEAppGlobals* globals, XP_Bool newGame,
const CommsAddrRec* XP_UNUSED_STANDALONE(addr) ) const CommsAddrRec* XP_UNUSED_STANDALONE(addr) )
@ -865,9 +868,10 @@ ceInitAndStartBoard( CEAppGlobals* globals, XP_Bool newGame,
} }
if ( newGame ) { if ( newGame ) {
TransportProcs procs;
ceInitTProcs( globals, &procs );
game_reset( MEMPOOL &globals->game, &globals->gameInfo, &globals->util, game_reset( MEMPOOL &globals->game, &globals->gameInfo, &globals->util,
0, &globals->appPrefs.cp, CE_SEND_PROC, 0, &globals->appPrefs.cp, &procs );
CE_RESET_PROC globals );
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH #if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
if ( !!addr ) { if ( !!addr ) {
@ -1157,17 +1161,19 @@ ceLoadSavedGame( CEAppGlobals* globals )
} }
if ( success ) { if ( success ) {
TransportProcs procs;
if ( flags >= CE_GAMEFILE_VERSION1 ) { if ( flags >= CE_GAMEFILE_VERSION1 ) {
ce_draw_fromStream( globals->draw, stream, flags ); ce_draw_fromStream( globals->draw, stream, flags );
} }
XP_DEBUGF( "calling game_makeFromStream" ); XP_DEBUGF( "calling game_makeFromStream" );
ceInitTProcs( globals, &procs );
success = game_makeFromStream( MEMPOOL stream, &globals->game, success = game_makeFromStream( MEMPOOL stream, &globals->game,
&globals->gameInfo, dict, &globals->gameInfo, dict,
&globals->util, &globals->util,
(DrawCtx*)globals->draw, (DrawCtx*)globals->draw,
&globals->appPrefs.cp, CE_SEND_PROC, &globals->appPrefs.cp, &procs );
CE_RESET_PROC globals );
if ( success ) { if ( success ) {
ceSetTitleFromName( globals ); ceSetTitleFromName( globals );
} else { } else {
@ -1435,10 +1441,11 @@ InitInstance(HINSTANCE hInstance, int nCmdShow
oldGameLoaded = prevStateExists && ceLoadSavedGame( globals ); oldGameLoaded = prevStateExists && ceLoadSavedGame( globals );
if ( !oldGameLoaded ) { if ( !oldGameLoaded ) {
TransportProcs procs;
ceInitTProcs( globals, &procs );
game_makeNewGame( MPPARM(mpool) &globals->game, &globals->gameInfo, game_makeNewGame( MPPARM(mpool) &globals->game, &globals->gameInfo,
&globals->util, (DrawCtx*)globals->draw, 0, &globals->util, (DrawCtx*)globals->draw, 0,
&globals->appPrefs.cp, &globals->appPrefs.cp, &procs );
CE_SEND_PROC, CE_RESET_PROC globals );
newDone = ceDoNewGame( globals ); /* calls ceInitAndStartBoard */ newDone = ceDoNewGame( globals ); /* calls ceInitAndStartBoard */
if ( !newDone ) { if ( !newDone ) {