Fix: items after the removed RCT1 theme have wrong index

This commit is contained in:
Hielke Morsink 2023-05-15 20:57:17 +02:00
parent 286d116026
commit fd3346b4b3
No known key found for this signature in database
GPG Key ID: FE0B343DF883E7F2
1 changed files with 8 additions and 0 deletions

View File

@ -1397,6 +1397,14 @@ private:
break;
case WIDX_TITLE_MUSIC_DROPDOWN:
{
// HACK: When RCT1 is not available, it's not in the dropdown, so indices higher than it should be incremented
const bool rct1MusicThemeIsAvailable = IsRCT1TitleMusicAvailable();
for (size_t i = 0; i < std::size(TitleThemeOptions) && static_cast<int32_t>(i) <= dropdownIndex; i++)
{
if (TitleThemeOptions[i].Kind == TitleMusicKind::RCT1 && !rct1MusicThemeIsAvailable)
dropdownIndex++;
}
gConfigSound.TitleMusic = TitleThemeOptions[dropdownIndex].Kind;
ConfigSaveDefault();
Invalidate();