1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-30 16:20:21 +00:00

Merge branch 'fix_7385' into 'master'

Fix #7385

Closes #7385

See merge request OpenMW/openmw!3117
This commit is contained in:
psi29a 2023-06-09 21:23:54 +00:00
commit 766b829ce6

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();