mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-06 09:39:49 +00:00
Allow starting at an (unnamed) exterior cell using --start (Feature #3941)
This commit is contained in:
parent
fe8437ae10
commit
632d39ca76
@ -278,8 +278,7 @@ void OMW::Engine::setResourceDir (const boost::filesystem::path& parResDir)
|
|||||||
mResDir = parResDir;
|
mResDir = parResDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set start cell name (only interiors for now)
|
// Set start cell name
|
||||||
|
|
||||||
void OMW::Engine::setCell (const std::string& cellName)
|
void OMW::Engine::setCell (const std::string& cellName)
|
||||||
{
|
{
|
||||||
mCellName = cellName;
|
mCellName = cellName;
|
||||||
|
@ -148,7 +148,7 @@ namespace OMW
|
|||||||
/// Set resource dir
|
/// Set resource dir
|
||||||
void setResourceDir(const boost::filesystem::path& parResDir);
|
void setResourceDir(const boost::filesystem::path& parResDir);
|
||||||
|
|
||||||
/// Set start cell name (only interiors for now)
|
/// Set start cell name
|
||||||
void setCell(const std::string& cellName);
|
void setCell(const std::string& cellName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2582,7 +2582,25 @@ namespace MWWorld
|
|||||||
{
|
{
|
||||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||||
|
|
||||||
if (const ESM::Cell *ext = getExterior(name)) {
|
const ESM::Cell *ext = getExterior(name);
|
||||||
|
|
||||||
|
if (!ext && name.find(',') != std::string::npos) {
|
||||||
|
try {
|
||||||
|
int x = std::stoi(name.substr(0, name.find(',')));
|
||||||
|
int y = std::stoi(name.substr(name.find(',')+1));
|
||||||
|
ext = getExterior(x, y)->getCell();
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument)
|
||||||
|
{
|
||||||
|
// This exception can be ignored, as this means that name probably refers to a interior cell instead of comma separated coordinates
|
||||||
|
}
|
||||||
|
catch (std::out_of_range)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Cell coordinates out of range.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ext) {
|
||||||
int x = ext->getGridX();
|
int x = ext->getGridX();
|
||||||
int y = ext->getGridY();
|
int y = ext->getGridY();
|
||||||
indexToPosition(x, y, pos.pos[0], pos.pos[1], true);
|
indexToPosition(x, y, pos.pos[0], pos.pos[1], true);
|
||||||
@ -2592,6 +2610,7 @@ namespace MWWorld
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user