mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 20:26:43 +00:00 
			
		
		
		
	Order of arguments for ContainerStore::stacks shouldn't matter. Supplying them in the correct order is error prone, and also caused a bug where equipped items would incorrectly stack.
This commit is contained in:
		
							parent
							
								
									0dab7031c0
								
							
						
					
					
						commit
						700d06764c
					
				
					 4 changed files with 2 additions and 4 deletions
				
			
		|  | @ -56,7 +56,7 @@ void InventoryItemModel::removeItem (const ItemStack& item, size_t count) | |||
| 
 | ||||
|     if (removed == 0) | ||||
|         throw std::runtime_error("Item to remove not found in container store"); | ||||
|     else if (removed < count) | ||||
|     else if (removed < static_cast<int>(count)) | ||||
|         throw std::runtime_error("Not enough items in the stack to remove"); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -93,7 +93,6 @@ namespace MWWorld | |||
| 
 | ||||
|             virtual bool stacks (const Ptr& stack, const Ptr& item); | ||||
|             ///< @return true if the two specified objects can stack with each other
 | ||||
|             /// @note stack is the item that is already in this container
 | ||||
| 
 | ||||
|             void fill (const ESM::InventoryList& items, const std::string& owner, const MWWorld::ESMStore& store); | ||||
|             ///< Insert items into *this.
 | ||||
|  |  | |||
|  | @ -295,7 +295,7 @@ bool MWWorld::InventoryStore::stacks(const Ptr& stack, const Ptr& item) | |||
|     for (TSlots::const_iterator iter (mSlots.begin()); | ||||
|         iter!=mSlots.end(); ++iter) | ||||
|     { | ||||
|         if (*iter != end() && stack == **iter) | ||||
|         if (*iter != end() && (stack == **iter || item == **iter)) | ||||
|         { | ||||
|             bool stackWhenEquipped = MWWorld::Class::get(**iter).getEquipmentSlots(**iter).second; | ||||
|             if (!stackWhenEquipped) | ||||
|  |  | |||
|  | @ -109,7 +109,6 @@ namespace MWWorld | |||
| 
 | ||||
|             virtual bool stacks (const Ptr& stack, const Ptr& item); | ||||
|             ///< @return true if the two specified objects can stack with each other
 | ||||
|             /// @note stack is the item that is already in this container (it may be equipped)
 | ||||
| 
 | ||||
|             virtual int remove(const Ptr& item, int count, const Ptr& actor); | ||||
|             ///< Remove \a count item(s) designated by \a item from this inventory.
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue