mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 21:45:33 +00:00
Disallow redirection to info refusal for greetings
This commit is contained in:
parent
05796d85a4
commit
43e85ea0c6
3 changed files with 24 additions and 7 deletions
|
@ -139,7 +139,8 @@ namespace MWDialogue
|
|||
{
|
||||
if(it->mType == ESM::Dialogue::Greeting)
|
||||
{
|
||||
if (const ESM::DialInfo *info = filter.search (*it))
|
||||
// Search a response (we do not accept a fallback to "Info refusal" here)
|
||||
if (const ESM::DialInfo *info = filter.search (*it, false))
|
||||
{
|
||||
//initialise the GUI
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Dialogue);
|
||||
|
@ -248,7 +249,7 @@ namespace MWDialogue
|
|||
|
||||
const ESM::Dialogue& dialogue = *dialogues.find (topic);
|
||||
|
||||
if (const ESM::DialInfo *info = filter.search (dialogue))
|
||||
if (const ESM::DialInfo *info = filter.search (dialogue, true))
|
||||
{
|
||||
parseText (info->mResponse);
|
||||
|
||||
|
@ -295,7 +296,7 @@ namespace MWDialogue
|
|||
{
|
||||
if (iter->mType == ESM::Dialogue::Topic)
|
||||
{
|
||||
if (filter.search (*iter))
|
||||
if (filter.responseAvailable (*iter))
|
||||
{
|
||||
std::string lower = Misc::StringUtils::lowerCase(iter->mId);
|
||||
mActorKnownTopics.push_back (lower);
|
||||
|
@ -412,7 +413,7 @@ namespace MWDialogue
|
|||
{
|
||||
Filter filter (mActor, mChoice, mTalkedTo);
|
||||
|
||||
if (const ESM::DialInfo *info = filter.search (mDialogueMap[mLastTopic]))
|
||||
if (const ESM::DialInfo *info = filter.search (mDialogueMap[mLastTopic], true))
|
||||
{
|
||||
mChoiceMap.clear();
|
||||
mChoice = -1;
|
||||
|
|
|
@ -554,7 +554,7 @@ MWDialogue::Filter::Filter (const MWWorld::Ptr& actor, int choice, bool talkedTo
|
|||
: mActor (actor), mChoice (choice), mTalkedToPlayer (talkedToPlayer)
|
||||
{}
|
||||
|
||||
const ESM::DialInfo *MWDialogue::Filter::search (const ESM::Dialogue& dialogue) const
|
||||
const ESM::DialInfo *MWDialogue::Filter::search (const ESM::Dialogue& dialogue, const bool fallbackToInfoRefusal) const
|
||||
{
|
||||
bool infoRefusal = false;
|
||||
|
||||
|
@ -571,7 +571,7 @@ const ESM::DialInfo *MWDialogue::Filter::search (const ESM::Dialogue& dialogue)
|
|||
}
|
||||
}
|
||||
|
||||
if (infoRefusal)
|
||||
if (infoRefusal && fallbackToInfoRefusal)
|
||||
{
|
||||
// No response is valid because of low NPC disposition,
|
||||
// search a response in the topic "Info Refusal"
|
||||
|
@ -590,3 +590,14 @@ const ESM::DialInfo *MWDialogue::Filter::search (const ESM::Dialogue& dialogue)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool MWDialogue::Filter::responseAvailable (const ESM::Dialogue& dialogue) const
|
||||
{
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter = dialogue.mInfo.begin();
|
||||
iter!=dialogue.mInfo.end(); ++iter)
|
||||
{
|
||||
if (testActor (*iter) && testPlayer (*iter) && testSelectStructs (*iter))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,12 @@ namespace MWDialogue
|
|||
|
||||
Filter (const MWWorld::Ptr& actor, int choice, bool talkedToPlayer);
|
||||
|
||||
const ESM::DialInfo *search (const ESM::Dialogue& dialogue) const;
|
||||
const ESM::DialInfo *search (const ESM::Dialogue& dialogue, const bool fallbackToInfoRefusal) const;
|
||||
///< Get a matching response for the requested dialogue.
|
||||
/// Redirect to "Info Refusal" topic if a response fulfills all conditions but disposition.
|
||||
|
||||
bool responseAvailable (const ESM::Dialogue& dialogue) const;
|
||||
///< Does a matching response exist? (disposition is ignored for this check)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue