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

Function GetAxisForNewRailWaypoint

src/waypoint_cmd.cpp:106–119  ·  view source on GitHub ↗

* Get the axis for a new rail waypoint. This means that if it is a valid * tile to build a waypoint on it returns a valid Axis, otherwise an * invalid one. * @param tile the tile to look at. * @return the axis for the to-be-build waypoint. */

Source from the content-addressed store, hash-verified

104 * @return the axis for the to-be-build waypoint.
105 */
106Axis GetAxisForNewRailWaypoint(TileIndex tile)
107{
108 /* The axis for rail waypoints is easy. */
109 if (IsRailWaypointTile(tile)) return GetRailStationAxis(tile);
110
111 /* Non-plain rail type, no valid axis for waypoints. */
112 if (!IsTileType(tile, MP_RAILWAY) || GetRailTileType(tile) != RailTileType::Normal) return INVALID_AXIS;
113
114 switch (GetTrackBits(tile)) {
115 case TRACK_BIT_X: return AXIS_X;
116 case TRACK_BIT_Y: return AXIS_Y;
117 default: return INVALID_AXIS;
118 }
119}
120
121/**
122 * Get the axis for a new road waypoint. This means that if it is a valid

Callers 2

IsValidTileForWaypointFunction · 0.85
PlaceRail_WaypointFunction · 0.85

Calls 5

IsRailWaypointTileFunction · 0.85
GetRailStationAxisFunction · 0.85
IsTileTypeFunction · 0.85
GetRailTileTypeFunction · 0.85
GetTrackBitsFunction · 0.85

Tested by

no test coverage detected