fix for questions

actorid
gugus 13 years ago
parent 11569819db
commit 2707391535

@ -560,16 +560,14 @@ namespace MWDialogue
if(pos==0) if(pos==0)
{ {
knownTopics[*it] = true; knownTopics[*it] = true;
win->addKeyword(*it);
} }
else if(text.substr(pos -1,1) == " ") else if(text.substr(pos -1,1) == " ")
{ {
knownTopics[*it] = true; knownTopics[*it] = true;
win->addKeyword(*it);
} }
} }
} }
updateTopics();
} }
void DialogueManager::startDialogue (const MWWorld::Ptr& actor) void DialogueManager::startDialogue (const MWWorld::Ptr& actor)
@ -692,6 +690,8 @@ namespace MWDialogue
void DialogueManager::updateTopics() void DialogueManager::updateTopics()
{ {
std::list<std::string> keywordList;
actorKnownTopics.clear(); actorKnownTopics.clear();
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow(); MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list; ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list;
@ -709,12 +709,14 @@ namespace MWDialogue
//does the player know the topic? //does the player know the topic?
if(knownTopics.find(toLower(it->first)) != knownTopics.end()) if(knownTopics.find(toLower(it->first)) != knownTopics.end())
{ {
win->addKeyword(it->first); keywordList.push_back(it->first);
break;
} }
} }
} }
} }
} }
win->setKeywords(keywordList);
} }
void DialogueManager::keywordSelected(std::string keyword) void DialogueManager::keywordSelected(std::string keyword)
@ -765,41 +767,27 @@ namespace MWDialogue
{ {
mChoice = mChoiceMap[answere]; mChoice = mChoiceMap[answere];
//ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list;
bool found = false;
//ESMS::RecListT<ESM::Dialogue>::MapType::iterator it;
std::vector<ESM::DialInfo>::const_iterator iter; std::vector<ESM::DialInfo>::const_iterator iter;
//for(it = dialogueList.begin(); it!=dialogueList.end();it++)
if(mDialogueMap.find(mLastTopic) != mDialogueMap.end()) if(mDialogueMap.find(mLastTopic) != mDialogueMap.end())
{ {
ESM::Dialogue ndialogue = mDialogueMap[mLastTopic]; ESM::Dialogue ndialogue = mDialogueMap[mLastTopic];
if(ndialogue.type == ESM::Dialogue::Topic) if(ndialogue.type == ESM::Dialogue::Topic)
{ {
for (iter = ndialogue.mInfo.begin(); for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
iter!=ndialogue.mInfo.end(); ++iter) iter!=ndialogue.mInfo.end(); ++iter)
{ {
if(iter->id == mLastDialogue.id) found = true; if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true))
if(found) break;
}
}
if(found)
{
for (std::vector<ESM::DialInfo>::const_iterator iter2 = iter;
iter2!=ndialogue.mInfo.begin();)
{
--iter2;
if (isMatching (mActor, *iter2) && functionFilter(mActor,*iter2,true))
{ {
mChoiceMap.clear(); mChoiceMap.clear();
mChoice = -1; mChoice = -1;
mIsInChoice = false; mIsInChoice = false;
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow(); MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
std::string text = iter2->response; std::string text = iter->response;
parseText(text); parseText(text);
win->addText(text); win->addText(text);
executeScript(iter2->resultScript); executeScript(iter->resultScript);
mLastTopic = mLastTopic; mLastTopic = mLastTopic;
mLastDialogue = *iter2; mLastDialogue = *iter;
break; break;
} }
} }

@ -113,12 +113,12 @@ void DialogueWindow::startDialogue(std::string npcName)
setText("NpcName", npcName); setText("NpcName", npcName);
} }
void DialogueWindow::addKeyword(std::string keyWord) void DialogueWindow::setKeywords(std::list<std::string> keyWords)
{ {
if(topicsList->findItemIndexWith(keyWord) == MyGUI::ITEM_NONE) topicsList->removeAllItems();
for(std::list<std::string>::iterator it = keyWords.begin(); it != keyWords.end(); it++)
{ {
topicsList->addItem(keyWord); topicsList->addItem(*it);
pTopicsText[keyWord] = " ";
} }
} }

@ -42,7 +42,7 @@ namespace MWGui
void startDialogue(std::string npcName); void startDialogue(std::string npcName);
void stopDialogue(); void stopDialogue();
void addKeyword(std::string keyWord); void setKeywords(std::list<std::string> keyWord);
void removeKeyword(std::string keyWord); void removeKeyword(std::string keyWord);
void addText(std::string text); void addText(std::string text);
void addTitle(std::string text); void addTitle(std::string text);

Loading…
Cancel
Save