[Client] Make it possible to easily iterate through container items

This commit is contained in:
David Cernat 2017-02-14 23:10:45 +02:00
parent c8cbfbef62
commit 88f891b5bd
3 changed files with 23 additions and 0 deletions

View file

@ -47,6 +47,20 @@ void WorldEvent::addContainerItem(ContainerItem containerItem)
void WorldEvent::sendContainers(MWWorld::CellStore* cellStore)
{
MWWorld::CellRefList<ESM::Container> *containerList = cellStore->getContainers();
for (typename MWWorld::CellRefList<ESM::Container>::List::iterator listIter(containerList->mList.begin());
listIter != containerList->mList.end(); ++listIter)
{
MWWorld::Ptr container(&*listIter, 0);
MWWorld::ContainerStore& containerStore = container.getClass().getContainerStore(container);
for (MWWorld::ContainerStoreIterator storeIter = containerStore.begin(); storeIter != containerStore.end(); ++storeIter)
{
MWWorld::Ptr itemPtr = *storeIter;
}
}
}

View file

@ -491,6 +491,12 @@ namespace MWWorld
lastRefNumIndex = value;
}
// Added by tes3mp and used to get all the containers in the cell
CellRefList<ESM::Container> *CellStore::getContainers()
{
return &mContainers;
}
float CellStore::getWaterLevel() const
{
if (isExterior())

View file

@ -243,6 +243,9 @@ namespace MWWorld
void setLastRefNumIndex(unsigned int value);
// Added by tes3mp and used to record the last reference number in the cell
CellRefList<ESM::Container> *getContainers();
// Added by tes3mp and used to get all the containers in the cell
float getWaterLevel() const;
void setWaterLevel (float level);