mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-13 15:09:43 +00:00
implemented exterior coc
This commit is contained in:
parent
a740a577a9
commit
5f84b680af
4 changed files with 60 additions and 2 deletions
|
@ -41,9 +41,20 @@ namespace MWScript
|
|||
runtime.pop();
|
||||
|
||||
ESM::Position pos;
|
||||
pos.pos[0] = pos.pos[1] = pos.pos[2] = 0;
|
||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
context.getWorld().changeCell (cell, pos);
|
||||
pos.pos[2] = 0;
|
||||
|
||||
if (const ESM::Cell *exterior = context.getWorld().getExterior (cell))
|
||||
{
|
||||
context.getWorld().indexToPosition (exterior->data.gridX, exterior->data.gridY,
|
||||
pos.pos[0], pos.pos[1]);
|
||||
context.getWorld().changeToExteriorCell (pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.pos[0] = pos.pos[1] = 0;
|
||||
context.getWorld().changeCell (cell, pos);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -691,6 +691,20 @@ namespace MWWorld
|
|||
changeCell (x, y, position);
|
||||
}
|
||||
|
||||
const ESM::Cell *World::getExterior (const std::string& cellName) const
|
||||
{
|
||||
// first try named cells
|
||||
if (const ESM::Cell *cell = mStore.cells.searchExtByName (cellName))
|
||||
return cell;
|
||||
|
||||
// didn't work -> now check for regions
|
||||
if (mStore.regions.search (cellName))
|
||||
if (const ESM::Cell *cell = mStore.cells.searchExtByRegion (cellName))
|
||||
return cell;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void World::markCellAsUnchanged()
|
||||
{
|
||||
mCellChanged = false;
|
||||
|
|
|
@ -145,6 +145,9 @@ namespace MWWorld
|
|||
|
||||
void changeToExteriorCell (const ESM::Position& position);
|
||||
|
||||
const ESM::Cell *getExterior (const std::string& cellName) const;
|
||||
///< Return a cell matching the given name or a 0-pointer, if there is no such cell.
|
||||
|
||||
void markCellAsUnchanged();
|
||||
|
||||
std::string getFacedHandle();
|
||||
|
|
|
@ -209,6 +209,36 @@ namespace ESMS
|
|||
return it2->second;
|
||||
}
|
||||
|
||||
const Cell *searchExtByName (const std::string& id) const
|
||||
{
|
||||
for (ExtCells::const_iterator iter = extCells.begin(); iter!=extCells.end(); ++iter)
|
||||
{
|
||||
const ExtCellsCol& column = iter->second;
|
||||
for (ExtCellsCol::const_iterator iter = column.begin(); iter!=column.end(); ++iter)
|
||||
{
|
||||
if (iter->second->name==id)
|
||||
return iter->second;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Cell *searchExtByRegion (const std::string& id) const
|
||||
{
|
||||
for (ExtCells::const_iterator iter = extCells.begin(); iter!=extCells.end(); ++iter)
|
||||
{
|
||||
const ExtCellsCol& column = iter->second;
|
||||
for (ExtCellsCol::const_iterator iter = column.begin(); iter!=column.end(); ++iter)
|
||||
{
|
||||
if (iter->second->region==id)
|
||||
return iter->second;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void load(ESMReader &esm, const std::string &id)
|
||||
{
|
||||
using namespace std;
|
||||
|
|
Loading…
Reference in a new issue