mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 13:15:34 +00:00
Merge branch 'worldmodel' into 'master'
[Refactoring] Remove unused code related to mwworld/worldmodel See merge request OpenMW/openmw!2761
This commit is contained in:
commit
a2d8390713
6 changed files with 5 additions and 74 deletions
|
@ -199,8 +199,6 @@ namespace MWBase
|
|||
virtual MWWorld::Ptr searchPtrViaActorId(int actorId) = 0;
|
||||
///< Search is limited to the active cells.
|
||||
|
||||
virtual MWWorld::Ptr searchPtrViaRefNum(const ESM::RefId& id, const ESM::RefNum& refNum) = 0;
|
||||
|
||||
virtual MWWorld::Ptr findContainer(const MWWorld::ConstPtr& ptr) = 0;
|
||||
///< Return a pointer to a liveCellRef which contains \a ptr.
|
||||
/// \note Search is limited to the active cells.
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/scriptmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwworld/worldmodel.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
|
||||
|
@ -62,7 +63,7 @@ namespace
|
|||
if (pair.second.empty())
|
||||
return MWWorld::Ptr();
|
||||
else if (pair.first.hasContentFile())
|
||||
return MWBase::Environment::get().getWorld()->searchPtrViaRefNum(pair.second, pair.first);
|
||||
return MWBase::Environment::get().getWorldModel()->getPtr(pair.first);
|
||||
return MWBase::Environment::get().getWorld()->searchPtr(pair.second, false);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -680,7 +680,7 @@ namespace MWWorld
|
|||
{
|
||||
// TODO: caching still doesn't work efficiently here (only works for the one CellStore that the reference is
|
||||
// in)
|
||||
Ptr ptr = mWorldModel.getPtr(name, *cellstore, false);
|
||||
Ptr ptr = mWorldModel.getPtr(name, *cellstore);
|
||||
|
||||
if (!ptr.isEmpty())
|
||||
return ptr;
|
||||
|
@ -728,11 +728,6 @@ namespace MWWorld
|
|||
return mWorldScene->searchPtrViaActorId(actorId);
|
||||
}
|
||||
|
||||
Ptr World::searchPtrViaRefNum(const ESM::RefId& id, const ESM::RefNum& refNum)
|
||||
{
|
||||
return mWorldModel.getPtr(id, refNum);
|
||||
}
|
||||
|
||||
struct FindContainerVisitor
|
||||
{
|
||||
ConstPtr mContainedPtr;
|
||||
|
|
|
@ -286,8 +286,6 @@ namespace MWWorld
|
|||
Ptr searchPtrViaActorId(int actorId) override;
|
||||
///< Search is limited to the active cells.
|
||||
|
||||
Ptr searchPtrViaRefNum(const ESM::RefId& id, const ESM::RefNum& refNum) override;
|
||||
|
||||
MWWorld::Ptr findContainer(const MWWorld::ConstPtr& ptr) override;
|
||||
///< Return a pointer to a liveCellRef which contains \a ptr.
|
||||
/// \note Search is limited to the active cells.
|
||||
|
|
|
@ -294,7 +294,7 @@ MWWorld::CellStore* MWWorld::WorldModel::getCellByPosition(
|
|||
return getInterior(cellNameInSameWorldSpace);
|
||||
}
|
||||
|
||||
MWWorld::Ptr MWWorld::WorldModel::getPtr(const ESM::RefId& name, CellStore& cell, bool searchInContainers)
|
||||
MWWorld::Ptr MWWorld::WorldModel::getPtr(const ESM::RefId& name, CellStore& cell)
|
||||
{
|
||||
if (cell.getState() == CellStore::State_Unloaded)
|
||||
cell.preload();
|
||||
|
@ -314,9 +314,6 @@ MWWorld::Ptr MWWorld::WorldModel::getPtr(const ESM::RefId& name, CellStore& cell
|
|||
if (!ptr.isEmpty() && MWWorld::CellStore::isAccessible(ptr.getRefData(), ptr.getCellRef()))
|
||||
return ptr;
|
||||
|
||||
if (searchInContainers)
|
||||
return cell.searchInContainer(name);
|
||||
|
||||
return Ptr();
|
||||
}
|
||||
|
||||
|
@ -377,37 +374,6 @@ MWWorld::Ptr MWWorld::WorldModel::getPtr(const ESM::RefId& name)
|
|||
return Ptr();
|
||||
}
|
||||
|
||||
MWWorld::Ptr MWWorld::WorldModel::getPtr(const ESM::RefId& id, const ESM::RefNum& refNum)
|
||||
{
|
||||
for (auto& pair : mInteriors)
|
||||
{
|
||||
Ptr ptr = getPtr(pair.second, id, refNum);
|
||||
if (!ptr.isEmpty())
|
||||
return ptr;
|
||||
}
|
||||
for (auto& pair : mExteriors)
|
||||
{
|
||||
Ptr ptr = getPtr(pair.second, id, refNum);
|
||||
if (!ptr.isEmpty())
|
||||
return ptr;
|
||||
}
|
||||
return Ptr();
|
||||
}
|
||||
|
||||
MWWorld::Ptr MWWorld::WorldModel::getPtr(CellStore& cellStore, const ESM::RefId& id, const ESM::RefNum& refNum)
|
||||
{
|
||||
if (cellStore.getState() == CellStore::State_Unloaded)
|
||||
cellStore.preload();
|
||||
if (cellStore.getState() == CellStore::State_Preloaded)
|
||||
{
|
||||
if (cellStore.hasId(id))
|
||||
cellStore.load();
|
||||
else
|
||||
return Ptr();
|
||||
}
|
||||
return cellStore.searchViaRefNum(refNum);
|
||||
}
|
||||
|
||||
void MWWorld::WorldModel::getExteriorPtrs(const ESM::RefId& name, std::vector<MWWorld::Ptr>& out)
|
||||
{
|
||||
const MWWorld::Store<ESM::Cell>& cells = mStore.get<ESM::Cell>();
|
||||
|
@ -422,20 +388,6 @@ void MWWorld::WorldModel::getExteriorPtrs(const ESM::RefId& name, std::vector<MW
|
|||
}
|
||||
}
|
||||
|
||||
void MWWorld::WorldModel::getInteriorPtrs(const ESM::RefId& name, std::vector<MWWorld::Ptr>& out)
|
||||
{
|
||||
const MWWorld::Store<ESM::Cell>& cells = mStore.get<ESM::Cell>();
|
||||
for (MWWorld::Store<ESM::Cell>::iterator iter = cells.intBegin(); iter != cells.intEnd(); ++iter)
|
||||
{
|
||||
CellStore* cellStore = getCellStore(&(*iter));
|
||||
|
||||
Ptr ptr = getPtrAndCache(name, *cellStore);
|
||||
|
||||
if (!ptr.isEmpty())
|
||||
out.push_back(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<MWWorld::Ptr> MWWorld::WorldModel::getAll(const ESM::RefId& id)
|
||||
{
|
||||
PtrCollector visitor;
|
||||
|
|
|
@ -56,8 +56,6 @@ namespace MWWorld
|
|||
CellStore* getCellStore(const ESM::Cell* cell);
|
||||
Ptr getPtrAndCache(const ESM::RefId& name, CellStore& cellStore);
|
||||
|
||||
Ptr getPtr(CellStore& cellStore, const ESM::RefId& id, const ESM::RefNum& refNum);
|
||||
|
||||
void writeCell(ESM::ESMWriter& writer, CellStore& cell) const;
|
||||
|
||||
std::unordered_map<ESM::RefNum, Ptr> mPtrIndex;
|
||||
|
@ -88,15 +86,9 @@ namespace MWWorld
|
|||
|
||||
Ptr getPtr(const ESM::RefNum& refNum) const;
|
||||
|
||||
Ptr getPtr(const ESM::RefId& name, CellStore& cellStore, bool searchInContainers = false);
|
||||
///< \param searchInContainers Only affect loaded cells.
|
||||
/// @note name must be lower case
|
||||
|
||||
/// @note name must be lower case
|
||||
Ptr getPtr(const ESM::RefId& name, CellStore& cellStore);
|
||||
Ptr getPtr(const ESM::RefId& name);
|
||||
|
||||
Ptr getPtr(const ESM::RefId& id, const ESM::RefNum& refNum);
|
||||
|
||||
template <typename Fn>
|
||||
void forEachLoadedCellStore(Fn&& fn)
|
||||
{
|
||||
|
@ -111,11 +103,6 @@ namespace MWWorld
|
|||
/// @note name must be lower case
|
||||
void getExteriorPtrs(const ESM::RefId& name, std::vector<MWWorld::Ptr>& out);
|
||||
|
||||
/// Get all Ptrs referencing \a name in interior cells
|
||||
/// @note Due to the current implementation of getPtr this only supports one Ptr per cell.
|
||||
/// @note name must be lower case
|
||||
void getInteriorPtrs(const ESM::RefId& name, std::vector<MWWorld::Ptr>& out);
|
||||
|
||||
std::vector<MWWorld::Ptr> getAll(const ESM::RefId& id);
|
||||
|
||||
int countSavedGameRecords() const;
|
||||
|
|
Loading…
Reference in a new issue