-
-
Notifications
You must be signed in to change notification settings - Fork 843
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
Fix travel times stored in the linkgraph #9693
Conversation
22cf85b
to
9dcf94e
Compare
9dcf94e
to
e7acbed
Compare
The counter
Is it the same? or is there an important difference that makes it necessary to add two similar but distinct time stamps? |
I thought about using a date, the code would be a bit simpler but it would be a bit less precise. More importantly, it would break when using the cheat that changes the current year. While working on this PR I found out that setting the current year does break The time I store does not exactly correspond to the date of last station departure because to fix #9665 the variable introduced by my PR has to be exactly the time since |
Isn't it possible to just store current vehicle tick and do some math when the exact value is needed ? And remove most counters. |
Without the time since last loading, you would probably need to store the date of last loading, which has its advantages (no need to increment the counters) and drawbacks (lower resolution, problems when using cheats and when reaching last valid year). I grep'd for |
I looked a bit more into your suggestion and I think |
e7acbed
to
b70e157
Compare
Could someone please have another look at this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me, but I'd like another pair of eyes on it
(Please disregard that I screwed up the rebase, we can fix that on merge... or you can fix it :) )
63dbdd4
to
b6fe96a
Compare
I rebased onto master. #10035 makes the third commit simpler, I now use _tick_counter instead of _date_frac to compute durations in ticks. |
Motivation / Problem
This PR fixes a few problems with travel times in the linkgraph (#9457).
Description
To fix #9665, I added a member variable
BaseConsist::time_since_last_loading
that is incremented whenevercurrent_order_time
is, and that is reset when the vehicle loads cargo at a station, just likelast_loading_station
.This fully fixes the travel times in the example savegame of #9665. I also tested with a go to depot order and with a basic conditional order.
Limitations
This PR needs a savegame upgrade.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.