mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
Implement MWWorld::InventoryStore::unequipAll()
This commit is contained in:
parent
ddc92d1fbd
commit
aa563e947e
@ -110,6 +110,23 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite
|
||||
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)
|
||||
{
|
||||
if (slot<0 || slot>=static_cast<int> (mSlots.size()))
|
||||
|
@ -78,6 +78,9 @@ namespace MWWorld
|
||||
|
||||
ContainerStoreIterator getSlot (int slot);
|
||||
|
||||
void unequipAll();
|
||||
///< Unequip all currently equipped items.
|
||||
|
||||
void autoEquip (const MWWorld::Ptr& npc);
|
||||
///< Auto equip items according to stats and item value.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user