Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic spacing in timetables not working #8054

Closed
arbulgazar opened this issue Apr 2, 2020 · 9 comments
Closed

Automatic spacing in timetables not working #8054

arbulgazar opened this issue Apr 2, 2020 · 9 comments
Labels
needs triage This issue needs further investigation before it becomes actionable

Comments

@arbulgazar
Copy link

Automatic spacing introduced since version 1.4.0 is not working and ctrl-Start Date clicking does not result in start date being offset for the vehicles sharing the same order.
Screenshot from 2020-04-02 17-38-20

Version of OpenTTD

openttd-1.10.0-linux-ubuntu-bionic-amd64.deb

Expected result

The start date of each vehicle is increased by the "gap number" so that each vehicle starts the same number of days after the last.

Actual result

Only the first vehicle in the list (the one that "Start Date" was applied to) gets the start date. No other vehicles in the shared order get the start date. Vehicles end up in a usual catarpillar-style stacking after any amount of time.

Steps to reproduce

From wiki (see last section):

  1. Set up a vehicle and plot the route using the Orders tab.
  2. When complete, click on the Timetable button and click Autofill.
  3. Start the vehicle and let it complete the route and fill in the timetable.
  4. Stop the vehicle as soon as the last item has filled in the timetable.
  5. On the Orders tab, click Skip until the next station is the first station in the list.
  6. Unclick Autofill and add a little slack into the timetable to account for filling up at stations. Since this is generally the first time you visit each station, there are no passengers to load, and you need to increase the time so that the vehicle can load up.
  7. Once the timetable is complete, decide how many vehicles you want on that route.
  8. Clone the initial vehicle using ctrl-click. The cloned vehicles will share the order list and timetable.
  9. Once you have all the clones, select the first vehicle and ctrl-click on Start Date.
  10. Set a start date a few days into the future. Ideally, the vehicle should arrive at the first station before this time.
  11. Release all the vehicles. They will bunch up at the first station but should leave in regular intervals until they are all spaced out.
@arbulgazar
Copy link
Author

Adding a save file with a minimalistic example, but this problem is consistent across all games.
timetable_bug_save.zip

@arbulgazar
Copy link
Author

Update - the problem seems to be with Linux build specifically. Checked on Windows - works as intended. Moreover, this is probably nothing to do with timetables and more with shared orders. When you change the waiting times on one vehicle with shared orders - it's not updated on other vehicles. I thought that's the expected behaviour, but on Windows it is changing. So I guess the problem is with shared orders in general.

@tpetazzoni
Copy link

I can confirm this bug on Linux. I didn't test on Windows though. How can this sort of bug be platform-specific ? Any progress ?

@TrueBrain
Copy link
Member

TrueBrain commented Jan 11, 2021

Although I know too little about timetables to work on the essence of this bug, I did check if I could spot any difference in behaviour between Linux and Windows: I cannot. The way OpenTTD is build up, this is also not likely, which was why I was looking into that part specifically (as this would also cause multiplayer desyncs, in most cases).

Would you be able to test this again with 1.10.3 on both Linux and Windows, and let us know what exactly the difference is that you notice between the two?

For the bug itself, I leave that to someone who understands timetables, which might not be a lot of people, in all honesty. I just wanted to make sure this was not a desync-capable bug :)

Tnx!

@TrueBrain TrueBrain added the needs triage This issue needs further investigation before it becomes actionable label Jan 11, 2021
@tpetazzoni
Copy link

Here I am running OpenTTD 1.10.3, on Linux (package from the Fedora distribution). I don't have right away a Windows VM to test and compare. What I'm saying on OpenTTD 1.10.3 in Linux is that Ctrl+click on the Start date doesn't do what the various tutorials say it should do: recalculate start dates for each vehicles sharing the same orders so that they are spread evenly on their route.

@TrueBrain
Copy link
Member

TrueBrain commented Jan 11, 2021

@tpetazzoni : I was not debating the bug yes or not :) I was asking @arbulgazar if he could retest with 1.10.3, as I am unable to reproduce any difference between the OSes.

In the meantime I got curious how timetables worked exactly, and what the behaviour should be. While doing so I found out that the steps listed above, when followed exactly, work fine for me. Including the ctrl+click on both Windows and Linux on "Start date". Took me a while to figure out which button to ctrl+click, but okay .. the UI likes to hide stuff, that's for sure.

From the above savegame, when stopping all vehicles, I have this in the timetables:
image

ctrl+click "Start date", set to month in future:
image

On Linux and Windows, both 1.10.3 as latest nightly.

So that brings me to a question for you @tpetazzoni : as this works for me, I need some more information to debug your case. If I ctrl+click on Start date, and put the date a month in the future, all shared vehicles get a new start date. If this is not working for you, is ctrl working at all for you? So for example if you clone a vehicle by clicking clone vehicle and holding ctrl over another vehicle, does that create a shared order (instead of a copy of the order)?

@tpetazzoni
Copy link

Ctrl+Click definitely works for shared orders. I just built OpenTTD from Git, and added some debug messages in the Timetable code, and I definitely see _ctrl_clicked being true, and the window ID passed around having bit 20 set. And from my quick testing tonight, it seems like the start dates are indeed set on all vehicles sharing the order, so it seems like I'm not able to reproduce the bug with the OpenTTD I've built myself. I need to take a bit more to compare with the OpenTTD from Fedora, to see if there's really a behavior difference. I'll follow up later.

@nchappe
Copy link
Contributor

nchappe commented Jul 24, 2022

In the code the exact condition to set the timetable start date for all the vehicles with the same shared orders when the set start date button is pressed is v->orders->IsCompleteTimetable() && _ctrl_pressed, which means that if some orders are not explicitly timetabled, Ctrl+Click silently falls back to setting the timetable start date of a single vehicle, with no user feedback.
This is explained in the relevant tooltip ("Ctrl+Click distributes all vehicles sharing this order evenly from the given date based on their relative order, if the order is completely timetabled"), but I still find it a bit counter-intuitive, and I suspect this is the root of this issue.

@2TallTyler
Copy link
Member

Superseded by #10289 - thanks to @nchappe for triaging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue needs further investigation before it becomes actionable
Projects
None yet
Development

No branches or pull requests

5 participants