1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-12-13 19:13:06 +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.rot[0] = pos.rot[1] = pos.rot[2] = 0;
pos.pos[0] = pos.pos[1] = pos.pos[2] = 0; pos.pos[0] = pos.pos[1] = pos.pos[2] = 0;
const MWWorld::CellStore& cellStore = mWorldModel.getInterior(name); const MWWorld::CellStore* cellStore = mWorldModel.findInterior(name);
ESM::RefId cellId = cellStore.getCell()->getId(); 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; pos = *destPos;
return cellId; return cellId;
} }
if (std::optional<ESM::Position> destPos = searchDoorDestInCell(cellStore)) if (std::optional<ESM::Position> destPos = searchDoorDestInCell(*cellStore))
{ {
pos = *destPos; pos = *destPos;
return cellId; return cellId;
} }
if (std::optional<ESM::Position> destPos = searchMarkerPosition(cellStore, "xmarkerheading")) if (std::optional<ESM::Position> destPos = searchMarkerPosition(*cellStore, "xmarkerheading"))
{ {
pos = *destPos; pos = *destPos;
return cellId; return cellId;
} }
// Fall back to the first static location. // 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()) if (!statics4.empty())
{ {
pos = statics4.begin()->mRef.getPosition(); pos = statics4.begin()->mRef.getPosition();
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0; pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
return cellId; 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()) if (!statics.empty())
{ {
pos = statics.begin()->mRef.getPosition(); pos = statics.begin()->mRef.getPosition();