1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-28 18:18:52 +00:00
OpenMW/apps/openmw/mwbase/journal.hpp
fteppe 125b21de20 Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID

Slowly going through all the changes to make, still hundreds of errors

a lot of functions/structures use std::string or stringview to designate an ID. So it takes time

Continues slowly replacing ids. There are technically more and more compilation errors

I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type

Continue moving forward, changes to the stores

slowly moving along

Starting to see the fruit of those changes.

still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.

More replacements. Things are starting to get easier

I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.

Still moving forward, and for the first time error count is going down!

Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably

Cells are back to using string for the name, haven't fixed everything yet. Many other changes

Under the bar of 400 compilation errors.

more good progress <100 compile errors!

More progress

Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string

some more progress on other fronts

Mostly game settings clean

one error opened a lot of other errors. Down to 18, but more will prbably appear

only link errors left??

Fixed link errors

OpenMW compiles, and launches, with some issues, but still!
2022-12-27 19:15:54 +01:00

100 lines
3.1 KiB
C++

#ifndef GAME_MWBASE_JOURNAL_H
#define GAME_MWBASE_JOURNAL_H
#include <deque>
#include <map>
#include <string>
#include <string_view>
#include <cstdint>
#include "../mwdialogue/journalentry.hpp"
#include "../mwdialogue/quest.hpp"
#include "../mwdialogue/topic.hpp"
namespace Loading
{
class Listener;
}
namespace ESM
{
class ESMReader;
class ESMWriter;
}
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<ESM::RefId, MWDialogue::Quest> TQuestContainer; // topic, quest
typedef TQuestContainer::const_iterator TQuestIter;
typedef std::map<ESM::RefId, MWDialogue::Topic> TTopicContainer; // topic-id, topic-content
typedef TTopicContainer::const_iterator TTopicIter;
public:
Journal() {}
virtual void clear() = 0;
virtual ~Journal() {}
virtual void addEntry(const ESM::RefId& id, int index, const MWWorld::Ptr& actor) = 0;
///< Add a journal entry.
/// @param actor Used as context for replacing of escape sequences (%name, etc).
virtual void setJournalIndex(const ESM::RefId& id, int index) = 0;
///< Set the journal index without adding an entry.
virtual int getJournalIndex(const ESM::RefId& id) const = 0;
///< Get the journal index.
virtual void addTopic(const ESM::RefId& topicId, const ESM::RefId& infoId, const MWWorld::Ptr& actor) = 0;
/// \note topicId must be lowercase
virtual void removeLastAddedTopicResponse(const ESM::RefId& topicId, std::string_view actorName) = 0;
///< Removes the last topic response added for the given topicId and actor name.
/// \note topicId must be lowercase
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.
virtual int countSavedGameRecords() const = 0;
virtual void write(ESM::ESMWriter& writer, Loading::Listener& progress) const = 0;
virtual void readRecord(ESM::ESMReader& reader, uint32_t type) = 0;
};
}
#endif