1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 16:29:55 +00:00

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

fix #7410

Closes #7410

See merge request OpenMW/openmw!3104
This commit is contained in:
psi29a 2023-06-04 11:28:26 +00:00
commit 2f5bfb4df2
2 changed files with 9 additions and 7 deletions

View file

@ -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();
}

View file

@ -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;
}