void Container::restock(const MWWorld::Ptr& ptr) const
{
    MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
    const ESM::InventoryList& list = ref->mBase->mInventory;
    MWWorld::ContainerStore& store = getContainerStore(ptr);

    // setting ownership not needed, since taking items from a container inherits the
    // container's owner automatically
    store.restock(list, ptr, "");
}
Example #2
0
    float Creature::getEncumbrance (const MWWorld::Ptr& ptr) const
    {
        float weight = getContainerStore (ptr).getWeight();

        const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);

        weight -= stats.getMagicEffects().get (MWMechanics::EffectKey (8)).mMagnitude; // feather

        weight += stats.getMagicEffects().get (MWMechanics::EffectKey (7)).mMagnitude; // burden

        if (weight<0)
            weight = 0;

        return weight;
    }
float Container::getEncumbrance (const MWWorld::Ptr& ptr) const
{
    return getContainerStore (ptr).getWeight();
}