Open KeithWM opened 3 weeks ago
With a game in "daily" mode I have a related issue that setting timetable entries in minutes, results in a total timetable length that is not equal to the sum of the minutes. In "hourly" mode, the issue with the "off by one" only occurs for smaller numbers of hours in the timetable.
I'm not sure how exactly the scaling of time is implemented, but I suspect there should be a slightly different scaling to avoid non-divisble integers being divided. E.g. I can imagine that in the switch from Vanilla pace with "day" as the unit to Hourly with "hour" as the unit, we are effectively doing something like 74 4 / 24 (vanilla ticks times scaling divided by unit switch). Perhaps the best one can do here is introduce the "3 hourly" where 74 4 * 3 / 24 = 37 is exact.
Similarly for daily 74 (4 24) / (24 60) = 74 4 / 60 is also not exact. English does not have a convenient word for "quarter-hour" (kwartier in Dutch, Viertelstunde in German), but that time unit would allow for an exact match as 74 (4 24) / (24 4) = 74. Then for weekly 74 (4 24 7) / (24 60) = 74 28 / 60 is also not exact. Here making the play-time week 7.5 days helps by achieving 74 (4 24 7.5) / (24 60) = 37 exactly.
I could of course be completely off in my assumptions on what is happening here, and I sincerely apologize if my suggestions do you any injustice.
So then I discovered the custom mode... ...I started a game with 720 minutes, following my 7.5 day week plan and that works like a charm!
And I can recreate the three-hourly approach successfully too, but for 24 hours (even for 21 hours) the choice of the "minute" unit of time is problematic.
Version of OpenTTD
OpenTTD 13.4-slowpace-1.3.1 (on MacOS Monterrey 12.7.6)
Expected result
When setting a timetable entry to a particular value, I expect the result to be stored as that value.
Actual result
Each value is stored as 1 less than I set.
Steps to reproduce
FYI: If I set it to 1, I see a 0 appear, but 34 ticks if I switch to showing ticks. If I increase this to 35 ticks, and then switch back to showing the time table in minutes, it does show 1. It might just be a rounding or integer division issue. If I set it to 2 minutes, I see a 1 appear, but 69 ticks. Again, changing it to 70 does update the minutes to 2.