mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 09:09:40 +00:00
Fix editor oddities
This commit is contained in:
parent
a4625ea784
commit
6e79064a57
7 changed files with 26 additions and 44 deletions
|
@ -65,7 +65,7 @@ const char* CSMWorld::ConstInfoSelectWrapper::FunctionEnumStrings[] = {
|
|||
"PC Endurance",
|
||||
"PC Personality",
|
||||
"PC Luck",
|
||||
"PC Corpus",
|
||||
"PC Corprus",
|
||||
"Weather",
|
||||
"PC Vampire",
|
||||
"Level",
|
||||
|
@ -105,37 +105,21 @@ const char* CSMWorld::ConstInfoSelectWrapper::RelationEnumStrings[] = {
|
|||
nullptr,
|
||||
};
|
||||
|
||||
const char* CSMWorld::ConstInfoSelectWrapper::ComparisonEnumStrings[] = {
|
||||
"Boolean",
|
||||
"Integer",
|
||||
"Numeric",
|
||||
nullptr,
|
||||
};
|
||||
|
||||
// static functions
|
||||
|
||||
std::string CSMWorld::ConstInfoSelectWrapper::convertToString(ESM::DialogueCondition::Function name)
|
||||
namespace
|
||||
{
|
||||
if (name < ESM::DialogueCondition::Function_None)
|
||||
return FunctionEnumStrings[name];
|
||||
else
|
||||
std::string_view convertToString(ESM::DialogueCondition::Function name)
|
||||
{
|
||||
if (name < ESM::DialogueCondition::Function_None)
|
||||
return CSMWorld::ConstInfoSelectWrapper::FunctionEnumStrings[name];
|
||||
return "(Invalid Data: Function)";
|
||||
}
|
||||
}
|
||||
|
||||
std::string CSMWorld::ConstInfoSelectWrapper::convertToString(ESM::DialogueCondition::Comparison type)
|
||||
{
|
||||
if (type < ESM::DialogueCondition::Comp_None)
|
||||
return RelationEnumStrings[type];
|
||||
else
|
||||
std::string_view convertToString(ESM::DialogueCondition::Comparison type)
|
||||
{
|
||||
if (type != ESM::DialogueCondition::Comp_None)
|
||||
return CSMWorld::ConstInfoSelectWrapper::RelationEnumStrings[type - ESM::DialogueCondition::Comp_Eq];
|
||||
return "(Invalid Data: Relation)";
|
||||
}
|
||||
|
||||
std::string CSMWorld::ConstInfoSelectWrapper::convertToString(ComparisonType type)
|
||||
{
|
||||
if (type < Comparison_None)
|
||||
return ComparisonEnumStrings[type];
|
||||
else
|
||||
return "(Invalid Data: Comparison)";
|
||||
}
|
||||
}
|
||||
|
||||
// ConstInfoSelectWrapper
|
||||
|
@ -269,7 +253,7 @@ void CSMWorld::ConstInfoSelectWrapper::updateComparisonType()
|
|||
case ESM::DialogueCondition::Function_SameFaction:
|
||||
case ESM::DialogueCondition::Function_Detected:
|
||||
case ESM::DialogueCondition::Function_Alarmed:
|
||||
case ESM::DialogueCondition::Function_PcCorpus:
|
||||
case ESM::DialogueCondition::Function_PcCorprus:
|
||||
case ESM::DialogueCondition::Function_PcVampire:
|
||||
case ESM::DialogueCondition::Function_Attacked:
|
||||
case ESM::DialogueCondition::Function_TalkedToPc:
|
||||
|
@ -457,7 +441,7 @@ std::pair<int, int> CSMWorld::ConstInfoSelectWrapper::getValidIntRange() const
|
|||
case ESM::DialogueCondition::Function_SameFaction:
|
||||
case ESM::DialogueCondition::Function_Detected:
|
||||
case ESM::DialogueCondition::Function_Alarmed:
|
||||
case ESM::DialogueCondition::Function_PcCorpus:
|
||||
case ESM::DialogueCondition::Function_PcCorprus:
|
||||
case ESM::DialogueCondition::Function_PcVampire:
|
||||
case ESM::DialogueCondition::Function_Attacked:
|
||||
case ESM::DialogueCondition::Function_TalkedToPc:
|
||||
|
|
|
@ -25,11 +25,6 @@ namespace CSMWorld
|
|||
|
||||
static const char* FunctionEnumStrings[];
|
||||
static const char* RelationEnumStrings[];
|
||||
static const char* ComparisonEnumStrings[];
|
||||
|
||||
static std::string convertToString(ESM::DialogueCondition::Function name);
|
||||
static std::string convertToString(ESM::DialogueCondition::Comparison type);
|
||||
static std::string convertToString(ComparisonType type);
|
||||
|
||||
ConstInfoSelectWrapper(const ESM::DialogueCondition& select);
|
||||
|
||||
|
|
|
@ -605,7 +605,7 @@ namespace CSMWorld
|
|||
}
|
||||
case 2:
|
||||
{
|
||||
return infoSelectWrapper.getRelationType();
|
||||
return infoSelectWrapper.getRelationType() - ESM::DialogueCondition::Comp_Eq;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
|
@ -643,7 +643,8 @@ namespace CSMWorld
|
|||
}
|
||||
case 2: // Relation
|
||||
{
|
||||
infoSelectWrapper.setRelationType(static_cast<ESM::DialogueCondition::Comparison>(value.toInt()));
|
||||
infoSelectWrapper.setRelationType(
|
||||
static_cast<ESM::DialogueCondition::Comparison>(value.toInt() + ESM::DialogueCondition::Comp_Eq));
|
||||
break;
|
||||
}
|
||||
case 3: // Value
|
||||
|
|
|
@ -618,7 +618,7 @@ bool MWDialogue::Filter::getSelectStructBoolean(const SelectWrapper& select) con
|
|||
|
||||
return player.getClass().getCreatureStats(player).hasBlightDisease();
|
||||
|
||||
case ESM::DialogueCondition::Function_PcCorpus:
|
||||
case ESM::DialogueCondition::Function_PcCorprus:
|
||||
|
||||
return player.getClass()
|
||||
.getCreatureStats(player)
|
||||
|
|
|
@ -26,9 +26,9 @@ namespace
|
|||
return value1 < value2;
|
||||
case ESM::DialogueCondition::Comp_Le:
|
||||
return value1 <= value2;
|
||||
default:
|
||||
throw std::runtime_error("unknown compare type in dialogue info select");
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown compare type in dialogue info select");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -226,7 +226,7 @@ MWDialogue::SelectWrapper::Type MWDialogue::SelectWrapper::getType() const
|
|||
case ESM::DialogueCondition::Function_SameFaction:
|
||||
case ESM::DialogueCondition::Function_PcCommonDisease:
|
||||
case ESM::DialogueCondition::Function_PcBlightDisease:
|
||||
case ESM::DialogueCondition::Function_PcCorpus:
|
||||
case ESM::DialogueCondition::Function_PcCorprus:
|
||||
case ESM::DialogueCondition::Function_PcExpelled:
|
||||
case ESM::DialogueCondition::Function_PcVampire:
|
||||
case ESM::DialogueCondition::Function_TalkedToPc:
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace ESM
|
|||
return {};
|
||||
}
|
||||
}
|
||||
else if (rule[1] > '1' && rule[1] <= '9' || rule[1] >= 'A' && rule[1] <= 'C')
|
||||
else if ((rule[1] > '1' && rule[1] <= '9') || (rule[1] >= 'A' && rule[1] <= 'C'))
|
||||
{
|
||||
if (rule.size() == 5)
|
||||
{
|
||||
|
@ -134,6 +134,8 @@ namespace ESM
|
|||
void DialogueCondition::save(ESMWriter& esm) const
|
||||
{
|
||||
auto variant = std::visit([](auto value) { return ESM::Variant(value); }, mValue);
|
||||
if (variant.getType() != VT_Float)
|
||||
variant.setType(VT_Int);
|
||||
std::string rule;
|
||||
rule.reserve(5 + mVariable.size());
|
||||
rule += static_cast<char>(mIndex + '0');
|
||||
|
@ -189,7 +191,7 @@ namespace ESM
|
|||
start--;
|
||||
else
|
||||
start -= 2;
|
||||
auto result = std::to_chars(start, end, mFunction);
|
||||
auto result = std::to_chars(start, end, static_cast<int>(mFunction));
|
||||
if (result.ec != std::errc())
|
||||
{
|
||||
Log(Debug::Error) << "Failed to save SCVR rule";
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace ESM
|
|||
Function_PcEndurance,
|
||||
Function_PcPersonality,
|
||||
Function_PcLuck,
|
||||
Function_PcCorpus,
|
||||
Function_PcCorprus,
|
||||
Function_Weather,
|
||||
Function_PcVampire,
|
||||
Function_Level,
|
||||
|
|
Loading…
Reference in a new issue