# road_internal.h File Reference

Functions used internally by the roads. More...

`#include "tile_cmd.h"`

Go to the source code of this file.

## Functions
RoadBits | CleanUpRoadBits (const TileIndex tile, RoadBits org_rb)
| Clean up unneccesary RoadBits of a planed tile.
bool | CheckAllowRemoveRoad (TileIndex tile, RoadBits remove, Owner owner, bool *edge_road, RoadType rt)
| Is it allowed to remove the given road bits from the given tile?
void | DrawTramCatenary (TileInfo *ti, RoadBits tram)
| Draw the catenary for tram road bits.

## Detailed Description

Functions used internally by the roads.

Definition in file road_internal.h.

## Function Documentation

bool CheckAllowRemoveRoad | ( | TileIndex | tile,
|  | RoadBits | remove,
|  | Owner | owner,
|  | bool * | edge_road,
|  | RoadType | rt |
| ) |  |  |

Is it allowed to remove the given road bits from the given tile?

Parameters:

  | tile | the tile to remove the road from
  | remove | the roadbits that are going to be removed
  | owner | the actual owner of the roadbits of the tile
  | edge_road | are the removed bits from a town?
  | rt | the road type to remove the bits from

Returns:
  true when it is allowed to remove the road bits

Definition at line 47 of file road_cmd.cpp.

References GetAnyRoadBits(), OWNER_NONE, OWNER_TOWN, OWNER_WATER, ROAD_NE, ROAD_NONE, ROAD_NW, ROAD_SE, ROAD_SW, ROADTYPE_ROAD, and TILE_ADDXY.

Referenced by CanRemoveRoadWithStop(), and RemoveRoad().

RoadBits CleanUpRoadBits | ( | const TileIndex | tile,
|  | RoadBits | org_rb |
| ) |  |  |

Clean up unneccesary RoadBits of a planed tile.

Parameters:

  | tile | current tile
  | org_rb | planed RoadBits

Returns:
  optimised RoadBits

Definition at line 24 of file road.cpp.

References CountBits(), DIAGDIR_BEGIN, DIAGDIR_END, DiagDirToAxis(), DiagDirToRoadBits(), GetAnyRoadBits(), GetTileType(), IsWater(), MirrorRoadBits(), MP_CLEAR, MP_RAILWAY, MP_ROAD, MP_STATION, MP_TREES, MP_TUNNELBRIDGE, MP_WATER, ROADTYPE_ROAD, ROADTYPE_TRAM, and TileAddByDiagDir().

void DrawTramCatenary | ( | TileInfo * | ti,
|  | RoadBits | tram |
| ) |  |  |

Draw the catenary for tram road bits.

Parameters:

  | ti | information about the tile (position, slope)
  | tram | the roadbits to draw the catenary for

Draw the catenary for tram road bits.

Parameters:

  | ti | information about the tile (slopes, height etc)
  | tram | the roadbits for the tram

Definition at line 967 of file road_cmd.cpp.

References AddSortableSpriteToDraw(), BB_HEIGHT_UNDER_BRIDGE, GetBridgeHeight(), GetNorthernBridgeEnd(), IsBridgeAbove(), IsTransparencySet(), MayHaveBridgeAbove(), SLOPE_FLAT, TILE_HEIGHT, and TO_CATENARY.

Referenced by DrawRoadBits().