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

Function PlaceRoad_Waypoint

src/road_gui.cpp:255–272  ·  view source on GitHub ↗

* Place a road waypoint. * @param tile Position to start dragging a waypoint. */

Source from the content-addressed store, hash-verified

253 * @param tile Position to start dragging a waypoint.
254 */
255static void PlaceRoad_Waypoint(TileIndex tile)
256{
257 if (_remove_button_clicked) {
258 VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_REMOVE_ROAD_WAYPOINT);
259 return;
260 }
261
262 Axis axis = GetAxisForNewRoadWaypoint(tile);
263 if (IsValidAxis(axis)) {
264 /* Valid tile for waypoints */
265 VpStartPlaceSizing(tile, axis == AXIS_X ? VPM_X_LIMITED : VPM_Y_LIMITED, DDSP_BUILD_ROAD_WAYPOINT);
266 VpSetPlaceSizingLimit(_settings_game.station.station_spread);
267 } else {
268 /* Tile where we can't build road waypoints. This is always going to fail,
269 * but provides the user with a proper error message. */
270 Command<CMD_BUILD_ROAD_WAYPOINT>::Post(STR_ERROR_CAN_T_BUILD_ROAD_WAYPOINT, tile, AXIS_X, 1, 1, ROADSTOP_CLASS_WAYP, 0, StationID::Invalid(), false);
271 }
272}
273
274/**
275 * Callback for placing a bus station.

Callers 1

OnPlaceObjectMethod · 0.85

Calls 5

VpStartPlaceSizingFunction · 0.85
IsValidAxisFunction · 0.85
VpSetPlaceSizingLimitFunction · 0.85
InvalidFunction · 0.85

Tested by

no test coverage detected