1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-07-21 05:14:10 +00:00

Merge remote-tracking branch 'jordan-ayers/topic/COC-Exterior-Cell-Selection'

This commit is contained in:
Marc Zinnschlag 2013-10-12 23:18:19 +02:00
commit 708cde2688

View file

@ -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 {