mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
there was no extension in the compiler context. Corrected. But Choice doesn't work.
This commit is contained in:
parent
39415f0b4a
commit
6f7752633a
@ -360,7 +360,7 @@ void OMW::Engine::go()
|
|||||||
|
|
||||||
// Create dialog system
|
// Create dialog system
|
||||||
mEnvironment.mJournal = new MWDialogue::Journal (mEnvironment);
|
mEnvironment.mJournal = new MWDialogue::Journal (mEnvironment);
|
||||||
mEnvironment.mDialogueManager = new MWDialogue::DialogueManager (mEnvironment);
|
mEnvironment.mDialogueManager = new MWDialogue::DialogueManager (mEnvironment,mExtensions);
|
||||||
|
|
||||||
// load cell
|
// load cell
|
||||||
ESM::Position pos;
|
ESM::Position pos;
|
||||||
|
@ -411,10 +411,11 @@ namespace MWDialogue
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogueManager::DialogueManager (MWWorld::Environment& environment) :
|
DialogueManager::DialogueManager (MWWorld::Environment& environment,const Compiler::Extensions& extensions) :
|
||||||
mEnvironment (environment),mCompilerContext (MWScript::CompilerContext::Type_Dialgoue, environment),
|
mEnvironment (environment),mCompilerContext (MWScript::CompilerContext::Type_Dialgoue, environment),
|
||||||
mErrorStream(std::cout.rdbuf()),mErrorHandler(mErrorStream)
|
mErrorStream(std::cout.rdbuf()),mErrorHandler(mErrorStream)
|
||||||
{
|
{
|
||||||
|
mCompilerContext.setExtensions (&extensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::addTopic(std::string topic)
|
void DialogueManager::addTopic(std::string topic)
|
||||||
@ -522,6 +523,7 @@ namespace MWDialogue
|
|||||||
|
|
||||||
bool DialogueManager::compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code)
|
bool DialogueManager::compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code)
|
||||||
{
|
{
|
||||||
|
std::cout << cmd << std::endl;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mErrorHandler.reset();
|
mErrorHandler.reset();
|
||||||
@ -543,7 +545,6 @@ namespace MWDialogue
|
|||||||
Compiler::ScriptParser parser(mErrorHandler,mCompilerContext, locals);
|
Compiler::ScriptParser parser(mErrorHandler,mCompilerContext, locals);
|
||||||
|
|
||||||
scanner.scan (parser);
|
scanner.scan (parser);
|
||||||
|
|
||||||
if(mErrorHandler.isGood())
|
if(mErrorHandler.isGood())
|
||||||
{
|
{
|
||||||
parser.getCode(code);
|
parser.getCode(code);
|
||||||
@ -606,4 +607,10 @@ namespace MWDialogue
|
|||||||
win->addText(error);
|
win->addText(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogueManager::askQuestion(std::string question, int choice)
|
||||||
|
{
|
||||||
|
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
||||||
|
win->askQuestion(question,choice);
|
||||||
|
std::cout << "choice";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,12 +44,14 @@ namespace MWDialogue
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DialogueManager (MWWorld::Environment& environment);
|
DialogueManager (MWWorld::Environment& environment,const Compiler::Extensions& extensions);
|
||||||
|
|
||||||
void startDialogue (const MWWorld::Ptr& actor);
|
void startDialogue (const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
void addTopic(std::string topic);
|
void addTopic(std::string topic);
|
||||||
|
|
||||||
|
void askQuestion(std::string question,int choice);
|
||||||
|
|
||||||
//calbacks for the GUI
|
//calbacks for the GUI
|
||||||
void keywordSelected(std::string keyword);
|
void keywordSelected(std::string keyword);
|
||||||
void goodbyeSelected();
|
void goodbyeSelected();
|
||||||
|
@ -204,13 +204,13 @@ void DialogueWindow::addText(std::string text)
|
|||||||
history->addDialogText("#B29154"+parseText(text)+"#B29154");
|
history->addDialogText("#B29154"+parseText(text)+"#B29154");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::askQuestion(std::string question,std::list<std::string> answers)
|
void DialogueWindow::askQuestion(std::string question,int choice)
|
||||||
{
|
{
|
||||||
history->addDialogText(parseText(question));
|
history->addDialogText("#572D21"+question+"#B29154"+" ");
|
||||||
for(std::list<std::string>::iterator it = answers.begin();it!=answers.end();it++)
|
/*for(std::list<std::string>::iterator it = answers.begin();it!=answers.end();it++)
|
||||||
{
|
{
|
||||||
history->addDialogText("#572D21"+(*it)+"#B29154"+" ");
|
history->addDialogText("#572D21"+(*it)+"#B29154"+" ");
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::updateOptions()
|
void DialogueWindow::updateOptions()
|
||||||
|
@ -45,7 +45,7 @@ namespace MWGui
|
|||||||
void addKeyword(std::string keyWord,std::string topicText);
|
void addKeyword(std::string keyWord,std::string topicText);
|
||||||
void removeKeyword(std::string keyWord);
|
void removeKeyword(std::string keyWord);
|
||||||
void addText(std::string text);
|
void addText(std::string text);
|
||||||
void askQuestion(std::string question,std::list<std::string> answers);
|
void askQuestion(std::string question,int choice);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onSelectTopic(MyGUI::List* _sender, size_t _index);
|
void onSelectTopic(MyGUI::List* _sender, size_t _index);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user