View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005134||Multi Theft Auto : San Andreas||GUI / Menus / Console||public||2009-12-12 13:15||2010-03-21 11:29|
|Target Version||1.0.4||Fixed in Version||1.0.4|
|Summary||0005134: Sorting in server browser is not done properly when sorting by 'host'|
If you try to sort the server list by the 'host', it will not be done properly. It seems as only first part of the IP number (eg. 192.x.x.x) is sorted fine, while other parts (x.1.2.3) are not sorted and put in the list randomly.
|Steps To Reproduce|
|Tags||No tags attached.|
This happens because the host of each list item is added as a number type (in CServerBrowser.cpp). This leads to creation of a CEGUI::ListboxNumberItem (in CGUIListItem_Impl.cpp). The latter class implements a sort function using atoi() (in CEGUIListBoxNumberItem.cpp).
The manual page for atoi describes the following:
"The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value.
The string can contain additional characters after those that form the integral number, which are ignored and have no effect on the behavior of this function."
This means that the number that is sorted is the set of digits of the IP address up until the first dot.
Since we cannot simply turn the entire IP address in a big number (shorter IP addresses would appear earlier), this would require yet another CEGUI change. Or we could just disable sorting the host column altogether.