mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 19:41:36 +00:00
Merge branch 'FixUBOnDoubleMove' into 'master'
Avoid double move when an area with same coordinates already exists See merge request OpenMW/openmw!2059
This commit is contained in:
commit
3403ea1d9e
1 changed files with 5 additions and 2 deletions
|
@ -404,12 +404,15 @@ namespace MWWorld
|
||||||
land.load(esm, isDeleted);
|
land.load(esm, isDeleted);
|
||||||
|
|
||||||
// Same area defined in multiple plugins? -> last plugin wins
|
// Same area defined in multiple plugins? -> last plugin wins
|
||||||
auto [it, inserted] = mStatic.insert(std::move(land));
|
auto it = mStatic.lower_bound(land);
|
||||||
if (!inserted) {
|
if (it != mStatic.end() && (std::tie(it->mX, it->mY) == std::tie(land.mX, land.mY)))
|
||||||
|
{
|
||||||
auto nh = mStatic.extract(it);
|
auto nh = mStatic.extract(it);
|
||||||
nh.value() = std::move(land);
|
nh.value() = std::move(land);
|
||||||
mStatic.insert(std::move(nh));
|
mStatic.insert(std::move(nh));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
mStatic.insert(it, std::move(land));
|
||||||
|
|
||||||
return RecordId("", isDeleted);
|
return RecordId("", isDeleted);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue