OpenTTD

Tasklist

FS#6014 - Station List: add an option to sort by the number of occurences in vehicles' schedules

Attached to Project: OpenTTD
Opened by Daniel Kamil Kozar (xavery) - Sunday, 11 May 2014, 13:40 GMT
Last edited by andythenorth (andythenorth) - Saturday, 02 September 2017, 12:39 GMT
Type Feature Request
Category Interface
Status With patch
Assigned To No-one
Operating System All
Severity Low
Priority Low
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

When playing OpenTTD, I occasionally have the need to find out which stations are used the most and which are sparingly used. I took the liberty of writing the patch to implement this. It adds the option to sort the station list by the "Vehicle usage rating", which will favour stations which are referenced most by all the vehicles that can stop there, according to the facilities found at a given station.
This task depends upon

Comment by Ingo von Borstel (planetmaker) - Sunday, 11 May 2014, 20:22 GMT
The check for all vehicles in all stations is a very expensive check. How does that influence the playability (CPU usage) on a vehicle and order-rich map when the station list is open with this new sorting? You could e.g. try with http://wiki.openttdcoop.org/PublicServer:Archive_-_Games_191_-_200#gameid_200 or some other game (which?) from that list.

Also what's the use case for sorting stations by vehicle count, especially if the counts of different transport types are added? The only use cases we could find are:
* find unserviced stations
* monitor airports for crashed trains by plane count
* monitor RV stations for crashed RV on level crossings

Unserviced stations can be easier / less expensively checked via the stations alone, and abort as soon as any vehicle is found. Finding badly serviced stations is better done via cargo ratings instead of vehicle count.
Plane and RV accidents are news, so players get those already. I can see that being a *cheat* for single player to build and replace them in the nearest depot. Though that has issues for RV as it might not have a valid connection to the crash site, so maybe only for planes.

As to the patch itself: you're doing already well with the doxygen, but it needs to be even more :). Next to a short description and a description of every parameter, each function with a return value needs an @return doxygen line as well which describes the type and meaning of its return value. Comments in the code itself are also /* ... */ when there's no functional code in the same line(s).
Comment by Daniel Kamil Kozar (xavery) - Sunday, 11 May 2014, 20:45 GMT
Hey, and thanks for the comments. You are of course right about this being a very expensive (too expensive, even) check : however, it seems to me that there is no other way to do it with the current codebase unless every station had a variable which would be incremented/decremented on its every add/removal from a vehicle's schedule.
I tested the function with the "Public Server Game 199" savegame. Unfortunately, it crashes in station_map.h at the line IsTileType(t, MP_STATION). This would suggest that the sorter function is called with parameters that are not necessarily stations - I obviously need to dig into the code a bit more.
As for the usecase, I find having such a thing useful when I play a game with lots of large airports, which are very far away from each other (think corners) and are serviced by the fastest airplanes. In this case, it is convenient to have a somewhat equal number of planes servicing these airports. But I'm no expert player, so that feature might not be that useful to anybody else.
I attached the crash log, in case it's useful to anyone.
Comment by andythenorth (andythenorth) - Friday, 01 September 2017, 10:33 GMT
Based on patch review from planetmaker, I think this one is unlikely to have a route forward. Suggest closing it, with thanks.

Loading...