| 466 | }; |
| 467 | |
| 468 | void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override |
| 469 | { |
| 470 | if (!gui_scope) return; |
| 471 | |
| 472 | if (!ValParamRailType(this->railtype)) { |
| 473 | /* Close toolbar if rail type is not available. */ |
| 474 | this->Close(); |
| 475 | return; |
| 476 | } |
| 477 | |
| 478 | bool can_build = CanBuildVehicleInfrastructure(VEH_TRAIN); |
| 479 | for (const WidgetID widget : can_build_widgets) this->SetWidgetDisabledState(widget, !can_build); |
| 480 | if (!can_build) { |
| 481 | CloseWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL); |
| 482 | CloseWindowById(WC_BUILD_STATION, TRANSPORT_RAIL); |
| 483 | CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL); |
| 484 | CloseWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL); |
| 485 | CloseWindowById(WC_SELECT_STATION, 0); |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | bool OnTooltip([[maybe_unused]] Point pt, WidgetID widget, TooltipCloseCondition close_cond) override |
| 490 | { |
no test coverage detected