From 2d9b15746f2659c5388d274a280c7cef8b9c1003 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 8 Aug 2006 18:55:16 +0000 Subject: [PATCH] If the selected language doesn't exist, eg. default selection picked Macedonian and the theme doesn't support that language, we'll actually use BASE_LANGUAGE, so show that language as selected in options, not the one that sorts to the top. --- stepmania/src/ScreenOptionsMasterPrefs.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/stepmania/src/ScreenOptionsMasterPrefs.cpp b/stepmania/src/ScreenOptionsMasterPrefs.cpp index e4a0697631..354eb55a35 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.cpp +++ b/stepmania/src/ScreenOptionsMasterPrefs.cpp @@ -16,6 +16,8 @@ #include "GameConstantsAndTypes.h" #include "DisplayResolutions.h" #include "LocalizedString.h" +#include "SpecialFiles.h" +#include "RageLog.h" static void GetPrefsDefaultModifiers( PlayerOptions &po, SongOptions &so ) { @@ -181,10 +183,22 @@ static void Language( int &sel, bool ToSel, const ConfOption *pConfOption ) if( ToSel ) { - sel = 0; - for( unsigned i=1; iGetCurLanguage()) ) sel = i; + + /* If the current language doesn't exist, we'll show BASE_LANGUAGE, so select that. */ + for( unsigned i=0; sel == -1 && i < vs.size(); ++i ) + if( !stricmp(vs[i], SpecialFiles::BASE_LANGUAGE) ) + sel = i; + + if( sel == -1 ) + { + LOG->Warn( "Couldn't find language \"%s\" or fallback \"%s\"; using \"%s\"", + THEME->GetCurLanguage().c_str(), SpecialFiles::BASE_LANGUAGE.c_str(), vs[0].c_str() ); + sel = 0; + } } else { const RString &sNewLanguage = vs[sel];