aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/DataStores
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-07-12 00:41:56 +0200
committerShauren <shauren.trinity@gmail.com>2015-07-12 00:41:56 +0200
commit228b9329259e136bfab281127963e99ec6ff43a0 (patch)
tree161ef67262a841f8b34f24823c4a5eddc3ec8569 /src/server/shared/DataStores
parentf7f7e4d0610c51434387fcd1947cac515db739a5 (diff)
Core/Players: Fixed power slot ordering
Diffstat (limited to 'src/server/shared/DataStores')
-rw-r--r--src/server/shared/DataStores/DB2Store.h8
-rw-r--r--src/server/shared/DataStores/DBStorageIterator.h3
2 files changed, 9 insertions, 2 deletions
diff --git a/src/server/shared/DataStores/DB2Store.h b/src/server/shared/DataStores/DB2Store.h
index c541a6651a3..b4ae20ce1da 100644
--- a/src/server/shared/DataStores/DB2Store.h
+++ b/src/server/shared/DataStores/DB2Store.h
@@ -181,6 +181,14 @@ public:
DB2DatabaseLoader(_fileName).LoadStrings(_format, _hotfixStatement + 1, locale, _indexTable.AsChar, _stringPoolList);
}
+ typedef bool(*SortFunc)(T const* left, T const* right);
+
+ void Sort(SortFunc pred)
+ {
+ ASSERT(strpbrk(_format, "nd") == nullptr, "Only non-indexed storages can be sorted");
+ std::sort(_indexTable.AsT, _indexTable.AsT + _indexTableSize, pred);
+ }
+
iterator begin() { return iterator(_indexTable.AsT, _indexTableSize); }
iterator end() { return iterator(_indexTable.AsT, _indexTableSize, _indexTableSize); }
diff --git a/src/server/shared/DataStores/DBStorageIterator.h b/src/server/shared/DataStores/DBStorageIterator.h
index a34cd6677c2..767900a123e 100644
--- a/src/server/shared/DataStores/DBStorageIterator.h
+++ b/src/server/shared/DataStores/DBStorageIterator.h
@@ -30,9 +30,8 @@ public:
{
if (_pos < _end)
{
- do
+ while (_pos < _end && !_index[_pos])
++_pos;
- while (_pos < _end && !_index[_pos]);
}
}