protect changeDict feature with compile-time flags (since it can't be

used on Android)
This commit is contained in:
Eric House 2012-10-24 06:46:54 -07:00
parent c69dbda36f
commit 13c74cfbd5
4 changed files with 14 additions and 3 deletions

View file

@ -44,8 +44,9 @@ assertUtilOK( XW_UtilCtxt* util )
# define assertUtilOK(u)
#endif
#ifdef XWFEATURE_CHANGEDICT
static void gi_setDict( MPFORMAL CurGameInfo* gi, const DictionaryCtxt* dict );
#endif
static void
checkServerRole( CurGameInfo* gi, XP_U16* nPlayersHere, XP_U16* nPlayersTotal )
@ -186,6 +187,7 @@ game_reset( MPFORMAL XWGame* game, CurGameInfo* gi,
board_prefsChanged( game->board, cp );
} /* game_reset */
#ifdef XWFEATURE_CHANGEDICT
void
game_changeDict( MPFORMAL XWGame* game, CurGameInfo* gi, DictionaryCtxt* dict )
{
@ -194,6 +196,7 @@ game_changeDict( MPFORMAL XWGame* game, CurGameInfo* gi, DictionaryCtxt* dict )
gi_setDict( MPPARM(mpool) gi, dict );
server_resetEngines( game->server );
}
#endif
XP_Bool
game_makeFromStream( MPFORMAL XWStreamCtxt* stream, XWGame* game,
@ -572,6 +575,7 @@ gi_writeToStream( XWStreamCtxt* stream, const CurGameInfo* gi )
}
} /* gi_writeToStream */
#ifdef XWFEATURE_CHANGEDICT
static void
gi_setDict( MPFORMAL CurGameInfo* gi, const DictionaryCtxt* dict )
{
@ -583,6 +587,7 @@ gi_setDict( MPFORMAL CurGameInfo* gi, const DictionaryCtxt* dict )
XP_FREEP( mpool, &pl->dictName );
}
}
#endif
XP_Bool
player_hasPasswd( LocalPlayer* player )

View file

@ -1581,6 +1581,7 @@ server_getEngineFor( ServerCtxt* server, XP_U16 playerNum )
return engine;
} /* server_getEngineFor */
#ifdef XWFEATURE_CHANGEDICT
void
server_resetEngines( ServerCtxt* server )
{
@ -1589,6 +1590,7 @@ server_resetEngines( ServerCtxt* server )
server_resetEngine( server, nPlayers );
}
}
#endif
void
server_resetEngine( ServerCtxt* server, XP_U16 playerNum )

View file

@ -108,6 +108,8 @@ DEFINES += -DXWFEATURE_TRAYUNDO_ONE
DEFINES += -DXWFEATURE_BONUSALL
# DEFINES += -DXWFEATURE_BONUSALLHINT
DEFINES += -DXWFEATURE_HILITECELL
# allow change dict inside running game
DEFINES += -DXWFEATURE_CHANGEDICT
# MAX_ROWS controls STREAM_VERS_BIGBOARD and with it move hashing
DEFINES += -DMAX_ROWS=32

View file

@ -861,6 +861,7 @@ save_game( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* XP_UNUSED(globals) )
{
} /* save_game */
#ifdef XWFEATURE_CHANGEDICT
static void
change_dictionary( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* globals )
{
@ -877,6 +878,7 @@ change_dictionary( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* globals )
}
g_slist_free( dicts );
} /* change_dictionary */
#endif
static void
handle_undo( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* XP_UNUSED(globals) )
@ -1020,10 +1022,10 @@ makeMenus( GtkAppGlobals* globals, int XP_UNUSED(argc),
GTK_SIGNAL_FUNC(load_game), globals );
(void)createAddItem( fileMenu, "Save game",
GTK_SIGNAL_FUNC(save_game), globals );
#ifdef XWFEATURE_CHANGEDICT
(void)createAddItem( fileMenu, "Change dictionary",
GTK_SIGNAL_FUNC(change_dictionary), globals );
#endif
(void)createAddItem( fileMenu, "Cancel trade",
GTK_SIGNAL_FUNC(handle_trade_cancel), globals );