View Issue Details

IDProjectCategoryView StatusLast Update
0005134Multi Theft Auto : San AndreasGUI / Menus / Consolepublic2010-03-21 11:29
ReporterjhxpAssigned Tomabako 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version1.0.2 
Target Version1.0.4Fixed in Version1.0.4 
Summary0005134: Sorting in server browser is not done properly when sorting by 'host'
Description

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
  1. Open server browser and wait till the list loads
  2. Sort the list by 'host'
  3. Look at the sorting results in host column
Additional Information

http://www.jhxp.net/personal/mta/server-browser-sorting-by-host.jpg

TagsNo tags attached.

Activities

IJs

2009-12-23 13:43

administrator   ~~0010905

Last edited: 2009-12-23 13:58

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.

x86

2010-03-21 11:29

administrator   ~~0011212

Fixed in: http://github.com/multitheftauto/multitheftauto/commit/e4a6ddb69f371d044ca0be78debbccffe900114a

Issue History

Date Modified Username Field Change