Merge branch 'fix-#7410' into 'master'

fix #7410

Closes #7410

See merge request OpenMW/openmw!3104
macos_ci
psi29a 2 years ago
commit 2f5bfb4df2

@ -142,7 +142,10 @@ namespace MWWorld
std::string_view getTypeDescription() const override
{
if constexpr (ESM::isESM4Rec(X::sRecordId))
return ESM::getRecNameString(X::sRecordId).toStringView();
{
static constexpr ESM::FixedString<6> name = ESM::getRecNameString(X::sRecordId);
return name.toStringView();
}
else
return X::getRecordType();
}

@ -332,17 +332,16 @@ namespace ESM
return RecName & sEsm4RecnameFlag;
}
inline FixedString<6> getRecNameString(ESM::RecNameInts recName)
constexpr inline FixedString<6> getRecNameString(ESM::RecNameInts recName)
{
ESM::FixedString<6> name;
name.assign("");
name.mData[5] = '\0';
ESM::NAME fourCCName(recName & ~ESM::sEsm4RecnameFlag);
for (int i = 0; i < 4; i++)
name.mData[i] = fourCCName.mData[i];
if (ESM::isESM4Rec(recName))
{
name.mData[4] = '4';
}
name.mData[4] = ESM::isESM4Rec(recName) ? '4' : '\0';
return name;
}

Loading…
Cancel
Save