mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-15 18:39:51 +00:00
Issue #219: Proper implementation of talked to PC filter
This commit is contained in:
parent
7e8d4bb3c9
commit
f8fcca64b6
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include "../mwclass/npc.hpp"
|
#include "../mwclass/npc.hpp"
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
|
|
||||||
#include "filter.hpp"
|
#include "filter.hpp"
|
||||||
|
|
||||||
@ -225,6 +226,10 @@ namespace MWDialogue
|
|||||||
|
|
||||||
mActor = actor;
|
mActor = actor;
|
||||||
|
|
||||||
|
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (actor).getCreatureStats (actor);
|
||||||
|
mTalkedTo = creatureStats.hasTalkedToPlayer();
|
||||||
|
creatureStats.talkedToPlayer();
|
||||||
|
|
||||||
mActorKnownTopics.clear();
|
mActorKnownTopics.clear();
|
||||||
|
|
||||||
//initialise the GUI
|
//initialise the GUI
|
||||||
@ -240,7 +245,7 @@ namespace MWDialogue
|
|||||||
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
||||||
|
|
||||||
Filter filter (actor, mChoice);
|
Filter filter (actor, mChoice, mTalkedTo);
|
||||||
|
|
||||||
MWWorld::Store<ESM::Dialogue>::iterator it = dialogs.begin();
|
MWWorld::Store<ESM::Dialogue>::iterator it = dialogs.begin();
|
||||||
for (; it != dialogs.end(); ++it)
|
for (; it != dialogs.end(); ++it)
|
||||||
@ -344,7 +349,7 @@ namespace MWDialogue
|
|||||||
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
||||||
|
|
||||||
Filter filter (mActor, mChoice);
|
Filter filter (mActor, mChoice, mTalkedTo);
|
||||||
|
|
||||||
MWWorld::Store<ESM::Dialogue>::iterator it = dialogs.begin();
|
MWWorld::Store<ESM::Dialogue>::iterator it = dialogs.begin();
|
||||||
for (; it != dialogs.end(); ++it)
|
for (; it != dialogs.end(); ++it)
|
||||||
@ -431,7 +436,7 @@ namespace MWDialogue
|
|||||||
ESM::Dialogue ndialogue = mDialogueMap[keyword];
|
ESM::Dialogue ndialogue = mDialogueMap[keyword];
|
||||||
if(ndialogue.mType == ESM::Dialogue::Topic)
|
if(ndialogue.mType == ESM::Dialogue::Topic)
|
||||||
{
|
{
|
||||||
Filter filter (mActor, mChoice);
|
Filter filter (mActor, mChoice, mTalkedTo);
|
||||||
|
|
||||||
for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
|
for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
|
||||||
iter!=ndialogue.mInfo.end(); ++iter)
|
iter!=ndialogue.mInfo.end(); ++iter)
|
||||||
@ -478,7 +483,7 @@ namespace MWDialogue
|
|||||||
ESM::Dialogue ndialogue = mDialogueMap[mLastTopic];
|
ESM::Dialogue ndialogue = mDialogueMap[mLastTopic];
|
||||||
if(ndialogue.mType == ESM::Dialogue::Topic)
|
if(ndialogue.mType == ESM::Dialogue::Topic)
|
||||||
{
|
{
|
||||||
Filter filter (mActor, mChoice);
|
Filter filter (mActor, mChoice, mTalkedTo);
|
||||||
|
|
||||||
for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
|
for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
|
||||||
iter!=ndialogue.mInfo.end(); ++iter)
|
iter!=ndialogue.mInfo.end(); ++iter)
|
||||||
|
@ -40,6 +40,7 @@ namespace MWDialogue
|
|||||||
bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code);
|
bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code);
|
||||||
void executeScript(std::string script);
|
void executeScript(std::string script);
|
||||||
MWWorld::Ptr mActor;
|
MWWorld::Ptr mActor;
|
||||||
|
bool mTalkedTo;
|
||||||
|
|
||||||
void printError(std::string error);
|
void printError(std::string error);
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||||||
|
|
||||||
case SelectWrapper::Function_TalkedToPc:
|
case SelectWrapper::Function_TalkedToPc:
|
||||||
|
|
||||||
return MWWorld::Class::get (mActor).getCreatureStats (mActor).hasTalkedToPlayer();
|
return mTalkedToPlayer;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
@ -329,7 +329,9 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MWDialogue::Filter::Filter (const MWWorld::Ptr& actor, int choice) : mActor (actor), mChoice (choice) {}
|
MWDialogue::Filter::Filter (const MWWorld::Ptr& actor, int choice, bool talkedToPlayer)
|
||||||
|
: mActor (actor), mChoice (choice), mTalkedToPlayer (talkedToPlayer)
|
||||||
|
{}
|
||||||
|
|
||||||
bool MWDialogue::Filter::operator() (const ESM::DialInfo& info) const
|
bool MWDialogue::Filter::operator() (const ESM::DialInfo& info) const
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,7 @@ namespace MWDialogue
|
|||||||
{
|
{
|
||||||
MWWorld::Ptr mActor;
|
MWWorld::Ptr mActor;
|
||||||
int mChoice;
|
int mChoice;
|
||||||
|
bool mTalkedToPlayer;
|
||||||
|
|
||||||
bool testActor (const ESM::DialInfo& info) const;
|
bool testActor (const ESM::DialInfo& info) const;
|
||||||
///< Is this the right actor for this \a info?
|
///< Is this the right actor for this \a info?
|
||||||
@ -36,7 +37,7 @@ namespace MWDialogue
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Filter (const MWWorld::Ptr& actor, int choice);
|
Filter (const MWWorld::Ptr& actor, int choice, bool talkedToPlayer);
|
||||||
|
|
||||||
bool operator() (const ESM::DialInfo& info) const;
|
bool operator() (const ESM::DialInfo& info) const;
|
||||||
///< \return does the dialogue match?
|
///< \return does the dialogue match?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user