mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-13 09:36:43 +00:00
Improves check: throws an error that says which RecName is used twice.
This commit is contained in:
parent
9b1c405467
commit
64a9f742da
1 changed files with 27 additions and 1 deletions
|
@ -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>
|
template <typename T>
|
||||||
static bool typedReadRecordESM4(ESM4::Reader& reader, Store<T>& store)
|
static bool typedReadRecordESM4(ESM4::Reader& reader, Store<T>& store)
|
||||||
{
|
{
|
||||||
|
@ -239,7 +261,11 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
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);
|
||||||
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…
Reference in a new issue