mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Improves check: throws an error that says which RecName is used twice.
This commit is contained in:
parent
9b1c405467
commit
64a9f742da
@ -196,6 +196,28 @@ namespace MWWorld
|
||||
{
|
||||
};
|
||||
|
||||
struct RecNameIntChar
|
||||
{
|
||||
char name[6];
|
||||
RecNameIntChar(ESM::RecNameInts recName)
|
||||
{
|
||||
unsigned int FourCC = recName & ~ESM::sEsm4RecnameFlag; // Removes the flag
|
||||
name[0] = FourCC & 0xFF;
|
||||
name[1] = (FourCC >> 8) & 0xFF;
|
||||
name[2] = (FourCC >> 16) & 0xFF;
|
||||
name[3] = (FourCC >> 24) & 0xFF;
|
||||
if (ESM::isESM4Rec(recName))
|
||||
{
|
||||
name[4] = '4';
|
||||
name[5] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
name[4] = '\0';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
static bool typedReadRecordESM4(ESM4::Reader& reader, Store<T>& store)
|
||||
{
|
||||
@ -239,7 +261,11 @@ namespace MWWorld
|
||||
{
|
||||
const unsigned int recordIdCount
|
||||
= std::apply([](auto&&... x) { return (hasSameRecordId(x, T::sRecordId) + ...); }, stores);
|
||||
assert(recordIdCount == 1);
|
||||
if (recordIdCount != 1)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"The same RecNameInt is used twice ESM::REC_" + std::string(RecNameIntChar(T::sRecordId).name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user