[Scummvm-cvs-logs] SF.net SVN: scummvm: [21951] scummvm/trunk/gui
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Apr 16 12:24:02 CEST 2006
Revision: 21951
Author: fingolfin
Date: 2006-04-16 12:23:14 -0700 (Sun, 16 Apr 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21951&view=rev
Log Message:
-----------
Fix for bug #1471383: Instead of overloading ConfigManager::set, we now have new setInt and setBool methods (matching getInt/getBool), which avoids strange quirks & bugs caused by (char *) being implicitly cast to int (ouch)
Modified Paths:
--------------
scummvm/trunk/common/config-manager.cpp
scummvm/trunk/common/config-manager.h
scummvm/trunk/engines/queen/queen.cpp
scummvm/trunk/engines/saga/interface.cpp
scummvm/trunk/engines/scumm/dialogs.cpp
scummvm/trunk/engines/scumm/he/script_v70he.cpp
scummvm/trunk/engines/scumm/he/script_v72he.cpp
scummvm/trunk/engines/scumm/input.cpp
scummvm/trunk/engines/scumm/script.cpp
scummvm/trunk/engines/scumm/script_v6.cpp
scummvm/trunk/engines/scumm/scumm.cpp
scummvm/trunk/engines/sky/control.cpp
scummvm/trunk/engines/sword2/sword2.cpp
scummvm/trunk/gui/options.cpp
Modified: scummvm/trunk/common/config-manager.cpp
===================================================================
--- scummvm/trunk/common/config-manager.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/common/config-manager.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -507,13 +507,13 @@
*/
}
-void ConfigManager::set(const String &key, int value, const String &domName) {
+void ConfigManager::setInt(const String &key, int value, const String &domName) {
char tmp[128];
snprintf(tmp, sizeof(tmp), "%i", value);
set(key, String(tmp), domName);
}
-void ConfigManager::set(const String &key, bool value, const String &domName) {
+void ConfigManager::setBool(const String &key, bool value, const String &domName) {
set(key, String(value ? "true" : "false"), domName);
}
Modified: scummvm/trunk/common/config-manager.h
===================================================================
--- scummvm/trunk/common/config-manager.h 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/common/config-manager.h 2006-04-16 19:23:14 UTC (rev 21951)
@@ -130,8 +130,8 @@
//
int getInt(const String &key, const String &domName = String::emptyString) const;
bool getBool(const String &key, const String &domName = String::emptyString) const;
- void set(const String &key, int value, const String &domName = String::emptyString);
- void set(const String &key, bool value, const String &domName = String::emptyString);
+ void setInt(const String &key, int value, const String &domName = String::emptyString);
+ void setBool(const String &key, bool value, const String &domName = String::emptyString);
void registerDefault(const String &key, const String &value);
Modified: scummvm/trunk/engines/queen/queen.cpp
===================================================================
--- scummvm/trunk/engines/queen/queen.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/engines/queen/queen.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -194,12 +194,12 @@
}
void QueenEngine::writeOptionSettings() {
- ConfMan.set("music_volume", _music->volume());
- ConfMan.set("music_mute", !_sound->musicOn());
- ConfMan.set("sfx_mute", !_sound->sfxOn());
- ConfMan.set("talkspeed", _talkSpeed);
- ConfMan.set("speech_mute", !_sound->speechOn());
- ConfMan.set("subtitles", _subtitles);
+ ConfMan.setInt("music_volume", _music->volume());
+ ConfMan.setBool("music_mute", !_sound->musicOn());
+ ConfMan.setBool("sfx_mute", !_sound->sfxOn());
+ ConfMan.setInt("talkspeed", _talkSpeed);
+ ConfMan.setBool("speech_mute", !_sound->speechOn());
+ ConfMan.setBool("subtitles", _subtitles);
ConfMan.flushToDisk();
}
Modified: scummvm/trunk/engines/saga/interface.cpp
===================================================================
--- scummvm/trunk/engines/saga/interface.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/engines/saga/interface.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -1364,21 +1364,21 @@
case kTextReadingSpeed:
if (_vm->getFeatures() & GF_CD_FX) {
_vm->_subtitlesEnabled = !_vm->_subtitlesEnabled;
- ConfMan.set("subtitles", _vm->_subtitlesEnabled);
+ ConfMan.setBool("subtitles", _vm->_subtitlesEnabled);
} else {
_vm->_readingSpeed = (_vm->_readingSpeed + 1) % 4;
- ConfMan.set("talkspeed", _vm->_readingSpeed);
+ ConfMan.setInt("talkspeed", _vm->_readingSpeed);
}
break;
case kTextMusic:
_vm->_musicVolume = (_vm->_musicVolume + 1) % 11;
_vm->_music->setVolume(_vm->_musicVolume == 10 ? -1 : _vm->_musicVolume * 25, 1);
- ConfMan.set("music_volume", _vm->_musicVolume * 25);
+ ConfMan.setInt("music_volume", _vm->_musicVolume * 25);
break;
case kTextSound:
_vm->_soundVolume = (_vm->_soundVolume + 1) % 11;
_vm->_sound->setVolume(_vm->_soundVolume == 10 ? 255 : _vm->_soundVolume * 25);
- ConfMan.set("sfx_volume", _vm->_soundVolume * 25);
+ ConfMan.setInt("sfx_volume", _vm->_soundVolume * 25);
break;
}
}
Modified: scummvm/trunk/engines/scumm/dialogs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/dialogs.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/engines/scumm/dialogs.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -719,14 +719,14 @@
void ConfigDialog::close() {
if (getResult()) {
// Subtitles
- ConfMan.set("subtitles", _subtitlesCheckbox->getState(), _domain);
+ ConfMan.setBool("subtitles", _subtitlesCheckbox->getState(), _domain);
// Sync with current setting
if (!_speechCheckbox->getState()) {
- ConfMan.set("speech_mute", true, _domain);
+ ConfMan.setBool("speech_mute", true, _domain);
_vm->_voiceMode = 2;
} else {
- ConfMan.set("speech_mute", false, _domain);
+ ConfMan.setBool("speech_mute", false, _domain);
_vm->_voiceMode = _subtitlesCheckbox->getState();
}
Modified: scummvm/trunk/engines/scumm/he/script_v70he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v70he.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/engines/scumm/he/script_v70he.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -990,7 +990,7 @@
switch (type) {
case 1: // number
- ConfMan.set((char *)option, value);
+ ConfMan.setInt((char *)option, value);
debug(1, "o70_writeINI: Option %s Value %d", option, value);
break;
case 2: // string
Modified: scummvm/trunk/engines/scumm/he/script_v72he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v72he.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/engines/scumm/he/script_v72he.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -2134,7 +2134,7 @@
case 6: // number
value = pop();
copyScriptString(option, sizeof(option));
- ConfMan.set((char *)option, value);
+ ConfMan.setInt((char *)option, value);
debug(1, "o72_writeINI: Option %s Value %d", option, value);
break;
case 77: // HE 100
Modified: scummvm/trunk/engines/scumm/input.cpp
===================================================================
--- scummvm/trunk/engines/scumm/input.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/engines/scumm/input.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -334,18 +334,18 @@
switch(_voiceMode) {
case 0:
sprintf(buf, "Speech Only");
- ConfMan.set("speech_mute", false);
- ConfMan.set("subtitles", false);
+ ConfMan.setBool("speech_mute", false);
+ ConfMan.setBool("subtitles", false);
break;
case 1:
sprintf(buf, "Speech and Subtitles");
- ConfMan.set("speech_mute", false);
- ConfMan.set("subtitles", true);
+ ConfMan.setBool("speech_mute", false);
+ ConfMan.setBool("subtitles", true);
break;
case 2:
sprintf(buf, "Subtitles Only");
- ConfMan.set("speech_mute", true);
- ConfMan.set("subtitles", true);
+ ConfMan.setBool("speech_mute", true);
+ ConfMan.setBool("subtitles", true);
break;
}
@@ -434,7 +434,7 @@
if (vol > Audio::Mixer::kMaxMixerVolume)
vol = Audio::Mixer::kMaxMixerVolume;
- ConfMan.set("music_volume", vol);
+ ConfMan.setInt("music_volume", vol);
setupVolumes();
} else if (_lastKeyHit == '-' || _lastKeyHit == '+') { // Change text speed
if (_lastKeyHit == '+' && _defaultTalkDelay > 0)
Modified: scummvm/trunk/engines/scumm/script.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/engines/scumm/script.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -606,14 +606,14 @@
if (_game.heversion <= 73 && vm.slot[_currentScript].number == 1)
return;
assert(value == 0 || value == 1);
- ConfMan.set("subtitles", value);
+ ConfMan.setBool("subtitles", value);
}
if (VAR_NOSUBTITLES != 0xFF && var == VAR_NOSUBTITLES) {
// Ignore default setting in HE60-71 games
if (_game.heversion >= 60 && vm.slot[_currentScript].number == 1)
return;
assert(value == 0 || value == 1);
- ConfMan.set("subtitles", !value);
+ ConfMan.setBool("subtitles", !value);
}
if (var == VAR_CHARINC && ConfMan.hasKey("talkspeed")) {
Modified: scummvm/trunk/engines/scumm/script_v6.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_v6.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/engines/scumm/script_v6.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -2592,7 +2592,7 @@
_saveSound = args[1];
break;
case 215:
- ConfMan.set("subtitles", args[1] != 0);
+ ConfMan.setBool("subtitles", args[1] != 0);
break;
default:
error("o6_kernelSetFunctions: default case %d (param count %d)", args[0], num);
Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/engines/scumm/scumm.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -548,12 +548,12 @@
if (ConfMan.hasKey("nosubtitles")) {
printf("Configuration key 'nosubtitles' is deprecated. Use 'subtitles' instead\n");
if (!ConfMan.hasKey("subtitles"))
- ConfMan.set("subtitles", !ConfMan.getBool("nosubtitles"));
+ ConfMan.setBool("subtitles", !ConfMan.getBool("nosubtitles"));
}
// Make sure that at least subtitles are enabled
if (ConfMan.getBool("speech_mute") && !ConfMan.getBool("subtitles"))
- ConfMan.set("subtitles", 1);
+ ConfMan.setBool("subtitles", true);
// TODO Detect subtitle only versions of scumm6 games
if (ConfMan.getBool("speech_mute"))
Modified: scummvm/trunk/engines/sky/control.cpp
===================================================================
--- scummvm/trunk/engines/sky/control.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/engines/sky/control.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -718,7 +718,7 @@
_statusBar->setToText(0x7000 + 86);
}
- ConfMan.set("sfx_mute", (SkyEngine::_systemVars.systemFlags & SF_FX_OFF) != 0);
+ ConfMan.setBool("sfx_mute", (SkyEngine::_systemVars.systemFlags & SF_FX_OFF) != 0);
pButton->drawToScreen(WITH_MASK);
buttonControl(pButton);
@@ -742,8 +742,8 @@
_statusBar->setToText(0x7000 + 35); // text only
}
- ConfMan.set("subtitles", (flags & SF_ALLOW_TEXT) != 0);
- ConfMan.set("speech_mute", (flags & SF_ALLOW_SPEECH) == 0);
+ ConfMan.setBool("subtitles", (flags & SF_ALLOW_TEXT) != 0);
+ ConfMan.setBool("speech_mute", (flags & SF_ALLOW_SPEECH) == 0);
SkyEngine::_systemVars.systemFlags |= flags;
Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/engines/sword2/sword2.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -216,16 +216,16 @@
}
void Sword2Engine::writeSettings() {
- ConfMan.set("music_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType));
- ConfMan.set("speech_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType));
- ConfMan.set("sfx_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType));
- ConfMan.set("music_mute", _sound->isMusicMute());
- ConfMan.set("speech_mute", _sound->isSpeechMute());
- ConfMan.set("sfx_mute", _sound->isFxMute());
- ConfMan.set("gfx_details", _screen->getRenderLevel());
- ConfMan.set("subtitles", getSubtitles());
- ConfMan.set("object_labels", _mouse->getObjectLabels());
- ConfMan.set("reverse_stereo", _sound->isReverseStereo());
+ ConfMan.setInt("music_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType));
+ ConfMan.setInt("speech_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType));
+ ConfMan.setInt("sfx_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType));
+ ConfMan.setBool("music_mute", _sound->isMusicMute());
+ ConfMan.setBool("speech_mute", _sound->isSpeechMute());
+ ConfMan.setBool("sfx_mute", _sound->isFxMute());
+ ConfMan.setInt("gfx_details", _screen->getRenderLevel());
+ ConfMan.setBool("subtitles", getSubtitles());
+ ConfMan.setBool("object_labels", _mouse->getObjectLabels());
+ ConfMan.setInt("reverse_stereo", _sound->isReverseStereo());
ConfMan.flushToDisk();
}
Modified: scummvm/trunk/gui/options.cpp
===================================================================
--- scummvm/trunk/gui/options.cpp 2006-04-16 18:32:28 UTC (rev 21950)
+++ scummvm/trunk/gui/options.cpp 2006-04-16 19:23:14 UTC (rev 21951)
@@ -208,8 +208,8 @@
if (getResult()) {
if (_fullscreenCheckbox) {
if (_enableGraphicSettings) {
- ConfMan.set("fullscreen", _fullscreenCheckbox->getState(), _domain);
- ConfMan.set("aspect_ratio", _aspectCheckbox->getState(), _domain);
+ ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain);
+ ConfMan.setBool("aspect_ratio", _aspectCheckbox->getState(), _domain);
if ((int32)_gfxPopUp->getSelectedTag() >= 0)
ConfMan.set("gfx_mode", _gfxPopUp->getSelectedString(), _domain);
@@ -226,9 +226,9 @@
if (_musicVolumeSlider) {
if (_enableVolumeSettings) {
- ConfMan.set("music_volume", _musicVolumeSlider->getValue(), _domain);
- ConfMan.set("sfx_volume", _sfxVolumeSlider->getValue(), _domain);
- ConfMan.set("speech_volume", _speechVolumeSlider->getValue(), _domain);
+ ConfMan.setInt("music_volume", _musicVolumeSlider->getValue(), _domain);
+ ConfMan.setInt("sfx_volume", _sfxVolumeSlider->getValue(), _domain);
+ ConfMan.setInt("speech_volume", _speechVolumeSlider->getValue(), _domain);
} else {
ConfMan.removeKey("music_volume", _domain);
ConfMan.removeKey("sfx_volume", _domain);
@@ -238,7 +238,7 @@
if (_subCheckbox) {
if (_enableAudioSettings) {
- ConfMan.set("subtitles", _subCheckbox->getState(), _domain);
+ ConfMan.setBool("subtitles", _subCheckbox->getState(), _domain);
const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers();
while (md->name && md->id != (int)_midiPopUp->getSelectedTag())
md++;
@@ -255,9 +255,9 @@
// MIDI options
if (_multiMidiCheckbox) {
if (_enableMIDISettings) {
- ConfMan.set("multi_midi", _multiMidiCheckbox->getState(), _domain);
- ConfMan.set("native_mt32", _mt32Checkbox->getState(), _domain);
- ConfMan.set("enable_gs", _enableGSCheckbox->getState(), _domain);
+ ConfMan.setBool("multi_midi", _multiMidiCheckbox->getState(), _domain);
+ ConfMan.setBool("native_mt32", _mt32Checkbox->getState(), _domain);
+ ConfMan.setBool("enable_gs", _enableGSCheckbox->getState(), _domain);
String soundFont = _soundFont->getLabel();
if (!soundFont.empty() && (soundFont != "None"))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list