Changeset - r13018:7caa31b19a80
[Not reviewed]
master
0 3 0
rubidium - 15 years ago 2009-09-13 17:38:07
rubidium@openttd.org
(svn r17526) -Codechange: use QSortT instead of qsort for sorting the language list in the network GUI
3 files changed with 6 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/network/network_gui.cpp
Show inline comments
 
@@ -31,6 +31,7 @@
 
#include "../sortlist_type.h"
 
#include "../company_base.h"
 
#include "../company_func.h"
 
#include "../core/sort_func.hpp"
 

	
 
#include "table/strings.h"
 
#include "../table/sprites.h"
 
@@ -63,7 +64,7 @@ void SortNetworkLanguages()
 
	}
 

	
 
	/* Sort the strings (we don't move 'any' and the 'invalid' one) */
 
	qsort(&_language_dropdown[1], NETLANG_COUNT - 1, sizeof(StringID), &StringIDSorter);
 
	QSortT(_language_dropdown, NETLANG_COUNT - 1, &StringIDSorter);
 
}
 

	
 
enum {
src/strings.cpp
Show inline comments
 
@@ -1350,14 +1350,12 @@ const char *GetCurrentLocale(const char 
 
const char *GetCurrentLocale(const char *param);
 
#endif /* !(defined(WIN32) || defined(__APPLE__)) */
 

	
 
int CDECL StringIDSorter(const void *a, const void *b)
 
int CDECL StringIDSorter(const StringID *a, const StringID *b)
 
{
 
	const StringID va = *(const StringID*)a;
 
	const StringID vb = *(const StringID*)b;
 
	char stra[512];
 
	char strb[512];
 
	GetString(stra, va, lastof(stra));
 
	GetString(strb, vb, lastof(strb));
 
	GetString(stra, *a, lastof(stra));
 
	GetString(strb, *b, lastof(strb));
 

	
 
	return strcmp(stra, strb);
 
}
src/strings_func.h
Show inline comments
 
@@ -100,7 +100,7 @@ extern DynamicLanguages _dynlang; // def
 
bool ReadLanguagePack(int index);
 
void InitializeLanguagePacks();
 

	
 
int CDECL StringIDSorter(const void *a, const void *b);
 
int CDECL StringIDSorter(const StringID *a, const StringID *b);
 

	
 
/** Key comparison function for std::map */
 
struct StringIDCompare
0 comments (0 inline, 0 general)