mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-28 19:21:04 +00:00
Avoid double move when an area with same coordinates already exists
This commit is contained in:
parent
39d7f2c95b
commit
cbf48b4382
@ -404,12 +404,15 @@ namespace MWWorld
|
||||
land.load(esm, isDeleted);
|
||||
|
||||
// Same area defined in multiple plugins? -> last plugin wins
|
||||
auto [it, inserted] = mStatic.insert(std::move(land));
|
||||
if (!inserted) {
|
||||
auto it = mStatic.lower_bound(land);
|
||||
if (it != mStatic.end() && (std::tie(it->mX, it->mY) == std::tie(land.mX, land.mY)))
|
||||
{
|
||||
auto nh = mStatic.extract(it);
|
||||
nh.value() = std::move(land);
|
||||
mStatic.insert(std::move(nh));
|
||||
}
|
||||
else
|
||||
mStatic.insert(it, std::move(land));
|
||||
|
||||
return RecordId("", isDeleted);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user