1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 15:39:02 +00:00
OpenMW/apps/openmw/mwdialogue/journalimp.hpp
elsid b5ec584be2
Replace ESM::RefId::sEmpty by default constructed RefId where possible
Static const is only required to provide a reference or a pointer when it is not
possible with default constructed temporary.
2023-02-18 01:07:15 +01:00

77 lines
2.5 KiB
C++

#ifndef GAME_MWDIALOG_JOURNAL_H
#define GAME_MWDIALOG_JOURNAL_H
#include "../mwbase/journal.hpp"
#include "quest.hpp"
namespace MWDialogue
{
/// \brief The player's journal
class Journal : public MWBase::Journal
{
TEntryContainer mJournal;
TQuestContainer mQuests;
TTopicContainer mTopics;
private:
Quest& getQuest(const ESM::RefId& id);
Topic& getTopic(const ESM::RefId& id);
bool isThere(const ESM::RefId& topicId, const ESM::RefId& infoId = ESM::RefId()) const;
public:
Journal();
void clear() override;
void addEntry(const ESM::RefId& id, int index, const MWWorld::Ptr& actor) override;
///< Add a journal entry.
/// @param actor Used as context for replacing of escape sequences (%name, etc).
void setJournalIndex(const ESM::RefId& id, int index) override;
///< Set the journal index without adding an entry.
int getJournalIndex(const ESM::RefId& id) const override;
///< Get the journal index.
void addTopic(const ESM::RefId& topicId, const ESM::RefId& infoId, const MWWorld::Ptr& actor) override;
/// \note topicId must be lowercase
void removeLastAddedTopicResponse(const ESM::RefId& topicId, std::string_view actorName) override;
///< Removes the last topic response added for the given topicId and actor name.
/// \note topicId must be lowercase
TEntryIter begin() const override;
///< Iterator pointing to the begin of the main journal.
///
/// \note Iterators to main journal entries will never become invalid.
TEntryIter end() const override;
///< Iterator pointing past the end of the main journal.
TQuestIter questBegin() const override;
///< Iterator pointing to the first quest (sorted by topic ID)
TQuestIter questEnd() const override;
///< Iterator pointing past the last quest.
TTopicIter topicBegin() const override;
///< 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 override;
///< Iterator pointing past the last topic.
int countSavedGameRecords() const override;
void write(ESM::ESMWriter& writer, Loading::Listener& progress) const override;
void readRecord(ESM::ESMReader& reader, uint32_t type) override;
};
}
#endif