Feature #6090: Change music set during gameplay
This commit is contained in:

committed by
frosch

parent
430e20f7e4
commit
19f5a6cbb0
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user