about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-11-29 22:34:47 +0100
committeroy <Tom_Adams@web.de>2011-11-29 22:34:47 +0100
commit48d367db204adb2eb0bef9764b12773891d6975f (patch)
tree32e982d29f4f496fbf27fe68cdb1b2be93012277 /src
parent8238853b8cb3b25b5b10f70f4787ae38682eb1c4 (diff)
downloadzcatch-48d367db204adb2eb0bef9764b12773891d6975f.tar.gz
zcatch-48d367db204adb2eb0bef9764b12773891d6975f.zip
added faster way of inverting the sorted serverlist by KillaBilla. Closes #885
Diffstat (limited to 'src')
-rw-r--r--src/engine/client/serverbrowser.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/engine/client/serverbrowser.cpp b/src/engine/client/serverbrowser.cpp
index d60c15b8..87964003 100644
--- a/src/engine/client/serverbrowser.cpp
+++ b/src/engine/client/serverbrowser.cpp
@@ -26,7 +26,7 @@ class SortWrap
 	CServerBrowser *m_pThis;
 public:
 	SortWrap(CServerBrowser *t, SortFunc f) : m_pfnSort(f), m_pThis(t) {}
-	bool operator()(int a, int b) { return (m_pThis->*m_pfnSort)(a, b); }
+	bool operator()(int a, int b) { return (g_Config.m_BrSortOrder ? (m_pThis->*m_pfnSort)(b, a) : (m_pThis->*m_pfnSort)(a, b)); }
 };
 
 CServerBrowser::CServerBrowser()
@@ -294,17 +294,6 @@ void CServerBrowser::Sort()
 	else if(g_Config.m_BrSort == IServerBrowser::SORT_GAMETYPE)
 		std::stable_sort(m_pSortedServerlist, m_pSortedServerlist+m_NumSortedServers, SortWrap(this, &CServerBrowser::SortCompareGametype));
 
-	// invert the list if requested
-	if(g_Config.m_BrSortOrder)
-	{
-		for(i = 0; i < m_NumSortedServers/2; i++)
-		{
-			int Temp = m_pSortedServerlist[i];
-			m_pSortedServerlist[i] = m_pSortedServerlist[m_NumSortedServers-i-1];
-			m_pSortedServerlist[m_NumSortedServers-i-1] = Temp;
-		}
-	}
-
 	// set indexes
 	for(i = 0; i < m_NumSortedServers; i++)
 		m_ppServerlist[m_pSortedServerlist[i]]->m_Info.m_SortedIndex = i;