1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 06:39:49 +00:00
OpenMW/apps/openmw/mwdialogue/dialoguemanagerimp.hpp

95 lines
2.9 KiB
C++
Raw Normal View History

2012-08-11 10:02:51 +00:00
#ifndef GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
#define GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
2010-08-06 16:01:34 +00:00
#include "../mwbase/dialoguemanager.hpp"
2012-11-10 13:31:58 +00:00
#include <map>
#include <list>
2010-08-06 16:01:34 +00:00
#include <components/compiler/streamerrorhandler.hpp>
#include <components/translation/translation.hpp>
2012-02-17 19:20:23 +00:00
2010-08-08 11:21:03 +00:00
#include "../mwworld/ptr.hpp"
2012-11-10 13:31:58 +00:00
#include "../mwscript/compilercontext.hpp"
namespace MWDialogue
2010-08-06 16:01:34 +00:00
{
class DialogueManager : public MWBase::DialogueManager
2010-08-06 16:01:34 +00:00
{
2012-11-10 13:31:58 +00:00
std::map<std::string, ESM::Dialogue> mDialogueMap;
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
Translation::Storage& mTranslationDataStorage;
2012-02-17 19:20:23 +00:00
MWScript::CompilerContext mCompilerContext;
std::ostream mErrorStream;
Compiler::StreamErrorHandler mErrorHandler;
2012-12-08 13:24:15 +00:00
2012-02-17 19:20:23 +00:00
MWWorld::Ptr mActor;
bool mTalkedTo;
2012-02-17 19:20:23 +00:00
int mChoice;
2012-11-10 13:31:58 +00:00
std::map<std::string, int> mChoiceMap;
std::string mLastTopic;
ESM::DialInfo mLastDialogue;
bool mIsInChoice;
2012-11-09 23:29:36 +00:00
float mTemporaryDispositionChange;
float mPermanentDispositionChange;
bool mScriptVerbose;
2012-11-09 23:29:36 +00:00
2012-11-10 13:31:58 +00:00
void parseText (const std::string& text);
void updateTopics();
bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code);
void executeScript (const std::string& script);
void printError (const std::string& error);
2012-12-08 13:24:15 +00:00
void executeTopic (const std::string& topic);
2010-08-06 16:01:34 +00:00
public:
DialogueManager (const Compiler::Extensions& extensions, bool scriptVerbose, Translation::Storage& translationDataStorage);
2010-08-06 16:01:34 +00:00
virtual void startDialogue (const MWWorld::Ptr& actor);
2010-08-06 16:01:34 +00:00
virtual void addTopic (const std::string& topic);
2012-02-10 15:09:43 +00:00
virtual void askQuestion (const std::string& question,int choice);
virtual void goodbye();
2012-11-10 13:31:58 +00:00
virtual MWWorld::Ptr getActor() const;
///< Return the actor the player is currently talking to.
2012-04-04 20:13:57 +00:00
//calbacks for the GUI
virtual void keywordSelected (const std::string& keyword);
virtual void goodbyeSelected();
virtual void questionAnswered (const std::string& answer);
2012-11-09 23:29:36 +00:00
virtual void persuade (int type);
virtual int getTemporaryDispositionChange () const;
2012-11-09 23:38:45 +00:00
virtual void applyTemporaryDispositionChange (int delta);
2010-08-06 16:01:34 +00:00
};
struct HyperTextToken
{
HyperTextToken(const std::string& text, bool link) : mText(text), mLink(link) {}
std::string mText;
bool mLink;
};
// In translations (at least Russian) the links are marked with @#, so
// it should be a function to parse it
std::vector<HyperTextToken> ParseHyperText(const std::string& text);
size_t RemovePseudoAsterisks(std::string& phrase);
2010-08-06 16:01:34 +00:00
}
#endif