From eee5d20809a3d538c5f03d6650dfbd6f7d28dd3f Mon Sep 17 00:00:00 2001 From: gugus Date: Fri, 10 Feb 2012 22:54:17 +0100 Subject: [PATCH] a little fix --- apps/openmw/mwdialogue/dialoguemanager.cpp | 36 +++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwdialogue/dialoguemanager.cpp b/apps/openmw/mwdialogue/dialoguemanager.cpp index 8e70778700..df85430327 100644 --- a/apps/openmw/mwdialogue/dialoguemanager.cpp +++ b/apps/openmw/mwdialogue/dialoguemanager.cpp @@ -121,6 +121,14 @@ namespace namespace MWDialogue { + + //helper function + std::string::size_type find_str_ci(const std::string& str, const std::string& substr,size_t pos) + { + return toLower(str).find(toLower(substr),pos); + } + + bool DialogueManager::isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo::SelectStruct& select) const { @@ -439,9 +447,9 @@ namespace MWDialogue if (isMatching (actor, *iter)) { // start dialogue - std::cout << "found matching info record" << std::endl; + //std::cout << "found matching info record" << std::endl; - std::cout << "response: " << iter->response << std::endl; + //std::cout << "response: " << iter->response << std::endl; if (!iter->sound.empty()) { @@ -450,28 +458,34 @@ namespace MWDialogue if (!iter->resultScript.empty()) { - std::cout << "script: " << iter->resultScript << std::endl; + //std::cout << "script: " << iter->resultScript << std::endl; // TODO execute script } + std::string text = iter->response; + std::map::iterator it; + for(it = actorKnownTopics.begin();it != actorKnownTopics.end();it++) + { + if(find_str_ci(text,it->first,0) !=std::string::npos) + { + std::cout << "fouuuuuuuuuuund"; + knownTopics[it->first] = true; + MWGui::DialogueWindow* win2 = mEnvironment.mWindowManager->getDialogueWindow(); + win2->addKeyword(it->first,it->second); + } + } win->addText(iter->response); - break; + //break; } } } - //helper function - std::string::size_type find_str_ci(const std::string& str, const std::string& substr,size_t pos) - { - return toLower(str).find(toLower(substr),pos); - } - void DialogueManager::keywordSelected(std::string keyword) { std::string text = actorKnownTopics[keyword]; std::map::iterator it; for(it = actorKnownTopics.begin();it != actorKnownTopics.end();it++) { - if(find_str_ci(text,it->second,0) !=std::string::npos) + if(find_str_ci(text,it->first,0) !=std::string::npos) { knownTopics[it->first] = true; MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();