Here is another timetable and separation patch, with two simple goals. First; to implement a "setup once and forget" mode for timetables. Second; to add automatic separation of vehicles.
This patch was inspired by this patch from MagicBuzz
but handles separation in a new way.
Vehicles now examine only their position relative to the vehicle directly in front and the vehicle directly behind. To quote the code:
v->lateness_counter = (separation_ahead - separation_behind) / 2;
The patch adds two new options:
"Automatically manage timetables" - Enables timetables to be automated.
"Use timetable to ensure vehicles separation" - Turns on separation for all timetables.
To automate a timetable, click the Automate button where Autofill used to be. To stop using a timetable, simply click Automate again and all times will be removed. If you ctrl-click Automate when it is active then the automatic updating of times will stop but all the times will remain and the vehicles will keep running on a static timetable.
When Automate is on everything should take care of itself, and one should never have to open the timetable window again to adjust values. Both loading and travel times can automatically increase or decrease as the game progresses, and times for new orders are added automatically as well.
So when you add new vehicles, add or remove stations, upgrade to faster vehicles or redesign the network you will not have to adjust anything in the timetable yourself. All of these changes should only create temporary disturbances that will eventually go away.
A timetable that has been automated will start when the vehicle arrives at any station and stop (until arriving at another station) when the vehicle is stopped, sent to a depot or an order is skipped. This way you can still manually make vehicles skip orders etc without it messing up the times in the timetable.
At least these are all the ideas but this is still a work-in-progress. Feedback welcome!
I'm new to the openttd-codebase so there are probably better ways to do some things.
I'm aware of the Improved Timetable Management patch
and will look at it closer for inspiration.Enjoy!
Apply patches with patch -p1
Version 0.6 by Wouter here
Thank you for taking the time to build and post these!
(since I've never tested it myself; use at your own risk etc, etc.
)Automated timetables and separation
Version 0.1 - barely works?
Version 0.2 - less ugly code, more stable separation.
Version 0.3 - separation improved, misc fixes.
Version 0.4 - small fixes to order times adjustment.
Version 0.5 - faster separation, hopefully, and misc cleanups.
Version 0.6 - separation logic rewritten.
Version 0.7 - try to handle large deviations like jams by restarting timetable.
Version 0.71 - small bugfix regarding removing shared orders.
Version 0.72 - minor bugfixes, crash when de-automating with no orders fixed.
Version 0.8 - via-orders fixed, ctrl-click behaviour inverted, conditional orders should be less bad.
Try having vehicles begin to separate even when timetable is very incomplete.