
The problem I'm facing at the moment is that trams is not a simple switch of roadtype like stated in the wiki, but actually shows some problems with the AIRoad class. If it's all working as intended, then perhaps the documentation can be made at bit clearer for some functions what to expect from then if you're using trams.
Allow me to illustrate: I would like to build a passenger tram stop in a town on a busy shopping street

Code: Select all
370 area.AddRectangle(AITown.GetLocation(town) - AIMap.GetTileIndex(curRange, curRange),
AITown.GetLocation(town) + AIMap.GetTileIndex(curRange, curRange));
371
372 AIRoad.SetCurrentRoadType(AIRoad.ROADTYPE_ROAD);
373 area.Valuate(AIRoad.IsRoadTile);
374 area.KeepValue(1);
375 Debug("Town road tiles count (road mode): " + area.Count());
376
377 AIRoad.SetCurrentRoadType(AIRoad.ROADTYPE_TRAM);
378 area.Valuate(AIRoad.IsRoadTile);
379 area.KeepValue(1);
380 Debug("Town road tiles count (tram mode): " + area.Count());
381
382 area.Valuate(AIRoad.IsDriveThroughRoadStationTile);
383 area.KeepValue(0);
384 Debug("Town road tiles count without station (tram mode): " + area.Count());
385 area.Valuate(AIRoad.GetNeighbourRoadCount);
386 area.KeepValue(2); // entrance and exit; allow 1 as well?
387 Debug("Town road tiles count with 2 neighbours (tram mode): " + area.Count());
35 road tiles (road mode)
35 road tiles (tram mode)
34 road tiles without stations (tram mode)
0 road tiles with 2 neighbours (tram mode)
And I can assure you there's plenty road tiles with exactly 2 neigbouring road tiles. So: IsRoadTile checks for road, regardless of current roadtype, whereas the neighbour count is actually dependent on the current roadtype. Wouldn't it be best if both were to be showing the same behaviour? After all, setcurrentroadtype says: "Set the RoadType for all further AIRoad functions." Or perhaps change the functions to have an extra optional parameter roadtype which defaults to the current type ( GetNeighBourRoadCount(tile, roadtype = currenttype) ), because now I have to switch to road to select a tile, then switch to tram to build the stop.