OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
dialoguemanagerimp.hpp
Go to the documentation of this file.
1 #ifndef GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
2 #define GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
3 
4 #include "../mwbase/dialoguemanager.hpp"
5 
6 #include <map>
7 #include <set>
8 
11 
12 #include "../mwworld/ptr.hpp"
13 
14 #include "../mwscript/compilercontext.hpp"
15 
16 namespace ESM
17 {
18  struct Dialogue;
19 }
20 
21 namespace MWDialogue
22 {
24  {
25  std::map<std::string, ESM::Dialogue> mDialogueMap;
26  std::set<std::string> mKnownTopics;// Those are the topics the player knows.
27 
28  // Modified faction reactions. <Faction1, <Faction2, Difference> >
29  typedef std::map<std::string, std::map<std::string, int> > ModFactionReactionMap;
31 
32  std::set<std::string> mActorKnownTopics;
33 
36  std::ostream mErrorStream;
38 
40  bool mTalkedTo;
41 
42  int mChoice;
43  std::string mLastTopic; // last topic ID, lowercase
45 
48 
49  void parseText (const std::string& text);
50 
51  void updateTopics();
52  void updateGlobals();
53 
54  bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code);
55  void executeScript (const std::string& script);
56 
57  void executeTopic (const std::string& topic);
58 
59  public:
60 
61  DialogueManager (const Compiler::Extensions& extensions, bool scriptVerbose, Translation::Storage& translationDataStorage);
62 
63  virtual void clear();
64 
65  virtual bool isInChoice() const;
66 
67  virtual void startDialogue (const MWWorld::Ptr& actor);
68 
69  virtual void addTopic (const std::string& topic);
70 
71  virtual void askQuestion (const std::string& question,int choice);
72 
73  virtual void goodbye();
74 
75  virtual bool checkServiceRefused ();
76 
77  virtual void say(const MWWorld::Ptr &actor, const std::string &topic) const;
78 
79  //calbacks for the GUI
80  virtual void keywordSelected (const std::string& keyword);
81  virtual void goodbyeSelected();
82  virtual void questionAnswered (int answer);
83 
84  virtual void persuade (int type);
85  virtual int getTemporaryDispositionChange () const;
86 
88  virtual void applyDispositionChange (int delta);
89 
90  virtual int countSavedGameRecords() const;
91 
92  virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
93 
94  virtual void readRecord (ESM::ESMReader& reader, uint32_t type);
95 
97  virtual void modFactionReaction (const std::string& faction1, const std::string& faction2, int diff);
98 
99  virtual void setFactionReaction (const std::string& faction1, const std::string& faction2, int absolute);
100 
102  virtual int getFactionReaction (const std::string& faction1, const std::string& faction2) const;
103 
105  virtual void clearInfoActor (const MWWorld::Ptr& actor) const;
106  };
107 }
108 
109 #endif
void updateTopics()
Definition: dialoguemanagerimp.cpp:334
Interface for dialogue manager (implemented in MWDialogue)
Definition: dialoguemanager.hpp:27
virtual void modFactionReaction(const std::string &faction1, const std::string &faction2, int diff)
Changes faction1's opinion of faction2 by diff.
Definition: dialoguemanagerimp.cpp:690
void updateGlobals()
Definition: dialoguemanagerimp.cpp:329
std::map< std::string, ESM::Dialogue > mDialogueMap
Definition: dialoguemanagerimp.hpp:25
virtual void say(const MWWorld::Ptr &actor, const std::string &topic) const
Definition: dialoguemanagerimp.cpp:625
Definition: dialoguemanagerimp.hpp:23
virtual bool checkServiceRefused()
Definition: dialoguemanagerimp.cpp:594
virtual void readRecord(ESM::ESMReader &reader, uint32_t type)
Definition: dialoguemanagerimp.cpp:672
virtual bool isInChoice() const
Definition: dialoguemanagerimp.cpp:442
Definition: esmreader.hpp:21
virtual int countSavedGameRecords() const
Definition: dialoguemanagerimp.cpp:650
std::set< std::string > mKnownTopics
Definition: dialoguemanagerimp.hpp:26
virtual void goodbye()
Definition: dialoguemanagerimp.cpp:523
virtual void persuade(int type)
Definition: dialoguemanagerimp.cpp:532
virtual void applyDispositionChange(int delta)
Definition: dialoguemanagerimp.cpp:589
virtual void addTopic(const std::string &topic)
Definition: dialoguemanagerimp.cpp:82
Error handler implementation: Write errors into stream.
Definition: streamerrorhandler.hpp:12
int mChoice
Definition: dialoguemanagerimp.hpp:42
Definition: translation.hpp:9
virtual void startDialogue(const MWWorld::Ptr &actor)
Definition: dialoguemanagerimp.cpp:115
virtual void questionAnswered(int answer)
Definition: dialoguemanagerimp.cpp:466
Definition: loadinglistener.hpp:8
MWScript::CompilerContext mCompilerContext
Definition: dialoguemanagerimp.hpp:35
virtual void clearInfoActor(const MWWorld::Ptr &actor) const
Removes the last added topic response for the given actor from the journal.
Definition: dialoguemanagerimp.cpp:738
std::map< std::string, std::map< std::string, int > > ModFactionReactionMap
Definition: dialoguemanagerimp.hpp:29
bool mIsInChoice
Definition: dialoguemanagerimp.hpp:44
virtual void goodbyeSelected()
Definition: dialoguemanagerimp.cpp:447
Definition: esmwriter.hpp:17
DialogueManager()
Definition: dialoguemanager.hpp:37
Collection of compiler extensions.
Definition: extensions.hpp:39
std::ostream mErrorStream
Definition: dialoguemanagerimp.hpp:36
std::string mLastTopic
Definition: dialoguemanagerimp.hpp:43
virtual void setFactionReaction(const std::string &faction1, const std::string &faction2, int absolute)
Definition: dialoguemanagerimp.cpp:705
bool mTalkedTo
Definition: dialoguemanagerimp.hpp:40
Compiler::StreamErrorHandler mErrorHandler
Definition: dialoguemanagerimp.hpp:37
virtual int getFactionReaction(const std::string &faction1, const std::string &faction2) const
Definition: dialoguemanagerimp.cpp:718
bool compile(const std::string &cmd, std::vector< Interpreter::Type_Code > &code)
Definition: dialoguemanagerimp.cpp:193
virtual void keywordSelected(const std::string &keyword)
Definition: dialoguemanagerimp.cpp:426
float mPermanentDispositionChange
Definition: dialoguemanagerimp.hpp:47
virtual int getTemporaryDispositionChange() const
Definition: dialoguemanagerimp.cpp:584
ModFactionReactionMap mChangedFactionReaction
Definition: dialoguemanagerimp.hpp:30
MWWorld::Ptr mActor
Definition: dialoguemanagerimp.hpp:39
virtual void askQuestion(const std::string &question, int choice)
Definition: dialoguemanagerimp.cpp:515
virtual void clear()
Definition: dialoguemanagerimp.cpp:74
std::set< std::string > mActorKnownTopics
Definition: dialoguemanagerimp.hpp:32
void parseText(const std::string &text)
Definition: dialoguemanagerimp.cpp:87
int code
Definition: crashcatcher.cpp:70
virtual void write(ESM::ESMWriter &writer, Loading::Listener &progress) const
Definition: dialoguemanagerimp.cpp:655
void executeTopic(const std::string &topic)
Definition: dialoguemanagerimp.cpp:266
float mTemporaryDispositionChange
Definition: dialoguemanagerimp.hpp:46
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
void executeScript(const std::string &script)
Definition: dialoguemanagerimp.cpp:247
Translation::Storage & mTranslationDataStorage
Definition: dialoguemanagerimp.hpp:34
Definition: compilercontext.hpp:8