From 53129ec1a747a12df48fcbf2a352481491b5c1a5 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Fri, 29 May 2009 01:54:45 +0000 Subject: [PATCH] Made sortMaps clearer. --- client/CPreGame.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index 4aaa6123c..d42ab69a2 100644 --- a/client/CPreGame.cpp +++ b/client/CPreGame.cpp @@ -2373,16 +2373,21 @@ void CPreGame::quitAskBox() { showAskBox("\"{} Are you sure you want to quit?\"",NULL,NULL); } + +// Sort the maps on the new key (map size, map name, ...) void CPreGame::sortMaps() { - std::sort(ourScenSel->mapsel.selMaps.begin(),ourScenSel->mapsel.selMaps.end(),mapSorter(_name)); - if(ourScenSel->mapsel.sortBy != _name) - std::stable_sort(ourScenSel->mapsel.selMaps.begin(),ourScenSel->mapsel.selMaps.end(),mapSorter(ourScenSel->mapsel.sortBy)); + std::vector &sm = ourScenSel->mapsel.selMaps; + + std::sort(sm.begin(), sm.end(), mapSorter(_name)); + if (ourScenSel->mapsel.sortBy != _name) + std::stable_sort(sm.begin(), sm.end(),mapSorter(ourScenSel->mapsel.sortBy)); ourScenSel->mapsel.select(0,false,true); ourScenSel->mapsel.slid->whereAreWe=0; ourScenSel->mapsel.slid->updateSlid(); printMapsFrom(0); } + void CPreGame::setTurnLength(int on) { int min;