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
Allow scripts to check for river tiles #5377 #6751
Conversation
I forgot to add to src/script/api/ai_changelog.hpp and src/script/api/game_changelog.hpp. I'll fix that. |
…he cost to demolish river tiles. (based on patch by krinn)
8801eb1
to
ebaedb6
Compare
ScriptTile::IsWaterTile seems to return true for sea, canal and river. What is so special about rivers, that they need a specific check, while sea and canal do not? Same question holds for GetBuildCost() |
Maybe an API change - GetWaterTile that returns none, sea, canal or river ? |
I don't know the reasoning why you need only this but not IsCanalTile. Both river and canal share the property that it can be deleted. For a path finder it may be useful to get to know of both canal and river tiles if you like to destroy them. If you want to bridge, then the IsWaterTile should probably be sufficient. The PR is based on a patch that seemed valid, but I don't know all the details of the use case that caused it to be written. |
Apparently there is ScriptMarine::IsCanalTile. Suggestion:
Ideally the docs should link between them :) |
Closed until there is an usecase. |
It's still possible to properly detect a river tile with the current API, but it required me to read OpenTTD source to understand how the functions do their things.
|
@SamuXarick Looking at the code above, it looks like your version of |
Oops, I wasn't aware it was possible to have rivers on tile height 0 via scenario editor. Rivers that have locks or water depots don't count. The submitted code was also not considering them.
So, it seems that there isn't a way to detect river tiles in all case scenarios. I can't think of a workaround atm. |
Adds these two methods for AIs and Game Scripts
Based on FlySpray patch by krinn (#5377)