Feature: Allow base sounds set to be changed mid-game. (#12399)

This commit is contained in:
Peter Nelson
2024-04-01 17:54:42 +01:00
committed by GitHub
parent 3d2a8fb60c
commit d68e5159e1
5 changed files with 51 additions and 8 deletions

View File

@@ -47,6 +47,7 @@
#include "network/network_survey.h"
#include "video/video_driver.hpp"
#include "social_integration.h"
#include "sound_func.h"
#include "safeguards.h"
@@ -940,13 +941,7 @@ struct GameOptionsWindow : Window {
break;
case WID_GO_BASE_SFX_DROPDOWN:
if (_game_mode == GM_MENU) {
auto set = BaseSounds::GetSet(index);
BaseSounds::ini_set = set->name;
BaseSounds::SetSet(set);
this->reload = true;
this->InvalidateData();
}
ChangeSoundSet(index);
break;
case WID_GO_BASE_MUSIC_DROPDOWN:
@@ -982,7 +977,6 @@ struct GameOptionsWindow : Window {
#endif /* HAS_TRUETYPE_FONT */
this->SetWidgetDisabledState(WID_GO_BASE_GRF_DROPDOWN, _game_mode != GM_MENU);
this->SetWidgetDisabledState(WID_GO_BASE_SFX_DROPDOWN, _game_mode != GM_MENU);
this->SetWidgetDisabledState(WID_GO_BASE_GRF_PARAMETERS, BaseGraphics::GetUsedSet() == nullptr || !BaseGraphics::GetUsedSet()->IsConfigurable());