summaryrefslogtreecommitdiff
path: root/src/settings_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings_gui.cpp')
-rw-r--r--src/settings_gui.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 79bb71fb8..5ebac0280 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -114,19 +114,24 @@ static int GetCurRes()
static void ShowCustCurrency();
template <class T>
-static DropDownList *BuiltSetDropDownList(int *selected_index)
+static DropDownList *BuildSetDropDownList(int *selected_index, bool allow_selection)
{
int n = T::GetNumSets();
*selected_index = T::GetIndexOfUsedSet();
DropDownList *list = new DropDownList();
for (int i = 0; i < n; i++) {
- *list->Append() = new DropDownListCharStringItem(T::GetSet(i)->name, i, (_game_mode == GM_MENU) ? false : (*selected_index != i));
+ *list->Append() = new DropDownListCharStringItem(T::GetSet(i)->name, i, !allow_selection && (*selected_index != i));
}
return list;
}
+DropDownList *BuildMusicSetDropDownList(int *selected_index)
+{
+ return BuildSetDropDownList<BaseMusic>(selected_index, true);
+}
+
/** Window for displaying the textfile of a BaseSet. */
template <class TBaseSet>
struct BaseSetTextfileWindow : public TextfileWindow {
@@ -297,15 +302,15 @@ struct GameOptionsWindow : Window {
}
case WID_GO_BASE_GRF_DROPDOWN:
- list = BuiltSetDropDownList<BaseGraphics>(selected_index);
+ list = BuildSetDropDownList<BaseGraphics>(selected_index, (_game_mode == GM_MENU));
break;
case WID_GO_BASE_SFX_DROPDOWN:
- list = BuiltSetDropDownList<BaseSounds>(selected_index);
+ list = BuildSetDropDownList<BaseSounds>(selected_index, (_game_mode == GM_MENU));
break;
case WID_GO_BASE_MUSIC_DROPDOWN:
- list = BuiltSetDropDownList<BaseMusic>(selected_index);
+ list = BuildMusicSetDropDownList(selected_index);
break;
default:
@@ -544,7 +549,7 @@ struct GameOptionsWindow : Window {
break;
case WID_GO_BASE_MUSIC_DROPDOWN:
- this->SetMediaSet<BaseMusic>(index);
+ ChangeMusicSet(index);
break;
}
}