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

Method OnInit

src/road_gui.cpp:417–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415 }
416
417 void OnInit() override
418 {
419 /* Configure the road toolbar for the roadtype. */
420 const RoadTypeInfo *rti = GetRoadTypeInfo(this->roadtype);
421 this->GetWidget<NWidgetCore>(WID_ROT_ROAD_X)->SetSprite(rti->gui_sprites.build_x_road);
422 this->GetWidget<NWidgetCore>(WID_ROT_ROAD_Y)->SetSprite(rti->gui_sprites.build_y_road);
423 this->GetWidget<NWidgetCore>(WID_ROT_AUTOROAD)->SetSprite(rti->gui_sprites.auto_road);
424 if (_game_mode != GM_EDITOR) {
425 this->GetWidget<NWidgetCore>(WID_ROT_DEPOT)->SetSprite(rti->gui_sprites.build_depot);
426 }
427 this->GetWidget<NWidgetCore>(WID_ROT_CONVERT_ROAD)->SetSprite(rti->gui_sprites.convert_road);
428 this->GetWidget<NWidgetCore>(WID_ROT_BUILD_TUNNEL)->SetSprite(rti->gui_sprites.build_tunnel);
429 }
430
431 /**
432 * Switch to another road type.

Callers

nothing calls this directly

Calls 2

GetRoadTypeInfoFunction · 0.85
SetSpriteMethod · 0.80

Tested by

no test coverage detected