From 814d721e33d7914648b51be62b7d3a75402d52ca Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 11 Sep 2010 15:12:42 +0200 Subject: [PATCH] build external cell names from name of region instead of from internal region id --- apps/openmw/mwworld/world.cpp | 16 +++++++++++++--- components/esm_store/reclists.hpp | 4 +++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index de3c1ab5c..ca29facfd 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -698,9 +698,19 @@ namespace MWWorld return cell; // didn't work -> now check for regions - if (mStore.regions.search (cellName)) - if (const ESM::Cell *cell = mStore.cells.searchExtByRegion (cellName)) - return cell; + std::string cellName2 = ESMS::RecListT::toLower (cellName); + + for (ESMS::RecListT::MapType::const_iterator iter (mStore.regions.list.begin()); + iter!=mStore.regions.list.end(); ++iter) + { + if (ESMS::RecListT::toLower (iter->second.name)==cellName2) + { + if (const ESM::Cell *cell = mStore.cells.searchExtByRegion (iter->first)) + return cell; + + break; + } + } return 0; } diff --git a/components/esm_store/reclists.hpp b/components/esm_store/reclists.hpp index 823433f56..81b0d6054 100644 --- a/components/esm_store/reclists.hpp +++ b/components/esm_store/reclists.hpp @@ -226,12 +226,14 @@ namespace ESMS const Cell *searchExtByRegion (const std::string& id) const { + std::string id2 = toLower (id); + for (ExtCells::const_iterator iter = extCells.begin(); iter!=extCells.end(); ++iter) { const ExtCellsCol& column = iter->second; for (ExtCellsCol::const_iterator iter = column.begin(); iter!=column.end(); ++iter) { - if (iter->second->region==id) + if (toLower (iter->second->region)==id) return iter->second; } }