1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-21 11:39:44 +00:00
This commit is contained in:
Petr Mikheev 2023-06-08 22:45:37 +02:00
parent 8b0ef546b8
commit 801a5a3213

View file

@ -2709,34 +2709,36 @@ namespace MWWorld
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
pos.pos[0] = pos.pos[1] = pos.pos[2] = 0;
const MWWorld::CellStore& cellStore = mWorldModel.getInterior(name);
ESM::RefId cellId = cellStore.getCell()->getId();
const MWWorld::CellStore* cellStore = mWorldModel.findInterior(name);
if (!cellStore)
return ESM::RefId();
ESM::RefId cellId = cellStore->getCell()->getId();
if (std::optional<ESM::Position> destPos = searchMarkerPosition(cellStore, "cocmarkerheading"))
if (std::optional<ESM::Position> destPos = searchMarkerPosition(*cellStore, "cocmarkerheading"))
{
pos = *destPos;
return cellId;
}
if (std::optional<ESM::Position> destPos = searchDoorDestInCell(cellStore))
if (std::optional<ESM::Position> destPos = searchDoorDestInCell(*cellStore))
{
pos = *destPos;
return cellId;
}
if (std::optional<ESM::Position> destPos = searchMarkerPosition(cellStore, "xmarkerheading"))
if (std::optional<ESM::Position> destPos = searchMarkerPosition(*cellStore, "xmarkerheading"))
{
pos = *destPos;
return cellId;
}
// Fall back to the first static location.
const MWWorld::CellRefList<ESM4::Static>::List& statics4 = cellStore.getReadOnlyEsm4Statics().mList;
const MWWorld::CellRefList<ESM4::Static>::List& statics4 = cellStore->getReadOnlyEsm4Statics().mList;
if (!statics4.empty())
{
pos = statics4.begin()->mRef.getPosition();
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
return cellId;
}
const MWWorld::CellRefList<ESM::Static>::List& statics = cellStore.getReadOnlyStatics().mList;
const MWWorld::CellRefList<ESM::Static>::List& statics = cellStore->getReadOnlyStatics().mList;
if (!statics.empty())
{
pos = statics.begin()->mRef.getPosition();