mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-02 07:11:33 +00:00
Replace switch statements
This commit is contained in:
parent
29a46b0fc0
commit
f61083d02c
1 changed files with 25 additions and 35 deletions
|
@ -32,16 +32,13 @@ namespace
|
|||
return !Misc::StringUtils::ciEqual(actor.getCellRef().getRefId(), select.getName());
|
||||
if (actor.getClass().isNpc())
|
||||
{
|
||||
switch (select.getFunction())
|
||||
{
|
||||
case MWDialogue::SelectWrapper::Function_NotFaction:
|
||||
if (select.getFunction() == MWDialogue::SelectWrapper::Function_NotFaction)
|
||||
return !Misc::StringUtils::ciEqual(actor.getClass().getPrimaryFaction(actor), select.getName());
|
||||
case MWDialogue::SelectWrapper::Function_NotClass:
|
||||
else if (select.getFunction() == MWDialogue::SelectWrapper::Function_NotClass)
|
||||
return !Misc::StringUtils::ciEqual(actor.get<ESM::NPC>()->mBase->mClass, select.getName());
|
||||
case MWDialogue::SelectWrapper::Function_NotRace:
|
||||
else if (select.getFunction() == MWDialogue::SelectWrapper::Function_NotRace)
|
||||
return !Misc::StringUtils::ciEqual(actor.get<ESM::NPC>()->mBase->mRace, select.getName());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -50,22 +47,17 @@ namespace
|
|||
for (const ESM::DialInfo::SelectStruct& select : info.mSelects)
|
||||
{
|
||||
MWDialogue::SelectWrapper wrapper = select;
|
||||
|
||||
switch (wrapper.getType())
|
||||
{
|
||||
case MWDialogue::SelectWrapper::Type_Boolean:
|
||||
if (wrapper.getType() == MWDialogue::SelectWrapper::Type_Boolean)
|
||||
{
|
||||
if (!wrapper.selectCompare(matchesStaticFilters(wrapper, actor)))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case MWDialogue::SelectWrapper::Type_Inverted:
|
||||
else if (wrapper.getType() == MWDialogue::SelectWrapper::Type_Inverted)
|
||||
{
|
||||
if (!matchesStaticFilters(wrapper, actor))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case MWDialogue::SelectWrapper::Type_Numeric:
|
||||
else if (wrapper.getType() == MWDialogue::SelectWrapper::Type_Numeric)
|
||||
{
|
||||
if (wrapper.getFunction() == MWDialogue::SelectWrapper::Function_Local)
|
||||
{
|
||||
|
@ -78,8 +70,6 @@ namespace
|
|||
if (type == ' ')
|
||||
return false; // script does not have a variable of this name.
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue