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

Function BuildRailClick_Remove

src/rail_gui.cpp:355–382  ·  view source on GitHub ↗

* The "remove"-button click proc of the build-rail toolbar. * @param w Build-rail toolbar window * @see BuildRailToolbarWindow::OnClick() */

Source from the content-addressed store, hash-verified

353 * @see BuildRailToolbarWindow::OnClick()
354 */
355static void BuildRailClick_Remove(Window *w)
356{
357 if (w->IsWidgetDisabled(WID_RAT_REMOVE)) return;
358 ToggleRailButton_Remove(w);
359 SndClickBeep();
360
361 /* handle station builder */
362 if (w->IsWidgetLowered(WID_RAT_BUILD_STATION)) {
363 if (_remove_button_clicked) {
364 /* starting drag & drop remove */
365 if (!_settings_client.gui.station_dragdrop) {
366 SetTileSelectSize(1, 1);
367 } else {
368 VpSetPlaceSizingLimit(-1);
369 }
370 } else {
371 /* starting station build mode */
372 if (!_settings_client.gui.station_dragdrop) {
373 int x = _settings_client.gui.station_numtracks;
374 int y = _settings_client.gui.station_platlength;
375 if (_station_gui.axis == 0) std::swap(x, y);
376 SetTileSelectSize(x, y);
377 } else {
378 VpSetPlaceSizingLimit(_settings_game.station.station_spread);
379 }
380 }
381 }
382}
383
384static void DoRailroadTrack(Track track)
385{

Callers 1

OnClickMethod · 0.85

Calls 7

ToggleRailButton_RemoveFunction · 0.85
SndClickBeepFunction · 0.85
SetTileSelectSizeFunction · 0.85
VpSetPlaceSizingLimitFunction · 0.85
swapFunction · 0.85
IsWidgetDisabledMethod · 0.80
IsWidgetLoweredMethod · 0.80

Tested by

no test coverage detected