mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
Partial ammo equipping
This commit is contained in:
parent
a555519290
commit
a176e0f9ea
@ -7,6 +7,7 @@
|
||||
Bug #4204: Dead slaughterfish doesn't float to water surface after loading saved game
|
||||
Bug #4382: Sound output device does not change when it should
|
||||
Bug #4610: Casting a Bound Weapon spell cancels the casting animation by equipping the weapon prematurely
|
||||
Bug #4754: Stack of ammunition cannot be equipped partially
|
||||
Bug #4816: GetWeaponDrawn returns 1 before weapon is attached
|
||||
Bug #5057: Weapon swing sound plays at same pitch whether it hits or misses
|
||||
Bug #5129: Stuttering animation on Centurion Archer
|
||||
@ -26,6 +27,7 @@
|
||||
Bug #6716: mwscript comparison operator handling is too restrictive
|
||||
Bug #6807: Ultimate Galleon is not working properly
|
||||
Bug #6893: Lua: Inconsistent behavior with actors affected by Disable and SetDelete commands
|
||||
Bug #6894: Added item combines with equipped stack instead of creating a new unequipped stack
|
||||
Bug #6939: OpenMW-CS: ID columns are too short
|
||||
Bug #6949: Sun Damage effect doesn't work in quasi exteriors
|
||||
Bug #6964: Nerasa Dralor Won't Follow
|
||||
|
@ -579,7 +579,28 @@ namespace MWGui
|
||||
mDragAndDrop->mItem, mDragAndDrop->mDraggedCount, mTradeModel);
|
||||
}
|
||||
|
||||
useItem(ptr);
|
||||
// Handles partial equipping
|
||||
const std::pair<std::vector<int>, bool> slots = ptr.getClass().getEquipmentSlots(ptr);
|
||||
if (!slots.first.empty() && slots.second)
|
||||
{
|
||||
int equippedStackableCount = 0;
|
||||
MWWorld::InventoryStore& invStore = mPtr.getClass().getInventoryStore(mPtr);
|
||||
MWWorld::ConstContainerStoreIterator slotIt = invStore.getSlot(slots.first.front());
|
||||
|
||||
// Get the count before useItem()
|
||||
if (slotIt != invStore.end() && slotIt->getCellRef().getRefId() == ptr.getCellRef().getRefId())
|
||||
equippedStackableCount = slotIt->getRefData().getCount();
|
||||
|
||||
useItem(ptr);
|
||||
int unequipCount = ptr.getRefData().getCount() - mDragAndDrop->mDraggedCount - equippedStackableCount;
|
||||
if (unequipCount > 0)
|
||||
{
|
||||
invStore.unequipItemQuantity(ptr, unequipCount);
|
||||
updateItemView();
|
||||
}
|
||||
}
|
||||
else
|
||||
useItem(ptr);
|
||||
|
||||
// If item is ingredient or potion don't stop drag and drop to simplify action of taking more than one 1
|
||||
// item
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "containerstore.hpp"
|
||||
#include "inventorystore.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
@ -396,6 +397,11 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp(const Ptr& ptr,
|
||||
// determine whether to stack or not
|
||||
for (MWWorld::ContainerStoreIterator iter(begin(type)); iter != end(); ++iter)
|
||||
{
|
||||
// Don't stack with equipped items
|
||||
if (!mActor.isEmpty() && mActor.getClass().hasInventoryStore(mActor))
|
||||
if (mActor.getClass().getInventoryStore(mActor).isEquipped(*iter))
|
||||
continue;
|
||||
|
||||
if (stacks(*iter, ptr))
|
||||
{
|
||||
// stack
|
||||
|
Loading…
x
Reference in New Issue
Block a user