MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DrawRoadCatenary

Function DrawRoadCatenary

src/road_cmd.cpp:1441–1476  ·  view source on GitHub ↗

* Draws the catenary for the given tile * @param ti information about the tile (slopes, height etc) */

Source from the content-addressed store, hash-verified

1439 * @param ti information about the tile (slopes, height etc)
1440 */
1441void DrawRoadCatenary(const TileInfo *ti)
1442{
1443 RoadBits road = ROAD_NONE;
1444 RoadBits tram = ROAD_NONE;
1445
1446 if (IsTileType(ti->tile, MP_ROAD)) {
1447 if (IsNormalRoad(ti->tile)) {
1448 road = GetRoadBits(ti->tile, RTT_ROAD);
1449 tram = GetRoadBits(ti->tile, RTT_TRAM);
1450 } else if (IsLevelCrossing(ti->tile)) {
1451 tram = road = (GetCrossingRailAxis(ti->tile) == AXIS_Y ? ROAD_X : ROAD_Y);
1452 }
1453 } else if (IsTileType(ti->tile, MP_STATION)) {
1454 if (IsAnyRoadStop(ti->tile)) {
1455 if (IsDriveThroughStopTile(ti->tile)) {
1456 Axis axis = GetDriveThroughStopAxis(ti->tile);
1457 tram = road = (axis == AXIS_X ? ROAD_X : ROAD_Y);
1458 } else {
1459 tram = road = DiagDirToRoadBits(GetBayRoadStopDir(ti->tile));
1460 }
1461 }
1462 } else {
1463 /* No road here, no catenary to draw */
1464 return;
1465 }
1466
1467 RoadType rt = GetRoadTypeRoad(ti->tile);
1468 if (rt != INVALID_ROADTYPE && HasRoadCatenaryDrawn(rt)) {
1469 DrawRoadTypeCatenary(ti, rt, road);
1470 }
1471
1472 rt = GetRoadTypeTram(ti->tile);
1473 if (rt != INVALID_ROADTYPE && HasRoadCatenaryDrawn(rt)) {
1474 DrawRoadTypeCatenary(ti, rt, tram);
1475 }
1476}
1477
1478/**
1479 * Draws details on/around the road

Callers 3

DrawTile_StationFunction · 0.85
DrawRoadBitsFunction · 0.85
DrawTile_RoadFunction · 0.85

Calls 14

IsTileTypeFunction · 0.85
IsNormalRoadFunction · 0.85
GetRoadBitsFunction · 0.85
IsLevelCrossingFunction · 0.85
GetCrossingRailAxisFunction · 0.85
IsAnyRoadStopFunction · 0.85
IsDriveThroughStopTileFunction · 0.85
GetDriveThroughStopAxisFunction · 0.85
DiagDirToRoadBitsFunction · 0.85
GetBayRoadStopDirFunction · 0.85
GetRoadTypeRoadFunction · 0.85
HasRoadCatenaryDrawnFunction · 0.85

Tested by

no test coverage detected