News:

SimuTranslator
Make Simutrans speak your language.

Sort goods: via (amount)

Started by wlindley, August 29, 2022, 08:35:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wlindley

Currently, when sorting the goods list at a station "via (amount)" — which one would expect to sort first by destination, then by goods type — we get something like this:

217 barrels piece goods waiting
7 barrels beer via Purham Broadway dock
2 crates china via Arnhill Broadway Railway Station
16 barrels cider via Arnhill Street Stop
13 barrels cider via Arlsditch Holy Trinity Parish Church Railway Station
7 barrels cider via Purham Broadway dock
12 crates flour via Arnhill Broadway Railway Station
11 crates flour via Purham Broadway dock
1 crates flour via Arlsditch Holy Trinity Parish Church Railway Station
78 crates fruit via Purham Broadway dock
26 crates fruit via Arnhill Furniture shop Railway Station
1 crates textiles via Wealwich Mortimer Railway Station
22 crates vegetables via Purham Broadway dock
12 crates vegetables via Arnhill Furniture shop Railway Station
7 crates vegetables via Wealwich Mortimer Railway Station
2 sacks wool via Much Wyndburn Corner dock

which is less than entirely helpful in understanding how much is really going to each destination.  (It is in fact sorting by goods type, then by the 'via' station.)

Is there any way to recode this so we see something more useful like:

217 barrels piece goods waiting
14 via Arlsditch Holy Trinity Parish Church Railway Station
  (13 barrels cider, 1 crates flour)
14 via Arnhill Broadway Railway Station
  (2 crates china, 12 crates flour)
38 via Arnhill Furniture shop Railway Station
  (26 crates fruit, 12 crates vegetables)
16 barrels cider via Arnhill Street Stop
2 sacks wool via Much Wyndburn Corner dock
125 via Purham Broadway dock
  (7 barrels beer, 7 barrels cider, 11 crates flour, 78 crates fruit, 22 crates vegetables)
8 via Wealwich Mortimer Railway Station
  (1 crates textiles, 7 crates vegetables)

Mariculous

#1
Sure this is technically possible.
The main part of this seems to be located in freight_list_sorter_t
Don't be confused of the method naming. freight_list_sorter_t::sort_freight actually does much more than sorting the list...
I am wondering whether an OOP refactoring of this might be a good idea to improve maintainability and allow some flexibility.