From 83f5b1df81753f7dfdb1b50296c404734effa45b Mon Sep 17 00:00:00 2001 From: greye Date: Tue, 6 Nov 2012 17:58:49 +0400 Subject: [PATCH] change to static --> dynamic search order --- apps/openmw/mwworld/store.hpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index 1adc2677e..552f6d760 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -107,17 +107,18 @@ namespace MWWorld T item; item.mId = StringUtils::lowerCase(id); - typename Dynamic::const_iterator dit = mDynamic.find(item.mId); - if (dit != mDynamic.end()) { - return &dit->second; - } - typename std::vector::const_iterator it = std::lower_bound(mStatic.begin(), mStatic.end(), item, RecordCmp()); if (it != mStatic.end() && it->mId == item.mId) { return &(*it); } + + typename Dynamic::const_iterator dit = mDynamic.find(item.mId); + if (dit != mDynamic.end()) { + return &dit->second; + } + return 0; } @@ -388,17 +389,18 @@ namespace MWWorld ESM::Cell cell; cell.mName = StringUtils::lowerCase(id); - DynamicInt::const_iterator dit = mDynamicInt.find(cell.mName); - if (dit != mDynamicInt.end()) { - return &dit->second; - } - std::vector::const_iterator it = std::lower_bound(mInt.begin(), mInt.end(), cell, RecordCmp()); if (it != mInt.end() && StringUtils::ciEqual(it->mName, id)) { return &(*it); } + + DynamicInt::const_iterator dit = mDynamicInt.find(cell.mName); + if (dit != mDynamicInt.end()) { + return &dit->second; + } + return 0; } @@ -406,18 +408,19 @@ namespace MWWorld ESM::Cell cell; cell.mData.mX = x, cell.mData.mY = y; - std::pair key(x, y); - DynamicExt::const_iterator dit = mDynamicExt.find(key); - if (dit != mDynamicExt.end()) { - return &dit->second; - } - std::vector::const_iterator it = std::lower_bound(mExt.begin(), mExt.end(), cell, ExtCmp()); if (it != mExt.end() && it->mData.mX == x && it->mData.mY == y) { return &(*it); } + + std::pair key(x, y); + DynamicExt::const_iterator dit = mDynamicExt.find(key); + if (dit != mDynamicExt.end()) { + return &dit->second; + } + return 0; }