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

An arrival problem of too fast train #2824

Closed
DorpsGek opened this issue Apr 11, 2009 · 1 comment
Closed

An arrival problem of too fast train #2824

DorpsGek opened this issue Apr 11, 2009 · 1 comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

BizNoK opened the ticket and wrote:

Too fast trains, which added or replaced by newGRF, are has a problem about arriving station.

Cause of this problem is OpenTTD doesn't check train is appropriately matched with the station, in 1 tick.

In other words, cause of this problem is arrival check occured tick-by-tick, not tile-by-tile.

This problem bring on unmatched arrival of "too" fast train. So they couldn't process any load or unload task.

It occured speed of train over about 2,000 km. And due to its distance between station or snaped track, it could raises randomly but not at all.

To raise this problem by intent, add any GRFs which has over 3K speed and make the track to trains are could speed-up their maximum speed.

I solved this problem with fix some line of source code.

TrainLocoHandler() in train_cmd.cpp, there is a part for advance train on real track. About 100 lines below of start of function.

And there is a function invoking, which determines train could move next tile or not. Named TrainController().

But that hasn't a return value for use in other functions. So I tried to change this function to return some value, which it could move or not.

Especially it returns FALSE when the checking train is successfully entered to the station.

And I changed also TrainLocoHandler() to get return value of TrainController(), and If they couldn't go anymore cause train successfully entered to the station,

Then TrainLocoHandler() stops this train immediately.

This fix works pretty well. And it successfully stopping train even they has a 'massive' speed amount like over 10,000 km.

I couldn't found this fix occurs another problem. But maybe there is a bug that I don't know.

Please check this problem. And I hope this is some problem, not intended.

Thank you for reading. My English is not good. So I worried about anyone couldn't know what I want to say.

Reported version: 0.7.0
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/2824
@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Fixed

In r16079


This comment was imported from FlySpray: https://bugs.openttd.org/task/2824

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) Vehicles labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant