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

AIOrder.AppendOrder fails on "goto nearest depot and stop" order #4024

Closed
DorpsGek opened this issue Aug 10, 2010 · 1 comment
Closed

AIOrder.AppendOrder fails on "goto nearest depot and stop" order #4024

DorpsGek opened this issue Aug 10, 2010 · 1 comment
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

Attila7 opened the ticket and wrote:

I believe there is a bug in the way "go to nearest depot" orders are handled.
Line 528 of order_cmd.cpp reads:
if (new_order.GetDepotActionType() != ODATFB_NEAREST_DEPOT) {

It appears that this attempts to test if the order contains a "go to nearest depot" order and
skip the depot validation test if so. However if the the order also contains other bits,
such as a "stop in depot" order, the above test will be true and the code will attempt to
validate tile 0 as a depot.

Tile 0 is forced into an AppendOrder call at line 389 of ai_order.cpp if the order contains
a "go to nearest depot" order.

I think line 528 should be changed to:
if (!(new_order.GetDepotActionType() & ODATFB_NEAREST_DEPOT)) {

This will correctly test the relevant bit and skip the depot validation.

As the code stands now, it succeeds most of the time, because the validation of tile 0 will fail
depending on what command was last executed and by what AI. It is essentially a garbage test.

Reported version: trunk
Operating system: All


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

Rubidium closed the ticket.

Reason for closing: Fixed

In r20441


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

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) bug component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant