1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

there was no extension in the compiler context. Corrected. But Choice doesn't work.

This commit is contained in:
gugus 2012-03-07 18:44:09 +01:00
parent 39415f0b4a
commit 6f7752633a
5 changed files with 18 additions and 9 deletions

View File

@ -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;

View File

@ -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<Interpreter::Type_Code>& 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";
}
}

View File

@ -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();

View File

@ -204,13 +204,13 @@ void DialogueWindow::addText(std::string text)
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));
for(std::list<std::string>::iterator it = answers.begin();it!=answers.end();it++)
history->addDialogText("#572D21"+question+"#B29154"+" ");
/*for(std::list<std::string>::iterator it = answers.begin();it!=answers.end();it++)
{
history->addDialogText("#572D21"+(*it)+"#B29154"+" ");
}
}*/
}
void DialogueWindow::updateOptions()

View File

@ -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<std::string> answers);
void askQuestion(std::string question,int choice);
protected:
void onSelectTopic(MyGUI::List* _sender, size_t _index);