1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-28 08:37:12 +00:00

Store display's the ESM4's RecnameInt when not found

This commit is contained in:
florent.teppe 2023-01-04 14:07:47 +01:00
parent 631fa26872
commit b88eee08c2
3 changed files with 22 additions and 5 deletions

View File

@ -166,6 +166,10 @@ namespace MWWorld
{
msg << T::getRecordType();
}
else
{
msg << "ESM::REC_" << getRecNameString(T::sRecordId).toStringView();
}
msg << " '" << id << "' not found";
throw std::runtime_error(msg.str());
}
@ -1164,6 +1168,20 @@ namespace MWWorld
return mKeywordSearch;
}
ESM::FixedString<6> getRecNameString(ESM::RecNameInts recName)
{
ESM::FixedString<6> name;
name.assign("");
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';
}
return name;
}
}
template class MWWorld::TypedDynamicStore<ESM::Activator>;

View File

@ -517,6 +517,8 @@ namespace MWWorld
const MWDialogue::KeywordSearch<std::string, int>& getDialogIdKeywordSearch() const;
};
ESM::FixedString<6> getRecNameString(ESM::RecNameInts recName);
} // end namespace
#endif

View File

@ -315,11 +315,8 @@ static void testRecNameIntCount(const MWWorld::Store<T>& store, const MWWorld::E
{
const unsigned int recordIdCount
= std::apply([](auto&&... x) { return (hasSameRecordId(x, T::sRecordId) + ...); }, stores);
std::string RecordIdName(ESM::NAME(T::sRecordId & ~ESM::sEsm4RecnameFlag).toStringView());
if (ESM::isESM4Rec(T::sRecordId))
RecordIdName += '4';
ASSERT_EQ(recordIdCount, 1) << "The same RecNameInt is used twice ESM::REC_" << RecordIdName;
ASSERT_EQ(recordIdCount, 1) << "The same RecNameInt is used twice ESM::REC_"
<< MWWorld::getRecNameString(T::sRecordId).toStringView();
}
}