mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 17:06:41 +00:00
Merge branch 'getcell-ref' into 'master'
WorldImp functions return reference instead of ptr when ptr is never nullptr. See merge request OpenMW/openmw!2946
This commit is contained in:
commit
0a9d937cfe
19 changed files with 141 additions and 159 deletions
|
@ -157,7 +157,7 @@ namespace MWBase
|
|||
|
||||
virtual bool isCellQuasiExterior() const = 0;
|
||||
|
||||
virtual void getDoorMarkers(MWWorld::CellStore* cell, std::vector<DoorMarker>& out) = 0;
|
||||
virtual void getDoorMarkers(MWWorld::CellStore& cell, std::vector<DoorMarker>& out) = 0;
|
||||
///< get a list of teleport door markers for a given cell, to be displayed on the local map
|
||||
|
||||
virtual void setGlobalInt(MWWorld::GlobalVariableName name, int value) = 0;
|
||||
|
|
|
@ -300,7 +300,7 @@ namespace MWClass
|
|||
std::string Door::getDestination(const MWWorld::LiveCellRef<ESM::Door>& door)
|
||||
{
|
||||
std::string_view dest = MWBase::Environment::get().getWorld()->getCellName(
|
||||
MWBase::Environment::get().getWorldModel()->getCell(door.mRef.getDestCell()));
|
||||
&MWBase::Environment::get().getWorldModel()->getCell(door.mRef.getDestCell()));
|
||||
|
||||
return "#{sCell=" + std::string{ dest } + "}";
|
||||
}
|
||||
|
|
|
@ -584,7 +584,7 @@ namespace MWGui
|
|||
{
|
||||
if (!mInterior)
|
||||
requestMapRender(
|
||||
MWBase::Environment::get().getWorldModel()->getExterior(entry.mCellX, entry.mCellY));
|
||||
&MWBase::Environment::get().getWorldModel()->getExterior(entry.mCellX, entry.mCellY));
|
||||
|
||||
osg::ref_ptr<osg::Texture2D> texture = mLocalMapRender->getMapTexture(entry.mCellX, entry.mCellY);
|
||||
if (texture)
|
||||
|
@ -633,7 +633,7 @@ namespace MWGui
|
|||
for (MyGUI::Widget* widget : mExteriorDoorMarkerWidgets)
|
||||
widget->setVisible(false);
|
||||
|
||||
MWWorld::CellStore* cell = worldModel->getInterior(mPrefix);
|
||||
MWWorld::CellStore& cell = worldModel->getInterior(mPrefix);
|
||||
world->getDoorMarkers(cell, doors);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -130,9 +130,9 @@ namespace MWGui
|
|||
= MWWorld::positionToCellIndex(transport[i].mPos.pos[0], transport[i].mPos.pos[1]);
|
||||
if (cellname.empty())
|
||||
{
|
||||
MWWorld::CellStore* cell
|
||||
MWWorld::CellStore& cell
|
||||
= MWBase::Environment::get().getWorldModel()->getExterior(cellIndex.x(), cellIndex.y());
|
||||
cellname = MWBase::Environment::get().getWorld()->getCellName(cell);
|
||||
cellname = MWBase::Environment::get().getWorld()->getCellName(&cell);
|
||||
interior = false;
|
||||
}
|
||||
addDestination(ESM::RefId::stringRefId(cellname), transport[i].mPos, interior);
|
||||
|
|
|
@ -84,9 +84,9 @@ namespace MWLua
|
|||
WorldView* worldView = context.mWorldView;
|
||||
addTimeBindings(api, context, true);
|
||||
api["getCellByName"]
|
||||
= [](std::string_view name) { return GCell{ MWBase::Environment::get().getWorldModel()->getCell(name) }; };
|
||||
= [](std::string_view name) { return GCell{ &MWBase::Environment::get().getWorldModel()->getCell(name) }; };
|
||||
api["getExteriorCell"]
|
||||
= [](int x, int y) { return GCell{ MWBase::Environment::get().getWorldModel()->getExterior(x, y) }; };
|
||||
= [](int x, int y) { return GCell{ &MWBase::Environment::get().getWorldModel()->getExterior(x, y) }; };
|
||||
api["activeActors"] = GObjectList{ worldView->getActorsInScene() };
|
||||
api["createObject"] = [](std::string_view recordId, sol::optional<int> count) -> GObject {
|
||||
// Doesn't matter which cell to use because the new object will be in disabled state.
|
||||
|
|
|
@ -59,9 +59,9 @@ namespace MWLua
|
|||
if (name.empty())
|
||||
cell = nullptr; // default exterior worldspace
|
||||
else
|
||||
cell = wm->getCell(name);
|
||||
cell = &wm->getCell(name);
|
||||
}
|
||||
return wm->getCellByPosition(pos, cell);
|
||||
return &wm->getCellByPosition(pos, cell);
|
||||
}
|
||||
|
||||
void teleportPlayer(MWWorld::CellStore* destCell, const osg::Vec3f& pos, const osg::Vec3f& rot)
|
||||
|
|
|
@ -47,9 +47,8 @@ namespace MWLua
|
|||
const MWWorld::CellRef& cellRef = doorPtr(o).getCellRef();
|
||||
if (!cellRef.getTeleport())
|
||||
return sol::nil;
|
||||
MWWorld::CellStore* cell = MWBase::Environment::get().getWorldModel()->getCell(cellRef.getDestCell());
|
||||
assert(cell);
|
||||
return o.getCell(lua, cell);
|
||||
MWWorld::CellStore& cell = MWBase::Environment::get().getWorldModel()->getCell(cellRef.getDestCell());
|
||||
return o.getCell(lua, &cell);
|
||||
};
|
||||
|
||||
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
|
||||
|
@ -84,9 +83,8 @@ namespace MWLua
|
|||
const MWWorld::CellRef& cellRef = door4Ptr(o).getCellRef();
|
||||
if (!cellRef.getTeleport())
|
||||
return sol::nil;
|
||||
MWWorld::CellStore* cell = MWBase::Environment::get().getWorldModel()->getCell(cellRef.getDestCell());
|
||||
assert(cell);
|
||||
return o.getCell(lua, cell);
|
||||
MWWorld::CellStore& cell = MWBase::Environment::get().getWorldModel()->getCell(cellRef.getDestCell());
|
||||
return o.getCell(lua, &cell);
|
||||
};
|
||||
|
||||
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
|
||||
|
|
|
@ -398,11 +398,11 @@ namespace MWScript
|
|||
MWWorld::CellStore* store = nullptr;
|
||||
try
|
||||
{
|
||||
store = worldModel->getCell(cellID);
|
||||
store = &worldModel->getCell(cellID);
|
||||
if (store->isExterior())
|
||||
{
|
||||
const osg::Vec2i cellIndex = MWWorld::positionToCellIndex(x, y);
|
||||
store = worldModel->getExterior(cellIndex.x(), cellIndex.y());
|
||||
store = &worldModel->getExterior(cellIndex.x(), cellIndex.y());
|
||||
}
|
||||
}
|
||||
catch (std::exception&)
|
||||
|
@ -417,7 +417,7 @@ namespace MWScript
|
|||
if (!isPlayer)
|
||||
return;
|
||||
const osg::Vec2i cellIndex = MWWorld::positionToCellIndex(x, y);
|
||||
store = worldModel->getExterior(cellIndex.x(), cellIndex.y());
|
||||
store = &worldModel->getExterior(cellIndex.x(), cellIndex.y());
|
||||
}
|
||||
if (store)
|
||||
{
|
||||
|
@ -474,7 +474,7 @@ namespace MWScript
|
|||
if (isPlayer)
|
||||
{
|
||||
MWWorld::CellStore* cell
|
||||
= MWBase::Environment::get().getWorldModel()->getExterior(cellIndex.x(), cellIndex.y());
|
||||
= &MWBase::Environment::get().getWorldModel()->getExterior(cellIndex.x(), cellIndex.y());
|
||||
ptr = world->moveObject(ptr, cell, osg::Vec3(x, y, z));
|
||||
}
|
||||
else
|
||||
|
@ -518,7 +518,7 @@ namespace MWScript
|
|||
MWWorld::CellStore* store = nullptr;
|
||||
try
|
||||
{
|
||||
store = MWBase::Environment::get().getWorldModel()->getCell(cellName);
|
||||
store = &MWBase::Environment::get().getWorldModel()->getCell(cellName);
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
|
@ -568,7 +568,7 @@ namespace MWScript
|
|||
if (player.getCell()->isExterior())
|
||||
{
|
||||
const osg::Vec2i cellIndex = MWWorld::positionToCellIndex(x, y);
|
||||
store = MWBase::Environment::get().getWorldModel()->getExterior(cellIndex.x(), cellIndex.y());
|
||||
store = &MWBase::Environment::get().getWorldModel()->getExterior(cellIndex.x(), cellIndex.y());
|
||||
}
|
||||
else
|
||||
store = player.getCell();
|
||||
|
|
|
@ -563,7 +563,7 @@ void MWState::StateManager::loadGame(const Character* character, const std::file
|
|||
{
|
||||
// Cell no longer exists (i.e. changed game files), choose a default cell
|
||||
Log(Debug::Warning) << "Warning: Player character's cell no longer exists, changing to the default cell";
|
||||
MWWorld::CellStore* cell = MWBase::Environment::get().getWorldModel()->getExterior(0, 0);
|
||||
MWWorld::CellStore& cell = MWBase::Environment::get().getWorldModel()->getExterior(0, 0);
|
||||
float x, y;
|
||||
MWBase::Environment::get().getWorld()->indexToPosition(0, 0, x, y, false);
|
||||
ESM::Position pos;
|
||||
|
@ -573,7 +573,7 @@ void MWState::StateManager::loadGame(const Character* character, const std::file
|
|||
pos.rot[0] = 0;
|
||||
pos.rot[1] = 0;
|
||||
pos.rot[2] = 0;
|
||||
MWBase::Environment::get().getWorld()->changeToCell(cell->getCell()->getId(), pos, true, false);
|
||||
MWBase::Environment::get().getWorld()->changeToCell(cell.getCell()->getId(), pos, true, false);
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getWorld()->updateProjectilesCasters();
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace MWWorld
|
|||
// Find any NPCs that are following the actor and teleport them with him
|
||||
std::set<MWWorld::Ptr> followers;
|
||||
|
||||
bool toExterior = MWBase::Environment::get().getWorldModel()->getCell(mCellId)->isExterior();
|
||||
bool toExterior = MWBase::Environment::get().getWorldModel()->getCell(mCellId).isExterior();
|
||||
getFollowers(actor, followers, toExterior, true);
|
||||
|
||||
for (std::set<MWWorld::Ptr>::iterator it = followers.begin(); it != followers.end(); ++it)
|
||||
|
@ -66,7 +66,7 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
else
|
||||
teleported = world->moveObject(actor, worldModel->getCell(mCellId), mPosition.asVec3(), true, true);
|
||||
teleported = world->moveObject(actor, &worldModel->getCell(mCellId), mPosition.asVec3(), true, true);
|
||||
}
|
||||
|
||||
if (!world->isWaterWalkingCastableOnTarget(teleported) && MWMechanics::hasWaterWalking(teleported))
|
||||
|
|
|
@ -259,20 +259,20 @@ namespace MWWorld
|
|||
mPreloadCells.clear();
|
||||
}
|
||||
|
||||
void CellPreloader::preload(CellStore* cell, double timestamp)
|
||||
void CellPreloader::preload(CellStore& cell, double timestamp)
|
||||
{
|
||||
if (!mWorkQueue)
|
||||
{
|
||||
Log(Debug::Error) << "Error: can't preload, no work queue set";
|
||||
return;
|
||||
}
|
||||
if (cell->getState() == CellStore::State_Unloaded)
|
||||
if (cell.getState() == CellStore::State_Unloaded)
|
||||
{
|
||||
Log(Debug::Error) << "Error: can't preload objects for unloaded cell";
|
||||
return;
|
||||
}
|
||||
|
||||
PreloadMap::iterator found = mPreloadCells.find(cell);
|
||||
PreloadMap::iterator found = mPreloadCells.find(&cell);
|
||||
if (found != mPreloadCells.end())
|
||||
{
|
||||
// already preloaded, nothing to do other than updating the timestamp
|
||||
|
@ -304,11 +304,11 @@ namespace MWWorld
|
|||
return;
|
||||
}
|
||||
|
||||
osg::ref_ptr<PreloadItem> item(new PreloadItem(cell, mResourceSystem->getSceneManager(), mBulletShapeManager,
|
||||
osg::ref_ptr<PreloadItem> item(new PreloadItem(&cell, mResourceSystem->getSceneManager(), mBulletShapeManager,
|
||||
mResourceSystem->getKeyframeManager(), mTerrain, mLandManager, mPreloadInstances));
|
||||
mWorkQueue->addWorkItem(item);
|
||||
|
||||
mPreloadCells[cell] = PreloadEntry(timestamp, item);
|
||||
mPreloadCells[&cell] = PreloadEntry(timestamp, item);
|
||||
}
|
||||
|
||||
void CellPreloader::notifyLoaded(CellStore* cell)
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace MWWorld
|
|||
|
||||
/// Ask a background thread to preload rendering meshes and collision shapes for objects in this cell.
|
||||
/// @note The cell itself must be in State_Loaded or State_Preloaded.
|
||||
void preload(MWWorld::CellStore* cell, double timestamp);
|
||||
void preload(MWWorld::CellStore& cell, double timestamp);
|
||||
|
||||
void notifyLoaded(MWWorld::CellStore* cell);
|
||||
|
||||
|
|
|
@ -367,7 +367,7 @@ namespace MWWorld
|
|||
|
||||
try
|
||||
{
|
||||
mCellStore = MWBase::Environment::get().getWorldModel()->getCell(player.mCellId);
|
||||
mCellStore = &MWBase::Environment::get().getWorldModel()->getCell(player.mCellId);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -401,7 +401,7 @@ namespace MWWorld
|
|||
if (player.mHasMark)
|
||||
{
|
||||
mMarkedPosition = player.mMarkedPosition;
|
||||
mMarkedCell = MWBase::Environment::get().getWorldModel()->getCell(player.mMarkedCell);
|
||||
mMarkedCell = &MWBase::Environment::get().getWorldModel()->getCell(player.mMarkedCell);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -377,19 +377,19 @@ namespace MWWorld
|
|||
mRendering.notifyWorldSpaceChanged();
|
||||
}
|
||||
|
||||
void Scene::loadCell(CellStore* cell, Loading::Listener* loadingListener, bool respawn, const osg::Vec3f& position,
|
||||
void Scene::loadCell(CellStore& cell, Loading::Listener* loadingListener, bool respawn, const osg::Vec3f& position,
|
||||
const DetourNavigator::UpdateGuard* navigatorUpdateGuard)
|
||||
{
|
||||
using DetourNavigator::HeightfieldShape;
|
||||
|
||||
assert(mActiveCells.find(cell) == mActiveCells.end());
|
||||
mActiveCells.insert(cell);
|
||||
assert(mActiveCells.find(&cell) == mActiveCells.end());
|
||||
mActiveCells.insert(&cell);
|
||||
|
||||
Log(Debug::Info) << "Loading cell " << cell->getCell()->getDescription();
|
||||
Log(Debug::Info) << "Loading cell " << cell.getCell()->getDescription();
|
||||
|
||||
const int cellX = cell->getCell()->getGridX();
|
||||
const int cellY = cell->getCell()->getGridY();
|
||||
const MWWorld::Cell& cellVariant = *cell->getCell();
|
||||
const int cellX = cell.getCell()->getGridX();
|
||||
const int cellY = cell.getCell()->getGridY();
|
||||
const MWWorld::Cell& cellVariant = *cell.getCell();
|
||||
|
||||
if (cellVariant.isExterior())
|
||||
{
|
||||
|
@ -440,22 +440,22 @@ namespace MWWorld
|
|||
},
|
||||
[&](const ESM4::Cell& cell) {},
|
||||
},
|
||||
*cell->getCell());
|
||||
*cell.getCell());
|
||||
|
||||
// register local scripts
|
||||
// do this before insertCell, to make sure we don't add scripts from levelled creature spawning twice
|
||||
mWorld.getLocalScripts().addCell(cell);
|
||||
mWorld.getLocalScripts().addCell(&cell);
|
||||
|
||||
if (respawn)
|
||||
cell->respawn();
|
||||
cell.respawn();
|
||||
|
||||
insertCell(*cell, loadingListener, navigatorUpdateGuard);
|
||||
insertCell(cell, loadingListener, navigatorUpdateGuard);
|
||||
|
||||
mRendering.addCell(cell);
|
||||
mRendering.addCell(&cell);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->addCell(cell);
|
||||
bool waterEnabled = cellVariant.hasWater() || cell->isExterior();
|
||||
float waterLevel = cell->getWaterLevel();
|
||||
MWBase::Environment::get().getWindowManager()->addCell(&cell);
|
||||
bool waterEnabled = cellVariant.hasWater() || cell.isExterior();
|
||||
float waterLevel = cell.getWaterLevel();
|
||||
mRendering.setWaterEnabled(waterEnabled);
|
||||
if (waterEnabled)
|
||||
{
|
||||
|
@ -477,10 +477,10 @@ namespace MWWorld
|
|||
else
|
||||
mPhysics->disableWater();
|
||||
|
||||
if (!cell->isExterior() && !cellVariant.isQuasiExterior())
|
||||
if (!cell.isExterior() && !cellVariant.isQuasiExterior())
|
||||
mRendering.configureAmbient(cellVariant);
|
||||
|
||||
mPreloader->notifyLoaded(cell);
|
||||
mPreloader->notifyLoaded(&cell);
|
||||
}
|
||||
|
||||
void Scene::clear()
|
||||
|
@ -554,7 +554,7 @@ namespace MWWorld
|
|||
|
||||
mNavigator.setWorldspace(Misc::StringUtils::lowerCase(mWorld.getWorldModel()
|
||||
.getExterior(playerCellX, playerCellY)
|
||||
->getCell()
|
||||
.getCell()
|
||||
->getWorldSpace()
|
||||
.serializeText()),
|
||||
navigatorUpdateGuard.get());
|
||||
|
@ -580,7 +580,7 @@ namespace MWWorld
|
|||
{
|
||||
if (!isCellInCollection(x, y, collection))
|
||||
{
|
||||
refsToLoad += mWorld.getWorldModel().getExterior(x, y)->count();
|
||||
refsToLoad += mWorld.getWorldModel().getExterior(x, y).count();
|
||||
cellsPositionsToLoad.emplace_back(x, y);
|
||||
}
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ namespace MWWorld
|
|||
{
|
||||
if (!isCellInCollection(x, y, mActiveCells))
|
||||
{
|
||||
CellStore* cell = mWorld.getWorldModel().getExterior(x, y);
|
||||
CellStore& cell = mWorld.getWorldModel().getExterior(x, y);
|
||||
loadCell(cell, loadingListener, changeEvent, pos, navigatorUpdateGuard.get());
|
||||
}
|
||||
}
|
||||
|
@ -623,8 +623,8 @@ namespace MWWorld
|
|||
|
||||
navigatorUpdateGuard.reset();
|
||||
|
||||
CellStore* current = mWorld.getWorldModel().getExterior(playerCellX, playerCellY);
|
||||
MWBase::Environment::get().getWindowManager()->changeCell(current);
|
||||
CellStore& current = mWorld.getWorldModel().getExterior(playerCellX, playerCellY);
|
||||
MWBase::Environment::get().getWindowManager()->changeCell(¤t);
|
||||
|
||||
if (changeEvent)
|
||||
mCellChanged = true;
|
||||
|
@ -676,8 +676,8 @@ namespace MWWorld
|
|||
loadingListener->setLabel(
|
||||
"Testing exterior cells (" + std::to_string(i) + "/" + std::to_string(cells.getExtSize()) + ")...");
|
||||
|
||||
CellStore* cell = mWorld.getWorldModel().getExterior(it->mData.mX, it->mData.mY);
|
||||
mNavigator.setWorldspace(Misc::StringUtils::lowerCase(cell->getCell()->getWorldSpace().serializeText()),
|
||||
CellStore& cell = mWorld.getWorldModel().getExterior(it->mData.mX, it->mData.mY);
|
||||
mNavigator.setWorldspace(Misc::StringUtils::lowerCase(cell.getCell()->getWorldSpace().serializeText()),
|
||||
navigatorUpdateGuard.get());
|
||||
const osg::Vec3f position
|
||||
= osg::Vec3f(it->mData.mX + 0.5f, it->mData.mY + 0.5f, 0) * Constants::CellSizeInUnits;
|
||||
|
@ -734,8 +734,8 @@ namespace MWWorld
|
|||
loadingListener->setLabel(
|
||||
"Testing interior cells (" + std::to_string(i) + "/" + std::to_string(cells.getIntSize()) + ")...");
|
||||
|
||||
CellStore* cell = mWorld.getWorldModel().getInterior(it->mName);
|
||||
mNavigator.setWorldspace(Misc::StringUtils::lowerCase(cell->getCell()->getWorldSpace().serializeText()),
|
||||
CellStore& cell = mWorld.getWorldModel().getInterior(it->mName);
|
||||
mNavigator.setWorldspace(Misc::StringUtils::lowerCase(cell.getCell()->getWorldSpace().serializeText()),
|
||||
navigatorUpdateGuard.get());
|
||||
ESM::Position position;
|
||||
mWorld.findInteriorPosition(it->mName, position);
|
||||
|
@ -772,21 +772,21 @@ namespace MWWorld
|
|||
mRendering.getResourceSystem()->setExpiryDelay(Settings::Manager::getFloat("cache expiry delay", "Cells"));
|
||||
}
|
||||
|
||||
void Scene::changePlayerCell(CellStore* cell, const ESM::Position& pos, bool adjustPlayerPos)
|
||||
void Scene::changePlayerCell(CellStore& cell, const ESM::Position& pos, bool adjustPlayerPos)
|
||||
{
|
||||
mCurrentCell = cell;
|
||||
mCurrentCell = &cell;
|
||||
|
||||
mRendering.enableTerrain(cell->isExterior());
|
||||
mRendering.enableTerrain(cell.isExterior());
|
||||
|
||||
MWWorld::Ptr old = mWorld.getPlayerPtr();
|
||||
mWorld.getPlayer().setCell(cell);
|
||||
mWorld.getPlayer().setCell(&cell);
|
||||
|
||||
MWWorld::Ptr player = mWorld.getPlayerPtr();
|
||||
mRendering.updatePlayerPtr(player);
|
||||
|
||||
// The player is loaded before the scene and by default it is grounded, with the scene fully loaded,
|
||||
// we validate and correct this. Only run once, during initial cell load.
|
||||
if (old.mCell == cell)
|
||||
if (old.mCell == &cell)
|
||||
mPhysics->traceDown(player, player.getRefData().getPosition().asVec3(), 10.f);
|
||||
|
||||
if (adjustPlayerPos)
|
||||
|
@ -857,7 +857,7 @@ namespace MWWorld
|
|||
void Scene::changeToInteriorCell(
|
||||
std::string_view cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
||||
{
|
||||
CellStore* cell = mWorld.getWorldModel().getInterior(cellName);
|
||||
CellStore& cell = mWorld.getWorldModel().getInterior(cellName);
|
||||
bool useFading = (mCurrentCell != nullptr);
|
||||
if (useFading)
|
||||
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0.5);
|
||||
|
@ -866,7 +866,7 @@ namespace MWWorld
|
|||
loadingListener->setLabel("#{OMWEngine:LoadingInterior}");
|
||||
Loading::ScopedLoad load(loadingListener);
|
||||
|
||||
if (mCurrentCell != nullptr && *mCurrentCell == *cell)
|
||||
if (mCurrentCell != nullptr && *mCurrentCell == cell)
|
||||
{
|
||||
mWorld.moveObject(mWorld.getPlayerPtr(), position.asVec3());
|
||||
mWorld.rotateObject(mWorld.getPlayerPtr(), position.asRotationVec3());
|
||||
|
@ -889,10 +889,10 @@ namespace MWWorld
|
|||
}
|
||||
assert(mActiveCells.empty());
|
||||
|
||||
loadingListener->setProgressRange(cell->count());
|
||||
loadingListener->setProgressRange(cell.count());
|
||||
|
||||
mNavigator.setWorldspace(
|
||||
Misc::StringUtils::lowerCase(cell->getCell()->getWorldSpace().serializeText()), navigatorUpdateGuard.get());
|
||||
Misc::StringUtils::lowerCase(cell.getCell()->getWorldSpace().serializeText()), navigatorUpdateGuard.get());
|
||||
mNavigator.updateBounds(position.asVec3(), navigatorUpdateGuard.get());
|
||||
|
||||
// Load cell.
|
||||
|
@ -919,7 +919,7 @@ namespace MWWorld
|
|||
|
||||
MWBase::Environment::get().getWindowManager()->changeCell(mCurrentCell);
|
||||
|
||||
MWBase::Environment::get().getWorld()->getPostProcessor()->setExteriorFlag(cell->getCell()->isQuasiExterior());
|
||||
MWBase::Environment::get().getWorld()->getPostProcessor()->setExteriorFlag(cell.getCell()->isQuasiExterior());
|
||||
}
|
||||
|
||||
void Scene::changeToExteriorCell(
|
||||
|
@ -928,9 +928,9 @@ namespace MWWorld
|
|||
|
||||
if (changeEvent)
|
||||
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0.5);
|
||||
CellStore* current = mWorld.getWorldModel().getCell(extCellId);
|
||||
CellStore& current = mWorld.getWorldModel().getCell(extCellId);
|
||||
|
||||
const osg::Vec2i cellIndex(current->getCell()->getGridX(), current->getCell()->getGridY());
|
||||
const osg::Vec2i cellIndex(current.getCell()->getGridX(), current.getCell()->getGridY());
|
||||
|
||||
changeCellGrid(position.asVec3(), cellIndex.x(), cellIndex.y(), changeEvent);
|
||||
|
||||
|
@ -1182,12 +1182,12 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
|
||||
void Scene::preloadCell(CellStore* cell, bool preloadSurrounding)
|
||||
void Scene::preloadCell(CellStore& cell, bool preloadSurrounding)
|
||||
{
|
||||
if (preloadSurrounding && cell->isExterior())
|
||||
if (preloadSurrounding && cell.isExterior())
|
||||
{
|
||||
int x = cell->getCell()->getGridX();
|
||||
int y = cell->getCell()->getGridY();
|
||||
int x = cell.getCell()->getGridX();
|
||||
int y = cell.getCell()->getGridY();
|
||||
unsigned int numpreloaded = 0;
|
||||
for (int dx = -mHalfGridSize; dx <= mHalfGridSize; ++dx)
|
||||
{
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace MWWorld
|
|||
osg::Vec2i getNewGridCenter(const osg::Vec3f& pos, const osg::Vec2i* currentGridCenter = nullptr) const;
|
||||
|
||||
void unloadCell(CellStore* cell, const DetourNavigator::UpdateGuard* navigatorUpdateGuard);
|
||||
void loadCell(CellStore* cell, Loading::Listener* loadingListener, bool respawn, const osg::Vec3f& position,
|
||||
void loadCell(CellStore& cell, Loading::Listener* loadingListener, bool respawn, const osg::Vec3f& position,
|
||||
const DetourNavigator::UpdateGuard* navigatorUpdateGuard);
|
||||
|
||||
public:
|
||||
|
@ -143,13 +143,13 @@ namespace MWWorld
|
|||
|
||||
~Scene();
|
||||
|
||||
void preloadCell(MWWorld::CellStore* cell, bool preloadSurrounding = false);
|
||||
void preloadCell(MWWorld::CellStore& cell, bool preloadSurrounding = false);
|
||||
void preloadTerrain(const osg::Vec3f& pos, bool sync = false);
|
||||
void reloadTerrain();
|
||||
|
||||
void playerMoved(const osg::Vec3f& pos);
|
||||
|
||||
void changePlayerCell(CellStore* newCell, const ESM::Position& position, bool adjustPlayerPos);
|
||||
void changePlayerCell(CellStore& newCell, const ESM::Position& position, bool adjustPlayerPos);
|
||||
|
||||
CellStore* getCurrentCell();
|
||||
|
||||
|
|
|
@ -507,7 +507,7 @@ namespace MWWorld
|
|||
{
|
||||
if (getPlayerPtr().getCell()->isExterior())
|
||||
mWorldScene->preloadTerrain(getPlayerPtr().getRefData().getPosition().asVec3());
|
||||
mWorldScene->preloadCell(getPlayerPtr().getCell(), true);
|
||||
mWorldScene->preloadCell(*getPlayerPtr().getCell(), true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -994,7 +994,7 @@ namespace MWWorld
|
|||
void World::changeToCell(
|
||||
const ESM::RefId& cellId, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
||||
{
|
||||
const MWWorld::Cell* destinationCell = getWorldModel().getCell(cellId)->getCell();
|
||||
const MWWorld::Cell* destinationCell = getWorldModel().getCell(cellId).getCell();
|
||||
bool exteriorCell = destinationCell->isExterior();
|
||||
|
||||
mPhysics->clearQueuedMovement();
|
||||
|
@ -1183,7 +1183,7 @@ namespace MWWorld
|
|||
else
|
||||
{
|
||||
if (mWorldScene->isCellActive(*newCell))
|
||||
mWorldScene->changePlayerCell(newCell, pos, false);
|
||||
mWorldScene->changePlayerCell(*newCell, pos, false);
|
||||
else
|
||||
mWorldScene->changeToExteriorCell(newCell->getCell()->getId(), pos, false);
|
||||
}
|
||||
|
@ -1271,12 +1271,12 @@ namespace MWWorld
|
|||
const osg::Vec2i index = positionToCellIndex(position.x(), position.y());
|
||||
|
||||
CellStore* cell = ptr.getCell();
|
||||
CellStore* newCell = mWorldModel.getExterior(index.x(), index.y());
|
||||
bool isCellActive = getPlayerPtr().isInCell() && getPlayerPtr().getCell()->isExterior()
|
||||
&& mWorldScene->isCellActive(*newCell);
|
||||
CellStore& newCell = mWorldModel.getExterior(index.x(), index.y());
|
||||
bool isCellActive
|
||||
= getPlayerPtr().isInCell() && getPlayerPtr().getCell()->isExterior() && mWorldScene->isCellActive(newCell);
|
||||
|
||||
if (cell->isExterior() || (moveToActive && isCellActive && ptr.getClass().isActor()))
|
||||
cell = newCell;
|
||||
cell = &newCell;
|
||||
|
||||
return moveObject(ptr, cell, position, movePhysics);
|
||||
}
|
||||
|
@ -2086,10 +2086,10 @@ namespace MWWorld
|
|||
}
|
||||
};
|
||||
|
||||
void World::getDoorMarkers(CellStore* cell, std::vector<World::DoorMarker>& out)
|
||||
void World::getDoorMarkers(CellStore& cell, std::vector<World::DoorMarker>& out)
|
||||
{
|
||||
GetDoorMarkerVisitor visitor{ out };
|
||||
cell->forEachType<ESM::Door>(visitor);
|
||||
cell.forEachType<ESM::Door>(visitor);
|
||||
}
|
||||
|
||||
void World::setWaterHeight(const float height)
|
||||
|
@ -2177,7 +2177,7 @@ namespace MWWorld
|
|||
if (cell->isExterior())
|
||||
{
|
||||
const osg::Vec2i index = positionToCellIndex(pos.pos[0], pos.pos[1]);
|
||||
cell = mWorldModel.getExterior(index.x(), index.y());
|
||||
cell = &mWorldModel.getExterior(index.x(), index.y());
|
||||
}
|
||||
|
||||
MWWorld::Ptr dropped = object.getClass().copyToCell(object, *cell, pos, count);
|
||||
|
@ -2767,14 +2767,11 @@ namespace MWWorld
|
|||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
pos.pos[0] = pos.pos[1] = pos.pos[2] = 0;
|
||||
|
||||
MWWorld::CellStore* cellStore = mWorldModel.getInterior(name);
|
||||
MWWorld::CellStore& cellStore = mWorldModel.getInterior(name);
|
||||
|
||||
if (!cellStore)
|
||||
return ESM::RefId::sEmpty;
|
||||
|
||||
ESM::RefId cellId = cellStore->getCell()->getId();
|
||||
ESM::RefId cellId = cellStore.getCell()->getId();
|
||||
std::vector<const MWWorld::CellRef*> sortedDoors;
|
||||
for (const MWWorld::LiveCellRef<ESM::Door>& door : cellStore->getReadOnlyDoors().mList)
|
||||
for (const MWWorld::LiveCellRef<ESM::Door>& door : cellStore.getReadOnlyDoors().mList)
|
||||
{
|
||||
if (!door.mRef.getTeleport())
|
||||
continue;
|
||||
|
@ -2792,27 +2789,23 @@ namespace MWWorld
|
|||
|
||||
for (const MWWorld::CellRef* door : sortedDoors)
|
||||
{
|
||||
MWWorld::CellStore* source = nullptr;
|
||||
source = mWorldModel.getCell(door->getDestCell());
|
||||
MWWorld::CellStore& source = mWorldModel.getCell(door->getDestCell());
|
||||
|
||||
if (source)
|
||||
// Find door leading to our current teleport door
|
||||
// and use its destination to position inside cell.
|
||||
for (const MWWorld::LiveCellRef<ESM::Door>& destDoor : source.getReadOnlyDoors().mList)
|
||||
{
|
||||
// Find door leading to our current teleport door
|
||||
// and use its destination to position inside cell.
|
||||
for (const MWWorld::LiveCellRef<ESM::Door>& destDoor : source->getReadOnlyDoors().mList)
|
||||
if (name == destDoor.mRef.getDestCell())
|
||||
{
|
||||
if (name == destDoor.mRef.getDestCell())
|
||||
{
|
||||
/// \note Using _any_ door pointed to the interior,
|
||||
/// not the one pointed to current door.
|
||||
pos = destDoor.mRef.getDoorDest();
|
||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
return cellId;
|
||||
}
|
||||
/// \note Using _any_ door pointed to the interior,
|
||||
/// not the one pointed to current door.
|
||||
pos = destDoor.mRef.getDoorDest();
|
||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
return cellId;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const MWWorld::LiveCellRef<ESM4::Static>& stat4 : cellStore->getReadOnlyEsm4Statics().mList)
|
||||
for (const MWWorld::LiveCellRef<ESM4::Static>& stat4 : cellStore.getReadOnlyEsm4Statics().mList)
|
||||
{
|
||||
if (Misc::StringUtils::lowerCase(stat4.mBase->mEditorId) == "cocmarkerheading")
|
||||
{
|
||||
|
@ -2823,7 +2816,7 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
// 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())
|
||||
{
|
||||
pos = statics4.begin()->mRef.getPosition();
|
||||
|
@ -2831,7 +2824,7 @@ namespace MWWorld
|
|||
return cellId;
|
||||
}
|
||||
// Fall back to the first static location.
|
||||
const MWWorld::CellRefList<ESM::Static>::List& statics = cellStore->getReadOnlyStatics().mList;
|
||||
const MWWorld::CellRefList<ESM::Static>::List& statics = cellStore.getReadOnlyStatics().mList;
|
||||
if (!statics.empty())
|
||||
{
|
||||
pos = statics.begin()->mRef.getPosition();
|
||||
|
@ -2849,7 +2842,7 @@ namespace MWWorld
|
|||
const MWWorld::Cell* ext = nullptr;
|
||||
try
|
||||
{
|
||||
ext = mWorldModel.getCell(nameId)->getCell();
|
||||
ext = mWorldModel.getCell(nameId).getCell();
|
||||
if (!ext->isExterior())
|
||||
return ESM::RefId();
|
||||
}
|
||||
|
@ -2868,7 +2861,7 @@ namespace MWWorld
|
|||
if (xResult.ec == std::errc::result_out_of_range || yResult.ec == std::errc::result_out_of_range)
|
||||
throw std::runtime_error("Cell coordinates out of range.");
|
||||
else if (xResult.ec == std::errc{} && yResult.ec == std::errc{})
|
||||
ext = mWorldModel.getExterior(x, y)->getCell();
|
||||
ext = mWorldModel.getExterior(x, y).getCell();
|
||||
// ignore std::errc::invalid_argument, as this means that name probably refers to a interior cell
|
||||
// instead of comma separated coordinates
|
||||
}
|
||||
|
@ -3288,12 +3281,10 @@ namespace MWWorld
|
|||
nextCells.clear();
|
||||
for (const auto& currentCell : currentCells)
|
||||
{
|
||||
MWWorld::CellStore* next = mWorldModel.getCell(currentCell);
|
||||
if (!next)
|
||||
continue;
|
||||
MWWorld::CellStore& next = mWorldModel.getCell(currentCell);
|
||||
|
||||
// Check if any door in the cell leads to an exterior directly
|
||||
for (const MWWorld::LiveCellRef<ESM::Door>& ref : next->getReadOnlyDoors().mList)
|
||||
for (const MWWorld::LiveCellRef<ESM::Door>& ref : next.getReadOnlyDoors().mList)
|
||||
{
|
||||
if (!ref.mRef.getTeleport())
|
||||
continue;
|
||||
|
@ -3342,19 +3333,17 @@ namespace MWWorld
|
|||
std::swap(currentCells, nextCells);
|
||||
for (const auto& cell : currentCells)
|
||||
{
|
||||
MWWorld::CellStore* next = mWorldModel.getCell(cell);
|
||||
MWWorld::CellStore& next = mWorldModel.getCell(cell);
|
||||
checkedCells.insert(cell);
|
||||
if (!next)
|
||||
continue;
|
||||
|
||||
closestMarker = next->searchConst(id);
|
||||
closestMarker = next.searchConst(id);
|
||||
if (!closestMarker.isEmpty())
|
||||
{
|
||||
return closestMarker;
|
||||
}
|
||||
|
||||
// Check if any door in the cell leads to an exterior directly
|
||||
for (const MWWorld::LiveCellRef<ESM::Door>& ref : next->getReadOnlyDoors().mList)
|
||||
for (const MWWorld::LiveCellRef<ESM::Door>& ref : next.getReadOnlyDoors().mList)
|
||||
{
|
||||
if (!ref.mRef.getTeleport())
|
||||
continue;
|
||||
|
@ -3638,14 +3627,9 @@ namespace MWWorld
|
|||
Log(Debug::Warning) << "Failed to confiscate items: prison marker not linked to prison interior";
|
||||
return;
|
||||
}
|
||||
MWWorld::CellStore* prison = mWorldModel.getCell(prisonName);
|
||||
if (!prison)
|
||||
{
|
||||
Log(Debug::Warning) << "Failed to confiscate items: failed to load cell " << prisonName;
|
||||
return;
|
||||
}
|
||||
MWWorld::CellStore& prison = mWorldModel.getCell(prisonName);
|
||||
|
||||
MWWorld::Ptr closestChest = prison->search(ESM::RefId::stringRefId("stolen_goods"));
|
||||
MWWorld::Ptr closestChest = prison.search(ESM::RefId::stringRefId("stolen_goods"));
|
||||
if (!closestChest.isEmpty()) // Found a close chest
|
||||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->confiscateStolenItems(ptr, closestChest);
|
||||
|
|
|
@ -245,7 +245,7 @@ namespace MWWorld
|
|||
|
||||
bool isCellQuasiExterior() const override;
|
||||
|
||||
void getDoorMarkers(MWWorld::CellStore* cell, std::vector<DoorMarker>& out) override;
|
||||
void getDoorMarkers(MWWorld::CellStore& cell, std::vector<DoorMarker>& out) override;
|
||||
///< get a list of teleport door markers for a given cell, to be displayed on the local map
|
||||
|
||||
void setGlobalInt(GlobalVariableName name, int value) override;
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace
|
|||
};
|
||||
}
|
||||
|
||||
MWWorld::CellStore* MWWorld::WorldModel::getCellStore(const ESM::Cell* cell)
|
||||
MWWorld::CellStore& MWWorld::WorldModel::getCellStore(const ESM::Cell* cell)
|
||||
{
|
||||
CellStore* cellStore = &mCells.emplace(cell->mId, CellStore(MWWorld::Cell(*cell), mStore, mReaders)).first->second;
|
||||
if (cell->mData.mFlags & ESM::Cell::Interior)
|
||||
|
@ -72,7 +72,7 @@ MWWorld::CellStore* MWWorld::WorldModel::getCellStore(const ESM::Cell* cell)
|
|||
if (result == mInteriors.end())
|
||||
result = mInteriors.emplace(cell->mName, cellStore).first;
|
||||
|
||||
return result->second;
|
||||
return *result->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ MWWorld::CellStore* MWWorld::WorldModel::getCellStore(const ESM::Cell* cell)
|
|||
if (result == mExteriors.end())
|
||||
result = mExteriors.emplace(std::make_pair(cell->getGridX(), cell->getGridY()), cellStore).first;
|
||||
|
||||
return result->second;
|
||||
return *result->second;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ MWWorld::WorldModel::WorldModel(const MWWorld::ESMStore& store, ESM::ReadersCach
|
|||
{
|
||||
}
|
||||
|
||||
MWWorld::CellStore* MWWorld::WorldModel::getExterior(int x, int y)
|
||||
MWWorld::CellStore& MWWorld::WorldModel::getExterior(int x, int y)
|
||||
{
|
||||
std::map<std::pair<int, int>, CellStore*>::iterator result = mExteriors.find(std::make_pair(x, y));
|
||||
|
||||
|
@ -192,7 +192,7 @@ MWWorld::CellStore* MWWorld::WorldModel::getExterior(int x, int y)
|
|||
result->second->load();
|
||||
}
|
||||
|
||||
return result->second;
|
||||
return *result->second;
|
||||
}
|
||||
|
||||
MWWorld::CellStore* MWWorld::WorldModel::getInteriorOrNull(std::string_view name)
|
||||
|
@ -217,19 +217,19 @@ MWWorld::CellStore* MWWorld::WorldModel::getInteriorOrNull(std::string_view name
|
|||
return result->second;
|
||||
}
|
||||
|
||||
MWWorld::CellStore* MWWorld::WorldModel::getInterior(std::string_view name)
|
||||
MWWorld::CellStore& MWWorld::WorldModel::getInterior(std::string_view name)
|
||||
{
|
||||
CellStore* res = getInteriorOrNull(name);
|
||||
if (res == nullptr)
|
||||
throw std::runtime_error("Interior not found: '" + std::string(name) + "'");
|
||||
return res;
|
||||
return *res;
|
||||
}
|
||||
|
||||
MWWorld::CellStore* MWWorld::WorldModel::getCell(const ESM::RefId& id)
|
||||
MWWorld::CellStore& MWWorld::WorldModel::getCell(const ESM::RefId& id)
|
||||
{
|
||||
auto result = mCells.find(id);
|
||||
if (result != mCells.end())
|
||||
return &result->second;
|
||||
return result->second;
|
||||
|
||||
if (const auto* exteriorId = id.getIf<ESM::ESM3ExteriorCellRefId>())
|
||||
return getExterior(exteriorId->getX(), exteriorId->getY());
|
||||
|
@ -259,13 +259,13 @@ MWWorld::CellStore* MWWorld::WorldModel::getCell(const ESM::RefId& id)
|
|||
{
|
||||
newCellStore->load();
|
||||
}
|
||||
return newCellStore;
|
||||
return *newCellStore;
|
||||
}
|
||||
|
||||
MWWorld::CellStore* MWWorld::WorldModel::getCell(std::string_view name)
|
||||
MWWorld::CellStore& MWWorld::WorldModel::getCell(std::string_view name)
|
||||
{
|
||||
if (CellStore* res = getInteriorOrNull(name)) // first try interiors
|
||||
return res;
|
||||
return *res;
|
||||
|
||||
// try named exteriors
|
||||
const ESM::Cell* cell = mStore.get<ESM::Cell>().searchExtByName(name);
|
||||
|
@ -296,11 +296,11 @@ MWWorld::CellStore* MWWorld::WorldModel::getCell(std::string_view name)
|
|||
return getExterior(cell->getGridX(), cell->getGridY());
|
||||
}
|
||||
|
||||
MWWorld::CellStore* MWWorld::WorldModel::getCellByPosition(
|
||||
MWWorld::CellStore& MWWorld::WorldModel::getCellByPosition(
|
||||
const osg::Vec3f& pos, MWWorld::CellStore* cellInSameWorldSpace)
|
||||
{
|
||||
if (cellInSameWorldSpace && !cellInSameWorldSpace->isExterior())
|
||||
return cellInSameWorldSpace;
|
||||
return *cellInSameWorldSpace;
|
||||
const osg::Vec2i cellIndex = positionToCellIndex(pos.x(), pos.y());
|
||||
return getExterior(cellIndex.x(), cellIndex.y());
|
||||
}
|
||||
|
@ -363,9 +363,9 @@ MWWorld::Ptr MWWorld::WorldModel::getPtr(const ESM::RefId& name)
|
|||
|
||||
for (iter = cells.extBegin(); iter != cells.extEnd(); ++iter)
|
||||
{
|
||||
CellStore* cellStore = getCellStore(&(*iter));
|
||||
CellStore& cellStore = getCellStore(&(*iter));
|
||||
|
||||
Ptr ptr = getPtrAndCache(name, *cellStore);
|
||||
Ptr ptr = getPtrAndCache(name, cellStore);
|
||||
|
||||
if (!ptr.isEmpty())
|
||||
return ptr;
|
||||
|
@ -373,9 +373,9 @@ MWWorld::Ptr MWWorld::WorldModel::getPtr(const ESM::RefId& name)
|
|||
|
||||
for (iter = cells.intBegin(); iter != cells.intEnd(); ++iter)
|
||||
{
|
||||
CellStore* cellStore = getCellStore(&(*iter));
|
||||
CellStore& cellStore = getCellStore(&(*iter));
|
||||
|
||||
Ptr ptr = getPtrAndCache(name, *cellStore);
|
||||
Ptr ptr = getPtrAndCache(name, cellStore);
|
||||
|
||||
if (!ptr.isEmpty())
|
||||
return ptr;
|
||||
|
@ -390,9 +390,9 @@ void MWWorld::WorldModel::getExteriorPtrs(const ESM::RefId& name, std::vector<MW
|
|||
const MWWorld::Store<ESM::Cell>& cells = mStore.get<ESM::Cell>();
|
||||
for (MWWorld::Store<ESM::Cell>::iterator iter = cells.extBegin(); iter != cells.extEnd(); ++iter)
|
||||
{
|
||||
CellStore* cellStore = getCellStore(&(*iter));
|
||||
CellStore& cellStore = getCellStore(&(*iter));
|
||||
|
||||
Ptr ptr = getPtrAndCache(name, *cellStore);
|
||||
Ptr ptr = getPtrAndCache(name, cellStore);
|
||||
|
||||
if (!ptr.isEmpty())
|
||||
out.push_back(ptr);
|
||||
|
@ -441,7 +441,7 @@ public:
|
|||
{
|
||||
try
|
||||
{
|
||||
return mWorldModel.getCell(cellId);
|
||||
return &mWorldModel.getCell(cellId);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -461,7 +461,7 @@ bool MWWorld::WorldModel::readRecord(ESM::ESMReader& reader, uint32_t type, cons
|
|||
|
||||
try
|
||||
{
|
||||
cellStore = getCell(state.mId);
|
||||
cellStore = &getCell(state.mId);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace MWWorld
|
|||
std::size_t mPtrIndexUpdateCounter = 0;
|
||||
ESM::RefNum mLastGeneratedRefnum;
|
||||
|
||||
CellStore* getCellStore(const ESM::Cell* cell);
|
||||
CellStore& getCellStore(const ESM::Cell* cell);
|
||||
CellStore* getInteriorOrNull(std::string_view name);
|
||||
Ptr getPtrAndCache(const ESM::RefId& name, CellStore& cellStore);
|
||||
|
||||
|
@ -63,16 +63,16 @@ namespace MWWorld
|
|||
|
||||
void clear();
|
||||
|
||||
CellStore* getExterior(int x, int y);
|
||||
CellStore* getInterior(std::string_view name);
|
||||
CellStore* getCell(std::string_view name); // interior or named exterior
|
||||
CellStore* getCell(const ESM::RefId& Id);
|
||||
CellStore& getExterior(int x, int y);
|
||||
CellStore& getInterior(std::string_view name);
|
||||
CellStore& getCell(std::string_view name); // interior or named exterior
|
||||
CellStore& getCell(const ESM::RefId& Id);
|
||||
|
||||
// Returns the cell that is in the same worldspace as `cellInSameWorldSpace`
|
||||
// (in case of nullptr - default exterior worldspace) and contains given position.
|
||||
// Interiors are single-cell worldspaces, so in case of an interior it just returns
|
||||
// the same cell.
|
||||
CellStore* getCellByPosition(const osg::Vec3f& pos, CellStore* cellInSameWorldSpace = nullptr);
|
||||
CellStore& getCellByPosition(const osg::Vec3f& pos, CellStore* cellInSameWorldSpace = nullptr);
|
||||
|
||||
void registerPtr(const MWWorld::Ptr& ptr);
|
||||
void deregisterPtr(const MWWorld::Ptr& ptr);
|
||||
|
|
Loading…
Reference in a new issue