1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-24 07:11:34 +00:00

SoundGen fix: use Original Creature field only if non-empty

This commit is contained in:
scrawl 2014-12-14 17:44:03 +01:00
parent 88a2e4c043
commit 192626c6f5

View file

@ -679,14 +679,15 @@ namespace MWClass
if(type >= 0) if(type >= 0)
{ {
std::vector<const ESM::SoundGenerator*> sounds; std::vector<const ESM::SoundGenerator*> sounds;
sounds.reserve(8);
MWWorld::LiveCellRef<ESM::Creature>* ref = ptr.get<ESM::Creature>(); MWWorld::LiveCellRef<ESM::Creature>* ref = ptr.get<ESM::Creature>();
const std::string& ourId = (ref->mBase->mOriginal.empty()) ? getId(ptr) : ref->mBase->mOriginal;
MWWorld::Store<ESM::SoundGenerator>::iterator sound = store.begin(); MWWorld::Store<ESM::SoundGenerator>::iterator sound = store.begin();
while(sound != store.end()) while(sound != store.end())
{ {
if (type == sound->mType && !sound->mCreature.empty() && Misc::StringUtils::ciEqual(ref->mBase->mOriginal, sound->mCreature)) if (type == sound->mType && !sound->mCreature.empty() && (Misc::StringUtils::ciEqual(ourId, sound->mCreature)))
sounds.push_back(&*sound); sounds.push_back(&*sound);
++sound; ++sound;
} }