mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-20 02:53:53 +00:00
Issue #219: fixed function decoding and moved choice function from DialogueManager to Filter
This commit is contained in:
parent
a752536cea
commit
c425b3f4a3
5 changed files with 22 additions and 16 deletions
|
@ -137,13 +137,6 @@ namespace MWDialogue
|
|||
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
|
||||
break;
|
||||
|
||||
case 50://choice
|
||||
if(choice)
|
||||
{
|
||||
if(!selectCompare<int,int>(comp,mChoice,select.mI)) return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 60://PC Vampire
|
||||
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
|
||||
break;
|
||||
|
@ -287,7 +280,7 @@ namespace MWDialogue
|
|||
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
||||
|
||||
Filter filter (actor);
|
||||
Filter filter (actor, mChoice);
|
||||
|
||||
MWWorld::Store<ESM::Dialogue>::iterator it = dialogs.begin();
|
||||
for (; it != dialogs.end(); ++it)
|
||||
|
@ -391,7 +384,7 @@ namespace MWDialogue
|
|||
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
||||
|
||||
Filter filter (mActor);
|
||||
Filter filter (mActor, mChoice);
|
||||
|
||||
MWWorld::Store<ESM::Dialogue>::iterator it = dialogs.begin();
|
||||
for (; it != dialogs.end(); ++it)
|
||||
|
@ -478,7 +471,7 @@ namespace MWDialogue
|
|||
ESM::Dialogue ndialogue = mDialogueMap[keyword];
|
||||
if(ndialogue.mType == ESM::Dialogue::Topic)
|
||||
{
|
||||
Filter filter (mActor);
|
||||
Filter filter (mActor, mChoice);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
|
||||
iter!=ndialogue.mInfo.end(); ++iter)
|
||||
|
@ -525,7 +518,7 @@ namespace MWDialogue
|
|||
ESM::Dialogue ndialogue = mDialogueMap[mLastTopic];
|
||||
if(ndialogue.mType == ESM::Dialogue::Topic)
|
||||
{
|
||||
Filter filter (mActor);
|
||||
Filter filter (mActor, mChoice);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
|
||||
iter!=ndialogue.mInfo.end(); ++iter)
|
||||
|
|
|
@ -220,6 +220,10 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
|
||||
return MWBase::Environment::get().getMechanicsManager()->countDeaths (select.getName());
|
||||
|
||||
case SelectWrapper::Function_Choice:
|
||||
|
||||
return mChoice;
|
||||
|
||||
default:
|
||||
|
||||
throw std::runtime_error ("unknown integer select function");
|
||||
|
@ -264,7 +268,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
}
|
||||
}
|
||||
|
||||
MWDialogue::Filter::Filter (const MWWorld::Ptr& actor) : mActor (actor) {}
|
||||
MWDialogue::Filter::Filter (const MWWorld::Ptr& actor, int choice) : mActor (actor), mChoice (choice) {}
|
||||
|
||||
bool MWDialogue::Filter::operator() (const ESM::DialInfo& info) const
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace MWDialogue
|
|||
class Filter
|
||||
{
|
||||
MWWorld::Ptr mActor;
|
||||
int mChoice;
|
||||
|
||||
bool testActor (const ESM::DialInfo& info) const;
|
||||
///< Is this the right actor for this \a info?
|
||||
|
@ -35,7 +36,7 @@ namespace MWDialogue
|
|||
|
||||
public:
|
||||
|
||||
Filter (const MWWorld::Ptr& actor);
|
||||
Filter (const MWWorld::Ptr& actor, int choice);
|
||||
|
||||
bool operator() (const ESM::DialInfo& info) const;
|
||||
///< \return does the dialogue match?
|
||||
|
|
|
@ -59,7 +59,13 @@ MWDialogue::SelectWrapper::Function MWDialogue::SelectWrapper::decodeFunction()
|
|||
|
||||
std::istringstream (mSelect.mSelectRule.substr(2,2)) >> index;
|
||||
|
||||
return static_cast<Function> (index);
|
||||
switch (index)
|
||||
{
|
||||
case 46: return Function_SameFaction;
|
||||
case 50: return Function_Choice;
|
||||
}
|
||||
|
||||
return Function_None;
|
||||
}
|
||||
|
||||
MWDialogue::SelectWrapper::SelectWrapper (const ESM::DialInfo::SelectStruct& select) : mSelect (select) {}
|
||||
|
@ -92,6 +98,7 @@ MWDialogue::SelectWrapper::Type MWDialogue::SelectWrapper::getType() const
|
|||
static const Function integerFunctions[] =
|
||||
{
|
||||
Function_Journal, Function_Item, Function_Dead,
|
||||
Function_Choice,
|
||||
Function_None // end marker
|
||||
};
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace MWDialogue
|
|||
|
||||
enum Function
|
||||
{
|
||||
Function_None = 0,
|
||||
Function_None,
|
||||
Function_Journal,
|
||||
Function_Item,
|
||||
Function_Dead,
|
||||
|
@ -24,7 +24,8 @@ namespace MWDialogue
|
|||
Function_Cell,
|
||||
Function_Local,
|
||||
Function_Global,
|
||||
Function_SameFaction
|
||||
Function_SameFaction,
|
||||
Function_Choice
|
||||
};
|
||||
|
||||
enum Type
|
||||
|
|
Loading…
Reference in a new issue