2012-08-11 10:02:51 +00:00
|
|
|
#ifndef GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
2012-08-09 08:35:53 +00:00
|
|
|
#define GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
2010-08-06 16:01:34 +00:00
|
|
|
|
2012-08-11 15:30:55 +00:00
|
|
|
#include "../mwbase/dialoguemanager.hpp"
|
|
|
|
|
2010-08-08 11:21:03 +00:00
|
|
|
#include <components/esm/loadinfo.hpp>
|
2010-08-06 16:01:34 +00:00
|
|
|
|
2012-02-18 11:19:42 +00:00
|
|
|
#include <components/compiler/streamerrorhandler.hpp>
|
2012-02-17 19:20:23 +00:00
|
|
|
#include "../mwscript/compilercontext.hpp"
|
|
|
|
#include "../mwscript/interpretercontext.hpp"
|
|
|
|
#include <components/compiler/output.hpp>
|
|
|
|
|
2010-08-08 11:21:03 +00:00
|
|
|
#include "../mwworld/ptr.hpp"
|
2012-08-09 08:35:53 +00:00
|
|
|
|
2012-02-09 18:27:15 +00:00
|
|
|
#include <map>
|
2010-08-08 09:34:03 +00:00
|
|
|
|
2010-08-06 17:16:44 +00:00
|
|
|
namespace MWDialogue
|
2010-08-06 16:01:34 +00:00
|
|
|
{
|
2012-08-09 08:35:53 +00:00
|
|
|
class DialogueManager : public MWBase::DialogueManager
|
2010-08-06 16:01:34 +00:00
|
|
|
{
|
2010-08-08 11:21:03 +00:00
|
|
|
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo::SelectStruct& select) const;
|
|
|
|
|
2010-08-08 09:34:03 +00:00
|
|
|
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo& info) const;
|
|
|
|
|
2012-03-16 16:30:59 +00:00
|
|
|
bool functionFilter(const MWWorld::Ptr& actor, const ESM::DialInfo& info,bool choice);
|
2012-03-14 17:47:29 +00:00
|
|
|
|
2012-02-15 12:23:59 +00:00
|
|
|
void parseText(std::string text);
|
|
|
|
|
2012-03-18 23:19:58 +00:00
|
|
|
void updateTopics();
|
|
|
|
|
|
|
|
std::map<std::string,ESM::Dialogue> mDialogueMap;
|
2012-07-13 10:51:58 +00:00
|
|
|
std::map<std::string,bool> mKnownTopics;// Those are the topics the player knows.
|
|
|
|
std::list<std::string> mActorKnownTopics;
|
2012-02-17 19:20:23 +00:00
|
|
|
|
|
|
|
MWScript::CompilerContext mCompilerContext;
|
2012-02-18 11:19:42 +00:00
|
|
|
std::ostream mErrorStream;
|
|
|
|
Compiler::StreamErrorHandler mErrorHandler;
|
2012-04-23 13:27:03 +00:00
|
|
|
|
2012-02-17 19:20:23 +00:00
|
|
|
|
2012-02-18 11:19:42 +00:00
|
|
|
bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code);
|
2012-02-17 19:20:23 +00:00
|
|
|
void executeScript(std::string script);
|
|
|
|
MWWorld::Ptr mActor;
|
|
|
|
|
|
|
|
void printError(std::string error);
|
2012-02-09 18:27:15 +00:00
|
|
|
|
2012-03-14 17:47:29 +00:00
|
|
|
int mChoice;
|
2012-03-16 16:30:59 +00:00
|
|
|
std::map<std::string,int> mChoiceMap;
|
|
|
|
std::string mLastTopic;
|
|
|
|
ESM::DialInfo mLastDialogue;
|
|
|
|
bool mIsInChoice;
|
2012-03-14 17:47:29 +00:00
|
|
|
|
2010-08-06 16:01:34 +00:00
|
|
|
public:
|
|
|
|
|
2012-04-23 13:27:03 +00:00
|
|
|
DialogueManager (const Compiler::Extensions& extensions);
|
2010-08-06 16:01:34 +00:00
|
|
|
|
2012-08-09 08:35:53 +00:00
|
|
|
virtual void startDialogue (const MWWorld::Ptr& actor);
|
2010-08-06 16:01:34 +00:00
|
|
|
|
2012-08-09 08:35:53 +00:00
|
|
|
virtual void addTopic (const std::string& topic);
|
2012-02-10 15:09:43 +00:00
|
|
|
|
2012-08-09 08:35:53 +00:00
|
|
|
virtual void askQuestion (const std::string& question,int choice);
|
2012-03-07 17:44:09 +00:00
|
|
|
|
2012-08-09 08:35:53 +00:00
|
|
|
virtual void goodbye();
|
2012-05-11 05:18:41 +00:00
|
|
|
|
2012-04-04 20:13:57 +00:00
|
|
|
///get the faction of the actor you are talking with
|
2012-08-09 08:35:53 +00:00
|
|
|
virtual std::string getFaction() const;
|
2012-04-04 20:13:57 +00:00
|
|
|
|
2012-02-05 11:25:23 +00:00
|
|
|
//calbacks for the GUI
|
2012-08-09 08:35:53 +00:00
|
|
|
virtual void keywordSelected (const std::string& keyword);
|
|
|
|
virtual void goodbyeSelected();
|
|
|
|
virtual void questionAnswered (const std::string& answer);
|
2012-02-05 11:25:23 +00:00
|
|
|
|
2010-08-06 16:01:34 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|