Add dialogue function: NotLocal

actorid
Emanuel Guevel 12 years ago
parent ad3478c8f2
commit f25b56ac88

@ -440,6 +440,30 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
return Misc::StringUtils::lowerCase (mActor.getCell()->mCell->mName)!=select.getName();
case SelectWrapper::Function_NotLocal:
{
std::string scriptName = MWWorld::Class::get (mActor).getScript (mActor);
if (scriptName.empty())
// This actor has no attached script, so there is no local variable
return true;
const ESM::Script *script =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Script>().find (scriptName);
std::string name = select.getName();
int i = 0;
for (; i < script->mVarNames.size(); ++i)
if (Misc::StringUtils::lowerCase(script->mVarNames[i]) == name)
break;
if (i >= script->mVarNames.size())
return true; // script does not have a variable of this name
return false;
}
case SelectWrapper::Function_SameGender:
return (player.get<ESM::NPC>()->mBase->mFlags & ESM::NPC::Female)==

@ -117,7 +117,7 @@ MWDialogue::SelectWrapper::Function MWDialogue::SelectWrapper::getFunction() con
case '9': return Function_NotClass;
case 'A': return Function_NotRace;
case 'B': return Function_NotCell;
case 'C': return Function_Local;
case 'C': return Function_NotLocal;
}
return Function_None;
@ -233,7 +233,7 @@ MWDialogue::SelectWrapper::Type MWDialogue::SelectWrapper::getType() const
static const Function invertedBooleanFunctions[] =
{
Function_NotId, Function_NotFaction, Function_NotClass,
Function_NotRace, Function_NotCell,
Function_NotRace, Function_NotCell, Function_NotLocal,
Function_None // end marker
};

@ -22,6 +22,7 @@ namespace MWDialogue
Function_NotClass,
Function_NotRace,
Function_NotCell,
Function_NotLocal,
Function_Local,
Function_Global,
Function_SameGender, Function_SameRace, Function_SameFaction,

Loading…
Cancel
Save