Issue #219: Proper implementation of talked to PC filter

actorid
Marc Zinnschlag 12 years ago
parent 7e8d4bb3c9
commit f8fcca64b6

@ -38,6 +38,7 @@
#include "../mwclass/npc.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/creaturestats.hpp"
#include "filter.hpp"
@ -224,6 +225,10 @@ namespace MWDialogue
mIsInChoice = false;
mActor = actor;
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (actor).getCreatureStats (actor);
mTalkedTo = creatureStats.hasTalkedToPlayer();
creatureStats.talkedToPlayer();
mActorKnownTopics.clear();
@ -240,7 +245,7 @@ namespace MWDialogue
const MWWorld::Store<ESM::Dialogue> &dialogs =
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();
for (; it != dialogs.end(); ++it)
@ -344,7 +349,7 @@ namespace MWDialogue
const MWWorld::Store<ESM::Dialogue> &dialogs =
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();
for (; it != dialogs.end(); ++it)
@ -431,7 +436,7 @@ namespace MWDialogue
ESM::Dialogue ndialogue = mDialogueMap[keyword];
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();
iter!=ndialogue.mInfo.end(); ++iter)
@ -478,7 +483,7 @@ namespace MWDialogue
ESM::Dialogue ndialogue = mDialogueMap[mLastTopic];
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();
iter!=ndialogue.mInfo.end(); ++iter)

@ -40,6 +40,7 @@ namespace MWDialogue
bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code);
void executeScript(std::string script);
MWWorld::Ptr mActor;
bool mTalkedTo;
void printError(std::string error);

@ -321,7 +321,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
case SelectWrapper::Function_TalkedToPc:
return MWWorld::Class::get (mActor).getCreatureStats (mActor).hasTalkedToPlayer();
return mTalkedToPlayer;
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
{

@ -16,6 +16,7 @@ namespace MWDialogue
{
MWWorld::Ptr mActor;
int mChoice;
bool mTalkedToPlayer;
bool testActor (const ESM::DialInfo& info) const;
///< Is this the right actor for this \a info?
@ -36,7 +37,7 @@ namespace MWDialogue
public:
Filter (const MWWorld::Ptr& actor, int choice);
Filter (const MWWorld::Ptr& actor, int choice, bool talkedToPlayer);
bool operator() (const ESM::DialInfo& info) const;
///< \return does the dialogue match?

Loading…
Cancel
Save