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

Method GetWidgetString

src/group_gui.cpp:556–579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

554 }
555
556 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
557 {
558 switch (widget) {
559 case WID_GL_FILTER_BY_CARGO:
560 return GetString(this->GetCargoFilterLabel(this->cargo_filter_criteria));
561
562 case WID_GL_AVAILABLE_VEHICLES:
563 return GetString(STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vli.vtype);
564
565 case WID_GL_CAPTION:
566 /* If selected_group == DEFAULT_GROUP || ALL_GROUP, draw the standard caption
567 * We list all vehicles or ungrouped vehicles */
568 if (IsDefaultGroupID(this->vli.ToGroupID()) || IsAllGroupID(this->vli.ToGroupID())) {
569 return GetString(stringid, STR_COMPANY_NAME, this->vli.company, this->vehicles.size(), this->vehicles.size());
570 } else {
571 uint num_vehicle = GetGroupNumVehicle(this->vli.company, this->vli.ToGroupID(), this->vli.vtype);
572
573 return GetString(stringid, STR_GROUP_NAME, this->vli.ToGroupID(), num_vehicle, num_vehicle);
574 }
575
576 default:
577 return this->Window::GetWidgetString(widget, stringid);
578 }
579 }
580
581 void OnPaint() override
582 {

Callers

nothing calls this directly

Calls 7

IsDefaultGroupIDFunction · 0.85
IsAllGroupIDFunction · 0.85
GetGroupNumVehicleFunction · 0.85
ToGroupIDMethod · 0.80
GetStringFunction · 0.70
GetCargoFilterLabelMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected