forked from mirror/openmw-tes3mp
Issue #107: DialogueManager is accessed only through the interface class from now on
This commit is contained in:
parent
e6ede480c7
commit
923109b260
11 changed files with 78 additions and 28 deletions
|
@ -32,7 +32,7 @@ add_openmw_dir (mwgui
|
||||||
)
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwdialogue
|
add_openmw_dir (mwdialogue
|
||||||
dialoguemanager journal journalentry quest topic
|
dialoguemanagerimp journal journalentry quest topic
|
||||||
)
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwscript
|
add_openmw_dir (mwscript
|
||||||
|
@ -64,7 +64,7 @@ add_openmw_dir (mwmechanics
|
||||||
)
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwbase
|
add_openmw_dir (mwbase
|
||||||
environment world scriptmanager
|
environment world scriptmanager dialoguemanager
|
||||||
)
|
)
|
||||||
|
|
||||||
# Main executable
|
# Main executable
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include "mwclass/classes.hpp"
|
#include "mwclass/classes.hpp"
|
||||||
|
|
||||||
#include "mwdialogue/dialoguemanager.hpp"
|
#include "mwdialogue/dialoguemanagerimp.hpp"
|
||||||
#include "mwdialogue/journal.hpp"
|
#include "mwdialogue/journal.hpp"
|
||||||
|
|
||||||
#include "mwmechanics/mechanicsmanager.hpp"
|
#include "mwmechanics/mechanicsmanager.hpp"
|
||||||
|
|
45
apps/openmw/mwbase/dialoguemanager.hpp
Normal file
45
apps/openmw/mwbase/dialoguemanager.hpp
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#ifndef GAME_MWBASE_DIALOGUEMANAGERIMP_H
|
||||||
|
#define GAME_MWBASE_DIALOGUEMANAGERIMP_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
class Ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MWBase
|
||||||
|
{
|
||||||
|
class DialogueManager
|
||||||
|
{
|
||||||
|
DialogueManager (const DialogueManager&);
|
||||||
|
///< not implemented
|
||||||
|
|
||||||
|
DialogueManager& operator= (const DialogueManager&);
|
||||||
|
///< not implemented
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DialogueManager() {}
|
||||||
|
|
||||||
|
virtual ~DialogueManager() {}
|
||||||
|
|
||||||
|
virtual void startDialogue (const MWWorld::Ptr& actor) = 0;
|
||||||
|
|
||||||
|
virtual void addTopic (const std::string& topic) = 0;
|
||||||
|
|
||||||
|
virtual void askQuestion (const std::string& question,int choice) = 0;
|
||||||
|
|
||||||
|
virtual void goodbye() = 0;
|
||||||
|
|
||||||
|
///get the faction of the actor you are talking with
|
||||||
|
virtual std::string getFaction() const = 0;
|
||||||
|
|
||||||
|
//calbacks for the GUI
|
||||||
|
virtual void keywordSelected (const std::string& keyword) = 0;
|
||||||
|
virtual void goodbyeSelected() = 0;
|
||||||
|
virtual void questionAnswered (const std::string& answer) = 0;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -7,13 +7,13 @@
|
||||||
|
|
||||||
#include "../mwsound/soundmanager.hpp"
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
#include "../mwdialogue/dialoguemanager.hpp"
|
|
||||||
#include "../mwdialogue/journal.hpp"
|
#include "../mwdialogue/journal.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||||
|
|
||||||
#include "world.hpp"
|
#include "world.hpp"
|
||||||
#include "scriptmanager.hpp"
|
#include "scriptmanager.hpp"
|
||||||
|
#include "dialoguemanager.hpp"
|
||||||
|
|
||||||
MWBase::Environment *MWBase::Environment::sThis = 0;
|
MWBase::Environment *MWBase::Environment::sThis = 0;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ void MWBase::Environment::setMechanicsManager (MWMechanics::MechanicsManager *me
|
||||||
mMechanicsManager = mechanicsManager;
|
mMechanicsManager = mechanicsManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWBase::Environment::setDialogueManager (MWDialogue::DialogueManager *dialogueManager)
|
void MWBase::Environment::setDialogueManager (DialogueManager *dialogueManager)
|
||||||
{
|
{
|
||||||
mDialogueManager = dialogueManager;
|
mDialogueManager = dialogueManager;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ MWMechanics::MechanicsManager *MWBase::Environment::getMechanicsManager() const
|
||||||
return mMechanicsManager;
|
return mMechanicsManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWDialogue::DialogueManager *MWBase::Environment::getDialogueManager() const
|
MWBase::DialogueManager *MWBase::Environment::getDialogueManager() const
|
||||||
{
|
{
|
||||||
assert (mDialogueManager);
|
assert (mDialogueManager);
|
||||||
return mDialogueManager;
|
return mDialogueManager;
|
||||||
|
|
|
@ -18,7 +18,6 @@ namespace MWMechanics
|
||||||
|
|
||||||
namespace MWDialogue
|
namespace MWDialogue
|
||||||
{
|
{
|
||||||
class DialogueManager;
|
|
||||||
class Journal;
|
class Journal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +30,7 @@ namespace MWBase
|
||||||
{
|
{
|
||||||
class World;
|
class World;
|
||||||
class ScriptManager;
|
class ScriptManager;
|
||||||
|
class DialogueManager;
|
||||||
|
|
||||||
/// \brief Central hub for mw-subsystems
|
/// \brief Central hub for mw-subsystems
|
||||||
///
|
///
|
||||||
|
@ -47,7 +47,7 @@ namespace MWBase
|
||||||
ScriptManager *mScriptManager;
|
ScriptManager *mScriptManager;
|
||||||
MWGui::WindowManager *mWindowManager;
|
MWGui::WindowManager *mWindowManager;
|
||||||
MWMechanics::MechanicsManager *mMechanicsManager;
|
MWMechanics::MechanicsManager *mMechanicsManager;
|
||||||
MWDialogue::DialogueManager *mDialogueManager;
|
DialogueManager *mDialogueManager;
|
||||||
MWDialogue::Journal *mJournal;
|
MWDialogue::Journal *mJournal;
|
||||||
MWInput::MWInputManager *mInputManager;
|
MWInput::MWInputManager *mInputManager;
|
||||||
float mFrameDuration;
|
float mFrameDuration;
|
||||||
|
@ -74,7 +74,7 @@ namespace MWBase
|
||||||
|
|
||||||
void setMechanicsManager (MWMechanics::MechanicsManager *mechanicsManager);
|
void setMechanicsManager (MWMechanics::MechanicsManager *mechanicsManager);
|
||||||
|
|
||||||
void setDialogueManager (MWDialogue::DialogueManager *dialogueManager);
|
void setDialogueManager (DialogueManager *dialogueManager);
|
||||||
|
|
||||||
void setJournal (MWDialogue::Journal *journal);
|
void setJournal (MWDialogue::Journal *journal);
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ namespace MWBase
|
||||||
|
|
||||||
MWMechanics::MechanicsManager *getMechanicsManager() const;
|
MWMechanics::MechanicsManager *getMechanicsManager() const;
|
||||||
|
|
||||||
MWDialogue::DialogueManager *getDialogueManager() const;
|
DialogueManager *getDialogueManager() const;
|
||||||
|
|
||||||
MWDialogue::Journal *getJournal() const;
|
MWDialogue::Journal *getJournal() const;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include "dialoguemanager.hpp"
|
#include "dialoguemanagerimp.hpp"
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef GAME_MMDIALOG_DIALOGUEMANAGER_H
|
#ifndef GAME_MMDIALOG_DIALOGUEMANAGERIMP_H
|
||||||
#define GAME_MWDIALOG_DIALOGUEMANAGER_H
|
#define GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
||||||
|
|
||||||
#include <components/esm/loadinfo.hpp>
|
#include <components/esm/loadinfo.hpp>
|
||||||
|
|
||||||
|
@ -8,12 +8,15 @@
|
||||||
#include "../mwscript/interpretercontext.hpp"
|
#include "../mwscript/interpretercontext.hpp"
|
||||||
#include <components/compiler/output.hpp>
|
#include <components/compiler/output.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace MWDialogue
|
namespace MWDialogue
|
||||||
{
|
{
|
||||||
class DialogueManager
|
class DialogueManager : public MWBase::DialogueManager
|
||||||
{
|
{
|
||||||
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo::SelectStruct& select) const;
|
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo::SelectStruct& select) const;
|
||||||
|
|
||||||
|
@ -50,21 +53,21 @@ namespace MWDialogue
|
||||||
|
|
||||||
DialogueManager (const Compiler::Extensions& extensions);
|
DialogueManager (const Compiler::Extensions& extensions);
|
||||||
|
|
||||||
void startDialogue (const MWWorld::Ptr& actor);
|
virtual void startDialogue (const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
void addTopic (const std::string& topic);
|
virtual void addTopic (const std::string& topic);
|
||||||
|
|
||||||
void askQuestion (const std::string& question,int choice);
|
virtual void askQuestion (const std::string& question,int choice);
|
||||||
|
|
||||||
void goodbye();
|
virtual void goodbye();
|
||||||
|
|
||||||
///get the faction of the actor you are talking with
|
///get the faction of the actor you are talking with
|
||||||
std::string getFaction() const;
|
virtual std::string getFaction() const;
|
||||||
|
|
||||||
//calbacks for the GUI
|
//calbacks for the GUI
|
||||||
void keywordSelected (const std::string& keyword);
|
virtual void keywordSelected (const std::string& keyword);
|
||||||
void goodbyeSelected();
|
virtual void goodbyeSelected();
|
||||||
void questionAnswered (const std::string& answer);
|
virtual void questionAnswered (const std::string& answer);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -9,7 +9,8 @@
|
||||||
#include <components/esm_store/store.hpp>
|
#include <components/esm_store/store.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwdialogue/dialoguemanager.hpp"
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
#include "dialogue_history.hpp"
|
#include "dialogue_history.hpp"
|
||||||
#include "window_manager.hpp"
|
#include "window_manager.hpp"
|
||||||
|
|
|
@ -7,8 +7,10 @@
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
|
|
||||||
#include "../mwdialogue/journal.hpp"
|
#include "../mwdialogue/journal.hpp"
|
||||||
#include "../mwdialogue/dialoguemanager.hpp"
|
|
||||||
|
|
||||||
#include "interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
#include "ref.hpp"
|
#include "ref.hpp"
|
||||||
|
@ -84,7 +86,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||||
{
|
{
|
||||||
MWDialogue::DialogueManager* dialogue = MWBase::Environment::get().getDialogueManager();
|
MWBase::DialogueManager* dialogue = MWBase::Environment::get().getDialogueManager();
|
||||||
while(arg0>0)
|
while(arg0>0)
|
||||||
{
|
{
|
||||||
std::string question = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string question = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
@ -26,7 +27,6 @@
|
||||||
#include "interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
#include "ref.hpp"
|
#include "ref.hpp"
|
||||||
|
|
||||||
#include "../mwdialogue/dialoguemanager.hpp"
|
|
||||||
|
|
||||||
namespace MWScript
|
namespace MWScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
#include "actiontalk.hpp"
|
#include "actiontalk.hpp"
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
#include "../mwdialogue/dialoguemanager.hpp"
|
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue