mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 15:06:43 +00:00
Implement MWWorld::InventoryStore::unequipAll()
This commit is contained in:
parent
ddc92d1fbd
commit
aa563e947e
2 changed files with 20 additions and 0 deletions
|
@ -110,6 +110,23 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite
|
||||||
flagAsModified();
|
flagAsModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MWWorld::InventoryStore::unequipAll()
|
||||||
|
{
|
||||||
|
for (int slot=0; slot < MWWorld::InventoryStore::Slots; ++slot)
|
||||||
|
{
|
||||||
|
MWWorld::ContainerStoreIterator it = getSlot(slot);
|
||||||
|
if (it != end())
|
||||||
|
{
|
||||||
|
equip(slot, end());
|
||||||
|
std::string script = MWWorld::Class::get(*it).getScript(*it);
|
||||||
|
|
||||||
|
// Unset OnPCEquip Variable on item's script, if it has a script with that variable declared
|
||||||
|
if(script != "")
|
||||||
|
(*it).mRefData->getLocals().setVarByInt(script, "onpcequip", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MWWorld::ContainerStoreIterator MWWorld::InventoryStore::getSlot (int slot)
|
MWWorld::ContainerStoreIterator MWWorld::InventoryStore::getSlot (int slot)
|
||||||
{
|
{
|
||||||
if (slot<0 || slot>=static_cast<int> (mSlots.size()))
|
if (slot<0 || slot>=static_cast<int> (mSlots.size()))
|
||||||
|
|
|
@ -78,6 +78,9 @@ namespace MWWorld
|
||||||
|
|
||||||
ContainerStoreIterator getSlot (int slot);
|
ContainerStoreIterator getSlot (int slot);
|
||||||
|
|
||||||
|
void unequipAll();
|
||||||
|
///< Unequip all currently equipped items.
|
||||||
|
|
||||||
void autoEquip (const MWWorld::Ptr& npc);
|
void autoEquip (const MWWorld::Ptr& npc);
|
||||||
///< Auto equip items according to stats and item value.
|
///< Auto equip items according to stats and item value.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue