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

Restore a train chain if it is not possible to allocate a new orderlist #6369

Closed
DorpsGek opened this issue Aug 30, 2015 · 1 comment
Closed
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

juanjo opened the ticket and wrote:

In revision r27389, function CmdSellRailWagon in train_cmd.cpp.

In the lines 1378-1394, the code does these things:

  1. First the command arranges the vehicle. If an error in the validation function is found, it RESTORES the train and returns an ERROR.
  2. Then calculates the value of the sold vehicles.
  3. Before execution of the command, it checks if a new orderlist can be created. If not, it generates an ERROR WITHOUT RESTORING the original train.

The attached patch, restores the train before generating the error. At the same time, I have also reordered the code, as for readability it seems the correct order is first checking possible errors and then calculating the cost of the command.

Anyway, it is almost impossible to reproduce the bug accidentally.

Attachments

Reported version: trunk
Operating system: All


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

frosch closed the ticket.

Reason for closing: Fixed

in r27419. Thanks for the patch!


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

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay labels Apr 7, 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/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant