Ensure the Group Offset is applied when Reloading a Song from Disk

This commit is contained in:
Crash Cringle
2025-03-03 23:25:32 -08:00
committed by teejusb
parent fe1bfbdde2
commit 835ca35065
+6 -1
View File
@@ -481,6 +481,7 @@ bool Song::ReloadFromSongDir( RString sDir )
return false;
copy.RemoveAutoGenNotes();
*this = copy;
m_SongTiming.m_fBeat0GroupOffsetInSeconds = GetGroup()->GetSyncOffset();
/* Go through the steps, first setting their Song pointer to this song
* (instead of the copy used above), and constructing a map to let us
@@ -489,10 +490,14 @@ bool Song::ReloadFromSongDir( RString sDir )
for( std::vector<Steps*>::const_iterator it = m_vpSteps.begin(); it != m_vpSteps.end(); ++it )
{
(*it)->m_pSong = this;
StepsID id;
id.FromSteps( *it );
mNewSteps[id] = *it;
// Reapply the Group Offset if the steps have their own timing data.
if( mNewSteps[id]->m_Timing.empty() )
continue;
mNewSteps[id]->m_Timing.m_fBeat0GroupOffsetInSeconds = GetGroup()->GetSyncOffset();
}
// Now we wipe out the new pointers, which were shallow copied and not deep copied...