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

AITIle.LowerTile fail to lower tiles when using 4 corners but still report success #4698

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

krinn opened the ticket and wrote:

Might affect also towngrowth as seen in terraform.cpp comment

Might affect also AITile.RaiseTile()

When an AI try to lower all tiles from a flat tile (to get a flat tile to a lower height) AITile.LowerTile doesn't execute the function if its argument is 15 (all corners).
Worst the function return success (ERR_NONE)

looks like it fail when neightbor tiles are also flat, as soon as one corner is lowered, even you keep asking to lower the 4 corners, this time, all goes normal, if need an error is report, else function success and corners are lowered.

fireup the savegame (openttd 1.1.1), bugai is running it, its task is to mark the area to work on, lower each tile and marking them with a v sign, and report error, and infos in ai debug window.

ai cannot lower any tile until at least one tile have only 3 corners up, just dig any tile one time, and the function will then work.

Attachments

Reported version: Version?
Operating system: All


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

krinn wrote:

Update: as a way to fix the bug, i tried switch 15 argument to 1 argument and still the ai cannot get the tile lowered. So it's not limit to trying to lower 4 corners. But more because neighbor tiles are at same height.

And tried with AITile.RaiseTile, didn't find a problem with it


This comment was imported from FlySpray: https://bugs.openttd.org/task/4698#comment10115

@DorpsGek
Copy link
Member Author

frosch wrote:

For a flat tile AITile.GetSlope(tile) return 0, not 15.
Thus calling AITile.LowerTile(tile, slope) has no effect.

Inserting an "if (slope == AITile.SLOPE_FLAT) slope = AITile.SLOPE_ELEVATED;" after "local compSlope=AITile.GetComplementSlope(slope);" fixes it.


This comment was imported from FlySpray: https://bugs.openttd.org/task/4698#comment10116

@DorpsGek
Copy link
Member Author

frosch closed the ticket.

Reason for closing: Bug in custom AI


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

@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