mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-31 09:36:41 +00:00
[Client] Make it possible to unload Cells & clear CellStores from World
This commit is contained in:
parent
339428872e
commit
0b85829e38
5 changed files with 103 additions and 0 deletions
|
@ -594,6 +594,26 @@ namespace MWBase
|
|||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Make it possible to unload a cell from elsewhere
|
||||
*/
|
||||
virtual void unloadCell(const ESM::Cell& cell) = 0;
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Clear the CellStore for a specific Cell from elsewhere
|
||||
*/
|
||||
virtual void clearCellStore(const ESM::Cell& cell) = 0;
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
virtual void getActorsStandingOn (const MWWorld::ConstPtr& object, std::vector<MWWorld::Ptr> &actors) = 0; ///< get a list of actors standing on \a object
|
||||
virtual bool getPlayerStandingOn (const MWWorld::ConstPtr& object) = 0; ///< @return true if the player is standing on \a object
|
||||
virtual bool getActorStandingOn (const MWWorld::ConstPtr& object) = 0; ///< @return true if any actor is standing on \a object
|
||||
|
|
|
@ -53,6 +53,27 @@ void MWWorld::Cells::clear()
|
|||
mIdCacheIndex = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Make it possible to clear the CellStore for a specific Cell,
|
||||
allowing cells to be replaced from elsewhere in the code
|
||||
*/
|
||||
void MWWorld::Cells::clear(const ESM::Cell& cell)
|
||||
{
|
||||
for (auto it = mInteriors.begin(); it != mInteriors.end(); ++it)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual((*it).first, cell.mName))
|
||||
{
|
||||
mInteriors.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
MWWorld::Ptr MWWorld::Cells::getPtrAndCache (const std::string& name, CellStore& cellStore)
|
||||
{
|
||||
Ptr ptr = getPtr (name, cellStore);
|
||||
|
|
|
@ -47,6 +47,17 @@ namespace MWWorld
|
|||
|
||||
void clear();
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Make it possible to clear the CellStore for a specific Cell,
|
||||
allowing cells to be replaced from elsewhere in the code
|
||||
*/
|
||||
void clear(const ESM::Cell& cell);
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
Cells (const MWWorld::ESMStore& store, std::vector<ESM::ESMReader>& reader);
|
||||
|
||||
CellStore *getExterior (int x, int y);
|
||||
|
|
|
@ -2924,6 +2924,37 @@ namespace MWWorld
|
|||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Make it possible to unload a cell from elsewhere
|
||||
*/
|
||||
void World::unloadCell(const ESM::Cell& cell)
|
||||
{
|
||||
if (isCellActive(cell))
|
||||
{
|
||||
const Scene::CellStoreCollection& activeCells = mWorldScene->getActiveCells();
|
||||
mwmp::CellController *cellController = mwmp::Main::get().getCellController();
|
||||
mWorldScene->unloadCell(activeCells.find(cellController->getCellStore(cell)));
|
||||
}
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Clear the CellStore for a specific Cell from elsewhere
|
||||
*/
|
||||
void World::clearCellStore(const ESM::Cell& cell)
|
||||
{
|
||||
mCells.clear(cell);
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
bool World::getPlayerStandingOn (const MWWorld::ConstPtr& object)
|
||||
{
|
||||
MWWorld::Ptr player = getPlayerPtr();
|
||||
|
|
|
@ -702,6 +702,26 @@ namespace MWWorld
|
|||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Make it possible to unload a cell from elsewhere
|
||||
*/
|
||||
void unloadCell(const ESM::Cell& cell) override;
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Clear the CellStore for a specific Cell from elsewhere
|
||||
*/
|
||||
virtual void clearCellStore(const ESM::Cell& cell) override;
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
void getActorsStandingOn (const MWWorld::ConstPtr& object, std::vector<MWWorld::Ptr> &actors) override; ///< get a list of actors standing on \a object
|
||||
bool getPlayerStandingOn (const MWWorld::ConstPtr& object) override; ///< @return true if the player is standing on \a object
|
||||
bool getActorStandingOn (const MWWorld::ConstPtr& object) override; ///< @return true if any actor is standing on \a object
|
||||
|
|
Loading…
Reference in a new issue