Question about AITile.HasTransportType()

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Question about AITile.HasTransportType()

Post by Zutty »

Hi all,

Should AITile.HasTransportType(tile, AITile.TRANSPORT_ROAD) return true for tram track tiles? It seems like it should to me, but it doesn't. At least it doesn't in this particular case...
tram_issue.png
tram_issue.png (29.45 KiB) Viewed 1309 times
The code that produced this was (with minor changes to make it more readable)...

Code: Select all

		local adjRoads = LandManager.GetAdjacentTileList(tile); // Get the four neighbouring tiles
		adjRoads.Valuate(function (_tile) {
			local hasRoad = AITile.HasTransportType(_tile, AITile.TRANSPORT_ROAD);
			AISign.BuildSign(_tile, ":" + ((hasRoad) ? "Y" : "N"));
			return (hasRoad) ? 1 : 0;
		});
		adjRoads.KeepValue(1);
		
		AISign.BuildSign(tile, ":"+adjRoads.Count()+((straightRoad)?"S":"="));
Is this a bug in the API or just me going about this the wrong way?

Thanks very much :)

Edit: The result is the same regardless of the current road type by the way.
PathZilla - A networking AI - Now with tram support.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 9 guests