TINSEL: Initialize remaining sound reels when loading old save

This commit is contained in:
PushmePullyu 2023-09-08 22:24:18 +02:00 committed by Filippos Karapetis
parent 4ff3fe1586
commit 15d85c2f00

View File

@ -341,6 +341,11 @@ static void syncSavedData(Common::Serializer &s, SAVED_DATA &sd, int numInterp,
int numReels = s.getVersion() >= 4 ? MAX_SOUNDREELS : 5;
for (int i = 0; i < numReels; ++i)
syncSoundReel(s, sd.SavedSoundReels[i]);
// For old saves we zero the remaining sound reels
if (s.isLoading() && numReels < MAX_SOUNDREELS) {
const auto reelSize = sizeof sd.SavedSoundReels[0];
memset(&sd.SavedSoundReels[numReels], 0, reelSize * (MAX_SOUNDREELS - numReels));
}
}
}