mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
make stubbed dict work
This commit is contained in:
parent
a22019c928
commit
09f657eef2
2 changed files with 24 additions and 4 deletions
|
@ -98,7 +98,11 @@ loadFromGameInfo( HWND hDlg, CEAppGlobals* globals, GameInfoState* giState )
|
||||||
XP_MEMCPY( giState->newDictName, gi->dictName,
|
XP_MEMCPY( giState->newDictName, gi->dictName,
|
||||||
(XP_U16)XP_STRLEN(gi->dictName) );
|
(XP_U16)XP_STRLEN(gi->dictName) );
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef STUBBED_DICT
|
||||||
|
str = "(Stub dict)";
|
||||||
|
#else
|
||||||
str = "--pick--";
|
str = "--pick--";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
XP_MEMSET( widebuf, 0, sizeof(widebuf) );
|
XP_MEMSET( widebuf, 0, sizeof(widebuf) );
|
||||||
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, str, strlen(str),
|
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, str, strlen(str),
|
||||||
|
@ -467,6 +471,7 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifndef STUBBED_DICT
|
||||||
case IDC_DICTBUTTON:
|
case IDC_DICTBUTTON:
|
||||||
if ( giState->isNewGame ) { /* ignore if in info mode */
|
if ( giState->isNewGame ) { /* ignore if in info mode */
|
||||||
giState->newDictName[0] = 0;
|
giState->newDictName[0] = 0;
|
||||||
|
@ -477,6 +482,7 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case OPTIONS_BUTTON:
|
case OPTIONS_BUTTON:
|
||||||
handleOptionsButton( hDlg, globals, giState );
|
handleOptionsButton( hDlg, globals, giState );
|
||||||
|
|
|
@ -358,10 +358,10 @@ ceInitAndStartBoard( CEAppGlobals* globals, XP_Bool newGame, CeGamePrefs* gp )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !dict ) {
|
if ( !dict ) {
|
||||||
XP_ASSERT( !!newDictName );
|
|
||||||
#ifdef STUBBED_DICT
|
#ifdef STUBBED_DICT
|
||||||
dict = make_stubbed_dict( MPPARM_NOCOMMA(globals->mpool) );
|
dict = make_stubbed_dict( MPPARM_NOCOMMA(globals->mpool) );
|
||||||
#else
|
#else
|
||||||
|
XP_ASSERT( !!newDictName );
|
||||||
XP_DEBUGF( "calling ce_dictionary_make" );
|
XP_DEBUGF( "calling ce_dictionary_make" );
|
||||||
dict = ce_dictionary_make( globals, copyString( MEMPOOL newDictName ));
|
dict = ce_dictionary_make( globals, copyString( MEMPOOL newDictName ));
|
||||||
#endif
|
#endif
|
||||||
|
@ -372,7 +372,8 @@ ceInitAndStartBoard( CEAppGlobals* globals, XP_Bool newGame, CeGamePrefs* gp )
|
||||||
if ( newGame ) {
|
if ( newGame ) {
|
||||||
XP_U16 newGameID = 0;
|
XP_U16 newGameID = 0;
|
||||||
game_reset( MEMPOOL &globals->game, &globals->gameInfo,
|
game_reset( MEMPOOL &globals->game, &globals->gameInfo,
|
||||||
newGameID, &globals->appPrefs.cp, (TransportSend)NULL, globals );
|
newGameID, &globals->appPrefs.cp, (TransportSend)NULL,
|
||||||
|
globals );
|
||||||
|
|
||||||
if ( !!gp ) {
|
if ( !!gp ) {
|
||||||
globals->gameInfo.hintsNotAllowed = gp->hintsNotAllowed;
|
globals->gameInfo.hintsNotAllowed = gp->hintsNotAllowed;
|
||||||
|
@ -528,9 +529,13 @@ ceLoadSavedGame( CEAppGlobals* globals )
|
||||||
|
|
||||||
hasDict = stream_getU8( stream );
|
hasDict = stream_getU8( stream );
|
||||||
if ( hasDict ) {
|
if ( hasDict ) {
|
||||||
|
#ifdef STUBBED_DICT
|
||||||
|
XP_ASSERT(0); /* just don't do this!!!! */
|
||||||
|
#else
|
||||||
XP_UCHAR* name = stringFromStream( MPPARM(globals->mpool)
|
XP_UCHAR* name = stringFromStream( MPPARM(globals->mpool)
|
||||||
stream );
|
stream );
|
||||||
dict = ce_dictionary_make( globals, name );
|
dict = ce_dictionary_make( globals, name );
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
dict = NULL;
|
dict = NULL;
|
||||||
}
|
}
|
||||||
|
@ -629,6 +634,7 @@ InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
hWnd, globals );
|
hWnd, globals );
|
||||||
|
|
||||||
/* choose one. If none found it's an error. */
|
/* choose one. If none found it's an error. */
|
||||||
|
#ifndef STUBBED_DICT
|
||||||
globals->gameInfo.dictName = ceLocateNthDict( MPPARM(mpool) 0 );
|
globals->gameInfo.dictName = ceLocateNthDict( MPPARM(mpool) 0 );
|
||||||
result = globals->gameInfo.dictName != NULL;
|
result = globals->gameInfo.dictName != NULL;
|
||||||
if ( !result ) {
|
if ( !result ) {
|
||||||
|
@ -636,7 +642,7 @@ InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
"dictionary.", L"Fatal error" );
|
"dictionary.", L"Fatal error" );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gi_initPlayerInfo( MPPARM(mpool) &globals->gameInfo, "Player %d" );
|
gi_initPlayerInfo( MPPARM(mpool) &globals->gameInfo, "Player %d" );
|
||||||
|
|
||||||
|
@ -800,7 +806,11 @@ doNewGame( CEAppGlobals* globals, XP_Bool silent )
|
||||||
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_GAMEINFO, globals->hWnd,
|
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_GAMEINFO, globals->hWnd,
|
||||||
(DLGPROC)GameInfo, (long)&giState );
|
(DLGPROC)GameInfo, (long)&giState );
|
||||||
|
|
||||||
if ( !giState.userCancelled && ((XP_U16)XP_STRLEN(giState.newDictName) > 0) ) {
|
if ( !giState.userCancelled
|
||||||
|
#ifndef STUBBED_DICT
|
||||||
|
&& ((XP_U16)XP_STRLEN(giState.newDictName) > 0)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
|
|
||||||
if ( giState.prefsChanged ) {
|
if ( giState.prefsChanged ) {
|
||||||
loadCurPrefsFromState( &globals->appPrefs, &globals->gameInfo,
|
loadCurPrefsFromState( &globals->appPrefs, &globals->gameInfo,
|
||||||
|
@ -1678,7 +1688,11 @@ static DictionaryCtxt*
|
||||||
ce_util_makeEmptyDict( XW_UtilCtxt* uc )
|
ce_util_makeEmptyDict( XW_UtilCtxt* uc )
|
||||||
{
|
{
|
||||||
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
||||||
|
#ifdef STUBBED_DICT
|
||||||
|
return make_stubbed_dict( MPPARM_NOCOMMA(globals->mpool) );
|
||||||
|
#else
|
||||||
return ce_dictionary_make( globals, NULL );
|
return ce_dictionary_make( globals, NULL );
|
||||||
|
#endif
|
||||||
} /* ce_util_makeEmptyDict */
|
} /* ce_util_makeEmptyDict */
|
||||||
|
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||||
|
|
Loading…
Reference in a new issue