mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 00:26:39 +00:00 
			
		
		
		
	Fix "additem gold_100" behavior
This commit is contained in:
		
							parent
							
								
									75e5023590
								
							
						
					
					
						commit
						aefcd1ad07
					
				
					 1 changed files with 3 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -302,20 +302,18 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr,
 | 
			
		|||
    // this ensures that gold piles of different sizes stack with each other (also, several scripts rely on Gold_001 for detecting player gold)
 | 
			
		||||
    if(MWClass::Miscellaneous().isGold(ptr))
 | 
			
		||||
    {
 | 
			
		||||
        int realCount = count * ptr.getClass().getValue(ptr);
 | 
			
		||||
 | 
			
		||||
        for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter)
 | 
			
		||||
        {
 | 
			
		||||
            if (Misc::StringUtils::ciEqual((*iter).getCellRef().getRefId(), MWWorld::ContainerStore::sGoldId))
 | 
			
		||||
            {
 | 
			
		||||
                iter->getRefData().setCount(iter->getRefData().getCount() + realCount);
 | 
			
		||||
                iter->getRefData().setCount(iter->getRefData().getCount() + count);
 | 
			
		||||
                flagAsModified();
 | 
			
		||||
                return iter;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        MWWorld::ManualRef ref(esmStore, MWWorld::ContainerStore::sGoldId, realCount);
 | 
			
		||||
        return addNewStack(ref.getPtr(), realCount);
 | 
			
		||||
        MWWorld::ManualRef ref(esmStore, MWWorld::ContainerStore::sGoldId, count);
 | 
			
		||||
        return addNewStack(ref.getPtr(), count);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // determine whether to stack or not
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue