1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-23 07:40:15 +00:00

Fixes suggested by KittyCat

This commit is contained in:
Emanuel Guevel 2013-08-06 14:55:08 +02:00
parent c59ad62c57
commit 47b8a31317
3 changed files with 4 additions and 6 deletions

View file

@ -110,7 +110,7 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite
flagAsModified(); flagAsModified();
} }
void MWWorld::InventoryStore::unequipAll() void MWWorld::InventoryStore::unequipAll(const MWWorld::Ptr& actor)
{ {
for (int slot=0; slot < MWWorld::InventoryStore::Slots; ++slot) for (int slot=0; slot < MWWorld::InventoryStore::Slots; ++slot)
{ {
@ -121,7 +121,7 @@ void MWWorld::InventoryStore::unequipAll()
std::string script = MWWorld::Class::get(*it).getScript(*it); 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 // Unset OnPCEquip Variable on item's script, if it has a script with that variable declared
if(script != "") if((actor.getRefData().getHandle() == "player") && (script != ""))
(*it).mRefData->getLocals().setVarByInt(script, "onpcequip", 0); (*it).mRefData->getLocals().setVarByInt(script, "onpcequip", 0);
} }
} }

View file

@ -78,7 +78,7 @@ namespace MWWorld
ContainerStoreIterator getSlot (int slot); ContainerStoreIterator getSlot (int slot);
void unequipAll(); void unequipAll(const MWWorld::Ptr& actor);
///< Unequip all currently equipped items. ///< Unequip all currently equipped items.
void autoEquip (const MWWorld::Ptr& npc); void autoEquip (const MWWorld::Ptr& npc);

View file

@ -1861,9 +1861,7 @@ namespace MWWorld
MWWorld::InventoryStore& invStore = MWWorld::Class::get(actor).getInventoryStore(actor); MWWorld::InventoryStore& invStore = MWWorld::Class::get(actor).getInventoryStore(actor);
if (werewolf) if (werewolf)
invStore.unequipAll(); invStore.unequipAll(actor);
else
invStore.autoEquip(actor);
if (actor.getRefData().getHandle() == "player") if (actor.getRefData().getHandle() == "player")
{ {