mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 14:09:39 +00:00
consider item value when auto equipping
This commit is contained in:
parent
d5a7d418dd
commit
34a02fef45
1 changed files with 15 additions and 5 deletions
|
@ -101,20 +101,30 @@ void MWWorld::InventoryStore::autoEquip (const MWMechanics::NpcStats& stats)
|
||||||
|
|
||||||
for (ContainerStoreIterator iter (begin()); iter!=end(); ++iter)
|
for (ContainerStoreIterator iter (begin()); iter!=end(); ++iter)
|
||||||
{
|
{
|
||||||
|
Ptr test = *iter;
|
||||||
|
|
||||||
std::pair<std::vector<int>, bool> itemsSlots =
|
std::pair<std::vector<int>, bool> itemsSlots =
|
||||||
MWWorld::Class::get (*iter).getEquipmentSlots (*iter);
|
MWWorld::Class::get (*iter).getEquipmentSlots (*iter);
|
||||||
|
|
||||||
for (std::vector<int>::const_iterator iter2 (itemsSlots.first.begin());
|
for (std::vector<int>::const_iterator iter2 (itemsSlots.first.begin());
|
||||||
iter2!=itemsSlots.first.end(); ++iter2)
|
iter2!=itemsSlots.first.end(); ++iter2)
|
||||||
{
|
{
|
||||||
/// \todo comapre item with item in slot
|
if (slots.at (*iter2)!=end())
|
||||||
if (slots.at (*iter2)==end())
|
|
||||||
{
|
{
|
||||||
/// \todo unstack, if reqquired (itemsSlots.second)
|
Ptr old = *slots.at (*iter2);
|
||||||
|
|
||||||
slots[*iter2] = iter;
|
// check value
|
||||||
break;
|
if (MWWorld::Class::get (old).getValue (old)>=MWWorld::Class::get (test).getValue (test))
|
||||||
|
{
|
||||||
|
/// \todo check skill
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \todo unstack, if reqquired (itemsSlots.second)
|
||||||
|
|
||||||
|
slots[*iter2] = iter;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue