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

GSTile.IsDesertTile always returns false when not baren tile #5537

Closed
DorpsGek opened this issue Apr 29, 2013 · 7 comments
Closed

GSTile.IsDesertTile always returns false when not baren tile #5537

DorpsGek opened this issue Apr 29, 2013 · 7 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

aantono opened the ticket and wrote:

In the GSTile.IsDesertTile(GSTown.GetLocation(TownID)) the check always returns "false" even when the town is clearly on the desert. Looks like the IsDeserTile function only returns true if the tile is empty (i.e. has no buildings, roads or anything else on it). Is this an intended behavior, and if so, can a function be added to GSTown object to check if the town is in the desert, or above the snowline for that matter?

Reported version: 1.3.0
Operating system: All


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

Zuu wrote:

There is also a similar bug in GSTile.IsSnowTile(tile_id).

The attached GS will put a sign on each town tile at startup. The sign display the result of GSTile.IsDesertTile and GSTile.IsSnowTile. The signs are never updated during the game, so variable snow line height changes are not tested.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5537#comment12169

@DorpsGek
Copy link
Member Author

Rubidium wrote:

Is it a bug, or is it a misunderstanding what "desert" tile means? They are in the same group as farm, rock and rough tiles. These are basic types of the CLEAR/class 0 tiles as you can see in http://hg.openttd.org/openttd/trunk.hg/raw-file/9b02c892cc76/docs/landscape.html and they are not telling you whether the tiles are snowy or deserty.

Okay, the documentation might not be 100% clear about it.

What you effectively want is the "terrain type" of a tile; from the NewGRF specification: "Terrain type: 0 normal, 1 desert, 2 rainforest, 4 on or above snowline". This doesn't exist, so I reckon this is a request for such an API.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5537#comment12170

@DorpsGek
Copy link
Member Author

aantono wrote:

I guess it is an error with documentation in this case. So then can we treat this as an API request? Basically what I'm looking for is to determine if the town is on a desert tile or above the snowline, to see if it would require extra cargos for town growth. So, with this in mind, I would like to propose to add functions to GSTown object to check for those conditions, based on a supplied town_id.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5537#comment12173

@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Fixed

In r25213; the documentation clarified, and GetTerrainType introduced which allows you to do what you want.


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

@DorpsGek
Copy link
Member Author

DorpsGek commented May 1, 2013

Zuu wrote:

GSTown.IsDesertTown or GSTown.IsSnowTown or similar is not needed in the API. Such convince methods which could check for the water pitfall may be included in SuperLib or some other GS library.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5537#comment12174

@DorpsGek
Copy link
Member Author

DorpsGek commented May 1, 2013

frosch wrote:

Unless the GS modifies the cargo requirements itself, your script should rather use GSTown::GetCargoGoal to detect water/food requirements. That should also work better with NewGRF which replace the cargos with other ones.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5537#comment12175

@DorpsGek
Copy link
Member Author

DorpsGek commented May 1, 2013

aantono wrote:

The script does exactly that, but knowing if the town is on the desert or not is needed to help calculate the goal and it also drives some other script logic dynamics. So I hope the r25213 change to introduce GetTerrainType will make it into the next GS API.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5537#comment12176

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) bug labels Apr 7, 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