Ignore lights without CanCarry flags when NPC selects torch (bug #4457)

0.6.3
Andrei Kortunov 7 years ago
parent 5a9e382efe
commit e08b0d3070

@ -30,6 +30,7 @@
Bug #4451: Script fails to compile when using "Begin, [ScriptName]" syntax Bug #4451: Script fails to compile when using "Begin, [ScriptName]" syntax
Bug #4453: Quick keys behaviour is invalid for equipment Bug #4453: Quick keys behaviour is invalid for equipment
Bug #4454: AI opens doors too slow Bug #4454: AI opens doors too slow
Bug #4457: Item without CanCarry flag prevents shield autoequipping in dark areas
Feature #4256: Implement ToggleBorders (TB) console command Feature #4256: Implement ToggleBorders (TB) console command
Feature #3276: Editor: Search- Show number of (remaining) search results and indicate a search without any results Feature #3276: Editor: Search- Show number of (remaining) search results and indicate a search without any results
Feature #4222: 360° screenshots Feature #4222: 360° screenshots

@ -984,7 +984,8 @@ namespace MWMechanics
MWWorld::ContainerStoreIterator torch = inventoryStore.end(); MWWorld::ContainerStoreIterator torch = inventoryStore.end();
for (MWWorld::ContainerStoreIterator it = inventoryStore.begin(); it != inventoryStore.end(); ++it) for (MWWorld::ContainerStoreIterator it = inventoryStore.begin(); it != inventoryStore.end(); ++it)
{ {
if (it->getTypeName() == typeid(ESM::Light).name()) if (it->getTypeName() == typeid(ESM::Light).name() &&
it->getClass().canBeEquipped(*it, ptr).first)
{ {
torch = it; torch = it;
break; break;
@ -1005,8 +1006,7 @@ namespace MWMechanics
heldIter = inventoryStore.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft); heldIter = inventoryStore.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
// If we have a torch and can equip it, then equip it now. // If we have a torch and can equip it, then equip it now.
if (heldIter == inventoryStore.end() if (heldIter == inventoryStore.end())
&& torch->getClass().canBeEquipped(*torch, ptr).first == 1)
{ {
inventoryStore.equip(MWWorld::InventoryStore::Slot_CarriedLeft, torch, ptr); inventoryStore.equip(MWWorld::InventoryStore::Slot_CarriedLeft, torch, ptr);
} }

Loading…
Cancel
Save