From 2aba3c0ce102d2f59a208276a6ebb63e921c52ed Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 26 Jan 2013 11:56:20 -0800 Subject: [PATCH] load dict early enough to have lang available to comms when it first connects. --- xwords4/linux/cursesmain.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/xwords4/linux/cursesmain.c b/xwords4/linux/cursesmain.c index efd80fb00..30225616f 100644 --- a/xwords4/linux/cursesmain.c +++ b/xwords4/linux/cursesmain.c @@ -1046,7 +1046,7 @@ data_socket_proc( GIOChannel* source, GIOCondition condition, gpointer data ) if ( 0 != (G_IO_IN & condition) ) { CursesAppGlobals* globals = (CursesAppGlobals*)data; int fd = g_io_channel_unix_get_fd( source ); - unsigned char buf[256]; + unsigned char buf[1024]; int nBytes; CommsAddrRec addrRec; CommsAddrRec* addrp = NULL; @@ -1292,7 +1292,7 @@ blocking_gotEvent( CursesAppGlobals* globals, int* ch ) globals ); } else { #ifndef XWFEATURE_STANDALONE_ONLY - unsigned char buf[256]; + unsigned char buf[1024]; int nBytes; CommsAddrRec addrRec; CommsAddrRec* addrp = NULL; @@ -1971,10 +1971,18 @@ cursesmain( XP_Bool isServer, LaunchParams* params ) #endif } - if ( !!stream ) { - if ( NULL == cGlobals->dict ) { + if ( NULL == cGlobals->dict ) { + if ( !!stream ) { cGlobals->dict = makeDictForStream( cGlobals, stream ); + } else { + cGlobals->dict = + linux_dictionary_make( MEMPOOL params, + cGlobals->gi.dictName, XP_TRUE ); } + } + cGlobals->gi.dictLang = dict_getLangCode( cGlobals->dict ); + + if ( !!stream ) { (void)game_makeFromStream( MEMPOOL stream, &cGlobals->game, &cGlobals->gi, cGlobals->dict, &cGlobals->dicts, cGlobals->util, @@ -2032,11 +2040,6 @@ cursesmain( XP_Bool isServer, LaunchParams* params ) } #endif - if ( NULL == cGlobals->dict ) { - cGlobals->dict = - linux_dictionary_make( MEMPOOL params, - cGlobals->gi.dictName, XP_TRUE ); - } model_setDictionary( cGlobals->game.model, cGlobals->dict ); setSquareBonuses( cGlobals ); positionSizeStuff( &g_globals, width, height );