Move the soundlist when updating a Ptr instead of copying

This commit is contained in:
Chris Robinson 2017-09-13 20:47:20 -07:00
parent 605c937572
commit abe80f5868

View file

@ -1203,16 +1203,16 @@ namespace MWSound
SoundMap::iterator snditer = mActiveSounds.find(old); SoundMap::iterator snditer = mActiveSounds.find(old);
if(snditer != mActiveSounds.end()) if(snditer != mActiveSounds.end())
{ {
SoundBufferRefPairList sndlist = snditer->second; SoundBufferRefPairList sndlist = std::move(snditer->second);
mActiveSounds.erase(snditer); mActiveSounds.erase(snditer);
mActiveSounds[updated] = sndlist; mActiveSounds.emplace(updated, std::move(sndlist));
} }
SaySoundMap::iterator sayiter = mActiveSaySounds.find(old); SaySoundMap::iterator sayiter = mActiveSaySounds.find(old);
if(sayiter != mActiveSaySounds.end()) if(sayiter != mActiveSaySounds.end())
{ {
Stream *stream = sayiter->second; Stream *stream = sayiter->second;
mActiveSaySounds.erase(sayiter); mActiveSaySounds.erase(sayiter);
mActiveSaySounds[updated] = stream; mActiveSaySounds.emplace(updated, stream);
} }
} }