Changeset - r21909:cf5e3292f853
[Not reviewed]
master
0 3 0
frosch - 10 years ago 2014-11-18 20:12:42
frosch@openttd.org
(svn r27063) -Fix [FS#6172]: Some lists did not use natural string sorting.
3 files changed with 7 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/newgrf_config.cpp
Show inline comments
 
@@ -715,7 +715,7 @@ static int CDECL GRFSorter(GRFConfig * c
 
	const GRFConfig *c1 = *p1;
 
	const GRFConfig *c2 = *p2;
 

	
 
	return strcasecmp(c1->GetName(), c2->GetName());
 
	return strnatcmp(c1->GetName(), c2->GetName());
 
}
 

	
 
/**
src/station_gui.cpp
Show inline comments
 
@@ -19,6 +19,7 @@
 
#include "cargotype.h"
 
#include "station_gui.h"
 
#include "strings_func.h"
 
#include "string_func.h"
 
#include "window_func.h"
 
#include "viewport_func.h"
 
#include "widgets/dropdown_func.h"
 
@@ -222,7 +223,9 @@ protected:
 
			GetString(buf_cache, STR_STATION_NAME, lastof(buf_cache));
 
		}
 

	
 
		return strcmp(buf, buf_cache);
 
		int r = strnatcmp(buf, buf_cache); // Sort by name (natural sorting).
 
		if (r == 0) return (*a)->index - (*b)->index;
 
		return r;
 
	}
 

	
 
	/** Sort stations by their type */
 
@@ -1186,7 +1189,7 @@ bool CargoSorter::SortStation(StationID 
 
	SetDParam(0, st2);
 
	GetString(buf2, STR_STATION_NAME, lastof(buf2));
 

	
 
	int res = strcmp(buf1, buf2);
 
	int res = strnatcmp(buf1, buf2); // Sort by name (natural sorting).
 
	if (res == 0) {
 
		return this->SortId(st1, st2);
 
	} else {
src/strings.cpp
Show inline comments
 
@@ -1864,7 +1864,7 @@ int CDECL StringIDSorter(const StringID 
 
	GetString(stra, *a, lastof(stra));
 
	GetString(strb, *b, lastof(strb));
 

	
 
	return strcmp(stra, strb);
 
	return strnatcmp(stra, strb);
 
}
 

	
 
/**
0 comments (0 inline, 0 general)