mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-11-03 23:56:47 +00:00 
			
		
		
		
	ESSImport: fix loading item stacks in containers
This commit is contained in:
		
							parent
							
								
									5104a5a023
								
							
						
					
					
						commit
						6d5bb57e00
					
				
					 1 changed files with 25 additions and 18 deletions
				
			
		| 
						 | 
					@ -18,28 +18,35 @@ namespace ESSImport
 | 
				
			||||||
            item.mId = contItem.mItem.toString();
 | 
					            item.mId = contItem.mItem.toString();
 | 
				
			||||||
            item.mCount = contItem.mCount;
 | 
					            item.mCount = contItem.mCount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (esm.isNextSub("XIDX"))
 | 
					            // seems that a stack of items can have a set of subrecords for each item? rings0000.ess
 | 
				
			||||||
                esm.skipHSub();
 | 
					            // doesn't make any sense to me, if the values were different then the items shouldn't stack in the first place?
 | 
				
			||||||
 | 
					            // I guess we should double check the stacking logic in OpenMW
 | 
				
			||||||
            std::string script = esm.getHNOString("SCRI");
 | 
					            for (int i=0;i<std::abs(item.mCount);++i)
 | 
				
			||||||
            // script variables?
 | 
					 | 
				
			||||||
            // unsure if before or after ESM::CellRef
 | 
					 | 
				
			||||||
            if (!script.empty())
 | 
					 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (esm.isNextSub("SLCS"))
 | 
					                if (esm.isNextSub("XIDX")) // index in the stack?
 | 
				
			||||||
                    esm.skipHSub();
 | 
					 | 
				
			||||||
                if (esm.isNextSub("SLSD")) // Short Data?
 | 
					 | 
				
			||||||
                    esm.skipHSub();
 | 
					 | 
				
			||||||
                if (esm.isNextSub("SLFD")) // Float Data?
 | 
					 | 
				
			||||||
                    esm.skipHSub();
 | 
					                    esm.skipHSub();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                std::string script = esm.getHNOString("SCRI");
 | 
				
			||||||
 | 
					                // script variables?
 | 
				
			||||||
 | 
					                // unsure if before or after ESM::CellRef
 | 
				
			||||||
 | 
					                if (!script.empty())
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (esm.isNextSub("SLCS"))
 | 
				
			||||||
 | 
					                        esm.skipHSub();
 | 
				
			||||||
 | 
					                    if (esm.isNextSub("SLSD")) // Short Data?
 | 
				
			||||||
 | 
					                        esm.skipHSub();
 | 
				
			||||||
 | 
					                    if (esm.isNextSub("SLFD")) // Float Data?
 | 
				
			||||||
 | 
					                        esm.skipHSub();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                // for XSOL and XCHG seen so far, but probably others too
 | 
				
			||||||
 | 
					                item.ESM::CellRef::loadData(esm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                item.mCondition = -1;
 | 
				
			||||||
 | 
					                // FIXME: for Lights, this is actually a float
 | 
				
			||||||
 | 
					                esm.getHNOT(item.mCondition, "XHLT");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // for XSOL and XCHG seen so far, but probably others too
 | 
					 | 
				
			||||||
            item.ESM::CellRef::loadData(esm);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            item.mCondition = -1;
 | 
					 | 
				
			||||||
            // FIXME: for Lights, this is actually a float
 | 
					 | 
				
			||||||
            esm.getHNOT(item.mCondition, "XHLT");
 | 
					 | 
				
			||||||
            mItems.push_back(item);
 | 
					            mItems.push_back(item);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue