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

Restoring a conditional order jump may fail #2130

Closed
DorpsGek opened this issue Jul 5, 2008 · 5 comments
Closed

Restoring a conditional order jump may fail #2130

DorpsGek opened this issue Jul 5, 2008 · 5 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Jul 5, 2008

Swallow opened the ticket and wrote:

Bug is present in r13677

When one replaces a vehicle in a depot, the order list is normally preserved. This order backup and restoration may fail for conditional order jumps in two cases:

a) The comparator used is not 'equal to' or 'not equal to'
b) The order to jump to has a higher number than the conditional jump itself.

As far I can tell, this is caused by these two lines (459/460) in order_cmd.cpp:

if (skip_to >= v->num_orders) return CMD_ERROR;
if (new_order.GetNonStopType() != ONSF_STOP_EVERYWHERE) return CMD_ERROR;

These checks may be needed when inserting orders, they cause trouble when restoring them. The order to skip to may be higher than the total number of orders because not all of them are inserted yet. Non stop flags use the same bits as the conditional comparator, which causes the second check to give problems.

Note: while I could find out what causes this. I'm not sure of the best solution. Therefore I decided to not to create a fix (yet)

Reported version: trunk
Operating system: All


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

DorpsGek commented Jul 9, 2008

Rubidium wrote:

The major problem is that you can't allow inserting orders that are invalid at the moment of insertion. I'm sure there's a proper way around it but as you already mentioned, it needs quite a lot of thinking for solutions before finding one that will actually work correctly.


This comment was imported from FlySpray: https://bugs.openttd.org/task/2130#comment4445

@DorpsGek
Copy link
Member Author

yorick wrote:

What about a DC_AUTOREPLACE flag that would allow the orders to be inserted?


This comment was imported from FlySpray: https://bugs.openttd.org/task/2130#comment4463

@DorpsGek
Copy link
Member Author

Rubidium wrote:

DC_AUTOREPLACE isn't send over the network and that is exactly what is needed to restore the backup.


This comment was imported from FlySpray: https://bugs.openttd.org/task/2130#comment4464

@DorpsGek
Copy link
Member Author

yorick wrote:

DC_AUTOREPLACE isn't, but the autoreplace itself should be done everywhere...


This comment was imported from FlySpray: https://bugs.openttd.org/task/2130#comment4465

@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Fixed

In r13752.


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

@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