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

Method UpdateRemoveWidgetStatus

src/rail_gui.cpp:524–552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

522 }
523
524 void UpdateRemoveWidgetStatus(WidgetID clicked_widget)
525 {
526 switch (clicked_widget) {
527 case WID_RAT_REMOVE:
528 /* If it is the removal button that has been clicked, do nothing,
529 * as it is up to the other buttons to drive removal status */
530 return;
531
532 case WID_RAT_BUILD_NS:
533 case WID_RAT_BUILD_X:
534 case WID_RAT_BUILD_EW:
535 case WID_RAT_BUILD_Y:
536 case WID_RAT_AUTORAIL:
537 case WID_RAT_BUILD_WAYPOINT:
538 case WID_RAT_BUILD_STATION:
539 case WID_RAT_BUILD_SIGNALS:
540 /* Removal button is enabled only if the rail/signal/waypoint/station
541 * button is still lowered. Once raised, it has to be disabled */
542 this->SetWidgetDisabledState(WID_RAT_REMOVE, !this->IsWidgetLowered(clicked_widget));
543 break;
544
545 default:
546 /* When any other buttons than rail/signal/waypoint/station, raise and
547 * disable the removal button */
548 this->DisableWidget(WID_RAT_REMOVE);
549 this->RaiseWidget(WID_RAT_REMOVE);
550 break;
551 }
552 }
553
554 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
555 {

Callers 1

OnClickMethod · 0.95

Calls 4

IsWidgetLoweredMethod · 0.80
DisableWidgetMethod · 0.80
RaiseWidgetMethod · 0.80

Tested by

no test coverage detected