mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-10 15:45:37 +00:00
Add RefId::is
This commit is contained in:
parent
4e0eb75094
commit
97fb06d8c9
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -3359,13 +3359,7 @@ namespace MWWorld
|
|||||||
if (!ref.mRef.getTeleport())
|
if (!ref.mRef.getTeleport())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool isExterior = visit(
|
if (ref.mRef.getDestCell().is<ESM::ESM3ExteriorCellRefId>())
|
||||||
[](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);
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user