mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 18:56:38 +00:00 
			
		
		
		
	fix a bug with case sensitivity: when searching for a cell which is already loaded,but with another case, the cell get loaded twice, which is bad :p
This commit is contained in:
		
							parent
							
								
									cc01a5ceed
								
							
						
					
					
						commit
						165065d378
					
				
					 1 changed files with 15 additions and 3 deletions
				
			
		|  | @ -8,6 +8,17 @@ | |||
| #include "class.hpp" | ||||
| #include "containerstore.hpp" | ||||
| 
 | ||||
| //helper function
 | ||||
| std::string toLower (const std::string& name) | ||||
| { | ||||
|     std::string lowerCase; | ||||
| 
 | ||||
|     std::transform (name.begin(), name.end(), std::back_inserter (lowerCase), | ||||
|         (int(*)(int)) std::tolower); | ||||
| 
 | ||||
|     return lowerCase; | ||||
| } | ||||
| 
 | ||||
| MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell) | ||||
| { | ||||
|     if (cell->data.flags & ESM::Cell::Interior) | ||||
|  | @ -129,13 +140,14 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y) | |||
| 
 | ||||
| MWWorld::Ptr::CellStore *MWWorld::Cells::getInterior (const std::string& name) | ||||
| { | ||||
|     std::map<std::string, Ptr::CellStore>::iterator result = mInteriors.find (name); | ||||
|     std::string nName = toLower(name); | ||||
|     std::map<std::string, Ptr::CellStore>::iterator result = mInteriors.find (nName); | ||||
| 
 | ||||
|     if (result==mInteriors.end()) | ||||
|     { | ||||
|         const ESM::Cell *cell = mStore.cells.findInt (name); | ||||
|         const ESM::Cell *cell = mStore.cells.findInt (nName); | ||||
| 
 | ||||
|         result = mInteriors.insert (std::make_pair (name, Ptr::CellStore (cell))).first; | ||||
|         result = mInteriors.insert (std::make_pair (nName, Ptr::CellStore (cell))).first; | ||||
|     } | ||||
| 
 | ||||
|     if (result->second.mState!=Ptr::CellStore::State_Loaded) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue