1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-10-05 08:56:40 +00:00

Fix(client): Override dynamic cell records as well, minor refactor for clarity

This commit is contained in:
Dave Corley 2023-09-26 21:04:28 -05:00
parent 8dcd759c62
commit 8d5570d85f

View file

@ -801,30 +801,37 @@ namespace MWWorld
*/ */
ESM::Cell *Store<ESM::Cell>::override(const ESM::Cell &cell) ESM::Cell *Store<ESM::Cell>::override(const ESM::Cell &cell)
{ {
if (search(cell) != 0) if (search(cell) == 0)
{ return insert(cell);
for (auto it = mSharedInt.begin(); it != mSharedInt.end(); ++it)
for (auto it = mSharedInt.begin(); it != mSharedInt.end(); ++it)
{ {
if (Misc::StringUtils::ciEqual((*it)->mName, cell.mName)) if (Misc::StringUtils::ciEqual((*it)->mName, cell.mName))
{ {
(*it) = &const_cast<ESM::Cell&>(cell); (*it) = &const_cast<ESM::Cell&>(cell);
break; break;
} }
} }
for (auto it = mInt.begin(); it != mInt.end(); ++it) for (auto it = mInt.begin(); it != mInt.end(); ++it)
{ {
if (Misc::StringUtils::ciEqual((*it).second.mName, cell.mName)) if (Misc::StringUtils::ciEqual((*it).second.mName, cell.mName))
{ {
(*it).second = cell; (*it).second = cell;
return &(*it).second; return &(*it).second;
} }
} }
}
else for (auto it = mDynamicInt.begin(); it != mDynamicInt.end(); ++it)
{ {
return insert(cell); if (Misc::StringUtils::ciEqual((*it).second.mName, cell.mName))
} {
(*it).second = cell;
return &(*it).second;
}
}
return nullptr;
} }
/* /*
End of tes3mp addition End of tes3mp addition