From 8097d9801dc19d1de9bef242bb65ee7aacc79268 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 6 Oct 2014 14:36:29 +0200 Subject: [PATCH] Fix HasSoulgem function to return number of soulgems --- apps/openmw/mwscript/containerextensions.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwscript/containerextensions.cpp b/apps/openmw/mwscript/containerextensions.cpp index 93711d036..96e30e396 100644 --- a/apps/openmw/mwscript/containerextensions.cpp +++ b/apps/openmw/mwscript/containerextensions.cpp @@ -290,18 +290,15 @@ namespace MWScript const std::string &name = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); + int count = 0; MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore (ptr); for (MWWorld::ContainerStoreIterator it = invStore.begin(MWWorld::ContainerStore::Type_Miscellaneous); it != invStore.end(); ++it) { - if (::Misc::StringUtils::ciEqual(it->getCellRef().getSoul(), name)) - { - runtime.push(1); - return; - } + ++count; } - runtime.push(0); + runtime.push(count); } };