forked from mirror/openmw-tes3mp
Issue #28: replaced the nested map structure in the CellList
This commit is contained in:
parent
aa87370d8f
commit
f0dd38b431
1 changed files with 8 additions and 30 deletions
|
@ -287,8 +287,7 @@ namespace ESMS
|
||||||
IntCells intCells;
|
IntCells intCells;
|
||||||
|
|
||||||
// List of exterior cells. Indexed as extCells[gridX][gridY].
|
// List of exterior cells. Indexed as extCells[gridX][gridY].
|
||||||
typedef std::map<int, ESM::Cell*> ExtCellsCol;
|
typedef std::map<std::pair<int, int>, ESM::Cell*> ExtCells;
|
||||||
typedef std::map<int, ExtCellsCol> ExtCells;
|
|
||||||
ExtCells extCells;
|
ExtCells extCells;
|
||||||
|
|
||||||
virtual void listIdentifier (std::vector<std::string>& identifier) const
|
virtual void listIdentifier (std::vector<std::string>& identifier) const
|
||||||
|
@ -303,13 +302,7 @@ namespace ESMS
|
||||||
delete it->second;
|
delete it->second;
|
||||||
|
|
||||||
for (ExtCells::iterator it = extCells.begin(); it!=extCells.end(); ++it)
|
for (ExtCells::iterator it = extCells.begin(); it!=extCells.end(); ++it)
|
||||||
{
|
|
||||||
ExtCellsCol& col = it->second;
|
|
||||||
for (ExtCellsCol::iterator it = col.begin(); it!=col.end(); ++it)
|
|
||||||
{
|
|
||||||
delete it->second;
|
delete it->second;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,17 +318,12 @@ namespace ESMS
|
||||||
|
|
||||||
const ESM::Cell *searchExt (int x, int y) const
|
const ESM::Cell *searchExt (int x, int y) const
|
||||||
{
|
{
|
||||||
ExtCells::const_iterator it = extCells.find (x);
|
ExtCells::const_iterator it = extCells.find (std::make_pair (x, y));
|
||||||
|
|
||||||
if (it==extCells.end())
|
if (it==extCells.end())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ExtCellsCol::const_iterator it2 = it->second.find (y);
|
return it->second;
|
||||||
|
|
||||||
if (it2 == it->second.end())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return it2->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESM::Cell *findExt (int x, int y) const
|
const ESM::Cell *findExt (int x, int y) const
|
||||||
|
@ -351,12 +339,8 @@ namespace ESMS
|
||||||
{
|
{
|
||||||
for (ExtCells::const_iterator iter = extCells.begin(); iter!=extCells.end(); ++iter)
|
for (ExtCells::const_iterator iter = extCells.begin(); iter!=extCells.end(); ++iter)
|
||||||
{
|
{
|
||||||
const ExtCellsCol& column = iter->second;
|
if (toLower (iter->second->name) == toLower (id))
|
||||||
for (ExtCellsCol::const_iterator iter = column.begin(); iter!=column.end(); ++iter)
|
return iter->second;
|
||||||
{
|
|
||||||
if ( toLower(iter->second->name) == toLower(id))
|
|
||||||
return iter->second;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -367,14 +351,8 @@ namespace ESMS
|
||||||
std::string id2 = toLower (id);
|
std::string id2 = toLower (id);
|
||||||
|
|
||||||
for (ExtCells::const_iterator iter = extCells.begin(); iter!=extCells.end(); ++iter)
|
for (ExtCells::const_iterator iter = extCells.begin(); iter!=extCells.end(); ++iter)
|
||||||
{
|
if (toLower (iter->second->region)==id)
|
||||||
const ExtCellsCol& column = iter->second;
|
return iter->second;
|
||||||
for (ExtCellsCol::const_iterator iter = column.begin(); iter!=column.end(); ++iter)
|
|
||||||
{
|
|
||||||
if (toLower (iter->second->region)==id)
|
|
||||||
return iter->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -398,7 +376,7 @@ namespace ESMS
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Store exterior cells by grid position
|
// Store exterior cells by grid position
|
||||||
extCells[cell->data.gridX][cell->data.gridY] = cell;
|
extCells[std::make_pair (cell->data.gridX, cell->data.gridY)] = cell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue