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

Possible fix for #7430: when train visits station, only reset time_since_pickup if has room to load #7595

Merged
merged 1 commit into from Dec 23, 2019

Conversation

MingweiSamuel
Copy link
Contributor

@MingweiSamuel MingweiSamuel commented May 16, 2019

@MingweiSamuel MingweiSamuel force-pushed the patch-1 branch 2 times, most recently from 27dc663 to f3e4a7e Compare May 18, 2019 06:37
@LordAro LordAro requested a review from PeterN June 6, 2019 16:34
@LordAro
Copy link
Member

LordAro commented Oct 25, 2019

For me, it makes sense to only reset time_since_pickup when cargo is actually loaded, not before. If a train with spare capacity for some cargo comes into a station, but for some reason doesn't pick any up, the cargo is still "old" and the pickup time shouldn't be reset. It's time since cargo pick up, not time since last (nonfull) train arrival

@nielsmh
Copy link
Contributor

nielsmh commented Oct 25, 2019

The time since load needs to be reset even when there is no cargo available to load on the station, since that value is used for station rating calculation. If a player that doesn't receive any cargo on their station due to low rating can't raise their rating by having vehicles attempt to load, they will never be able to compete.

I haven't looked at the code in detail, but the idea presented sounds reasonable.

@MingweiSamuel
Copy link
Contributor Author

MingweiSamuel commented Oct 29, 2019

I've split the PR into two commits:

  • The first one contains the functional changes; making if (cap_left > 0) { its own branch and only setting ge->time_since_pickup = 0; in there. Note the wrong indentation.
  • And the second one just fixes the indentation (which produces a big diff)

Should be a little easier to review (edit: though it will fail the commit checker)

LordAro
LordAro previously approved these changes Nov 23, 2019
Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me (does need commits merging though)

@LordAro LordAro added this to the 1.10.0 milestone Nov 23, 2019
@MingweiSamuel
Copy link
Contributor Author

Alright, squashed, looks like github automatically dismissed the review on force push unfortunately. I'm not too familiar with gh's system.

Copy of old commit without indentation: MingweiSamuel@d0c1353

@nielsmh nielsmh merged commit 26ce4eb into OpenTTD:master Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants