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

Method OnInvalidateData

src/rail_gui.cpp:468–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

Calls 5

CloseMethod · 0.95
ValParamRailTypeFunction · 0.85
CloseWindowByIdFunction · 0.85

Tested by

no test coverage detected