Parse dialogue text for keywords after the resultscript runs (Fixes #4210)

pull/337/head
scrawl 7 years ago
parent 7c5d2a1ac4
commit c36d250044

@ -77,6 +77,7 @@ namespace MWDialogue
void DialogueManager::parseText (const std::string& text) void DialogueManager::parseText (const std::string& text)
{ {
updateActorKnownTopics();
std::vector<HyperTextParser::Token> hypertext = HyperTextParser::parseHyperText(text); std::vector<HyperTextParser::Token> hypertext = HyperTextParser::parseHyperText(text);
for (std::vector<HyperTextParser::Token>::iterator tok = hypertext.begin(); tok != hypertext.end(); ++tok) for (std::vector<HyperTextParser::Token>::iterator tok = hypertext.begin(); tok != hypertext.end(); ++tok)
@ -145,18 +146,13 @@ namespace MWDialogue
// TODO play sound // TODO play sound
} }
// first topics update so that parseText knows the keywords to highlight
updateActorKnownTopics();
parseText (info->mResponse);
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor); MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
callback->addResponse("", Interpreter::fixDefinesDialog(info->mResponse, interpreterContext)); callback->addResponse("", Interpreter::fixDefinesDialog(info->mResponse, interpreterContext));
executeScript (info->mResultScript, mActor); executeScript (info->mResultScript, mActor);
mLastTopic = it->mId; mLastTopic = it->mId;
// update topics again to accommodate changes resulting from executeScript parseText (info->mResponse);
updateActorKnownTopics();
return true; return true;
} }
@ -252,8 +248,6 @@ namespace MWDialogue
const ESM::DialInfo* info = filter.search(dialogue, true); const ESM::DialInfo* info = filter.search(dialogue, true);
if (info) if (info)
{ {
parseText (info->mResponse);
std::string title; std::string title;
if (dialogue.mType==ESM::Dialogue::Persuasion) if (dialogue.mType==ESM::Dialogue::Persuasion)
{ {
@ -292,6 +286,8 @@ namespace MWDialogue
executeScript (info->mResultScript, mActor); executeScript (info->mResultScript, mActor);
parseText (info->mResponse);
mLastTopic = topic; mLastTopic = topic;
} }
} }

Loading…
Cancel
Save