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

Function GetAxisForNewRoadWaypoint

src/waypoint_cmd.cpp:128–142  ·  view source on GitHub ↗

* Get the axis for a new road 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

126 * @return the axis for the to-be-build waypoint.
127 */
128Axis GetAxisForNewRoadWaypoint(TileIndex tile)
129{
130 /* The axis for existing road waypoints is easy. */
131 if (IsRoadWaypointTile(tile)) return GetDriveThroughStopAxis(tile);
132
133 /* Non-plain road type, no valid axis for waypoints. */
134 if (!IsNormalRoadTile(tile)) return INVALID_AXIS;
135
136 RoadBits bits = GetAllRoadBits(tile);
137
138 if ((bits & ROAD_Y) == 0) return AXIS_X;
139 if ((bits & ROAD_X) == 0) return AXIS_Y;
140
141 return INVALID_AXIS;
142}
143
144extern CommandCost ClearTile_Station(TileIndex tile, DoCommandFlags flags);
145

Callers 1

PlaceRoad_WaypointFunction · 0.85

Calls 4

IsRoadWaypointTileFunction · 0.85
GetDriveThroughStopAxisFunction · 0.85
IsNormalRoadTileFunction · 0.85
GetAllRoadBitsFunction · 0.85

Tested by

no test coverage detected