diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index bff952ab8c..5322cb90d6 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -360,7 +360,7 @@ void OMW::Engine::go() // Create dialog system mEnvironment.mJournal = new MWDialogue::Journal (mEnvironment); - mEnvironment.mDialogueManager = new MWDialogue::DialogueManager (mEnvironment); + mEnvironment.mDialogueManager = new MWDialogue::DialogueManager (mEnvironment,mExtensions); // load cell ESM::Position pos; diff --git a/apps/openmw/mwdialogue/dialoguemanager.cpp b/apps/openmw/mwdialogue/dialoguemanager.cpp index 5bcf465990..498485b975 100644 --- a/apps/openmw/mwdialogue/dialoguemanager.cpp +++ b/apps/openmw/mwdialogue/dialoguemanager.cpp @@ -411,10 +411,11 @@ namespace MWDialogue return true; } - DialogueManager::DialogueManager (MWWorld::Environment& environment) : + DialogueManager::DialogueManager (MWWorld::Environment& environment,const Compiler::Extensions& extensions) : mEnvironment (environment),mCompilerContext (MWScript::CompilerContext::Type_Dialgoue, environment), mErrorStream(std::cout.rdbuf()),mErrorHandler(mErrorStream) { + mCompilerContext.setExtensions (&extensions); } void DialogueManager::addTopic(std::string topic) @@ -522,6 +523,7 @@ namespace MWDialogue bool DialogueManager::compile (const std::string& cmd,std::vector& code) { + std::cout << cmd << std::endl; try { mErrorHandler.reset(); @@ -543,7 +545,6 @@ namespace MWDialogue Compiler::ScriptParser parser(mErrorHandler,mCompilerContext, locals); scanner.scan (parser); - if(mErrorHandler.isGood()) { parser.getCode(code); @@ -606,4 +607,10 @@ namespace MWDialogue win->addText(error); } + void DialogueManager::askQuestion(std::string question, int choice) + { + MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow(); + win->askQuestion(question,choice); + std::cout << "choice"; + } } diff --git a/apps/openmw/mwdialogue/dialoguemanager.hpp b/apps/openmw/mwdialogue/dialoguemanager.hpp index 600171d331..83d4832ba0 100644 --- a/apps/openmw/mwdialogue/dialoguemanager.hpp +++ b/apps/openmw/mwdialogue/dialoguemanager.hpp @@ -44,12 +44,14 @@ namespace MWDialogue public: - DialogueManager (MWWorld::Environment& environment); + DialogueManager (MWWorld::Environment& environment,const Compiler::Extensions& extensions); void startDialogue (const MWWorld::Ptr& actor); void addTopic(std::string topic); + void askQuestion(std::string question,int choice); + //calbacks for the GUI void keywordSelected(std::string keyword); void goodbyeSelected(); diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index f336d8a38d..01466a7dc8 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -204,13 +204,13 @@ void DialogueWindow::addText(std::string text) history->addDialogText("#B29154"+parseText(text)+"#B29154"); } -void DialogueWindow::askQuestion(std::string question,std::list answers) +void DialogueWindow::askQuestion(std::string question,int choice) { - history->addDialogText(parseText(question)); - for(std::list::iterator it = answers.begin();it!=answers.end();it++) + history->addDialogText("#572D21"+question+"#B29154"+" "); + /*for(std::list::iterator it = answers.begin();it!=answers.end();it++) { history->addDialogText("#572D21"+(*it)+"#B29154"+" "); - } + }*/ } void DialogueWindow::updateOptions() diff --git a/apps/openmw/mwgui/dialogue.hpp b/apps/openmw/mwgui/dialogue.hpp index 232721f0aa..750a1c33ee 100644 --- a/apps/openmw/mwgui/dialogue.hpp +++ b/apps/openmw/mwgui/dialogue.hpp @@ -45,7 +45,7 @@ namespace MWGui void addKeyword(std::string keyWord,std::string topicText); void removeKeyword(std::string keyWord); void addText(std::string text); - void askQuestion(std::string question,std::list answers); + void askQuestion(std::string question,int choice); protected: void onSelectTopic(MyGUI::List* _sender, size_t _index);