From 8740354c80922efd1710a51dcf129e09b73ea42e Mon Sep 17 00:00:00 2001 From: gugus Date: Sun, 18 Mar 2012 17:03:54 +0100 Subject: [PATCH] inventory filter now use player inventory --- apps/openmw/mwdialogue/dialoguemanager.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwdialogue/dialoguemanager.cpp b/apps/openmw/mwdialogue/dialoguemanager.cpp index eb9e8bfb8f..4e80b8dc79 100644 --- a/apps/openmw/mwdialogue/dialoguemanager.cpp +++ b/apps/openmw/mwdialogue/dialoguemanager.cpp @@ -15,6 +15,7 @@ #include "../mwworld/world.hpp" #include "../mwworld/refdata.hpp" #include "../mwworld/player.hpp" +#include "../mwworld/containerstore.hpp" #include "../mwinput/inputmanager.hpp" #include "../mwgui/dialogue.hpp" @@ -332,7 +333,15 @@ namespace MWDialogue return true; case '5'://item - if(!selectCompare(comp,0,select.i)) return false; + MWWorld::Ptr player = mEnvironment.mWorld->getPlayer().getPlayer(); + MWWorld::ContainerStore& store = MWWorld::Class::get (player).getContainerStore (player); + + Interpreter::Type_Integer sum = 0; + + for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter) + if (iter->getCellRef().refID==name) + sum += iter->getRefData().getCount(); + if(!selectCompare(comp,sum,select.i)) return false; case '7':// not ID if(select.type==ESM::VT_String ||select.type==ESM::VT_Int)//bug in morrowind here? it's not a short, it's a string