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

Method OnInit

src/rail_gui.cpp:500–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498 }
499
500 void OnInit() override
501 {
502 /* Configure the rail toolbar for the railtype. */
503 const RailTypeInfo *rti = GetRailTypeInfo(this->railtype);
504 this->GetWidget<NWidgetCore>(WID_RAT_BUILD_NS)->SetSprite(rti->gui_sprites.build_ns_rail);
505 this->GetWidget<NWidgetCore>(WID_RAT_BUILD_X)->SetSprite(rti->gui_sprites.build_x_rail);
506 this->GetWidget<NWidgetCore>(WID_RAT_BUILD_EW)->SetSprite(rti->gui_sprites.build_ew_rail);
507 this->GetWidget<NWidgetCore>(WID_RAT_BUILD_Y)->SetSprite(rti->gui_sprites.build_y_rail);
508 this->GetWidget<NWidgetCore>(WID_RAT_AUTORAIL)->SetSprite(rti->gui_sprites.auto_rail);
509 this->GetWidget<NWidgetCore>(WID_RAT_BUILD_DEPOT)->SetSprite(rti->gui_sprites.build_depot);
510 this->GetWidget<NWidgetCore>(WID_RAT_CONVERT_RAIL)->SetSprite(rti->gui_sprites.convert_rail);
511 this->GetWidget<NWidgetCore>(WID_RAT_BUILD_TUNNEL)->SetSprite(rti->gui_sprites.build_tunnel);
512 }
513
514 /**
515 * Switch to another rail type.

Callers

nothing calls this directly

Calls 2

GetRailTypeInfoFunction · 0.85
SetSpriteMethod · 0.80

Tested by

no test coverage detected