mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-08 03:41:11 -04:00
Merge branch 'destinationunknown' into 'master'
Don't add non-existent cell travel destinations (#8349) Closes #8349 See merge request OpenMW/openmw!4540
This commit is contained in:
commit
1a08565a20
@ -4,6 +4,7 @@
|
|||||||
#include <MyGUI_Gui.h>
|
#include <MyGUI_Gui.h>
|
||||||
#include <MyGUI_ScrollView.h>
|
#include <MyGUI_ScrollView.h>
|
||||||
|
|
||||||
|
#include <components/debug/debuglog.hpp>
|
||||||
#include <components/esm3/loadcrea.hpp>
|
#include <components/esm3/loadcrea.hpp>
|
||||||
#include <components/esm3/loadgmst.hpp>
|
#include <components/esm3/loadgmst.hpp>
|
||||||
#include <components/misc/strings/conversion.hpp>
|
#include <components/misc/strings/conversion.hpp>
|
||||||
@ -124,12 +125,23 @@ namespace MWGui
|
|||||||
bool interior = true;
|
bool interior = true;
|
||||||
const ESM::ExteriorCellLocation cellIndex
|
const ESM::ExteriorCellLocation cellIndex
|
||||||
= ESM::positionToExteriorCellLocation(dest.mPos.pos[0], dest.mPos.pos[1]);
|
= ESM::positionToExteriorCellLocation(dest.mPos.pos[0], dest.mPos.pos[1]);
|
||||||
|
const MWWorld::WorldModel& worldModel = *MWBase::Environment::get().getWorldModel();
|
||||||
if (cellname.empty())
|
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);
|
cellname = MWBase::Environment::get().getWorld()->getCellName(&cell);
|
||||||
interior = false;
|
interior = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const MWWorld::CellStore* destCell = worldModel.findCell(cellname, false);
|
||||||
|
if (destCell == nullptr)
|
||||||
|
{
|
||||||
|
Log(Debug::Error) << "Failed to add travel destination: unknown cell (" << cellname << ")";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
interior = !destCell->getCell()->isExterior();
|
||||||
|
}
|
||||||
addDestination(ESM::RefId::stringRefId(cellname), dest.mPos, interior);
|
addDestination(ESM::RefId::stringRefId(cellname), dest.mPos, interior);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user