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

Function PlaceRail_Waypoint

src/rail_gui.cpp:168–185  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

166 * @param tile Position to start dragging a waypoint.
167 */
168static void PlaceRail_Waypoint(TileIndex tile)
169{
170 if (_remove_button_clicked) {
171 VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_REMOVE_STATION);
172 return;
173 }
174
175 Axis axis = GetAxisForNewRailWaypoint(tile);
176 if (IsValidAxis(axis)) {
177 /* Valid tile for waypoints */
178 VpStartPlaceSizing(tile, axis == AXIS_X ? VPM_X_LIMITED : VPM_Y_LIMITED, DDSP_BUILD_STATION);
179 VpSetPlaceSizingLimit(_settings_game.station.station_spread);
180 } else {
181 /* Tile where we can't build rail waypoints. This is always going to fail,
182 * but provides the user with a proper error message. */
183 Command<CMD_BUILD_RAIL_WAYPOINT>::Post(STR_ERROR_CAN_T_BUILD_RAIL_WAYPOINT , tile, AXIS_X, 1, 1, STAT_CLASS_WAYP, 0, StationID::Invalid(), false);
184 }
185}
186
187void CcStation(Commands, const CommandCost &result, TileIndex tile)
188{

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