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.
This commit is contained in:
Glenn Maynard
2006-08-08 18:55:16 +00:00
parent d04971e156
commit 2d9b15746f
+16 -2
View File
@@ -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; i<vs.size(); i++ )
sel = -1;
for( unsigned i=0; sel == -1 && i < vs.size(); ++i )
if( !stricmp(vs[i], THEME->GetCurLanguage()) )
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];