mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-06 21:45:35 +00:00
COC Command: Exterior cell selection fix.
Return the northernmost cell of the easternmost matching column for Ext. cells.
This commit is contained in:
parent
b5d620a8dc
commit
141382b8c0
1 changed files with 18 additions and 6 deletions
|
@ -656,26 +656,38 @@ namespace MWWorld
|
||||||
return iterator(mSharedExt.end());
|
return iterator(mSharedExt.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \todo implement appropriate index
|
// Return the northernmost cell in the easternmost column.
|
||||||
const ESM::Cell *searchExtByName(const std::string &id) const {
|
const ESM::Cell *searchExtByName(const std::string &id) const {
|
||||||
|
ESM::Cell *cell = 0;
|
||||||
std::vector<ESM::Cell *>::const_iterator it = mSharedExt.begin();
|
std::vector<ESM::Cell *>::const_iterator it = mSharedExt.begin();
|
||||||
for (; it != mSharedExt.end(); ++it) {
|
for (; it != mSharedExt.end(); ++it) {
|
||||||
if (Misc::StringUtils::ciEqual((*it)->mName, id)) {
|
if (Misc::StringUtils::ciEqual((*it)->mName, id)) {
|
||||||
return *it;
|
if ( cell == 0 ||
|
||||||
|
( (*it)->mData.mX > cell->mData.mX ) ||
|
||||||
|
( (*it)->mData.mX == cell->mData.mX && (*it)->mData.mY > cell->mData.mY ) )
|
||||||
|
{
|
||||||
|
cell = *it;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \todo implement appropriate index
|
// Return the northernmost cell in the easternmost column.
|
||||||
const ESM::Cell *searchExtByRegion(const std::string &id) const {
|
const ESM::Cell *searchExtByRegion(const std::string &id) const {
|
||||||
|
ESM::Cell *cell = 0;
|
||||||
std::vector<ESM::Cell *>::const_iterator it = mSharedExt.begin();
|
std::vector<ESM::Cell *>::const_iterator it = mSharedExt.begin();
|
||||||
for (; it != mSharedExt.end(); ++it) {
|
for (; it != mSharedExt.end(); ++it) {
|
||||||
if (Misc::StringUtils::ciEqual((*it)->mRegion, id)) {
|
if (Misc::StringUtils::ciEqual((*it)->mRegion, id)) {
|
||||||
return *it;
|
if ( cell == 0 ||
|
||||||
|
( (*it)->mData.mX > cell->mData.mX ) ||
|
||||||
|
( (*it)->mData.mX == cell->mData.mX && (*it)->mData.mY > cell->mData.mY ) )
|
||||||
|
{
|
||||||
|
cell = *it;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t getSize() const {
|
size_t getSize() const {
|
||||||
|
|
Loading…
Reference in a new issue