1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-31 06:06:39 +00:00

Use constexpr to do not generate an invalid code in templates

This commit is contained in:
Andrei Kortunov 2023-03-23 14:29:26 +04:00
parent db1b260323
commit 11484205f5

View file

@ -269,11 +269,15 @@ namespace CSMWorld
copy->mState = RecordBase::State_ModifiedOnly;
setRecordId(destination, copy->get());
if (type == UniversalId::Type_Reference)
if constexpr (std::is_same_v<ESXRecordT, CSMWorld::CellRef>)
{
CSMWorld::CellRef* ptr = (CSMWorld::CellRef*)&copy->mModified;
ptr->mRefNum.mIndex = 0;
if (type == UniversalId::Type_Reference)
{
CSMWorld::CellRef* ptr = (CSMWorld::CellRef*)&copy->mModified;
ptr->mRefNum.mIndex = 0;
}
}
const int index = getAppendIndex(destination, type);
insertRecord(std::move(copy), getAppendIndex(destination, type));