Hello everybody,
I have a question regarding the AITiles.LevelTiles function.
In the NOAI documenten it states that it returns:
"True if and only if the area was completely leveled. "
But I discovered some weird behavouir, when testing my AI. It seems that the function returns still true even if only some of the tiles got leveled, because in this example the Coal Mine is in the way.
I attached an image which illustrates the behaviour.
The two signs labeled "LS" and "LE" (the "LE" belongs to the sloped tile blow the sign itself) mark the first and last tile, which were given to the function as parameters.
In the debug log after "Building station 1!" you see the output of the AIError.GetLastErrorString() function and the the line after that the return value of the AITiles.LevelTiles function ("ret true").
The station was built after AITile.LevelTiles returned true.
Thanks
AITile::LevelTiles
Moderator: OpenTTD Developers
-
- Engineer
- Posts: 44
- Joined: 06 Sep 2008 12:41
- Location: Hamburg, Germany
Re: AITile::LevelTiles
The problem here is the documentation. It should have read:
Returns true if some part of the area was levelled.
Edit: fixed in r17049.
Returns true if some part of the area was levelled.
Edit: fixed in r17049.
-
- Engineer
- Posts: 44
- Joined: 06 Sep 2008 12:41
- Location: Hamburg, Germany
Re: AITile::LevelTiles
Ok thanks, that makes the function a bit less useful, but it is the same behaviour as the level tool in the GUI.
So I will have to invent my own then
So I will have to invent my own then

Re: AITile::LevelTiles
That's what I did, too. Looks better as well, seeing it dig away at a mountain, tile by tile 

-
- Engineer
- Posts: 44
- Joined: 06 Sep 2008 12:41
- Location: Hamburg, Germany
Re: AITile::LevelTiles
hehe, thats right. And I think I write my function so that it trys to do as little terraforming as possible first and if that fails it will go crazy and doesnt care anymore 

Who is online
Users browsing this forum: No registered users and 2 guests