1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 15:39:02 +00:00
OpenMW/apps/openmw/mwbase/dialoguemanager.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

122 lines
3.4 KiB
C++

#ifndef GAME_MWBASE_DIALOGUEMANAGER_H
#define GAME_MWBASE_DIALOGUEMANAGER_H
#include <list>
#include <string>
#include <string_view>
#include <vector>
#include <cstdint>
namespace Loading
{
class Listener;
}
namespace ESM
{
class ESMReader;
class ESMWriter;
struct RefId;
}
namespace MWWorld
{
class Ptr;
}
namespace MWBase
{
/// \brief Interface for dialogue manager (implemented in MWDialogue)
class DialogueManager
{
DialogueManager(const DialogueManager&);
///< not implemented
DialogueManager& operator=(const DialogueManager&);
///< not implemented
public:
class ResponseCallback
{
public:
virtual ~ResponseCallback() = default;
virtual void addResponse(const std::string& title, const std::string& text) = 0;
};
DialogueManager() {}
virtual void clear() = 0;
virtual ~DialogueManager() {}
virtual bool isInChoice() const = 0;
virtual bool startDialogue(const MWWorld::Ptr& actor, ResponseCallback* callback) = 0;
virtual bool inJournal(const ESM::RefId& topicId, const ESM::RefId& infoId) const = 0;
virtual void addTopic(const ESM::RefId& topic) = 0;
virtual void addChoice(std::string_view text, int choice) = 0;
virtual const std::vector<std::pair<std::string, int>>& getChoices() const = 0;
virtual bool isGoodbye() const = 0;
virtual void goodbye() = 0;
virtual void say(const MWWorld::Ptr& actor, const ESM::RefId& topic) = 0;
virtual void keywordSelected(const std::string& keyword, ResponseCallback* callback) = 0;
virtual void goodbyeSelected() = 0;
virtual void questionAnswered(int answer, ResponseCallback* callback) = 0;
enum TopicType
{
Specific = 1,
Exhausted = 2
};
enum ServiceType
{
Any = -1,
Barter = 1,
Repair = 2,
Spells = 3,
Training = 4,
Travel = 5,
Spellmaking = 6,
Enchanting = 7
};
virtual std::list<std::string> getAvailableTopics() = 0;
virtual int getTopicFlag(const ESM::RefId&) const = 0;
virtual bool checkServiceRefused(ResponseCallback* callback, ServiceType service = ServiceType::Any) = 0;
virtual void persuade(int type, ResponseCallback* callback) = 0;
/// @note Controlled by an option, gets discarded when dialogue ends by default
virtual void applyBarterDispositionChange(int delta) = 0;
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;
/// Changes faction1's opinion of faction2 by \a diff.
virtual void modFactionReaction(const ESM::RefId& faction1, const ESM::RefId& faction2, int diff) = 0;
virtual void setFactionReaction(const ESM::RefId& faction1, const ESM::RefId& faction2, int absolute) = 0;
/// @return faction1's opinion of faction2
virtual int getFactionReaction(const ESM::RefId& faction1, const ESM::RefId& faction2) const = 0;
/// Removes the last added topic response for the given actor from the journal
virtual void clearInfoActor(const MWWorld::Ptr& actor) const = 0;
};
}
#endif