From 192626c6f55421d57f20d4c963efde17dc95b0a1 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 14 Dec 2014 17:44:03 +0100 Subject: [PATCH] SoundGen fix: use Original Creature field only if non-empty --- apps/openmw/mwclass/creature.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index 25808c991a..b87dfda98b 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -679,14 +679,15 @@ namespace MWClass if(type >= 0) { std::vector sounds; - sounds.reserve(8); MWWorld::LiveCellRef* ref = ptr.get(); + const std::string& ourId = (ref->mBase->mOriginal.empty()) ? getId(ptr) : ref->mBase->mOriginal; + MWWorld::Store::iterator sound = store.begin(); 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); ++sound; }