mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-25 07:56:37 +00:00 
			
		
		
		
	Implemented a workaround for saving moved refs.
This commit is contained in:
		
							parent
							
								
									7673be6d0f
								
							
						
					
					
						commit
						e0d061c37b
					
				
					 1 changed files with 23 additions and 2 deletions
				
			
		|  | @ -303,13 +303,34 @@ void CSMDoc::WriteCellCollectionStage::perform (int stage, Messages& messages) | ||||||
|                 if (ref.mState==CSMWorld::RecordBase::State_Modified || |                 if (ref.mState==CSMWorld::RecordBase::State_Modified || | ||||||
|                     ref.mState==CSMWorld::RecordBase::State_ModifiedOnly) |                     ref.mState==CSMWorld::RecordBase::State_ModifiedOnly) | ||||||
|                 { |                 { | ||||||
|  |                     // To get an MVRF tag, the ref's mOriginalCell needs to be non-empty (empty
 | ||||||
|  |                     // is meant to indicate that it is the same as the current cell) and
 | ||||||
|  |                     // different to mCell (its current cell) TODO: the second check seems redundant?
 | ||||||
|  |                     //
 | ||||||
|  |                     // To have mOriginalCell be non-empty, it needs to be loaded as 'base' in
 | ||||||
|  |                     // RefCollection::load()
 | ||||||
|  |                     //
 | ||||||
|  |                     // recalculate the ref's cell location
 | ||||||
|  |                     std::ostringstream stream; | ||||||
|  |                     if (!interior) | ||||||
|  |                     { | ||||||
|  |                         std::pair<int, int> index = ref.get().getCellIndex(); | ||||||
|  |                         stream << "#" << index.first << " " << index.second; | ||||||
|  |                     } | ||||||
|  | 
 | ||||||
|                     if (!ref.get().mOriginalCell.empty() && |                     if (!ref.get().mOriginalCell.empty() && | ||||||
|                         ref.get().mOriginalCell!=ref.get().mCell) |                         ref.get().mOriginalCell!=stream.str()) | ||||||
|                     { |                     { | ||||||
|                         ESM::MovedCellRef moved; |                         ESM::MovedCellRef moved; | ||||||
|                         moved.mRefNum = ref.get().mRefNum; |                         moved.mRefNum = ref.get().mRefNum; | ||||||
| 
 | 
 | ||||||
|                         std::istringstream stream (ref.get().mCell.c_str()); |                         // Need to fill mTarget with the ref's new position.
 | ||||||
|  |                         //
 | ||||||
|  |                         // For this to work the view tht modified this ref needed to have the
 | ||||||
|  |                         // ref's mCell updted properly.
 | ||||||
|  |                         //
 | ||||||
|  |                         // For now use the temporary solution calculated above
 | ||||||
|  |                         std::istringstream stream (stream.str().c_str()); | ||||||
| 
 | 
 | ||||||
|                         char ignore; |                         char ignore; | ||||||
|                         stream >> ignore >> moved.mTarget[0] >> moved.mTarget[1]; |                         stream >> ignore >> moved.mTarget[0] >> moved.mTarget[1]; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue