1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-05-06 09:41:24 +00:00

Merge branch 'interiorvention' into 'master'

Fix exterior check when finding markers

Closes #7330 and #7326

See merge request OpenMW/openmw!2923
This commit is contained in:
psi29a 2023-04-13 19:45:34 +00:00
commit 6d2b0f3044
3 changed files with 13 additions and 12 deletions

View file

@ -114,13 +114,8 @@ namespace MWGui
store->listIdentifier(ids); store->listIdentifier(ids);
for (auto id : ids) for (auto id : ids)
{ {
visit( if (id.is<ESM::StringRefId>())
[&](auto&& variant) { mNames.push_back(id.getRefIdString());
using T = std::decay_t<decltype(variant)>;
if constexpr (std::is_same_v<T, ESM::StringRefId>)
mNames.push_back(id.getRefIdString());
},
id);
} }
ids.clear(); ids.clear();
} }

View file

@ -3298,7 +3298,7 @@ namespace MWWorld
if (!ref.mRef.getTeleport()) if (!ref.mRef.getTeleport())
continue; continue;
if (ref.mRef.getDestCell().empty()) if (ref.mRef.getDestCell().is<ESM::ESM3ExteriorCellRefId>())
{ {
ESM::Position pos = ref.mRef.getDoorDest(); ESM::Position pos = ref.mRef.getDoorDest();
result = pos.asVec3(); result = pos.asVec3();
@ -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,7 @@ namespace MWWorld
if (!ref.mRef.getTeleport()) if (!ref.mRef.getTeleport())
continue; continue;
if (ref.mRef.getDestCell().empty()) if (ref.mRef.getDestCell().is<ESM::ESM3ExteriorCellRefId>())
{ {
osg::Vec3f worldPos = ref.mRef.getDoorDest().asVec3(); osg::Vec3f worldPos = ref.mRef.getDoorDest().asVec3();
return getClosestMarkerFromExteriorPosition(worldPos, id); return getClosestMarkerFromExteriorPosition(worldPos, id);
@ -3367,7 +3367,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);
} }
} }

View file

@ -142,6 +142,12 @@ namespace ESM
return std::get_if<T>(&mValue); return std::get_if<T>(&mValue);
} }
template <class T>
bool is() const
{
return std::holds_alternative<T>(mValue);
}
friend constexpr bool operator==(const RefId& l, const RefId& r) { return l.mValue == r.mValue; } friend constexpr bool operator==(const RefId& l, const RefId& r) { return l.mValue == r.mValue; }
bool operator==(std::string_view rhs) const; bool operator==(std::string_view rhs) const;