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

autoreplaced trains can leave all wagons in depot #186

Closed
DorpsGek opened this issue May 24, 2006 · 3 comments
Closed

autoreplaced trains can leave all wagons in depot #186

DorpsGek opened this issue May 24, 2006 · 3 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

Bjarni opened the ticket and wrote:

the problem is that when mammoth trains are disabled, the max is 9 (it used to be 10. Don't ask me why ludde changed that)
If an engine got 8 wagons, it's a total of 9. If the engine is replaced to a dualheaded one, it mean that a train of two units tries to take 8 units and add them to the train. This will fail due to length and the wagons will be left behind.

Solutions:

  1. Make autoreplace remove a wagon. Because ReplaceVehicle() adds the wagons and MaybeReplaceVehicle() removes wagons (to keep length, not number of units) it mean that a change of design is needed (or dublicated code)
    I don't like this solution.

  2. completely remove max-train-length. Since trains are linked lists, we don't have anything that makes a hard limit. Because it takes time to go through all units in very long trains, this solution is not popular, at least not in multiplayer.

  3. a modified version of 2), which takes computer resources into account. Instead of making max-train-length based on single units, we will use it to prevent huge trains (specially in MP). Since it's not important if the limit is 30 or 32 units, we can make one (length)unit to be what you get when you hit the build button once, then a multiheaded pair of engines will only count once, an articulated engine will also only count once (like it does now, so it's inconsistent). This mean that autoreplace will always remove one unit and add one unit and this bug will be gone.
    It makes little sense to keep the max-train-length to keep trains to fit on 5 tile stations, both because of the max 9 (not 10, which is 5 tiles) and because newgrf allow us to use shorter wagons.

I'm in favour of 3). I already got it working in my local copy and it works. Now I would like feedback on what you think of such a change

Reported version: 0.4.7
Operating system: All


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

Bjarni wrote:

forgot to mention: if we go with 3), we should make max-train-length an int, not a bool, so some games can have 30 while others can have 70, 200 or completely off depending on what they want (and available CPU power)


This comment was imported from FlySpray: https://bugs.openttd.org/task/186#comment297

@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 3, 2006

peter1138 wrote:

This patch stops an engine being replaced if the train length would be too long.

There is no suppport for wagon removal yet, as, as you said, it would need to be done before the replacement is done, unless some hack is put it in to make the move command ignore length whilst in autoreplace...

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/186#comment312

@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 8, 2006

Bjarni closed the ticket.

Reason for closing: Fixed


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

@DorpsGek DorpsGek closed this as completed Jun 8, 2006
@DorpsGek DorpsGek added Autoreplace flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) 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