mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-20 16:23:52 +00:00
Merge remote-tracking branch 'zini/next' into nifogre
This commit is contained in:
commit
6a67a5e650
1 changed files with 22 additions and 1 deletions
|
@ -872,7 +872,28 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
void setUp() {
|
||||
std::sort(mStatic.begin(), mStatic.end(), Compare());
|
||||
/// \note This method sorts indexed values for further
|
||||
/// searches. Every loaded item is present in storage, but
|
||||
/// latest loaded shadows any previous while searching.
|
||||
/// If memory cost will be too high, it is possible to remove
|
||||
/// unused values.
|
||||
|
||||
Compare cmp;
|
||||
|
||||
std::stable_sort(mStatic.begin(), mStatic.end(), cmp);
|
||||
|
||||
typename std::vector<T>::iterator first, next;
|
||||
next = first = mStatic.begin();
|
||||
|
||||
while (first != mStatic.end() && ++next != mStatic.end()) {
|
||||
while (next != mStatic.end() && !cmp(*first, *next)) {
|
||||
++next;
|
||||
}
|
||||
if (first != --next) {
|
||||
std::swap(*first, *next);
|
||||
}
|
||||
first = ++next;
|
||||
}
|
||||
}
|
||||
|
||||
const T *search(int index) const {
|
||||
|
|
Loading…
Reference in a new issue