* 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. */
| 104 | * @return the axis for the to-be-build waypoint. |
| 105 | */ |
| 106 | Axis 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 |
no test coverage detected