mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 20:53:50 +00:00
Merge remote-tracking branch 'scrawl/inventory'
This commit is contained in:
commit
6ce2b962e1
5 changed files with 13 additions and 39 deletions
|
@ -46,7 +46,11 @@ namespace MWClass
|
|||
{
|
||||
std::auto_ptr<CustomData> data (new CustomData);
|
||||
|
||||
// \todo add initial container content
|
||||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
data->mContainerStore.fill(
|
||||
ref->mBase->mInventory, ptr.getCellRef().mOwner, MWBase::Environment::get().getWorld()->getStore());
|
||||
|
||||
// store
|
||||
ptr.getRefData().setCustomData (data.release());
|
||||
|
|
|
@ -91,6 +91,10 @@ namespace MWClass
|
|||
iter!=ref->mBase->mSpells.mList.end(); ++iter)
|
||||
data->mCreatureStats.getSpells().add (*iter);
|
||||
|
||||
// inventory
|
||||
data->mContainerStore.fill(ref->mBase->mInventory, getId(ptr),
|
||||
MWBase::Environment::get().getWorld()->getStore());
|
||||
|
||||
// store
|
||||
ptr.getRefData().setCustomData (data.release());
|
||||
}
|
||||
|
|
|
@ -227,6 +227,10 @@ namespace MWClass
|
|||
iter!=ref->mBase->mSpells.mList.end(); ++iter)
|
||||
data->mCreatureStats.getSpells().add (*iter);
|
||||
|
||||
// inventory
|
||||
data->mInventoryStore.fill(ref->mBase->mInventory, getId(ptr),
|
||||
MWBase::Environment::get().getWorld()->getStore());
|
||||
|
||||
// store
|
||||
ptr.getRefData().setCustomData (data.release());
|
||||
}
|
||||
|
|
|
@ -44,39 +44,6 @@ void MWWorld::Cells::clear()
|
|||
mIdCacheIndex = 0;
|
||||
}
|
||||
|
||||
void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore)
|
||||
{
|
||||
for (CellRefList<ESM::Container>::List::iterator iter (
|
||||
cellStore.mContainers.mList.begin());
|
||||
iter!=cellStore.mContainers.mList.end(); ++iter)
|
||||
{
|
||||
Ptr container (&*iter, &cellStore);
|
||||
|
||||
Class::get (container).getContainerStore (container).fill (
|
||||
iter->mBase->mInventory, container.getCellRef().mOwner, mStore);
|
||||
}
|
||||
|
||||
for (CellRefList<ESM::Creature>::List::iterator iter (
|
||||
cellStore.mCreatures.mList.begin());
|
||||
iter!=cellStore.mCreatures.mList.end(); ++iter)
|
||||
{
|
||||
Ptr container (&*iter, &cellStore);
|
||||
|
||||
Class::get (container).getContainerStore (container).fill (
|
||||
iter->mBase->mInventory, Class::get(container).getId(container), mStore);
|
||||
}
|
||||
|
||||
for (CellRefList<ESM::NPC>::List::iterator iter (
|
||||
cellStore.mNpcs.mList.begin());
|
||||
iter!=cellStore.mNpcs.mList.end(); ++iter)
|
||||
{
|
||||
Ptr container (&*iter, &cellStore);
|
||||
|
||||
Class::get (container).getContainerStore (container).fill (
|
||||
iter->mBase->mInventory, Class::get(container).getId(container), mStore);
|
||||
}
|
||||
}
|
||||
|
||||
MWWorld::Ptr MWWorld::Cells::getPtrAndCache (const std::string& name, Ptr::CellStore& cellStore)
|
||||
{
|
||||
Ptr ptr = getPtr (name, cellStore);
|
||||
|
@ -129,7 +96,6 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y)
|
|||
{
|
||||
// Multiple plugin support for landscape data is much easier than for references. The last plugin wins.
|
||||
result->second.load (mStore, mReader);
|
||||
fillContainers (result->second);
|
||||
}
|
||||
|
||||
return &result->second;
|
||||
|
@ -150,7 +116,6 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getInterior (const std::string& name)
|
|||
if (result->second.mState!=Ptr::CellStore::State_Loaded)
|
||||
{
|
||||
result->second.load (mStore, mReader);
|
||||
fillContainers (result->second);
|
||||
}
|
||||
|
||||
return &result->second;
|
||||
|
@ -168,7 +133,6 @@ MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name, Ptr::CellStore& ce
|
|||
if (std::binary_search (cell.mIds.begin(), cell.mIds.end(), lowerCase))
|
||||
{
|
||||
cell.load (mStore, mReader);
|
||||
fillContainers (cell);
|
||||
}
|
||||
else
|
||||
return Ptr();
|
||||
|
|
|
@ -31,8 +31,6 @@ namespace MWWorld
|
|||
|
||||
CellStore *getCellStore (const ESM::Cell *cell);
|
||||
|
||||
void fillContainers (CellStore& cellStore);
|
||||
|
||||
Ptr getPtrAndCache (const std::string& name, CellStore& cellStore);
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue