From 5f4aef3c1117cff2195a3ac12a1b3539e4f978f5 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Tue, 30 Dec 2008 21:04:09 +0000 Subject: (svn r14776) -Fix (r14742): ListPositionMap relied on std::map having sorted the map, which is now done by a manual key sorter on SmallMap. This fixes engine ID list sorting. --- src/core/smallmap_type.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/core/smallmap_type.hpp') diff --git a/src/core/smallmap_type.hpp b/src/core/smallmap_type.hpp index 681cacdff..cc2533dd0 100644 --- a/src/core/smallmap_type.hpp +++ b/src/core/smallmap_type.hpp @@ -96,6 +96,18 @@ struct SmallMap : SmallVector, S> { n->first = key; return n->second; } + + FORCEINLINE void SortByKey() + { + qsort(this->Begin(), this->items, sizeof(Pair), KeySorter); + } + + static int CDECL KeySorter(const void *a, const void *b) + { + const Pair *pa = (const Pair*)a; + const Pair *pb = (const Pair*)b; + return pa->first - pb->first; + } }; #endif /* SMALLMAP_TYPE_HPP */ -- cgit v1.2.3-54-g00ecf