SLUDGE: use multiple entries for language selection

This commit is contained in:
yinsimei 2017-07-12 23:20:46 +02:00 committed by Eugene Sandulenko
parent 6b794d3da7
commit ef5e8091f6
5 changed files with 19 additions and 14 deletions

View file

@ -30,11 +30,10 @@ namespace Sludge {
struct SludgeGameDescription {
ADGameDescription desc;
int gameType;
uint languageID;
};
int SludgeEngine::getGameType() const { return _gameDescription->gameType; }
uint SludgeEngine::getLanguageID() const { return _gameDescription->languageID; }
const char *SludgeEngine::getGameId() const { return _gameDescription->desc.gameId;}
uint32 SludgeEngine::getFeatures() const { return _gameDescription->desc.flags; }
Common::Language SludgeEngine::getLanguage() const { return _gameDescription->desc.language; }

View file

@ -49,6 +49,18 @@ static const SludgeGameDescription gameDescriptions[] = {
0
},
{
{
"verbcoin",
"",
AD_ENTRY1s("Verb Coin.slg", "e39ec315dcbf3a1137481f0a5fe1617d", 980270),
Common::DE_DEU,
Common::kPlatformUnknown,
ADGF_NO_FLAGS,
GUIO0()
},
1
},
{
{

View file

@ -31,12 +31,12 @@
namespace Sludge {
int *languageTable;
uint *languageTable;
Common::String *languageName;
settingsStruct gameSettings;
void makeLanguageTable(Common::File *table) {
languageTable = new int[gameSettings.numLanguages + 1];
languageTable = new uint[gameSettings.numLanguages + 1];
if (!checkNew(languageTable))
return;
@ -64,7 +64,6 @@ int getLanguageForFileB() {
if (languageTable[i] == gameSettings.languageID)
indexNum = i;
}
return indexNum;
}

View file

@ -65,7 +65,7 @@ public:
SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc);
virtual ~SludgeEngine();
int getGameType() const;
uint getLanguageID() const;
const char *getGameId() const;
uint32 getFeatures() const;
Common::Language getLanguage() const;

View file

@ -511,14 +511,9 @@ bool initSludge(const Common::String &filename) {
if (chdir(gameName)) return fatal("This game's preference folder is inaccessible!\nI can't access the following directory (maybe there's a file with the same name, or maybe it's read-protected):", gameName);
#endif
// Get user settings
readIniFile(filename);
// Get language selected by user
gameSettings.languageID = g_sludge->getLanguageID();
// There's no startup window on Linux and respecting this
// option from the ini file would disable commandline options.
saveIniFile(filename);
// Now set file indices properly to the chosen language.
languageNum = getLanguageForFileB();
if (languageNum < 0)