Issue #107: Journal is accessed only through the interface class from now on

actorid
Marc Zinnschlag 13 years ago
parent a84145a087
commit d00d40cc3f

@ -32,7 +32,7 @@ add_openmw_dir (mwgui
)
add_openmw_dir (mwdialogue
dialoguemanagerimp journal journalentry quest topic
dialoguemanagerimp journalimp journalentry quest topic
)
add_openmw_dir (mwscript
@ -64,7 +64,7 @@ add_openmw_dir (mwmechanics
)
add_openmw_dir (mwbase
environment world scriptmanager dialoguemanager
environment world scriptmanager dialoguemanager journal
)
# Main executable

@ -30,7 +30,7 @@
#include "mwclass/classes.hpp"
#include "mwdialogue/dialoguemanagerimp.hpp"
#include "mwdialogue/journal.hpp"
#include "mwdialogue/journalimp.hpp"
#include "mwmechanics/mechanicsmanager.hpp"

@ -7,13 +7,12 @@
#include "../mwsound/soundmanager.hpp"
#include "../mwdialogue/journal.hpp"
#include "../mwmechanics/mechanicsmanager.hpp"
#include "world.hpp"
#include "scriptmanager.hpp"
#include "dialoguemanager.hpp"
#include "journal.hpp"
MWBase::Environment *MWBase::Environment::sThis = 0;
@ -61,7 +60,7 @@ void MWBase::Environment::setDialogueManager (DialogueManager *dialogueManager)
mDialogueManager = dialogueManager;
}
void MWBase::Environment::setJournal (MWDialogue::Journal *journal)
void MWBase::Environment::setJournal (Journal *journal)
{
mJournal = journal;
}
@ -112,7 +111,7 @@ MWBase::DialogueManager *MWBase::Environment::getDialogueManager() const
return mDialogueManager;
}
MWDialogue::Journal *MWBase::Environment::getJournal() const
MWBase::Journal *MWBase::Environment::getJournal() const
{
assert (mJournal);
return mJournal;

@ -16,11 +16,6 @@ namespace MWMechanics
class MechanicsManager;
}
namespace MWDialogue
{
class Journal;
}
namespace MWInput
{
struct MWInputManager;
@ -31,6 +26,7 @@ namespace MWBase
class World;
class ScriptManager;
class DialogueManager;
class Journal;
/// \brief Central hub for mw-subsystems
///
@ -48,7 +44,7 @@ namespace MWBase
MWGui::WindowManager *mWindowManager;
MWMechanics::MechanicsManager *mMechanicsManager;
DialogueManager *mDialogueManager;
MWDialogue::Journal *mJournal;
Journal *mJournal;
MWInput::MWInputManager *mInputManager;
float mFrameDuration;
@ -76,7 +72,7 @@ namespace MWBase
void setDialogueManager (DialogueManager *dialogueManager);
void setJournal (MWDialogue::Journal *journal);
void setJournal (Journal *journal);
void setInputManager (MWInput::MWInputManager *inputManager);
@ -95,7 +91,7 @@ namespace MWBase
DialogueManager *getDialogueManager() const;
MWDialogue::Journal *getJournal() const;
Journal *getJournal() const;
MWInput::MWInputManager *getInputManager() const;

@ -0,0 +1,76 @@
#ifndef GAME_MWBASE_JOURNAL_H
#define GAME_MWBASE_JOURNAL_H
#include <string>
#include <deque>
#include <map>
namespace MWDialogue
{
class Quest;
class Topic;
struct StampedJournalEntry;
}
namespace MWBase
{
/// \brief Interface for the player's journal (implemented in MWDialogue)
class Journal
{
Journal (const Journal&);
///< not implemented
Journal& operator= (const Journal&);
///< not implemented
public:
typedef std::deque<MWDialogue::StampedJournalEntry> TEntryContainer;
typedef TEntryContainer::const_iterator TEntryIter;
typedef std::map<std::string, MWDialogue::Quest> TQuestContainer; // topc, quest
typedef TQuestContainer::const_iterator TQuestIter;
typedef std::map<std::string, MWDialogue::Topic> TTopicContainer; // topic-id, topic-content
typedef TTopicContainer::const_iterator TTopicIter;
public:
Journal() {}
virtual ~Journal() {}
virtual void addEntry (const std::string& id, int index) = 0;
///< Add a journal entry.
virtual void setJournalIndex (const std::string& id, int index) = 0;
///< Set the journal index without adding an entry.
virtual int getJournalIndex (const std::string& id) const = 0;
///< Get the journal index.
virtual void addTopic (const std::string& topicId, const std::string& infoId) = 0;
virtual TEntryIter begin() const = 0;
///< Iterator pointing to the begin of the main journal.
///
/// \note Iterators to main journal entries will never become invalid.
virtual TEntryIter end() const = 0;
///< Iterator pointing past the end of the main journal.
virtual TQuestIter questBegin() const = 0;
///< Iterator pointing to the first quest (sorted by topic ID)
virtual TQuestIter questEnd() const = 0;
///< Iterator pointing past the last quest.
virtual TTopicIter topicBegin() const = 0;
///< Iterator pointing to the first topic (sorted by topic ID)
///
/// \note The topic ID is identical with the user-visible topic string.
virtual TTopicIter topicEnd() const = 0;
///< Iterator pointing past the last topic.
};
}
#endif

@ -12,6 +12,7 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/scriptmanager.hpp"
#include "../mwbase/journal.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/refdata.hpp"
@ -22,8 +23,6 @@
#include "../mwgui/dialogue.hpp"
#include "../mwgui/window_manager.hpp"
#include "journal.hpp"
#include <iostream>
#include "../mwscript/extensions.hpp"

@ -1,5 +1,5 @@
#include "journal.hpp"
#include "journalimp.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"

@ -1,9 +1,7 @@
#ifndef GAME_MMDIALOG_JOURNAL_H
#define GAME_MWDIALOG_JOURNAL_H
#include <string>
#include <deque>
#include <map>
#include "../mwbase/journal.hpp"
#include "journalentry.hpp"
#include "quest.hpp"
@ -11,19 +9,8 @@
namespace MWDialogue
{
/// \brief The player's journal
class Journal
class Journal : public MWBase::Journal
{
public:
typedef std::deque<StampedJournalEntry> TEntryContainer;
typedef TEntryContainer::const_iterator TEntryIter;
typedef std::map<std::string, Quest> TQuestContainer; // topc, quest
typedef TQuestContainer::const_iterator TQuestIter;
typedef std::map<std::string, Topic> TTopicContainer; // topic-id, topic-content
typedef TTopicContainer::const_iterator TTopicIter;
private:
TEntryContainer mJournal;
TQuestContainer mQuests;
TTopicContainer mTopics;
@ -34,37 +21,37 @@ namespace MWDialogue
Journal();
void addEntry (const std::string& id, int index);
virtual void addEntry (const std::string& id, int index);
///< Add a journal entry.
void setJournalIndex (const std::string& id, int index);
virtual void setJournalIndex (const std::string& id, int index);
///< Set the journal index without adding an entry.
int getJournalIndex (const std::string& id) const;
virtual int getJournalIndex (const std::string& id) const;
///< Get the journal index.
void addTopic (const std::string& topicId, const std::string& infoId);
virtual void addTopic (const std::string& topicId, const std::string& infoId);
TEntryIter begin() const;
virtual TEntryIter begin() const;
///< Iterator pointing to the begin of the main journal.
///
/// \note Iterators to main journal entries will never become invalid.
TEntryIter end() const;
virtual TEntryIter end() const;
///< Iterator pointing past the end of the main journal.
TQuestIter questBegin() const;
virtual TQuestIter questBegin() const;
///< Iterator pointing to the first quest (sorted by topic ID)
TQuestIter questEnd() const;
virtual TQuestIter questEnd() const;
///< Iterator pointing past the last quest.
TTopicIter topicBegin() const;
virtual TTopicIter topicBegin() const;
///< Iterator pointing to the first topic (sorted by topic ID)
///
/// \note The topic ID is identical with the user-visible topic string.
TTopicIter topicEnd() const;
virtual TTopicIter topicEnd() const;
///< Iterator pointing past the last topic.
};
}

@ -2,11 +2,12 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwdialogue/journal.hpp"
#include "../mwbase/journal.hpp"
#include "../mwsound/soundmanager.hpp"
#include "../mwdialogue/journalentry.hpp"
#include "window_manager.hpp"
namespace

@ -9,8 +9,7 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/dialoguemanager.hpp"
#include "../mwdialogue/journal.hpp"
#include "../mwbase/journal.hpp"
#include "interpretercontext.hpp"
#include "ref.hpp"

Loading…
Cancel
Save