1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-04-01 04:20:20 +00:00

Fix exterior check when finding markers

This commit is contained in:
Evil Eye 2023-04-12 12:22:48 +02:00
parent d11a7899d4
commit 4e0eb75094

View File

@ -3338,8 +3338,8 @@ namespace MWWorld
nextCells.insert(ptr.getCell()->getCell()->getId()); nextCells.insert(ptr.getCell()->getCell()->getId());
while (!nextCells.empty()) while (!nextCells.empty())
{ {
currentCells = nextCells; currentCells.clear();
nextCells.clear(); std::swap(currentCells, nextCells);
for (const auto& cell : currentCells) for (const auto& cell : currentCells)
{ {
MWWorld::CellStore* next = mWorldModel.getCell(cell); MWWorld::CellStore* next = mWorldModel.getCell(cell);
@ -3359,7 +3359,13 @@ namespace MWWorld
if (!ref.mRef.getTeleport()) if (!ref.mRef.getTeleport())
continue; continue;
if (ref.mRef.getDestCell().empty()) bool isExterior = visit(
[](auto&& variant) {
using T = std::decay_t<decltype(variant)>;
return std::is_same_v<T, ESM::ESM3ExteriorCellRefId>;
},
ref.mRef.getDestCell());
if (isExterior)
{ {
osg::Vec3f worldPos = ref.mRef.getDoorDest().asVec3(); osg::Vec3f worldPos = ref.mRef.getDoorDest().asVec3();
return getClosestMarkerFromExteriorPosition(worldPos, id); return getClosestMarkerFromExteriorPosition(worldPos, id);
@ -3367,7 +3373,7 @@ namespace MWWorld
else else
{ {
const auto& dest = ref.mRef.getDestCell(); const auto& dest = ref.mRef.getDestCell();
if (!checkedCells.count(dest) && !currentCells.count(dest)) if (!checkedCells.contains(dest) && !currentCells.contains(dest))
nextCells.insert(dest); nextCells.insert(dest);
} }
} }