[patch] More precise timetable starts

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
hcoopz
Engineer
Engineer
Posts: 4
Joined: 29 Aug 2016 21:55
Location: NJ, USA

[patch] More precise timetable starts

Post by hcoopz »

Hi,

I've written a small patch that makes it possible to give vehicles more precise timetable starts. Currently, if you have two vehicles with shared orders with a total timetable duration of 7 days, it is impossible to start their timetables exactly 3.5 days apart, and I suspect that the only way to get them to run at evenly-spaced intervals is to tweak their orders after starting their timetables.

This is caused by a vehicle's timetable start information being a date, with no tick-level information. The patch adds a ticks field to support timetable starts that are not on exact date boundaries, and it modifies timetabling multiple vehicles with shared orders so that their timetable starts will be spread out equally to the nearest tick.

It also changes the timetable and start date picker windows. When the 'Show timetable in ticks rather than days' setting is enabled and a timetable start has been set, the timetable window shows both the date and the number of ticks, and when the start date picker window is opened it is extended with a ticks dropdown:
timetable-window.png
timetable-window.png (208.25 KiB) Viewed 1358 times
The patch should be applied to r27632 and is attached below:
timetable-start-ticks-3.diff
The updated version of the patch. (2016-09-05)
(16.86 KiB) Downloaded 55 times
No Windows build, sorry - I haven't managed to get cross-compilation working yet.

Let me know your thoughts! I would be very happy if this were included in trunk, so please let me know what I can do to make it more likely that it will be accepted if I submit it. I've been working on a rewrite of the departure boards/wall clock patch, and this patch being in trunk would allow it to work without breaking savegame or network compatibility, and I suspect it might also be useful for people playing with a day length patch (where only being able to set timetable starts to dates has more of an impact on timetabling).

Edits
  • 2016-08-29 I've changed the date picker window ticks dropdown so that it defaults to zero. This makes it more convenient when you want a timetable to start on a date boundary, and when you don't, it's unlikely that you want whatever the current game time tick counter is.
  • 2016-09-05 I've changed the way the widgets are constructed in the date picker window, allowing me to simplify the window logic. This has no effect on gameplay.
Original patch:
timetable-start-ticks.diff
The original version of the patch, which sets the date picker ticks field to the current game time ticks.
(19.24 KiB) Downloaded 50 times
xarick
Transport Coordinator
Transport Coordinator
Posts: 337
Joined: 26 Feb 2015 00:52

Re: [patch] More precise timetable starts

Post by xarick »

I tried this patch, but I was hoping that "travel for xxx ticks" weren't multiples of 74.
Formerly known as Samu
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests