mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 19:26:43 +00:00 
			
		
		
		
	Add InventoryStore::unequipItem()
This commit is contained in:
		
							parent
							
								
									12dbbde1e3
								
							
						
					
					
						commit
						37e91a278e
					
				
					 2 changed files with 20 additions and 0 deletions
				
			
		|  | @ -386,3 +386,15 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::unequipSlot(int slot, c | |||
| 
 | ||||
|     return it; | ||||
| } | ||||
| 
 | ||||
| MWWorld::ContainerStoreIterator MWWorld::InventoryStore::unequipItem(const MWWorld::Ptr& item, const MWWorld::Ptr& actor) | ||||
| { | ||||
|     for (int slot=0; slot<MWWorld::InventoryStore::Slots; ++slot) | ||||
|     { | ||||
|         MWWorld::ContainerStoreIterator equipped = getSlot(slot); | ||||
|         if (equipped != end() && *equipped == item) | ||||
|             return unequipSlot(slot, actor); | ||||
|     } | ||||
| 
 | ||||
|     throw std::runtime_error ("attempt to unequip an item that is not currently equipped"); | ||||
| } | ||||
|  |  | |||
|  | @ -119,6 +119,14 @@ namespace MWWorld | |||
|             /// @return an iterator to the item that was previously in the slot
 | ||||
|             /// (it can be re-stacked so its count may be different than when it
 | ||||
|             /// was equipped).
 | ||||
| 
 | ||||
|             ContainerStoreIterator unequipItem(const Ptr& item, const Ptr& actor); | ||||
|             ///< Unequip an item identified by its Ptr. An exception is thrown
 | ||||
|             /// if the item is not currently equipped.
 | ||||
|             ///
 | ||||
|             /// @return an iterator to the item that was previously in the slot
 | ||||
|             /// (it can be re-stacked so its count may be different than when it
 | ||||
|             /// was equipped).
 | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue