diff options
-rw-r--r-- | base/gameDetector.cpp | 1 | ||||
-rw-r--r-- | common/config-manager.cpp | 7 | ||||
-rw-r--r-- | sword1/sword1.cpp | 9 |
3 files changed, 12 insertions, 5 deletions
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp index 095153f73e..d51693f6a0 100644 --- a/base/gameDetector.cpp +++ b/base/gameDetector.cpp @@ -121,7 +121,6 @@ GameDetector::GameDetector() { // ConfMan.registerDefault("amiga", false); ConfMan.registerDefault("platform", Common::kPlatformPC); ConfMan.registerDefault("language", "en"); -// ConfMan.registerDefault("nosubtitles", false); ConfMan.registerDefault("subtitles", false); ConfMan.registerDefault("boot_param", 0); ConfMan.registerDefault("save_slot", -1); diff --git a/common/config-manager.cpp b/common/config-manager.cpp index cca805ec6b..8dec3ae4e0 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -334,6 +334,13 @@ const String & ConfigManager::get(const String &key, const String &domain) const int ConfigManager::getInt(const String &key, const String &dom) const { String value(get(key, dom)); char *errpos; + + // For now, be tolerant against missing config keys. Strictly spoken, it is + // a bug in the calling code to retrieve an int for a key which isn't even + // present... and a default value of 0 seems rather arbitrary. + if (value.isEmpty()) + return 0; + int ivalue = (int)strtol(value.c_str(), &errpos, 10); if (value.c_str() == errpos) error("Config file buggy: '%s' is not a valid integer", errpos); diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp index 6fd61ad66f..ac5b8d95f8 100644 --- a/sword1/sword1.cpp +++ b/sword1/sword1.cpp @@ -113,18 +113,19 @@ void SwordEngine::initialize(void) { _logic = new Logic(_objectMan, _resMan, _screen, _mouse, _sound, _music, _menu, _system, _mixer); _mouse->useLogicAndMenu(_logic, _menu); + ConfMan.registerDefault("speech_volume", 192); + uint8 musicVol = (uint8)ConfMan.getInt("music_volume"); uint8 speechVol = (uint8)ConfMan.getInt("speech_volume"); uint8 sfxVol = (uint8)ConfMan.getInt("sfx_volume"); - if (!speechVol) - speechVol = 192; _music->setVolume(musicVol, musicVol); // these routines expect left and right volume, _sound->setSpeechVol(speechVol, speechVol); // but our config manager doesn't support it. _sound->setSfxVol(sfxVol, sfxVol); - _systemVars.justRestoredGame = _systemVars.currentCD = - _systemVars.gamePaused = 0; + _systemVars.justRestoredGame = 0; + _systemVars.currentCD = 0; + _systemVars.gamePaused = 0; _systemVars.deathScreenFlag = 3; _systemVars.forceRestart = false; _systemVars.wantFade = true; |