need to replace the main dict too

This commit is contained in:
Andy2 2011-04-26 06:41:31 -07:00
parent 33c81ec7ec
commit 4113d92be7

View file

@ -259,18 +259,31 @@ public class CurGameInfo {
// Replace any dict that doesn't exist with newDict // Replace any dict that doesn't exist with newDict
public void replaceDicts( String newDict ) public void replaceDicts( String newDict )
{ {
Utils.logf( "replaceDicts(%s)", newDict );
String[] dicts = String[] dicts =
DictLangCache.getHaveLang( m_context, dictLang ); DictLangCache.getHaveLang( m_context, dictLang );
HashSet<String> installed = new HashSet<String>( Arrays.asList(dicts) ); HashSet<String> installed = new HashSet<String>( Arrays.asList(dicts) );
if ( !installed.contains( dictName ) ) {
dictName = newDict;
}
for ( int ii = 0; ii < nPlayers; ++ii ) { for ( int ii = 0; ii < nPlayers; ++ii ) {
String curDict = players[ii].dictName; LocalPlayer lp = players[ii];
if ( newDict.equals( curDict ) ) { if ( null == lp.dictName ) {
// we're good // continue to inherit
} else if ( installed.contains(curDict) ) { } else if ( !installed.contains( players[ii].dictName ) ) {
// we're good
} else {
players[ii].dictName = newDict; players[ii].dictName = newDict;
} }
// String curDict = players[ii].dictName;
// if ( newDict.equals( curDict ) ) {
// // we're good
// } else if ( installed.contains(curDict) ) {
// // we're good
// } else {
// players[ii].dictName = newDict;
// }
} }
} }
@ -372,9 +385,10 @@ public class CurGameInfo {
String robotDict = String robotDict =
DictLangCache.getBestDefault( m_context, dictLang, false ); DictLangCache.getBestDefault( m_context, dictLang, false );
if ( null == dictName || if ( null == dictName
dictLang != DictLangCache.getDictLangCode( m_context, || ! GameUtils.dictExists( m_context, dictName )
dictName ) ) { || dictLang != DictLangCache.getDictLangCode( m_context,
dictName ) ) {
dictName = humanDict; dictName = humanDict;
} }