1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 21:45:35 +00:00

Merge branch 'grayscale_dialogue_48' into 'openmw-48'

Dialogue issues 0.48

See merge request OpenMW/openmw!2480
This commit is contained in:
psi29a 2022-10-18 19:33:34 +00:00
commit dc9ba9dc80
3 changed files with 17 additions and 16 deletions

View file

@ -54,14 +54,14 @@ namespace MWBase
virtual bool startDialogue (const MWWorld::Ptr& actor, ResponseCallback* callback) = 0;
virtual bool inJournal (const std::string& topicId, const std::string& infoId) = 0;
virtual bool inJournal (const std::string& topicId, const std::string& infoId) const = 0;
virtual void addTopic(std::string_view topic) = 0;
virtual void addChoice(std::string_view text,int choice) = 0;
virtual const std::vector<std::pair<std::string, int> >& getChoices() = 0;
virtual const std::vector<std::pair<std::string, int> >& getChoices() const = 0;
virtual bool isGoodbye() = 0;
virtual bool isGoodbye() const = 0;
virtual void goodbye() = 0;
@ -90,7 +90,7 @@ namespace MWBase
};
virtual std::list<std::string> getAvailableTopics() = 0;
virtual int getTopicFlag(const std::string&) = 0;
virtual int getTopicFlag(const std::string&) const = 0;
virtual bool checkServiceRefused (ResponseCallback* callback, ServiceType service = ServiceType::Any) = 0;

View file

@ -257,7 +257,7 @@ namespace MWDialogue
}
}
bool DialogueManager::inJournal (const std::string& topicId, const std::string& infoId)
bool DialogueManager::inJournal(const std::string& topicId, const std::string& infoId) const
{
const MWDialogue::Topic *topicHistory = nullptr;
MWBase::Journal *journal = MWBase::Environment::get().getJournal();
@ -290,9 +290,7 @@ namespace MWDialogue
const ESM::Dialogue& dialogue = *dialogues.find (topic);
const ESM::DialInfo* info =
mChoice == -1 && mActorKnownTopics.count(topic) ?
mActorKnownTopics[topic].mInfo : filter.search(dialogue, true);
const ESM::DialInfo* info = filter.search(dialogue, true);
if (info)
{
@ -424,9 +422,12 @@ namespace MWDialogue
return keywordList;
}
int DialogueManager::getTopicFlag(const std::string& topicId)
int DialogueManager::getTopicFlag(const std::string& topicId) const
{
return mActorKnownTopics[topicId].mFlags;
auto known = mActorKnownTopics.find(topicId);
if (known != mActorKnownTopics.end())
return known->second.mFlags;
return 0;
}
void DialogueManager::keywordSelected (const std::string& keyword, ResponseCallback* callback)
@ -523,12 +524,12 @@ namespace MWDialogue
mChoices.emplace_back(text, choice);
}
const std::vector<std::pair<std::string, int> >& DialogueManager::getChoices()
const std::vector<std::pair<std::string, int>>& DialogueManager::getChoices() const
{
return mChoices;
}
bool DialogueManager::isGoodbye()
bool DialogueManager::isGoodbye() const
{
return mGoodbye;
}

View file

@ -83,16 +83,16 @@ namespace MWDialogue
bool startDialogue (const MWWorld::Ptr& actor, ResponseCallback* callback) override;
std::list<std::string> getAvailableTopics() override;
int getTopicFlag(const std::string& topicId) override;
int getTopicFlag(const std::string& topicId) const override;
bool inJournal (const std::string& topicId, const std::string& infoId) override;
bool inJournal (const std::string& topicId, const std::string& infoId) const override;
void addTopic(std::string_view topic) override;
void addChoice(std::string_view text,int choice) override;
const std::vector<std::pair<std::string, int> >& getChoices() override;
const std::vector<std::pair<std::string, int> >& getChoices() const override;
bool isGoodbye() override;
bool isGoodbye() const override;
void goodbye() override;