mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-03 08:36:40 +00:00
More MWWorld::CellStore* -> MWWorld::CellStore&
This commit is contained in:
parent
53cc9f3614
commit
a3a2685b9a
6 changed files with 48 additions and 48 deletions
|
@ -157,7 +157,7 @@ namespace MWBase
|
||||||
|
|
||||||
virtual bool isCellQuasiExterior() const = 0;
|
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
|
///< 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;
|
virtual void setGlobalInt(MWWorld::GlobalVariableName name, int value) = 0;
|
||||||
|
|
|
@ -633,7 +633,7 @@ namespace MWGui
|
||||||
for (MyGUI::Widget* widget : mExteriorDoorMarkerWidgets)
|
for (MyGUI::Widget* widget : mExteriorDoorMarkerWidgets)
|
||||||
widget->setVisible(false);
|
widget->setVisible(false);
|
||||||
|
|
||||||
MWWorld::CellStore* cell = &worldModel->getInterior(mPrefix);
|
MWWorld::CellStore& cell = worldModel->getInterior(mPrefix);
|
||||||
world->getDoorMarkers(cell, doors);
|
world->getDoorMarkers(cell, doors);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -641,7 +641,7 @@ namespace MWGui
|
||||||
for (MapEntry& entry : mMaps)
|
for (MapEntry& entry : mMaps)
|
||||||
{
|
{
|
||||||
if (!entry.mMapTexture && !widgetCropped(entry.mMapWidget, mLocalMap))
|
if (!entry.mMapTexture && !widgetCropped(entry.mMapWidget, mLocalMap))
|
||||||
world->getDoorMarkers(&worldModel->getExterior(entry.mCellX, entry.mCellY), doors);
|
world->getDoorMarkers(worldModel->getExterior(entry.mCellX, entry.mCellY), doors);
|
||||||
}
|
}
|
||||||
if (doors.empty())
|
if (doors.empty())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -377,19 +377,19 @@ namespace MWWorld
|
||||||
mRendering.notifyWorldSpaceChanged();
|
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)
|
const DetourNavigator::UpdateGuard* navigatorUpdateGuard)
|
||||||
{
|
{
|
||||||
using DetourNavigator::HeightfieldShape;
|
using DetourNavigator::HeightfieldShape;
|
||||||
|
|
||||||
assert(mActiveCells.find(cell) == mActiveCells.end());
|
assert(mActiveCells.find(&cell) == mActiveCells.end());
|
||||||
mActiveCells.insert(cell);
|
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 cellX = cell.getCell()->getGridX();
|
||||||
const int cellY = cell->getCell()->getGridY();
|
const int cellY = cell.getCell()->getGridY();
|
||||||
const MWWorld::Cell& cellVariant = *cell->getCell();
|
const MWWorld::Cell& cellVariant = *cell.getCell();
|
||||||
|
|
||||||
if (cellVariant.isExterior())
|
if (cellVariant.isExterior())
|
||||||
{
|
{
|
||||||
|
@ -440,22 +440,22 @@ namespace MWWorld
|
||||||
},
|
},
|
||||||
[&](const ESM4::Cell& cell) {},
|
[&](const ESM4::Cell& cell) {},
|
||||||
},
|
},
|
||||||
*cell->getCell());
|
*cell.getCell());
|
||||||
|
|
||||||
// register local scripts
|
// register local scripts
|
||||||
// do this before insertCell, to make sure we don't add scripts from levelled creature spawning twice
|
// 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)
|
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);
|
MWBase::Environment::get().getWindowManager()->addCell(&cell);
|
||||||
bool waterEnabled = cellVariant.hasWater() || cell->isExterior();
|
bool waterEnabled = cellVariant.hasWater() || cell.isExterior();
|
||||||
float waterLevel = cell->getWaterLevel();
|
float waterLevel = cell.getWaterLevel();
|
||||||
mRendering.setWaterEnabled(waterEnabled);
|
mRendering.setWaterEnabled(waterEnabled);
|
||||||
if (waterEnabled)
|
if (waterEnabled)
|
||||||
{
|
{
|
||||||
|
@ -477,10 +477,10 @@ namespace MWWorld
|
||||||
else
|
else
|
||||||
mPhysics->disableWater();
|
mPhysics->disableWater();
|
||||||
|
|
||||||
if (!cell->isExterior() && !cellVariant.isQuasiExterior())
|
if (!cell.isExterior() && !cellVariant.isQuasiExterior())
|
||||||
mRendering.configureAmbient(cellVariant);
|
mRendering.configureAmbient(cellVariant);
|
||||||
|
|
||||||
mPreloader->notifyLoaded(cell);
|
mPreloader->notifyLoaded(&cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::clear()
|
void Scene::clear()
|
||||||
|
@ -615,7 +615,7 @@ namespace MWWorld
|
||||||
if (!isCellInCollection(x, y, mActiveCells))
|
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());
|
loadCell(cell, loadingListener, changeEvent, pos, navigatorUpdateGuard.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,7 +682,7 @@ namespace MWWorld
|
||||||
const osg::Vec3f position
|
const osg::Vec3f position
|
||||||
= osg::Vec3f(it->mData.mX + 0.5f, it->mData.mY + 0.5f, 0) * Constants::CellSizeInUnits;
|
= osg::Vec3f(it->mData.mX + 0.5f, it->mData.mY + 0.5f, 0) * Constants::CellSizeInUnits;
|
||||||
mNavigator.updateBounds(position, navigatorUpdateGuard.get());
|
mNavigator.updateBounds(position, navigatorUpdateGuard.get());
|
||||||
loadCell(&cell, nullptr, false, position, navigatorUpdateGuard.get());
|
loadCell(cell, nullptr, false, position, navigatorUpdateGuard.get());
|
||||||
|
|
||||||
mNavigator.update(position, navigatorUpdateGuard.get());
|
mNavigator.update(position, navigatorUpdateGuard.get());
|
||||||
navigatorUpdateGuard.reset();
|
navigatorUpdateGuard.reset();
|
||||||
|
@ -740,7 +740,7 @@ namespace MWWorld
|
||||||
ESM::Position position;
|
ESM::Position position;
|
||||||
mWorld.findInteriorPosition(it->mName, position);
|
mWorld.findInteriorPosition(it->mName, position);
|
||||||
mNavigator.updateBounds(position.asVec3(), navigatorUpdateGuard.get());
|
mNavigator.updateBounds(position.asVec3(), navigatorUpdateGuard.get());
|
||||||
loadCell(&cell, nullptr, false, position.asVec3(), navigatorUpdateGuard.get());
|
loadCell(cell, nullptr, false, position.asVec3(), navigatorUpdateGuard.get());
|
||||||
|
|
||||||
mNavigator.update(position.asVec3(), navigatorUpdateGuard.get());
|
mNavigator.update(position.asVec3(), navigatorUpdateGuard.get());
|
||||||
navigatorUpdateGuard.reset();
|
navigatorUpdateGuard.reset();
|
||||||
|
@ -772,21 +772,21 @@ namespace MWWorld
|
||||||
mRendering.getResourceSystem()->setExpiryDelay(Settings::Manager::getFloat("cache expiry delay", "Cells"));
|
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();
|
MWWorld::Ptr old = mWorld.getPlayerPtr();
|
||||||
mWorld.getPlayer().setCell(cell);
|
mWorld.getPlayer().setCell(&cell);
|
||||||
|
|
||||||
MWWorld::Ptr player = mWorld.getPlayerPtr();
|
MWWorld::Ptr player = mWorld.getPlayerPtr();
|
||||||
mRendering.updatePlayerPtr(player);
|
mRendering.updatePlayerPtr(player);
|
||||||
|
|
||||||
// The player is loaded before the scene and by default it is grounded, with the scene fully loaded,
|
// 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.
|
// 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);
|
mPhysics->traceDown(player, player.getRefData().getPosition().asVec3(), 10.f);
|
||||||
|
|
||||||
if (adjustPlayerPos)
|
if (adjustPlayerPos)
|
||||||
|
@ -897,11 +897,11 @@ namespace MWWorld
|
||||||
|
|
||||||
// Load cell.
|
// Load cell.
|
||||||
mPagedRefs.clear();
|
mPagedRefs.clear();
|
||||||
loadCell(&cell, loadingListener, changeEvent, position.asVec3(), navigatorUpdateGuard.get());
|
loadCell(cell, loadingListener, changeEvent, position.asVec3(), navigatorUpdateGuard.get());
|
||||||
|
|
||||||
navigatorUpdateGuard.reset();
|
navigatorUpdateGuard.reset();
|
||||||
|
|
||||||
changePlayerCell(&cell, position, adjustPlayerPos);
|
changePlayerCell(cell, position, adjustPlayerPos);
|
||||||
|
|
||||||
// adjust fog
|
// adjust fog
|
||||||
mRendering.configureFog(*mCurrentCell->getCell());
|
mRendering.configureFog(*mCurrentCell->getCell());
|
||||||
|
@ -934,7 +934,7 @@ namespace MWWorld
|
||||||
|
|
||||||
changeCellGrid(position.asVec3(), cellIndex.x(), cellIndex.y(), changeEvent);
|
changeCellGrid(position.asVec3(), cellIndex.x(), cellIndex.y(), changeEvent);
|
||||||
|
|
||||||
changePlayerCell(¤t, position, adjustPlayerPos);
|
changePlayerCell(current, position, adjustPlayerPos);
|
||||||
|
|
||||||
if (changeEvent)
|
if (changeEvent)
|
||||||
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
|
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
|
||||||
|
@ -1133,7 +1133,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
preloadCell(&mWorld.getWorldModel().getCell(door.getCellRef().getDestCell()));
|
preloadCell(mWorld.getWorldModel().getCell(door.getCellRef().getDestCell()));
|
||||||
}
|
}
|
||||||
catch (std::exception&)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
|
@ -1177,17 +1177,17 @@ namespace MWWorld
|
||||||
+ mPreloadDistance;
|
+ mPreloadDistance;
|
||||||
|
|
||||||
if (dist < loadDist)
|
if (dist < loadDist)
|
||||||
preloadCell(&mWorld.getWorldModel().getExterior(cellX + dx, cellY + dy));
|
preloadCell(mWorld.getWorldModel().getExterior(cellX + dx, cellY + dy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 x = cell.getCell()->getGridX();
|
||||||
int y = cell->getCell()->getGridY();
|
int y = cell.getCell()->getGridY();
|
||||||
unsigned int numpreloaded = 0;
|
unsigned int numpreloaded = 0;
|
||||||
for (int dx = -mHalfGridSize; dx <= mHalfGridSize; ++dx)
|
for (int dx = -mHalfGridSize; dx <= mHalfGridSize; ++dx)
|
||||||
{
|
{
|
||||||
|
@ -1201,7 +1201,7 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mPreloader->preload(cell, mRendering.getReferenceTime());
|
mPreloader->preload(&cell, mRendering.getReferenceTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::preloadTerrain(const osg::Vec3f& pos, bool sync)
|
void Scene::preloadTerrain(const osg::Vec3f& pos, bool sync)
|
||||||
|
@ -1274,12 +1274,12 @@ namespace MWWorld
|
||||||
for (ESM::Transport::Dest& dest : listVisitor.mList)
|
for (ESM::Transport::Dest& dest : listVisitor.mList)
|
||||||
{
|
{
|
||||||
if (!dest.mCellName.empty())
|
if (!dest.mCellName.empty())
|
||||||
preloadCell(&mWorld.getWorldModel().getInterior(dest.mCellName));
|
preloadCell(mWorld.getWorldModel().getInterior(dest.mCellName));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osg::Vec3f pos = dest.mPos.asVec3();
|
osg::Vec3f pos = dest.mPos.asVec3();
|
||||||
const osg::Vec2i cellIndex = positionToCellIndex(pos.x(), pos.y());
|
const osg::Vec2i cellIndex = positionToCellIndex(pos.x(), pos.y());
|
||||||
preloadCell(&mWorld.getWorldModel().getExterior(cellIndex.x(), cellIndex.y()), true);
|
preloadCell(mWorld.getWorldModel().getExterior(cellIndex.x(), cellIndex.y()), true);
|
||||||
exteriorPositions.emplace_back(pos, gridCenterToBounds(getNewGridCenter(pos)));
|
exteriorPositions.emplace_back(pos, gridCenterToBounds(getNewGridCenter(pos)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ namespace MWWorld
|
||||||
osg::Vec2i getNewGridCenter(const osg::Vec3f& pos, const osg::Vec2i* currentGridCenter = nullptr) const;
|
osg::Vec2i getNewGridCenter(const osg::Vec3f& pos, const osg::Vec2i* currentGridCenter = nullptr) const;
|
||||||
|
|
||||||
void unloadCell(CellStore* cell, const DetourNavigator::UpdateGuard* navigatorUpdateGuard);
|
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);
|
const DetourNavigator::UpdateGuard* navigatorUpdateGuard);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -143,13 +143,13 @@ namespace MWWorld
|
||||||
|
|
||||||
~Scene();
|
~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 preloadTerrain(const osg::Vec3f& pos, bool sync = false);
|
||||||
void reloadTerrain();
|
void reloadTerrain();
|
||||||
|
|
||||||
void playerMoved(const osg::Vec3f& pos);
|
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();
|
CellStore* getCurrentCell();
|
||||||
|
|
||||||
|
|
|
@ -507,7 +507,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
if (getPlayerPtr().getCell()->isExterior())
|
if (getPlayerPtr().getCell()->isExterior())
|
||||||
mWorldScene->preloadTerrain(getPlayerPtr().getRefData().getPosition().asVec3());
|
mWorldScene->preloadTerrain(getPlayerPtr().getRefData().getPosition().asVec3());
|
||||||
mWorldScene->preloadCell(getPlayerPtr().getCell(), true);
|
mWorldScene->preloadCell(*getPlayerPtr().getCell(), true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1183,7 +1183,7 @@ namespace MWWorld
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mWorldScene->isCellActive(*newCell))
|
if (mWorldScene->isCellActive(*newCell))
|
||||||
mWorldScene->changePlayerCell(newCell, pos, false);
|
mWorldScene->changePlayerCell(*newCell, pos, false);
|
||||||
else
|
else
|
||||||
mWorldScene->changeToExteriorCell(newCell->getCell()->getId(), pos, false);
|
mWorldScene->changeToExteriorCell(newCell->getCell()->getId(), pos, false);
|
||||||
}
|
}
|
||||||
|
@ -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 };
|
GetDoorMarkerVisitor visitor{ out };
|
||||||
cell->forEachType<ESM::Door>(visitor);
|
cell.forEachType<ESM::Door>(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::setWaterHeight(const float height)
|
void World::setWaterHeight(const float height)
|
||||||
|
|
|
@ -245,7 +245,7 @@ namespace MWWorld
|
||||||
|
|
||||||
bool isCellQuasiExterior() const override;
|
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
|
///< 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;
|
void setGlobalInt(GlobalVariableName name, int value) override;
|
||||||
|
|
Loading…
Reference in a new issue