mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 12:58:00 +03:00
Don't add non-existent cell travel destinations (#8349)
This commit is contained in:
parent
63e3b8f41b
commit
d96f6116e6
1 changed files with 8 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
|||
#include <MyGUI_Gui.h>
|
||||
#include <MyGUI_ScrollView.h>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/esm3/loadcrea.hpp>
|
||||
#include <components/esm3/loadgmst.hpp>
|
||||
#include <components/misc/strings/conversion.hpp>
|
||||
|
@ -131,12 +132,18 @@ namespace MWGui
|
|||
bool interior = true;
|
||||
const ESM::ExteriorCellLocation cellIndex
|
||||
= ESM::positionToExteriorCellLocation(dest.mPos.pos[0], dest.mPos.pos[1]);
|
||||
const MWWorld::WorldModel& worldModel = *MWBase::Environment::get().getWorldModel();
|
||||
if (cellname.empty())
|
||||
{
|
||||
MWWorld::CellStore& cell = MWBase::Environment::get().getWorldModel()->getExterior(cellIndex);
|
||||
MWWorld::CellStore& cell = worldModel.getExterior(cellIndex);
|
||||
cellname = MWBase::Environment::get().getWorld()->getCellName(&cell);
|
||||
interior = false;
|
||||
}
|
||||
else if (worldModel.findCell(cellname, false) == nullptr)
|
||||
{
|
||||
Log(Debug::Error) << "Failed to add travel destination: unknown cell (" << cellname << ")";
|
||||
continue;
|
||||
}
|
||||
addDestination(ESM::RefId::stringRefId(cellname), dest.mPos, interior);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue