1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-01 20:36:40 +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(); msg << T::getRecordType();
} }
else
{
msg << "ESM::REC_" << getRecNameString(T::sRecordId).toStringView();
}
msg << " '" << id << "' not found"; msg << " '" << id << "' not found";
throw std::runtime_error(msg.str()); throw std::runtime_error(msg.str());
} }
@ -1164,6 +1168,20 @@ namespace MWWorld
return mKeywordSearch; 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>; template class MWWorld::TypedDynamicStore<ESM::Activator>;

View file

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

View file

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