Ensure the music wheel rebuilds when using SORT_PREFERRED.

The songs for each sort are not updated despite changes that might occur during the session. This commit ensures that the music wheel will be rebuilt when setting the sort to PREFERRED. This is needed because the songs in this particular sort are prone to change during a session because two players can have different preferred songs. Additionally, profiles can change during a session. This commit will properly rebuild the music wheel  when the sort is changed to SORT_PREFERRED.
This commit is contained in:
Crash Cringle
2024-02-25 09:36:21 -08:00
committed by teejusb
parent 58be4d521e
commit a7a8f51c33
+8 -3
View File
@@ -950,8 +950,11 @@ void MusicWheel::readyWheelItemsData(SortOrder so) {
BuildWheelItemDatas( aUnFilteredDatas, so );
}
FilterWheelItemDatas( aUnFilteredDatas, m__WheelItemDatas[so], so );
m_WheelItemDatasStatus[so]=VALID;
// The preferred sort's songs are subject to change during a session (particularly if two players have different preferred songs)
// thus it's status should remain invalid so the wheel items are rebuilt each time in case of change.
if (so != SORT_PREFERRED) {
m_WheelItemDatasStatus[so]=VALID;
}
LOG->Trace( "MusicWheel sorting took: %f", timer.GetTimeSinceStart() );
}
@@ -1242,7 +1245,9 @@ void MusicWheel::ChangeMusic( int iDist )
bool MusicWheel::ChangeSort( SortOrder new_so, bool allowSameSort ) // return true if change successful
{
ASSERT( new_so < NUM_SortOrder );
if( GAMESTATE->m_SortOrder == new_so && !allowSameSort )
// Ignore allowSameSort if we're using SORT_PREFERRED
// Each player has their own preferred songs which sorts the songs differently -crashcringle
if( GAMESTATE->m_SortOrder == new_so && (!allowSameSort && new_so != SORT_PREFERRED ))
{
return false;
}