mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-01 02:45:32 +00:00
Add dialogue function: NotLocal
This commit is contained in:
parent
ad3478c8f2
commit
f25b56ac88
3 changed files with 27 additions and 2 deletions
|
@ -440,6 +440,30 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
||||||
|
|
||||||
return Misc::StringUtils::lowerCase (mActor.getCell()->mCell->mName)!=select.getName();
|
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:
|
case SelectWrapper::Function_SameGender:
|
||||||
|
|
||||||
return (player.get<ESM::NPC>()->mBase->mFlags & ESM::NPC::Female)==
|
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 '9': return Function_NotClass;
|
||||||
case 'A': return Function_NotRace;
|
case 'A': return Function_NotRace;
|
||||||
case 'B': return Function_NotCell;
|
case 'B': return Function_NotCell;
|
||||||
case 'C': return Function_Local;
|
case 'C': return Function_NotLocal;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Function_None;
|
return Function_None;
|
||||||
|
@ -233,7 +233,7 @@ MWDialogue::SelectWrapper::Type MWDialogue::SelectWrapper::getType() const
|
||||||
static const Function invertedBooleanFunctions[] =
|
static const Function invertedBooleanFunctions[] =
|
||||||
{
|
{
|
||||||
Function_NotId, Function_NotFaction, Function_NotClass,
|
Function_NotId, Function_NotFaction, Function_NotClass,
|
||||||
Function_NotRace, Function_NotCell,
|
Function_NotRace, Function_NotCell, Function_NotLocal,
|
||||||
Function_None // end marker
|
Function_None // end marker
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace MWDialogue
|
||||||
Function_NotClass,
|
Function_NotClass,
|
||||||
Function_NotRace,
|
Function_NotRace,
|
||||||
Function_NotCell,
|
Function_NotCell,
|
||||||
|
Function_NotLocal,
|
||||||
Function_Local,
|
Function_Local,
|
||||||
Function_Global,
|
Function_Global,
|
||||||
Function_SameGender, Function_SameRace, Function_SameFaction,
|
Function_SameGender, Function_SameRace, Function_SameFaction,
|
||||||
|
|
Loading…
Reference in a new issue