First time post here. Played on and off since childhood. Mighty props to the dev community of OpenTTD.
Im also a professional developer and turned some free time to writing an AI for fun.
I have though quite a problem which is either my lack of knowledge of the AI API or an oversight of its development, which is...
How do I detect if a tile contains a house/building, specifically one that generates passengers.
I am currently using this code, which has more than a minor code-smell feel to it.
Code: Select all
static function DoesTileHaveHouse(tileIndex)
{
if (AITile.IsBuildable(tileIndex)) { return false; }
if (AIRoad.IsRoadTile(tileIndex)) { return false; }
if (AIRoad.IsRoadDepotTile(tileIndex)) { return false; }
if (AITile.IsSeaTile(tileIndex)) { return false; }
if (AITile.IsWaterTile(tileIndex)) { return false; }
if (AITile.IsStationTile(tileIndex)) { return false; }
if (AITile.HasTreeOnTile(tileIndex)) { return false; }
if (AITile.IsFarmTile(tileIndex)) { return false; }
if (AITile.IsRockTile(tileIndex)) { return false; }
if (AITile.IsRoughTile(tileIndex)) { return false; }
if (AIIndustry.GetIndustryID(tileIndex) != 65535) { return false; }
return true;
}
What is the correct way to detect if a tile has a house?
If one does not exist, how can I escalate to the dev team to implement this?
V13.0