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

after AIOrder.MoveOrder returned false last error should not be ERR_UNKNOWN #5648

Closed
DorpsGek opened this issue Jul 14, 2013 · 3 comments
Closed
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

Kogut opened the ticket and wrote:

AIOrder.MoveOrder(vehicle_id, 0);
AIOrder.MoveOrder(vehicle_id, 0);

Second call will always (OK, almost always) will not cause order position to change, function will return false. But last error will be set to ERR_UNKNOWN, not to expected error code like ERR_POSITION_NOT_CHANGED (note: this would require a new error code) or at least ERR_NONE.

Tested in r25591, I may produce a test AI if it would be useful.

Reported version: trunk
Operating system: All


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

Rubidium wrote:

I don't fancy creating error codes that are not useful for the user interface. This as error codes are simple translations of the error string (code) into an error code. As a result, error codes can only happen when there is an error string returned from the command.

In this case the target == from is already performed in the user interface, so the check in the command is purely for validating nothing corrupt is sent (think of someone with malicious intent in multiplayer).

Having said that... I'm not sure whether to turn a move with source == target into a "return true" or a precondition check.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5648#comment12405

@DorpsGek
Copy link
Member Author

krinn wrote:

I think precondition fail would match. The real answer is just returning false as the order wasn't change.
If you return true, you sent a command to the server for nothing, return false and triggering precondition failure if target==from will let dev fix his script.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5648#comment12406

@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Fixed

In r25612


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

@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