mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-29 03:26:38 +00:00 
			
		
		
		
	Fix the ESM::LandTexture NAME being discarded on loading
This commit is contained in:
		
							parent
							
								
									d1601feb39
								
							
						
					
					
						commit
						402f1ff5d8
					
				
					 4 changed files with 16 additions and 15 deletions
				
			
		|  | @ -454,6 +454,8 @@ void CSMDoc::WriteLandTextureCollectionStage::perform (int stage, Messages& mess | ||||||
| 
 | 
 | ||||||
|         mState.getWriter().startRecord (record.sRecordId); |         mState.getWriter().startRecord (record.sRecordId); | ||||||
| 
 | 
 | ||||||
|  |         mState.getWriter().writeHNString("NAME", record.mId); | ||||||
|  | 
 | ||||||
|         record.save (mState.getWriter()); |         record.save (mState.getWriter()); | ||||||
| 
 | 
 | ||||||
|         mState.getWriter().endRecord (record.sRecordId); |         mState.getWriter().endRecord (record.sRecordId); | ||||||
|  |  | ||||||
|  | @ -9,13 +9,7 @@ namespace CSMWorld | ||||||
|     { |     { | ||||||
|         ESM::LandTexture::load(esm); |         ESM::LandTexture::load(esm); | ||||||
| 
 | 
 | ||||||
|         int plugin = esm.getIndex(); |         mPluginIndex = esm.getIndex(); | ||||||
| 
 |  | ||||||
|         std::ostringstream stream; |  | ||||||
| 
 |  | ||||||
|         stream << mIndex << "_" << plugin; |  | ||||||
| 
 |  | ||||||
|         mId = stream.str(); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -7,13 +7,10 @@ | ||||||
| 
 | 
 | ||||||
| namespace CSMWorld | namespace CSMWorld | ||||||
| { | { | ||||||
|     /// \brief Wrapper for LandTexture record. Encodes mIndex and the plugin index (obtained from ESMReader)
 |     /// \brief Wrapper for LandTexture record, providing info which plugin the LandTexture was loaded from.
 | ||||||
|     /// in the ID.
 |  | ||||||
|     ///
 |  | ||||||
|     /// \attention The mId field of the ESM::LandTexture struct is not used.
 |  | ||||||
|     struct LandTexture : public ESM::LandTexture |     struct LandTexture : public ESM::LandTexture | ||||||
|     { |     { | ||||||
|         std::string mId; |         int mPluginIndex; | ||||||
| 
 | 
 | ||||||
|         void load (ESM::ESMReader &esm); |         void load (ESM::ESMReader &esm); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -28,10 +28,18 @@ namespace CSVRender | ||||||
| 
 | 
 | ||||||
|     const ESM::LandTexture* TerrainStorage::getLandTexture(int index, short plugin) |     const ESM::LandTexture* TerrainStorage::getLandTexture(int index, short plugin) | ||||||
|     { |     { | ||||||
|         std::ostringstream stream; |         int numRecords = mData.getLandTextures().getSize(); | ||||||
|         stream << index << "_" << plugin; |  | ||||||
| 
 | 
 | ||||||
|         return &mData.getLandTextures().getRecord(stream.str()).get(); |         for (int i=0; i<numRecords; ++i) | ||||||
|  |         { | ||||||
|  |             const CSMWorld::LandTexture* ltex = &mData.getLandTextures().getRecord(i).get(); | ||||||
|  |             if (ltex->mIndex == index && ltex->mPluginIndex == plugin) | ||||||
|  |                 return ltex; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         std::stringstream error; | ||||||
|  |         error << "Can't find LandTexture " << index << " from plugin " << plugin; | ||||||
|  |         throw std::runtime_error(error.str()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void TerrainStorage::getBounds(float &minX, float &maxX, float &minY, float &maxY) |     void TerrainStorage::getBounds(float &minX, float &maxX, float &minY, float &maxY) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue