From 13d8ea09b0f5da97a0dae719cb4cb39aa4ef97eb Mon Sep 17 00:00:00 2001 From: Jason Hooks Date: Wed, 27 Oct 2010 23:22:01 -0400 Subject: [PATCH] Cell case insensitivity, exterior and interior cells --- components/esm_store/reclists.hpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/components/esm_store/reclists.hpp b/components/esm_store/reclists.hpp index 75debb8fc..ee8de7578 100644 --- a/components/esm_store/reclists.hpp +++ b/components/esm_store/reclists.hpp @@ -9,7 +9,12 @@ #include #include #include +#include + + +using namespace boost::algorithm; + namespace ESMS { using namespace ESM; @@ -233,6 +238,15 @@ namespace ESMS } }; + struct ciLessBoost : std::binary_function +{ + bool operator() (const std::string & s1, const std::string & s2) const { + //case insensitive version of is_less + return lexicographical_compare(s1, s2, is_iless()); + } +}; + + // Cells aren't simply indexed by name. Exterior cells are treated // separately. // TODO: case handling (cell names are case-insensitive, but they are also showen to the @@ -245,7 +259,7 @@ namespace ESMS int getSize() { return count; } // List of interior cells. Indexed by cell name. - typedef std::map IntCells; + typedef std::map IntCells; IntCells intCells; // List of exterior cells. Indexed as extCells[gridX][gridY]. @@ -268,6 +282,7 @@ namespace ESMS } } + const Cell* findInt(const std::string &id) const { IntCells::const_iterator it = intCells.find(id); @@ -300,7 +315,7 @@ namespace ESMS const ExtCellsCol& column = iter->second; for (ExtCellsCol::const_iterator iter = column.begin(); iter!=column.end(); ++iter) { - if (iter->second->name==id) + if ( toLower(iter->second->name) == toLower(id)) return iter->second; } }