From 70a8391d904af18fad8f3a1e867ddb006217df89 Mon Sep 17 00:00:00 2001 From: ufdada Date: Fri, 3 Jan 2014 20:58:59 +0100 Subject: [PATCH 1/2] =?UTF-8?q?disable=20some=20settings=20if=20sound=20is?= =?UTF-8?q?n=C2=B4t=20enabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI/GameSettingsScreen.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 7ec5334796..339c9f706f 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -221,11 +221,14 @@ void GameSettingsScreen::CreateViews() { audioSettings->Add(new ItemHeader(ms->T("Audio"))); - audioSettings->Add(new PopupSliderChoice(&g_Config.iSFXVolume, 0, MAX_CONFIG_VOLUME, a->T("SFX volume"), screenManager())); - audioSettings->Add(new PopupSliderChoice(&g_Config.iBGMVolume, 0, MAX_CONFIG_VOLUME, a->T("BGM volume"), screenManager())); + PopupSliderChoice *sfxVol = audioSettings->Add(new PopupSliderChoice(&g_Config.iSFXVolume, 0, MAX_CONFIG_VOLUME, a->T("SFX volume"), screenManager())); + sfxVol->SetEnabledPtr((bool *)&g_Config.bEnableSound); + PopupSliderChoice *bgmVol = audioSettings->Add(new PopupSliderChoice(&g_Config.iBGMVolume, 0, MAX_CONFIG_VOLUME, a->T("BGM volume"), screenManager())); + bgmVol->SetEnabledPtr((bool *)&g_Config.bEnableSound); audioSettings->Add(new CheckBox(&g_Config.bEnableSound, a->T("Enable Sound"))); - audioSettings->Add(new CheckBox(&g_Config.bLowLatencyAudio, a->T("Low latency audio"))); + CheckBox *lowAudio = audioSettings->Add(new CheckBox(&g_Config.bLowLatencyAudio, a->T("Low latency audio"))); + lowAudio->SetEnabledPtr((bool *)&g_Config.bEnableSound); // Control ViewGroup *controlsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); From 028bbbeb0bc3ff62091b34af0adfcb3fa5765cdd Mon Sep 17 00:00:00 2001 From: ufdada Date: Fri, 3 Jan 2014 21:03:57 +0100 Subject: [PATCH 2/2] value already bool, no need to cast it --- UI/GameSettingsScreen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 339c9f706f..7c8f1ffe4c 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -222,13 +222,13 @@ void GameSettingsScreen::CreateViews() { audioSettings->Add(new ItemHeader(ms->T("Audio"))); PopupSliderChoice *sfxVol = audioSettings->Add(new PopupSliderChoice(&g_Config.iSFXVolume, 0, MAX_CONFIG_VOLUME, a->T("SFX volume"), screenManager())); - sfxVol->SetEnabledPtr((bool *)&g_Config.bEnableSound); + sfxVol->SetEnabledPtr(&g_Config.bEnableSound); PopupSliderChoice *bgmVol = audioSettings->Add(new PopupSliderChoice(&g_Config.iBGMVolume, 0, MAX_CONFIG_VOLUME, a->T("BGM volume"), screenManager())); - bgmVol->SetEnabledPtr((bool *)&g_Config.bEnableSound); + bgmVol->SetEnabledPtr(&g_Config.bEnableSound); audioSettings->Add(new CheckBox(&g_Config.bEnableSound, a->T("Enable Sound"))); CheckBox *lowAudio = audioSettings->Add(new CheckBox(&g_Config.bLowLatencyAudio, a->T("Low latency audio"))); - lowAudio->SetEnabledPtr((bool *)&g_Config.bEnableSound); + lowAudio->SetEnabledPtr(&g_Config.bEnableSound); // Control ViewGroup *controlsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));